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, () => {