From d47140e0ecda2561220a73636ab0f8600cb436bf Mon Sep 17 00:00:00 2001 From: setthawutttty Date: Fri, 24 Nov 2023 10:47:44 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B8=AA=E0=B9=88=E0=B8=87=E0=B9=80=E0=B8=A3?= =?UTF-8?q?=E0=B8=B7=E0=B9=88=E0=B8=AD=E0=B8=87=E0=B8=A3=E0=B9=89=E0=B8=AD?= =?UTF-8?q?=E0=B8=87=E0=B9=80=E0=B8=A3=E0=B8=B5=E0=B8=A2=E0=B8=99=E0=B9=84?= =?UTF-8?q?=E0=B8=9B=E0=B8=A2=E0=B8=B1=E0=B8=87=E0=B8=82=E0=B8=B1=E0=B9=89?= =?UTF-8?q?=E0=B8=99=E0=B8=95=E0=B8=AD=E0=B8=99=E0=B8=81=E0=B8=B2=E0=B8=A3?= =?UTF-8?q?=E0=B8=AA=E0=B8=B7=E0=B8=9A=E0=B8=AA=E0=B8=A7=E0=B8=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Dialogs/AddPersonal.vue | 2 +- .../components/1_Complaint/EditPage.vue | 35 ++++++++++++--- .../components/1_Complaint/Form.vue | 14 +++--- .../components/1_Complaint/Popup.vue | 43 +++++++++++-------- .../interface/request/complaint.ts | 4 +- 5 files changed, 62 insertions(+), 36 deletions(-) diff --git a/src/components/Dialogs/AddPersonal.vue b/src/components/Dialogs/AddPersonal.vue index 7e45d08c4..c304b724c 100644 --- a/src/components/Dialogs/AddPersonal.vue +++ b/src/components/Dialogs/AddPersonal.vue @@ -219,7 +219,7 @@ async function close() { /** เปิด dialog ยืนยัน */ function savePost() { if (selected.value.length != 0) { - dialogConfirm($q, () => console.log(selected.value)); + dialogConfirm($q, () => saveData()); } else { dialogMessageNotify($q, "กรุณาเลือกอย่างน้อย 1 รายการ"); } diff --git a/src/modules/11_discipline/components/1_Complaint/EditPage.vue b/src/modules/11_discipline/components/1_Complaint/EditPage.vue index 76f5d82df..9a208ae0b 100644 --- a/src/modules/11_discipline/components/1_Complaint/EditPage.vue +++ b/src/modules/11_discipline/components/1_Complaint/EditPage.vue @@ -69,7 +69,7 @@ const data = reactive({ documentFile: null, status: "", persons: [personOj], - reason: '', + result: '', disciplineComplaintDocs: [fileListOj], }); @@ -155,7 +155,7 @@ async function getData() { data.appellant = dataList.appellant; data.status = dataList.status; data.persons = dataList.persons; - data.reason = dataList.reason; + data.result = dataList.result; data.disciplineComplaintDocs = dataList.disciplineComplaintDocs; console.log("list", data.id); @@ -261,10 +261,17 @@ function confirmCancelInvestigate() { console.log("sent"); } -function sentApprove() { - showLoader(); +function emitPerson(data:ArrayPerson[]){ + console.log('person',data) + const dataMapId = data.map((item:ArrayPerson) => + item.personId + ) + console.log('id',dataMapId) + showLoader(); http - .get(config.API.complaintApprove(id.value)) + .put(config.API.complaintApprove(id.value),{ + persons:dataMapId + }) .then((res) => { router.push(`/discipline/complaints`); }) @@ -274,8 +281,22 @@ function sentApprove() { .finally(() => { hideLoader(); }); - console.log("sent"); } +// function sentApprove() { +// // showLoader(); +// // http +// // .put(config.API.complaintApprove(id.value)) +// // .then((res) => { +// // router.push(`/discipline/complaints`); +// // }) +// // .catch((e) => { +// // messageError($q, e); +// // }) +// // .finally(() => { +// // hideLoader(); +// // }); +// console.log("sent"); +// } /** เรียกใช้งาน ฟังชั่น ตอนเริ่มโหลดหน้า */ onMounted(() => { console.log(data); @@ -325,6 +346,6 @@ onMounted(() => { :data="data" :get-data="getData" /> - + diff --git a/src/modules/11_discipline/components/1_Complaint/Form.vue b/src/modules/11_discipline/components/1_Complaint/Form.vue index 92a030336..0ea6a356f 100644 --- a/src/modules/11_discipline/components/1_Complaint/Form.vue +++ b/src/modules/11_discipline/components/1_Complaint/Form.vue @@ -53,7 +53,7 @@ const levelConsiderationRef = ref(null); const dateNotificationRef = ref(null); const complaintFromRef = ref(null); const appellantRef = ref(null); -const reasonRef = ref(null); +const resultRef = ref(null); const fileList = ref([]); /** รับ props มาจากหน้าหลัก */ @@ -96,7 +96,7 @@ const formData = reactive({ appellant: "", documentFile: null, status: "", - reason: '', + result: '', persons: [], disciplineComplaintDocs: fileList.value ?? null, }); @@ -116,7 +116,7 @@ const objectComplaintsRef: MyObjectComplaintsRef = { dateNotification: dateNotificationRef, complaintFrom: complaintFromRef, appellant: appellantRef, - reason: reasonRef, + result: resultRef, }; /** options ทั้งหมด*/ @@ -393,7 +393,7 @@ watch(props.data, async () => { formData.complaintFrom = props.data.complaintFrom; formData.appellant = props.data.appellant; formData.status = props.data.status; - formData.reason = props.data.reason; + formData.result = props.data.result; formData.persons = complainstStore.rowsAdd; }); @@ -881,12 +881,12 @@ onMounted(() => {
([ { @@ -132,23 +135,23 @@ const initialPagination = ref({ function onclickSend() { // inputRef.value.validate(); - dialogConfirm($q, () => props.sentApprove()); + // dialogConfirm($q, () => props.sentApprove()); - // if (selected.value.length > 0) { - // dialogConfirm( - // $q, - // async () => { - // success($q, `ส่งข้อมูล${props.title}สำเร็จ`); - // console.log(selected.value); - - // props.close?.(); - // }, - // `ยืนยันการส่ง${props.title}`, - // `ต้องการยืนยันการส่ง${props.title}หรือไม่` - // ); - // } else { - // dialogMessageNotify($q, "กรุณาเลือกรายชื่อ"); - // } + if (selected.value.length > 0) { + dialogConfirm( + $q, + async () => { + success($q, `ส่งข้อมูล${props.title}สำเร็จ`); + console.log(selected.value); + emit('returnPerson',selected.value) + props.close?.(); + }, + `ยืนยันการส่ง${props.title}`, + `ต้องการยืนยันการส่ง${props.title}หรือไม่` + ); + } else { + dialogMessageNotify($q, "กรุณาเลือกรายชื่อ"); + } } function onClickClose() { @@ -158,8 +161,10 @@ function onClickClose() { watch([() => props.modal], () => { inspectionResults.value = props.modal ? "" : ""; selected.value = props.modal ? [] : []; - - selected.value.push(complainstStore.rowsAdd); + if(props.modal === true){ + selected.value = complainstStore.rowsAdd; + } + });