ปรับการแสดงผล action ในหน้ารายละเอียดของวินัย

This commit is contained in:
Warunee Tamkoo 2023-11-21 12:53:05 +07:00
parent 18e1e0d2bd
commit f916e32666
2 changed files with 61 additions and 27 deletions

View file

@ -3,17 +3,16 @@ import { onMounted, reactive, ref } from "vue";
import Form from "@/modules/11_discipline/components/2_InvestigateFacts/Form.vue"; import Form from "@/modules/11_discipline/components/2_InvestigateFacts/Form.vue";
import type { FormData } from "@/modules/11_discipline/interface/request/investigate"; import type { FormData } from "@/modules/11_discipline/interface/request/investigate";
import { useRouter, useRoute } from "vue-router"; import { useRouter, useRoute } from "vue-router";
import { useCounterMixin } from "@/stores/mixin"; import { useCounterMixin } from "@/stores/mixin";
import { useQuasar } from "quasar"; import { useQuasar } from "quasar";
const $q = useQuasar() const $q = useQuasar();
const mixin = useCounterMixin() const mixin = useCounterMixin();
const { dialogConfirm } = mixin const { dialogConfirm } = mixin;
const router = useRouter(); const router = useRouter();
const route = useRoute(); const route = useRoute();
const id = ref<string>(route.params.id as string); const id = ref<string>(route.params.id as string);
/** ข้อมูล v-model ของฟอร์ม */ /** ข้อมูล v-model ของฟอร์ม */
const data = reactive<FormData>({ const data = reactive<FormData>({
complaint: "", complaint: "",
@ -30,7 +29,7 @@ const data = reactive<FormData>({
daysExtend: null, daysExtend: null,
statusResult: "", statusResult: "",
causeText: "", causeText: "",
complaintStatus: "" complaintStatus: "NEW",
}); });
/** จำลองข้อมูลจาก api */ /** จำลองข้อมูลจาก api */
@ -56,20 +55,55 @@ const fetchData = async () => {
* นทกขอมลทเเกไข * นทกขอมลทเเกไข
* @param id ระบ คคล * @param id ระบ คคล
*/ */
async function onSubmit(id:string){ async function onSubmit(id: string) {
// put // put
console.log("edit",id); console.log("edit", id);
router.push(`/discipline/investigatefacts`); router.push(`/discipline/investigatefacts`);
}; }
/** ยืนยัน ส่งไปสอบสวน */ /** ยืนยัน ส่งไปสอบสวน */
function sentInvestigate(){ function sentInvestigate() {
dialogConfirm($q,()=> confirmSentInvestigate(),'ยืนยันส่งไปสอบสวน','ต้องการยืนยันส่งไปสอบสวนใช่หรือไม่?') dialogConfirm(
$q,
() => confirmSentInvestigate(),
"ยืนยันส่งไปสอบสวน",
"ต้องการยืนยันส่งไปสอบสวนใช่หรือไม่?"
);
}
/** ยืนยัน ยุติเรื่อง */
function endInvestigate() {
dialogConfirm(
$q,
() => confirmEndInvestigate(),
"ยืนยันยุติเรื่อง",
"ต้องการยืนยันยุติเรื่องใช่หรือไม่?"
);
}
/** ยืนยัน ยกเลิกการยุติเรื่อง */
function cancelInvestigate() {
dialogConfirm(
$q,
() => confirmCancelInvestigate(),
"ยืนยันยกเลิกการยุติเรื่อง",
"ต้องการยืนยันยกเลิกการยุติเรื่องใช่หรือไม่?"
);
} }
/** ฟังชั่น ส่งไปสอบสวน*/ /** ฟังชั่น ส่งไปสอบสวน*/
function confirmSentInvestigate(){ function confirmSentInvestigate() {
console.log('sent') console.log("sent");
}
/** ฟังชั่น ยุติเรื่อง*/
function confirmEndInvestigate() {
console.log("sent");
}
/** ฟังชั่น ยกเลิกการยุติเรื่อง*/
function confirmCancelInvestigate() {
console.log("sent");
} }
/** โหลดข้อมูลเมื่อเข้าหน้านี้ */ /** โหลดข้อมูลเมื่อเข้าหน้านี้ */
@ -95,10 +129,24 @@ onMounted(() => {
<q-space /> <q-space />
<div class="q-gutter-x-sm"> <div class="q-gutter-x-sm">
<q-btn <q-btn
v-if="data.complaintStatus === 'NEW'"
label="ส่งไปสอบสวน" label="ส่งไปสอบสวน"
color="public" color="public"
@click="sentInvestigate" @click="sentInvestigate"
/> />
<q-btn
v-if="data.complaintStatus === 'NEW'"
label="ยุติเรื่อง"
color="red-7"
@click="endInvestigate"
/>
<q-btn
v-if="data.complaintStatus === 'STOP'"
label="ยกเลิกการยุติเรื่อง"
color="red-7"
@click="cancelInvestigate"
/>
</div> </div>
</div> </div>

View file

@ -184,7 +184,6 @@ onMounted(async () => {
<span class="text-weight-medium">{{ col.label }}</span> <span class="text-weight-medium">{{ col.label }}</span>
</q-th> </q-th>
<q-th auto-width /> <q-th auto-width />
<q-th auto-width />
</q-tr> </q-tr>
</template> </template>
<template v-slot:body="props"> <template v-slot:body="props">
@ -209,19 +208,6 @@ onMounted(async () => {
> >
{{ props.row.active }} {{ props.row.active }}
</q-td> </q-td>
<q-td auto-width>
<div>
<q-btn
v-if="props.row.status === 'ยุติเรื่อง'"
for="#cancel"
dense
unelevated
color="primary"
class="q-px-sm"
>ยกเลกยเรอง</q-btn
>
</div>
</q-td>
</q-tr> </q-tr>
</template> </template>
</d-table> </d-table>