diff --git a/src/modules/07_insignia/components/1_Proposals/listProposals.vue b/src/modules/07_insignia/components/1_Proposals/listProposals.vue index 839b05e1d..0a46978a6 100644 --- a/src/modules/07_insignia/components/1_Proposals/listProposals.vue +++ b/src/modules/07_insignia/components/1_Proposals/listProposals.vue @@ -287,7 +287,7 @@ onMounted(async () => { {{ col.label }} - + @@ -323,7 +323,7 @@ onMounted(async () => { @click="clickEdit(props.row)" /> - + { {{ props.rowIndex + 1 }} - {{ props.row.citizenId }} + {{ props.row.citizenId ?? "-" }} {{ props.row.name }} diff --git a/src/modules/07_insignia/components/2_Manage/listManage.vue b/src/modules/07_insignia/components/2_Manage/listManage.vue index 47af92c6e..420281a7b 100644 --- a/src/modules/07_insignia/components/2_Manage/listManage.vue +++ b/src/modules/07_insignia/components/2_Manage/listManage.vue @@ -16,14 +16,17 @@ import DialogPopupReason from "@/components/Dialogs/PopupReason.vue"; //หม import { useCounterMixin } from "@/stores/mixin"; import { useInsigniaDataStore } from "@/modules/07_insignia/store"; import { useroleUserDataStore } from "@/stores/roleUser"; -/**use sToer */ + +/**use */ +const $q = useQuasar(); //ใช้ noti quasar const roleDataStore = useroleUserDataStore(); const DataStore = useInsigniaDataStore(); const mixin = useCounterMixin(); const { messageError, dialogConfirm, showLoader, hideLoader, success } = mixin; -const $q = useQuasar(); //ใช้ noti quasar - +/** + * ตัวแปร + */ const loading = ref(false); const loadview = ref(false); const hideBottom = ref(false); @@ -38,12 +41,19 @@ const stat = ref({ orgNoSendCount: 0, orgSendCount: 0, }); +const requestNote = ref(""); +const requestStatus = ref(""); +const requestId = ref(""); +const document = ref(""); +const fileUpload = ref(null); const modalPopupBackToEdit = ref(false); //model แก้ไข +const modalbackInsignia2Role = ref(false); -/** function เรียกรอบการเสนอขอพระราชทานเครื่อง*/ -async function fecthlistRound() { - // showLoader(); - await http +/** + * function เรียกรอบการเสนอขอพระราชทานเครื่อง + */ +function fecthlistRound() { + http .get(config.API.listRoundInsignia()) .then(async (res: any) => { optionRound.value = res.data.result.map((e: any) => ({ @@ -53,8 +63,6 @@ async function fecthlistRound() { })); //มีรอบการเสนอขอพระราชทานเครื่องแสดง UI if (optionRound.value.length !== 0) { - loadview.value = true; - loading.value = true; DataStore.optionRound = optionRound.value; const lastValue = optionRound.value[0]; if (DataStore.roundId) { @@ -72,13 +80,14 @@ async function fecthlistRound() { }) .catch((err) => { messageError($q, err); - hideLoader(); }); } -/** function เรียกดู Stat ของรอบการเสนอขอพระราชทานเครื่อง*/ -const fecthStat = async (id: string) => { - await http +/** + * function เรียกดู Stat ของรอบการเสนอขอพระราชทานเครื่อง + */ +function fecthStat(id: string) { + http .get(config.API.insigniaDashboard(id)) .then((res) => { stat.value = res.data.result; @@ -86,24 +95,28 @@ const fecthStat = async (id: string) => { .catch((err) => { messageError($q, err); }); -}; +} -/** funcion เช็คหน่วยงาน*/ -async function fecthAgency() { - await http +/** + * funcion เช็คหน่วยงาน + */ +function fecthAgency() { + http .get(config.API.keycloakPosition()) - .then(async (res) => { - // loadview.value = true; + .then((res) => { + loadview.value = true; DataStore.agency = res.data.result.rootId; DataStore.typeOc = DataStore.agency; - // loading.value = true; + loading.value = true; }) .catch((err) => { messageError($q, err); - }) - .finally(() => {}); + }); } +/** + * function fetch โครองสร้างปัจจุบัน + */ function fetchActiveId() { http .get(config.API.activeOrganization) @@ -115,6 +128,11 @@ function fetchActiveId() { messageError($q, err); }); } + +/** + * function fetch ข้อมูลโครองสร้างปัจจุบัน + * @param id โครงสร้างปัจจุบัน + */ function fetchListOrg(id: string) { showLoader(); http @@ -126,22 +144,22 @@ function fetchListOrg(id: string) { })); optiontypeOc.value = data; DataStore.fetchOption(optiontypeOc.value); //ค่าของหน่วยงานทั้งหมดไว้ที่ DataStore - fecthAgency(); + await fecthAgency(); }) .catch((err) => { messageError($q, err); - }) - .finally(() => { hideLoader(); }); } -/**function เรียกประเภทเครื่องราช*/ -async function fecthInsignia() { - await http +/** + * function เรียกประเภทเครื่องราช + */ +function fecthInsignia() { + http .get(config.API.insigniaOrg) .then((res) => { - let data = res.data.result; + const data = res.data.result; DataStore.fetchInsigniaType(data); }) .catch((err) => { @@ -149,7 +167,9 @@ async function fecthInsignia() { }); } -/** function เลือกรอบการแสดง*/ +/** + * function เปลี่ยนรอบการแสดง + */ async function changround() { DataStore.roundId = round.value; fecthStat(round.value); //เรียกดู Stat รอบที่เลือก @@ -165,10 +185,6 @@ async function changround() { roundFilter.year + 543 }`; } -const requestNote = ref(""); -const requestStatus = ref(""); -const requestId = ref(""); -const document = ref(""); /** * function เรียกข้อมูลรายชื่อข้าราชการสามัญฯ ที่มีสิทธิ์ยื่นขอพระราชทานเครื่องราชอิสริยาภรณ์ ตามรอบการเสนอขอ @@ -177,7 +193,7 @@ const document = ref(""); * @param role ประเภท officer,employee * @param status สถานะ */ -async function fecthInsigniaByOc( +function fecthInsigniaByOc( roundId: string, ocId: string, role: string, @@ -185,7 +201,7 @@ async function fecthInsigniaByOc( ) { if (roundId && ocId && role && status) { showLoader(); - await http + http .get(config.API.insigniaList(roundId, ocId, role, status)) .then(async (res) => { requestNote.value = res.data.result.requestNote; @@ -194,7 +210,7 @@ async function fecthInsigniaByOc( document.value = res.data.result.document; await DataStore.fetchData(res.data.result.items); // ส่งรายชื่อข้าราชการสามัญฯ await DataStore.fetchDataInsignia(res.data.result); // ส่งข้อมูลรอบบการแสดง - // loading.value = true; + loading.value = true; // แสดงปุมล็อกข้อมูล if (res.data.result.items !== null) { if (res.data.result.items.length !== 0) { @@ -203,7 +219,7 @@ async function fecthInsigniaByOc( } }) .catch((err) => { - // messageError($q, err); + messageError($q, err); }) .finally(() => { hideLoader(); @@ -211,11 +227,13 @@ async function fecthInsigniaByOc( } } -/**function ยืนยันการส่งรอบการเสนอขอต่อ เฉพาะ รอบที่ requestStatus st1 และ st4 */ -async function sendToDirector() { - dialogConfirm($q, async () => { +/** + * function ยืนยันการส่งรอบการเสนอขอต่อ เฉพาะ รอบที่ requestStatus st1 และ st4 + */ +function sendToDirector() { + dialogConfirm($q, () => { showLoader(); - await http + http .get(config.API.insigniaSendToDirector(round.value, DataStore.agency)) .then(async () => { await fecthStat(round.value); @@ -229,34 +247,35 @@ async function sendToDirector() { }) .catch((err) => { messageError($q, err); - }) - .finally(() => { hideLoader(); }); }); } -/** function open popup แก้ไข*/ -async function popupBackToEdit() { +/** + * function open popup แก้ไข* + */ +function popupBackToEdit() { modalPopupBackToEdit.value = true; } -const modalbackInsignia2Role = ref(false); -/**function open popup ตีกลับ admin*/ -const popupBackToInsignia2Role = async () => { +/** + * function open popup ตีกลับ admin + */ +function popupBackToInsignia2Role() { modalbackInsignia2Role.value = true; -}; +} /** * funtion ยืนยันการ ตีกลับรอบการเสนอขอ เฉพาะ รอบที่ requestStatus st3 และ insignia2Role * @param reason หมายเหตุการตีกลับ */ -async function backToEdit(reason: string) { +function backToEdit(reason: string) { dialogConfirm( $q, - async () => { + () => { showLoader(); - await http + http .put( config.API.insigniaDirectorBackToEdit(round.value, DataStore.agency), { @@ -283,13 +302,15 @@ async function backToEdit(reason: string) { ); } -/**function ยืนยันการอนุมัติรอบการเสนอขอ เฉพาะ รอบที่ requestStatus st3 และ insignia2Role */ -async function directorApproved() { +/** + * function ยืนยันการอนุมัติรอบการเสนอขอ เฉพาะ รอบที่ requestStatus st3 และ insignia2Role + */ +function directorApproved() { dialogConfirm( $q, - async () => { + () => { showLoader(); - await http + http .get(config.API.insigniaDirectorApproved(round.value, DataStore.agency)) .then(async () => { await fecthInsigniaByOc( @@ -315,9 +336,9 @@ async function directorApproved() { * function ยืนยันการตีกลับรอบการเสนอขอ เฉพาะ รอบที่ requestStatus st5 และ adminRole * @param reason หมายเหตุการตีกลับ */ -async function backToEditinsignia2Role(reason: string) { - dialogConfirm($q, async () => { - await http +function backToEditinsignia2Role(reason: string) { + dialogConfirm($q, () => { + http .put(config.API.rejectRequest(round.value, DataStore.typeOc), { reason: reason, }) @@ -337,11 +358,13 @@ async function backToEditinsignia2Role(reason: string) { }); } -/**function ยืนยันการล็อกข้อมูล*/ -async function requestSendNote() { - dialogConfirm($q, async () => { +/** + * function ยืนยันการล็อกข้อมูล + */ +function requestSendNote() { + dialogConfirm($q, () => { showLoader(); - await http + http .post(config.API.insigniaRequestSendNote(round.value), { name: roundName.value, }) @@ -362,7 +385,6 @@ async function requestSendNote() { }); } -const fileUpload = ref(null); /** * function อัปโหลดไฟล์เจ้าหน้าที่ * @param event file @@ -392,12 +414,14 @@ async function uploadFile(event: any) { }); } -/** hook*/ +/** + * hook + */ onMounted(async () => { tab.value = DataStore.mainTab; - await fecthlistRound(); - await fetchActiveId(); DataStore.dataInsigniaType.length === 0 && (await fecthInsignia()); + fecthlistRound(); + fetchActiveId(); }); diff --git a/src/modules/07_insignia/components/3_result/DialogForm.vue b/src/modules/07_insignia/components/3_result/DialogForm.vue index 5106683b9..00dc35a32 100644 --- a/src/modules/07_insignia/components/3_result/DialogForm.vue +++ b/src/modules/07_insignia/components/3_result/DialogForm.vue @@ -4,14 +4,23 @@ import { QForm, useQuasar } from "quasar"; import http from "@/plugins/http"; import config from "@/app.config"; -/** import Type*/ +/** + * import Type + */ import type { DataOption } from "@/modules/04_registry/components/profileType"; import DialogHeader from "@/components/DialogHeader.vue"; -/** import Stores */ +/** + * import Stores + */ import { useCounterMixin } from "@/stores/mixin"; import { useResultDataStore } from "@/modules/07_insignia/storeResult"; -/** useStore*/ + +/** + * use + */ +const $q = useQuasar(); +const myForm = ref(); const DataStore = useResultDataStore(); const mixin = useCounterMixin(); const { @@ -24,9 +33,35 @@ const { notifyError, } = mixin; -const $q = useQuasar(); -const myForm = ref(); +/** + * Props + */ + const props = defineProps({ + modal: Boolean, + save: { + type: Function, + }, + close: { + type: Function, + }, + roundId: { + type: String, + }, + action: { + type: String, + }, + personId: { + type: String, + }, + profileType: { + type: String, + }, + fecthlistInsignia: { type: Function, required: true }, +}); +/** + * ตัวแปร + */ const status = ref(""); const Advertise = ref(""); const issue = ref(""); @@ -51,49 +86,25 @@ const employeeClassOps = ref([ { id: "officer", name: "ข้าราชการ กทม.สามัญ" }, { id: "employee", name: "ลูกจ้างประจำ" }, ]); -const listPerson = ref([]); const paymentOp = [ { label: "จัดส่งทางไปรษณีย์", value: "จัดส่งทางไปรษณีย์" }, { label: "มารับด้วยตัวเอง", value: "มารับด้วยตัวเอง" }, ]; - -function clearAnnounceExam() { - announceDate.value = null; -} - -/** function reset วันที่ได้รับพระราชทานเครื่องราชอิสริยาภรณ์*/ -function clearDateReceivedate() { - receivedate.value = null; -} +const formFilter = reactive({ + page: 1, + pageSize: 10, + searchField: "citizenId", + searchKeyword: "", +}); /** function reset วันที่จ่ายใบกำกับ*/ function clearDateInvoiceDate() { invoiceDate.value = null; } -const props = defineProps({ - modal: Boolean, - save: { - type: Function, - }, - close: { - type: Function, - }, - roundId: { - type: String, - }, - action: { - type: String, - }, - personId: { - type: String, - }, - profileType: { - type: String, - }, -}); - -/** callback function จำทำงานเมื่อ props.modal = true เปิด popup เพิ่มรายชื่อบันทึกผล*/ +/** + * callback function จำทำงานเมื่อ props.modal = true เปิด popup เพิ่มรายชื่อบันทึกผล + */ watch(props, () => { if (props.modal === true) { employeeClass.value = ""; @@ -120,20 +131,23 @@ watch(props, () => { } } else { status.value = ""; + selectType(); } }); -/** disbleStatus */ +/** + * disbleStatus + */ const disbleStatus = computed(() => { if (employeeClass.value !== "") { return false; } else return true; }); -// เลือกประเภทลูกจ้าง -/** function เลือกประเภทลูกจ้าง */ -async function selectType() { - // showLoader(); +/** + * function เลือกประเภทลูกจ้าง + */ +function selectType() { cardid.value = ""; fullName.value = ""; position.value = ""; @@ -150,36 +164,13 @@ async function selectType() { announced.value = ""; invoiceDate.value = null; payment.value = ""; - // await fecthlistPerson(); } -/** function เรียกหน่วยงาน*/ -// async function fecthlistPerson() { -// await http -// .get(config.API.profileOrganizRoot) -// .then((res) => { -// const id = res.data.result[0].id; -// if (id !== "") { -// findlist(id); // id หน่วยงานไปเรียกรายชื่อ -// } -// }) -// .catch((e) => { -// messageError($q, e); -// }); -// } - -const formFilter = reactive({ - page: 1, - pageSize: 10, - searchField: "citizenId", - searchKeyword: "", -}); - /** * function เรียกรายชื่อลูกจ้างตาม id หน่วยงาน * @param id id หน่วยงาน */ -async function findlist(id: string = "", idCard: string) { + function findlist(id: string = "", idCard: string) { formFilter.searchKeyword = idCard; http .get( @@ -207,43 +198,18 @@ async function findlist(id: string = "", idCard: string) { .finally(() => { hideLoader(); }); - // let data = [{}]; - // // ข้าราชการ - // if (employeeClass.value === "officer") { - // data = [{ criteriaType: "is_retire", criteriaValue: "false" }]; - // // ลูกจ้างประจำ - // } else if (employeeClass.value === "employee") { - // data = [ - // { criteriaType: "is_retire", criteriaValue: "false" }, - // { criteriaType: "employee_class", criteriaValue: "perm" }, - // ]; - // } - // await http - // .post(config.API.profileSearchNewOcIdType(id, employeeClass.value), { - // criterias: data, - // }) - // .then((res) => { - // listPerson.value = res.data.result; - // }) - // .catch((e) => { - // messageError($q, e); - // }) - // .finally(() => { - // hideLoader(); - // }); } /** * function เรียกข้อมูลบันทึกผลตาม id - * @param id + * @param id personId */ -async function fectDataByid(id: string) { +function fectDataByid(id: string) { showLoader(); if (props.profileType !== undefined) { - // employeeClass.value = props.profileType.toString(); employeeClass.value = "officer"; } - await http + http .get(config.API.noteByid(id)) .then((res) => { let data = res.data.result; @@ -275,7 +241,7 @@ async function fectDataByid(id: string) { } /** function บักทึกผล*/ -async function onSubmit() { +function onSubmit() { dialogConfirm($q, () => { if (props.roundId !== undefined) { showLoader(); @@ -299,9 +265,9 @@ async function onSubmit() { http .put(config.API.noteAdd(props.roundId), body) .then(async () => { + await props.fecthlistInsignia?.(); await props.close?.(); await success($q, "บันทึกข้อมูลสำเร็จ"); - await showLoader(); }) .catch((err) => { messageError($q, err); @@ -311,7 +277,9 @@ async function onSubmit() { }); } -/** function หาเลขประจำตัวประชาชน*/ +/** + * function หาเลขประจำตัวประชาชน + */ function searchcardid() { if (cardid.value.length === 13) { findlist("", cardid.value); diff --git a/src/modules/07_insignia/components/3_result/Dialogbody.vue b/src/modules/07_insignia/components/3_result/Dialogbody.vue index d6772eb94..724cdc51d 100644 --- a/src/modules/07_insignia/components/3_result/Dialogbody.vue +++ b/src/modules/07_insignia/components/3_result/Dialogbody.vue @@ -7,8 +7,14 @@ import config from "@/app.config"; /** import Type*/ import type { DataOption } from "@/modules/04_registry/components/profileType"; +/** + * import Components + */ +import DialogHeader from "../DialogHeader.vue"; + /** import Stores */ import { useCounterMixin } from "@/stores/mixin"; + /** useStore*/ const mixin = useCounterMixin(); const { @@ -48,11 +54,6 @@ const props = defineProps({ dataModal: Object, }); -/** function reset วันที่ประกาศราชกิจจานุเบกษา*/ -function clearReceiveDate() { - Datereceive.value = null; -} - /** function clearDate */ function clearReturnDate() { Datereturn.value = null; @@ -74,17 +75,17 @@ function close() { * @param type receive,return * @param id personId */ -async function onSubmit(type: string, id: string) { +function onSubmit(type: string, id: string) { dialogConfirm($q, () => { const formData = new FormData(); if (props.dateCheckReceive === null) { formData.append("Date", dateToISO((Datereceive.value as Date) ?? nullii)); formData.append("File", files.value); - // formData.append("OrgId", OrganazationId.value); + formData.append("OrgId", OrganazationId.value); } else { formData.append("Date", dateToISO((Datereturn.value as Date) ?? nullii)); formData.append("File", filesReturn.value); - // formData.append("OrgId", OrganazationId2.value); + formData.append("OrgId", OrganazationId2.value); } showLoader(); http @@ -117,7 +118,7 @@ watch( ); /** function เรียกหน่วยงาน*/ -async function fetchOrgList() { +function fetchOrgList() { showLoader(); http .get(config.API.activeOrganization) @@ -144,30 +145,6 @@ async function fetchOrgList() { .finally(() => { hideLoader(); }); - // showLoader(); - // await http - // .get(config.API.insigniaOrg) - // .then(async (response: any) => { - // const orgArr = response.data.result.map((e: any) => ({ - // id: e.id, - // name: e.name + `(${e.shortName})`, - // })); - // OrgList.value = orgArr; - // OrgList2.value = orgArr; - // // [ - // // { - // // id: "00000000-0000-0000-0000-000000000000", - // // name: "สำนักนายกรัฐมนตรี", - // // }, - // // ...orgArr, - // // ]; - // }) - // .catch((err) => { - // messageError($q, err); - // }) - // .finally(() => { - // hideLoader(); - // }); } /** callback function จำทำงานเมื่อ props มีการเปลี่ยนแปลง*/ @@ -203,19 +180,8 @@ watch(props, () => { ) " > - - รับ-คืนเครื่องราชฯ - - + +
diff --git a/src/modules/07_insignia/components/5_Borrow/DialogForm.vue b/src/modules/07_insignia/components/5_Borrow/DialogForm.vue index 3e65a95f7..c3b5e8f16 100644 --- a/src/modules/07_insignia/components/5_Borrow/DialogForm.vue +++ b/src/modules/07_insignia/components/5_Borrow/DialogForm.vue @@ -39,7 +39,7 @@ const returndate = ref(); const reason = ref(""); const listPerson = ref([]); const OrgList = ref([]); -const filterOrgList = ref([]); +const filterOrgList = ref([]); const insigniaNoteProfileId = ref(""); const filterSelectRound = ref(); const selectRound = ref(); @@ -124,25 +124,32 @@ async function fecthlistInsignia() { } /** function ดึงข้อมูลรายการหน่วยงาน */ -// async function fetchOrgList() { -// showLoader(); -// await http -// .get(config.API.typeOc()) -// .then(async (response: any) => { -// const orgArr = response.data.result.map((e: any) => ({ -// id: e.organizationId, -// name: e.organizationName, -// })); -// OrgList.value = orgArr; -// filterOrgList.value = OrgList.value; -// }) -// .catch((err) => { -// messageError($q, err); -// }) -// .finally(() => { -// hideLoader(); -// }); -// } + +/** funcion เรียกข้อมูลหน่วยงานจัดสรรเครื่องราชอิสริยาภรณ์ */ +async function fetchOrgList() { + http + .get(config.API.activeOrganization) + .then((res) => { + const data = res.data.result; + + http + .get(config.API.orgByid(data.activeId)) + .then(async (res) => { + const data = await res.data.result.map((item: any) => ({ + id: item.orgTreeId, + name: item.orgName, + })); + OrgList.value = data; + filterOrgList.value = data; + }) + .catch((err) => { + messageError($q, err); + }); + }) + .catch((err) => { + messageError($q, err); + }); +} // ดึงข้อมูลการยืม-คืนมาแสดงเก็บไว้ก่อนเผื่อต้องเอาข้อมูลมาแสดงเพิ่ม // const fetchData = async () => { @@ -172,7 +179,6 @@ async function onSubmit() { .then(async () => { await props.closeAndFecth(); await clearData(); - // await hideLoader(); await success($q, "บันทึกข้อมูลสำเร็จ"); }) .catch((err) => { @@ -189,7 +195,6 @@ async function onSubmit() { .then(async () => { await props.closeAndFecth(); await clearData(); - // await hideLoader(); await success($q, "บันทึกข้อมูลสำเร็จ"); }) .catch((err) => { @@ -215,7 +220,6 @@ async function searchcardid() { ?.shortName || "" })`; insigniaNoteProfileId.value = node.id; - insigniaNoteProfileId.value = node.id; hideLoader(); } else { notifyError($q, "ไม่พบข้อมูลการได้รับในรอบนี้"); @@ -229,7 +233,6 @@ async function searchcardid() { fullName.value = ""; brand.value = ""; receivedate.value = null; - // OrganazationId.value = ""; } } @@ -281,11 +284,13 @@ onMounted(() => { /** function callback เช็ค props ถ้าเปิด dialog ให้ดึงรายการข้อมูล */ watch(props, () => { - // type.value = props.type; if (props.modal == true && props.roundId != "all") { roundNo.value = props.roundId; - fecthlistInsignia(); - // fetchOrgList(); + if (props.action === "editData") { + fetchOrgList(); + } else { + fecthlistInsignia(); + } } }); @@ -484,27 +489,27 @@ watch(props, () => {
- + /> +
(""); const selectRound = ref(""); const selectRoundOption = ref([]); @@ -51,7 +63,9 @@ const dateCheckReceive = ref(); const dateCheckReturn = ref(); const dataModal = ref([]); -/** ข้อมูล Tabla*/ +/** + * ข้อมูล Tabla + */ const columns = ref([ { name: "no", @@ -222,14 +236,15 @@ const visibleColumns = ref([ "address", "action", ]); - const filterRef = ref(); const filter = ref(""); -/** function เรียกรอบการเสนอขอพระราชทานเครื่องราช*/ -async function fecthRound() { +/** + *function เรียกรอบการเสนอขอพระราชทานเครื่องราช + */ +function fecthRound() { showLoader(); - await http + http .get(config.API.noteround()) .then(async (res) => { let data = res.data.result; @@ -252,9 +267,11 @@ async function fecthRound() { }); } -/** function เรียกประเภทเครื่องราช*/ -async function fecthInsignia() { - await http +/** + * function เรียกประเภทเครื่องราช + */ +function fecthInsignia() { + http .get(config.API.insigniaOrg) .then((res) => { let data = res.data.result; @@ -265,9 +282,11 @@ async function fecthInsignia() { }); } -/** function เรียกระดับเครื่องราช*/ -async function fecthInsigniaType() { - await http(config.API.insigniaTypeOrg) +/** + * function เรียกระดับเครื่องราช + */ +function fecthInsigniaType() { + http(config.API.insigniaTypeOrg) .then((res) => { let data = res.data.result; DataStore.fetchDatainsigniaType(data); @@ -279,7 +298,9 @@ async function fecthInsigniaType() { }); } -/** function เลือกประเภทเครื่องราช*/ +/** + * function เลือกประเภทเครื่องราช + */ function selectorInsignia() { fecthlistInsignia(); } @@ -295,7 +316,9 @@ function selectorRound(round: string) { fecthlistInsignia(); } -/** callback function จำทำงานเมื่อ tab มีการเปลี่ยนแปลง*/ +/** + * callback function จำทำงานเมื่อ tab มีการเปลี่ยนแปลง + */ watch(tab, () => { if (tab.value !== "doc") { DataStore.insignia = ""; @@ -308,22 +331,26 @@ watch(tab, () => { } }); -/** callback function จำทำงานเมื่อ modal มีการเปลี่ยนแปลง*/ -watch(modal, () => { - if (modal.value == false) { - fecthlistInsignia(); - } -}); +/** + * callback function จำทำงานเมื่อ modal มีการเปลี่ยนแปลง + */ +// watch(modal, () => { +// if (modal.value == false) { +// fecthlistInsignia(); +// } +// }); -/** function เรียกรายชื่อบันทึกผลการได้รับพระราชทานเครื่องราชอิสริยาภรณ์/การจ่ายใบกำกับ */ -async function fecthlistInsignia() { +/** + * function เรียกรายชื่อบันทึกผลการได้รับพระราชทานเครื่องราชอิสริยาภรณ์/การจ่ายใบกำกับ + */ +function fecthlistInsignia() { showLoader(); let data = { insigniaTypeId: tab.value, insigniaNoteId: selectRound.value, insigniaId: DataStore.insignia, }; - await http + http .post(config.API.noteSearch(), data) .then((res) => { let data = res.data.result; @@ -342,21 +369,16 @@ async function fecthlistInsignia() { * @param event file * @param action typepreview */ -async function uploadFile(event: any, action: string) { +function uploadFile(event: any, action: string) { if (selectRound.value !== undefined) { let id = selectRound.value; - dialogConfirm($q, async () => { + dialogConfirm($q, () => { + showLoader(); const formdata = new FormData(); formdata.append("file", event); - await http + http .put(config.API.uploadfileInsignia(action, id), formdata) - .then(() => { - success($q, "อัพโหลดไฟล์สำเร็จ"); - }) - .catch((err) => { - messageError($q, err); - }) - .finally(async () => { + .then(async () => { await fecthlistInsignia(); if (action === "receice") { fileResult.value = null; @@ -364,7 +386,12 @@ async function uploadFile(event: any, action: string) { fileinvoice.value = null; } - modelPerview.value = false; + await success($q, "อัพโหลดไฟล์สำเร็จ"); + modelPerview.value = await false; + }) + .catch((err) => { + messageError($q, err); + hideLoader(); }); }), "ยืนยันการบันทึกรายการข้อมูล", @@ -396,7 +423,9 @@ const save = () => { console.log("save function"); }; -/** ข้อมูล ไฟล์*/ +/** + * ข้อมูล ไฟล์ + */ const modelPerview = ref(false); const rowspreview = ref([]); const typepreview = ref(""); @@ -407,7 +436,7 @@ const fileInsignia = ref(null); * @param event ไฟล * @param actionType ประเภทไฟล์ receice,invoice */ -async function perviewfile(event: any, actionType: string) { +function perviewfile(event: any, actionType: string) { showLoader(); typepreview.value = actionType; fileInsignia.value = event; @@ -415,7 +444,7 @@ async function perviewfile(event: any, actionType: string) { let id = selectRound.value.toString(); const formdata = new FormData(); formdata.append("file", event); - await http + http .put(config.API.previewfileInsignia(actionType, id), formdata) .then((res) => { let data = res.data.result; @@ -448,8 +477,11 @@ async function perviewfile(event: any, actionType: string) { } } +function closeDialogPerview() { + modelPerview.value = false; +} + const resetFilter = () => { - // reset ค่าที่ค้นหาเมื่อกดปุ่ม X ในกล่องค้นหา filter.value = ""; filterRef.value!.focus(); }; @@ -465,7 +497,9 @@ const paginationLabel = (start: number, end: number, total: number) => { else return start + "-" + end + " ใน " + total; }; -/** function openPopup */ +/** + * function openPopup + */ function OpenModal(data: any) { dataModal.value = data; ModalDialog.value = true; @@ -520,8 +554,8 @@ function clearInsigniaFilters(name: string) { } /** hook*/ -onMounted(async () => { - await fecthRound(); +onMounted(() => { + fecthRound(); }); @@ -937,6 +971,7 @@ onMounted(async () => { :action="action" :personId="personId" :profileType="profileType" + :fecthlistInsignia="fecthlistInsignia" /> @@ -949,7 +984,8 @@ onMounted(async () => { - + + - + --> { {{ props.rowIndex + 1 }}
- {{ props.value }} + {{ props.value ?? "-" }}