From 7798707e960acfcb2855bdf5aea47463339cce56 Mon Sep 17 00:00:00 2001 From: "DESKTOP-1R2VSQH\\Lenovo ThinkPad E490" Date: Thu, 21 Nov 2024 14:53:46 +0700 Subject: [PATCH] =?UTF-8?q?fix=20=E0=B9=80=E0=B8=84=E0=B8=A3=E0=B8=B7?= =?UTF-8?q?=E0=B9=88=E0=B8=AD=E0=B8=87=E0=B8=A3=E0=B8=B2=E0=B8=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../3_result/DialogReceive_Return.vue | 98 ++++++++++--- .../components/3_result/DialogResults.vue | 134 ++++++++++++------ .../components/4_Allocate/DialogEdit.vue | 15 +- .../components/5_Borrow/DialogForm.vue | 3 +- .../07_insignia/interface/response/Main.ts | 2 + src/modules/07_insignia/storeResult.ts | 6 +- .../07_insignia/views/05_BorrowMain.vue | 2 +- 7 files changed, 189 insertions(+), 71 deletions(-) diff --git a/src/modules/07_insignia/components/3_result/DialogReceive_Return.vue b/src/modules/07_insignia/components/3_result/DialogReceive_Return.vue index e1edc5b26..5c1ebe4db 100644 --- a/src/modules/07_insignia/components/3_result/DialogReceive_Return.vue +++ b/src/modules/07_insignia/components/3_result/DialogReceive_Return.vue @@ -47,8 +47,10 @@ const files = ref(); //ไฟล์รับ const filesReturn = ref(); //ไฟล์คืน const OrganazationId = ref(""); //id หน่วยงานที่รับ const OrganazationId2 = ref(""); //id หน่วยงานที่คือ +const OrgListMain = ref([]); ////รายการหน่วยงาน const OrgList = ref([]); //รายการหน่วยงาน -const OrgList2 = ref([]); ////รายการหน่วยงาน +const OrgList2 = ref([]); //รายการหน่วยงาน + const Datereceive = ref(); //วันที่รับ const Datereturn = ref(); //วันที่คืน const nullii = ref(null); @@ -119,6 +121,16 @@ function onSubmit(type: string, id: string) { * function เรียกหน่วยงาน */ async function fetchOrgList() { + const newData = [ + { + id: "00000000-0000-0000-0000-000000000000", + name: "สำนักนายกรัฐมนตรี", + }, + ]; + // OrgListMain.value = newData; + // OrgList.value = newData; + // OrgList2.value = newData; + showLoader(); await http .get(config.API.activeOrganization) @@ -133,8 +145,11 @@ async function fetchOrgList() { name: item.orgName, }) ); - OrgList.value = dataSystem; - OrgList2.value = dataSystem; + + newData.push(...dataSystem); + OrgListMain.value = newData; + OrgList.value = newData; + OrgList2.value = newData; }) .catch((err) => { messageError($q, err); @@ -148,14 +163,49 @@ async function fetchOrgList() { }); } +/** + * function ค้นหาข้อมูลใน select + * @param val คำค้นหา + * @param update Function + */ +function filterOption(val: string, update: Function, type: string) { + switch (type) { + case "receive": + update(() => { + OrgList.value = OrgListMain.value.filter( + (v: DataOption) => v.name.indexOf(val) > -1 + ); + }); + break; + case "return": + update(() => { + OrgList2.value = OrgListMain.value.filter( + (v: DataOption) => v.name.indexOf(val) > -1 + ); + }); + break; + } +} + +/** + * class inpui + * @param val ค่าสถานะ + */ +function classInput(val: boolean) { + return { + "full-width cursor-pointer ": val, + "full-width cursor-pointer inputgreen": !val, + }; +} + /** * callback function จะทำงานเมื่อ modal มีการเปลี่ยนแปลง */ watch( () => props.modal, - () => { + async () => { if (props.modal == true) { - fetchOrgList(); + await fetchOrgList(); } } ); @@ -167,15 +217,16 @@ watch(props, () => { if (props.dataModal) { Datereceive.value = props.dataModal.dateReceiveInsignia; Datereturn.value = props.dataModal.dateReturnInsignia; - OrganazationId.value = props.dataModal.orgReceiveInsignia; + OrganazationId.value = props.dataModal.orgReceiveInsigniaId; filesCheck.value = props.dataModal.docReceiveInsignia; filesReturnCheck.value = props.dataModal.docReturnInsignia; OrganazationId2.value = Datereturn.value != null - ? props.dataModal.orgReturnInsignia == null || - props.dataModal.orgReturnInsignia == "-" + ? props.dataModal.orgReturnInsigniaId === null || + props.dataModal.orgReturnInsigniaId === "-" || + props.dataModal.orgReturnInsigniaId === "" ? "00000000-0000-0000-0000-000000000000" - : props.dataModal.orgReturnInsignia + : props.dataModal.orgReturnInsigniaId : ""; } }); @@ -183,7 +234,7 @@ watch(props, () => {