From d0bbf5f68ee19a9e55897ff4e289fdb66062de7c Mon Sep 17 00:00:00 2001 From: "DESKTOP-1R2VSQH\\Lenovo ThinkPad E490" Date: Tue, 20 Aug 2024 15:18:31 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B9=80=E0=B8=87=E0=B8=B4=E0=B8=99=E0=B9=80?= =?UTF-8?q?=E0=B8=94=E0=B8=B7=E0=B8=AD=E0=B8=99=20=3D>=20=E0=B9=80?= =?UTF-8?q?=E0=B8=A5=E0=B8=B7=E0=B9=88=E0=B8=AD=E0=B8=99=E0=B8=84=E0=B9=88?= =?UTF-8?q?=E0=B8=B2=E0=B8=88=E0=B9=89=E0=B8=B2=E0=B8=87=E0=B8=A5=E0=B8=B9?= =?UTF-8?q?=E0=B8=81=E0=B8=88=E0=B9=89=E0=B8=B2=E0=B8=87=E0=B8=9B=E0=B8=A3?= =?UTF-8?q?=E0=B8=B0=E0=B8=88=E0=B8=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SalaryEmployeeLists/DialogAddPerson.vue | 7 +-- .../SalaryEmployeeLists/DialogFormEdit.vue | 18 ++++---- .../SalaryEmployeeLists/DialogMoveGroup.vue | 13 +++--- .../SalaryEmployeeLists/DialogMoveLevel.vue | 14 +++--- .../SalaryEmployeeLists/DialogProperties.vue | 14 +++--- .../SalaryEmployeeLists/ProcessStep.vue | 44 +++++++++---------- .../SalaryEmployeeLists/TableTypeOther.vue | 6 +-- .../SalaryEmployeeLists/TableTypePending.vue | 9 ++-- .../components/SalaryLists/ProcessStep.vue | 4 +- .../SalaryLists/TableTypePending.vue | 6 +-- 10 files changed, 60 insertions(+), 75 deletions(-) diff --git a/src/modules/13_salary/components/SalaryEmployeeLists/DialogAddPerson.vue b/src/modules/13_salary/components/SalaryEmployeeLists/DialogAddPerson.vue index 98b8fe22f..2022ef5d2 100644 --- a/src/modules/13_salary/components/SalaryEmployeeLists/DialogAddPerson.vue +++ b/src/modules/13_salary/components/SalaryEmployeeLists/DialogAddPerson.vue @@ -148,11 +148,12 @@ function onClickAddPerson(data: DataPerson) { dialogConfirm( $q, () => { + showLoader(); http .post(config.API.salaryPeriodProfileEmp, body) - .then(() => { - props.fetchData?.(); - success($q, "เพื่มรายชื่อสำเร็จ"); + .then(async () => { + await props.fetchData?.(); + await success($q, "เพื่มรายชื่อสำเร็จ"); closeModal(); }) .catch((err) => { diff --git a/src/modules/13_salary/components/SalaryEmployeeLists/DialogFormEdit.vue b/src/modules/13_salary/components/SalaryEmployeeLists/DialogFormEdit.vue index 3f8893b56..89b69c2ba 100644 --- a/src/modules/13_salary/components/SalaryEmployeeLists/DialogFormEdit.vue +++ b/src/modules/13_salary/components/SalaryEmployeeLists/DialogFormEdit.vue @@ -13,7 +13,7 @@ import { useCounterMixin } from "@/stores/mixin"; /** use*/ const $q = useQuasar(); const mixin = useCounterMixin(); -const { dialogConfirm, success, messageError } = mixin; +const { dialogConfirm, success, messageError, showLoader, hideLoader } = mixin; /** props*/ const modal = defineModel("modal", { required: true }); @@ -44,6 +44,7 @@ function close() { function onSubmit() { dialogConfirm($q, () => { if (amount.value !== null) { + showLoader(); const amountString: string = amount.value.toString(); const body = { profileId: profileId.value, @@ -54,15 +55,16 @@ function onSubmit() { }; http .post(config.API.salaryPeriodEmp() + `/change/amount`, body) - .then(() => { - success($q, "บันทึกข้อมูลสำเร็จ"); - props.fetchData?.(); + .then(async () => { + await props.fetchData?.(); + await success($q, "บันทึกข้อมูลสำเร็จ"); + close(); }) .catch((e) => { messageError($q, e); }) .finally(() => { - close(); + hideLoader(); }); } }); @@ -88,6 +90,7 @@ function onSubmit() { :rules="[(val) => !!val || `${'กรุณากรอกเงินเดือนฐาน'}`]" lazy-rules hide-bottom-space + class="inputgreen" /> @@ -97,10 +100,7 @@ function onSubmit() { diff --git a/src/modules/13_salary/components/SalaryEmployeeLists/DialogMoveGroup.vue b/src/modules/13_salary/components/SalaryEmployeeLists/DialogMoveGroup.vue index 409210efc..28c814adc 100644 --- a/src/modules/13_salary/components/SalaryEmployeeLists/DialogMoveGroup.vue +++ b/src/modules/13_salary/components/SalaryEmployeeLists/DialogMoveGroup.vue @@ -55,16 +55,16 @@ function onSubmit() { }; http .post(config.API.salaryPeriod() + `/change/group`, body) - .then(() => { - success($q, "บันทึกข้อมูลสำเร็จ"); - props.fetchData?.(); + .then(async () => { + await props.fetchData?.(); + await success($q, "บันทึกข้อมูลสำเร็จ"); + close(); }) .catch((e) => { messageError($q, e); }) .finally(() => { hideLoader(); - close(); }); }); } @@ -120,10 +120,7 @@ function inputEdit(val: boolean) { diff --git a/src/modules/13_salary/components/SalaryEmployeeLists/DialogMoveLevel.vue b/src/modules/13_salary/components/SalaryEmployeeLists/DialogMoveLevel.vue index 00d8267c0..c4fb4e080 100644 --- a/src/modules/13_salary/components/SalaryEmployeeLists/DialogMoveLevel.vue +++ b/src/modules/13_salary/components/SalaryEmployeeLists/DialogMoveLevel.vue @@ -81,15 +81,15 @@ function onSubmit() { }; http .post(config.API.salaryPeriodEmp() + `/change/type`, body) - .then(() => { - success($q, "บันทึกข้อมูลสำเร็จ"); - props.fetchData?.(); + .then(async () => { + await props.fetchData?.(); + await success($q, "บันทึกข้อมูลสำเร็จ"); + close(); }) .catch((e) => { messageError($q, e); }) .finally(() => { - close(); hideLoader(); }); }); @@ -168,15 +168,11 @@ function inputEdit(val: boolean) {
- diff --git a/src/modules/13_salary/components/SalaryEmployeeLists/DialogProperties.vue b/src/modules/13_salary/components/SalaryEmployeeLists/DialogProperties.vue index c9ed6f8c4..ce5e3eefb 100644 --- a/src/modules/13_salary/components/SalaryEmployeeLists/DialogProperties.vue +++ b/src/modules/13_salary/components/SalaryEmployeeLists/DialogProperties.vue @@ -66,15 +66,15 @@ function onSubmit() { }; http .put(config.API.salaryPropertyEmp(profileId.value), body) - .then(() => { - success($q, "บันทึกข้อมูลสำเร็จ"); - props.fetchData?.(); + .then(async () => { + await props.fetchData?.(); + await success($q, "บันทึกข้อมูลสำเร็จ"); + close(); }) .catch((e) => { messageError($q, e); }) .finally(() => { - close(); hideLoader(); }); }); @@ -132,14 +132,10 @@ watch( - diff --git a/src/modules/13_salary/components/SalaryEmployeeLists/ProcessStep.vue b/src/modules/13_salary/components/SalaryEmployeeLists/ProcessStep.vue index 5bc5fbc0b..1f44a86b8 100644 --- a/src/modules/13_salary/components/SalaryEmployeeLists/ProcessStep.vue +++ b/src/modules/13_salary/components/SalaryEmployeeLists/ProcessStep.vue @@ -67,7 +67,7 @@ async function uploadFile(event: any) { res.data[key]?.fileName !== "" ); const link = res.data[foundKey]?.uploadUrl; - fileUpLoad(link); + await fileUpLoad(link); }) .catch((err) => { messageError($q, err); @@ -85,10 +85,10 @@ function fileUpLoad(url: string) { headers: { "Content-Type": fileUpload.value?.type }, onUploadProgress: (e) => console.log(e), }) - .then(() => { - success($q, "อัปโหลดไฟล์สำเร็จ"); + .then(async () => { + await fetchListFile(); + await success($q, "อัปโหลดไฟล์สำเร็จ"); fileUpload.value = null; - fetchListFile(); }) .catch((e) => { messageError($q, e); @@ -114,9 +114,10 @@ function saveReccommend(reason: string) { titleRecommend: reason, } ) - .then((res) => { - console.log(res); - props.getData?.(); + .then(async () => { + await props.getData?.(); + sendStep.value = sendStep.value + 1; + modalRecommend.value = false; }) .catch((e) => { messageError($q, e); @@ -124,8 +125,6 @@ function saveReccommend(reason: string) { .finally(() => { hideLoader(); }); - sendStep.value = sendStep.value + 1; - modalRecommend.value = false; }, "ยืนยันการ" + titleRecommend.value, "ต้องการยืนยันการ" + titleRecommend.value + "หรือไม่?" @@ -145,9 +144,9 @@ function sendToDirector(msg: string, type: string) { props.rootId ? props.rootId : "" ) ) - .then((res) => { - console.log(res); - props.getData?.(); + .then(async () => { + await props.getData?.(); + sendStep.value = sendStep.value == 3 ? 6 : sendStep.value + 1; }) .catch((e) => { messageError($q, e); @@ -155,7 +154,6 @@ function sendToDirector(msg: string, type: string) { .finally(() => { hideLoader(); }); - sendStep.value = sendStep.value == 3 ? 6 : sendStep.value + 1; }, "ยืนยันการ" + msg, "ต้องการยืนยันการ" + msg + "หรือไม่?" @@ -202,16 +200,16 @@ function onDeleteFile(fileName: string) { ) ) .then(() => { - success($q, "ลบไฟล์สำเร็จ"); - setTimeout(() => { - fetchListFile(); - hideLoader(); - }, 1000); + setTimeout(async () => { + await fetchListFile(); + await success($q, "ลบไฟล์สำเร็จ"); + await hideLoader(); + }, 2000); }) .catch((e) => { messageError($q, e); - }) - .finally(async () => {}); + hideLoader(); + }); }); } @@ -377,9 +375,8 @@ onMounted(() => { dense flat round - size="12px" color="blue" - icon="mdi-download-outline" + icon="mdi-download" @click="downloadFile(item.fileName)" > ดาวน์โหลดเอกสาร @@ -391,9 +388,8 @@ onMounted(() => { dense flat round - size="12px" color="red" - icon="mdi-delete-outline" + icon="mdi-delete" @click="onDeleteFile(item.fileName)" >ลบเอกสาร diff --git a/src/modules/13_salary/components/SalaryEmployeeLists/TableTypeOther.vue b/src/modules/13_salary/components/SalaryEmployeeLists/TableTypeOther.vue index 702f7a278..4e3d1db50 100644 --- a/src/modules/13_salary/components/SalaryEmployeeLists/TableTypeOther.vue +++ b/src/modules/13_salary/components/SalaryEmployeeLists/TableTypeOther.vue @@ -260,9 +260,9 @@ function onClickDelete(id: string) { showLoader(); await http .delete(config.API.salaryListPeriodProfileByIdEmp(id)) - .then(() => { - success($q, "ลบข้อมูลสำเร็จ"); - props.fetchDataTable?.(); + .then(async () => { + await props.fetchDataTable?.(); + await success($q, "ลบข้อมูลสำเร็จ"); }) .catch((err) => { messageError($q, err); diff --git a/src/modules/13_salary/components/SalaryEmployeeLists/TableTypePending.vue b/src/modules/13_salary/components/SalaryEmployeeLists/TableTypePending.vue index 810ffeb99..605d41ebe 100644 --- a/src/modules/13_salary/components/SalaryEmployeeLists/TableTypePending.vue +++ b/src/modules/13_salary/components/SalaryEmployeeLists/TableTypePending.vue @@ -217,9 +217,9 @@ function onClickDelete(id: string) { showLoader(); await http .delete(config.API.salaryListPeriodProfileByIdEmp(id)) - .then(() => { - success($q, "ลบข้อมูลสำเร็จ"); - props.fetchDataTable?.(); + .then(async () => { + await props.fetchDataTable?.(); + await success($q, "ลบข้อมูลสำเร็จ"); }) .catch((err) => { messageError($q, err); @@ -289,7 +289,6 @@ function searchData() { } function onProperties(data: any) { - console.log(data); modalDialogProperties.value = true; profileId.value = data.id; isPunish.value = data.isPunish; @@ -382,7 +381,7 @@ function onClickViewInfo(type: string, id: string) {