diff --git a/src/modules/11_discipline/components/1_Complaint/Form.vue b/src/modules/11_discipline/components/1_Complaint/Form.vue index 98bd0af17..4bd067213 100644 --- a/src/modules/11_discipline/components/1_Complaint/Form.vue +++ b/src/modules/11_discipline/components/1_Complaint/Form.vue @@ -160,14 +160,16 @@ function confirmDelete(id: string) { showLoader(); http .delete(config.API.complaintFileDelete(formData.id, id)) - .then(async (res) => { + .then(async () => { await props.getData(); success($q, `ลบไฟล์สำเร็จ`); }) .catch((e) => { messageError($q, e); }) - .finally(() => {}); + .finally(() => { + hideLoader(); + }); } /** @@ -188,7 +190,7 @@ function upLoadFileDoc() { showLoader(); http .put(config.API.complaintFileUpload(formData.id), Data) - .then(async (res) => { + .then(async () => { await props.getData(); countNum.value = 2; formData.documentFile = null; @@ -198,7 +200,7 @@ function upLoadFileDoc() { .catch((e) => { messageError($q, e); }) - .finally(async () => { + .finally(() => { hideLoader(); }); } @@ -215,7 +217,6 @@ async function addPerson(data: any, type?: string) { /** ดึงข้อมูล active */ async function getActive() { if (!formData.activeId) { - showLoader(); await http .get(config.API.activeOrganization) .then(async (res) => { @@ -225,16 +226,12 @@ async function getActive() { }) .catch((err) => { messageError($q, err); - }) - .finally(() => { - hideLoader(); }); } } /** ดึงข้อมูลหน่วยงานจาก api */ async function getOc(activeId: string) { - showLoader(); await http .get(config.API.orgByIdSystem(activeId, route.meta.Key as string)) .then(async (res) => { @@ -246,9 +243,6 @@ async function getOc(activeId: string) { }) .catch((err) => { messageError($q, err); - }) - .finally(() => { - hideLoader(); }); } @@ -264,8 +258,8 @@ function deletePerson(id: string) { } /** ช่องทางการร้องเรียน และฟังก์ชั่นการดึงข้อมูลช่องทางการร้องเรียนมาจาก api*/ -function getListChannel() { - http +async function getListChannel() { + await http .get( config.API.complaintListOp( mainStore.pathComplaintsChannal(route.name as string) @@ -386,7 +380,12 @@ watch(props.data, async () => { /** โหลดข้อมูลเมื่อเข้าหน้านี้ */ onMounted(async () => { mainStore.rowsAdd = []; - await Promise.all([getActive(), getListChannel()]); + try { + showLoader(); + await Promise.all([getActive(), getListChannel()]); + } finally { + hideLoader(); + } }); diff --git a/src/modules/11_discipline/components/2_InvestigateFacts/Form.vue b/src/modules/11_discipline/components/2_InvestigateFacts/Form.vue index 1fd503615..28bd4e0a9 100644 --- a/src/modules/11_discipline/components/2_InvestigateFacts/Form.vue +++ b/src/modules/11_discipline/components/2_InvestigateFacts/Form.vue @@ -526,10 +526,10 @@ async function saveDuty(id: string, duty: string, resolution: string) { duty: duty, commandNo: resolution, }) - .then((res: any) => { + .then(async () => { + await props.getData?.(); success($q, "บันทึกสำเร็จ"); closeEditDirector(); - props.getData?.(); }) .catch((e) => { messageError($q, e); diff --git a/src/modules/11_discipline/components/3_InvestigateDisciplinary/Form.vue b/src/modules/11_discipline/components/3_InvestigateDisciplinary/Form.vue index c0acb1948..20c0b1308 100644 --- a/src/modules/11_discipline/components/3_InvestigateDisciplinary/Form.vue +++ b/src/modules/11_discipline/components/3_InvestigateDisciplinary/Form.vue @@ -619,7 +619,7 @@ function emitPerson(data: PersonsArray[]) { .post(config.API.disciplinaryReport(), { Id: dataMapId, }) - .then((res) => { + .then(() => { getActive(); }) .catch((e) => { @@ -648,10 +648,10 @@ async function saveDuty(id: string, duty: string, resolution: string) { duty: duty, commandNo: resolution, }) - .then((res: any) => { + .then(async () => { + await props.fetchData(); success($q, "บันทึกสำเร็จ"); closeEditDirector(); - props.fetchData(); }) .catch((e) => { messageError($q, e); diff --git a/src/modules/11_discipline/components/4_Result/Form.vue b/src/modules/11_discipline/components/4_Result/Form.vue index d8bfabf96..8d5d433d5 100644 --- a/src/modules/11_discipline/components/4_Result/Form.vue +++ b/src/modules/11_discipline/components/4_Result/Form.vue @@ -161,17 +161,20 @@ async function selectComplainant(val: string) { */ function onSubmit() { dialogConfirm($q, async () => { + showLoader(); await http .put(config.API.listResultById(id.value), formData) - .then(() => { + .then(async () => { + await props.fetchData(); isSave.value = false; success($q, "บันทึกข้อมูลสำเร็จ"); - props.fetchData(); }) .catch((err) => { messageError($q, err); }) - .finally(async () => {}); + .finally(() => { + hideLoader(); + }); }); } @@ -194,7 +197,6 @@ function changeFormData() { /**เมื่อเริ่มโหลดหน้า * ส่งข้อมูลจำลองไปยัง store */ - function uploadFile() { /** uploadFile */ const Data = new FormData(); @@ -202,7 +204,7 @@ function uploadFile() { showLoader(); http .put(config.API.upLoadFileResult(id.value), Data) - .then(async (res) => { + .then(async () => { await props.fetchData(); countNum.value = 2; success($q, "อัปโหลดไฟล์สำเร็จ"); @@ -229,7 +231,7 @@ function confirmDelete(docid: string) { showLoader(); http .delete(config.API.deleteFileResult(id.value, docid)) - .then(async (res) => { + .then(async () => { await props.fetchData(); success($q, `ลบไฟล์สำเร็จ`); }) @@ -294,15 +296,17 @@ function onFaultSubmit() { offense: JSON.stringify(checkValue.value), remark: remark.value, }) - .then((res) => { + .then(async () => { + await props.fetchData(); success($q, "ระบุฐานความผิด สำเร็จ"); close(); - props.fetchData(); }) .catch((e) => { messageError($q, e); }) - .finally(() => {}); + .finally(() => { + hideLoader(); + }); }); } else { dialogMessageNotify($q, "กรุณาเลือกอย่างน้อย 1 มาตรา");