From 3c83bc8306cc398b95765270508c7713be40fb1d Mon Sep 17 00:00:00 2001 From: "DESKTOP-1R2VSQH\\Lenovo ThinkPad E490" Date: Mon, 11 Nov 2024 11:46:41 +0700 Subject: [PATCH] =?UTF-8?q?fix=20=E0=B9=80=E0=B8=87=E0=B8=B4=E0=B8=99?= =?UTF-8?q?=E0=B9=80=E0=B8=94=E0=B8=B7=E0=B8=AD=E0=B8=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/04_salaryLists/TabMain.vue | 8 +++----- src/modules/13_salary/views/04_salaryLists.vue | 18 +++++------------- .../13_salary/views/05_salaryListsEmployee.vue | 16 ++++------------ 3 files changed, 12 insertions(+), 30 deletions(-) diff --git a/src/modules/13_salary/components/04_salaryLists/TabMain.vue b/src/modules/13_salary/components/04_salaryLists/TabMain.vue index 1631d2154..9f3fdc137 100644 --- a/src/modules/13_salary/components/04_salaryLists/TabMain.vue +++ b/src/modules/13_salary/components/04_salaryLists/TabMain.vue @@ -251,7 +251,7 @@ function fetchDataQuota(id: string) { * function เรียกข้อมูลรายชื่อ * @param id กลุ่ม */ -function fetchDataPeriod(id: string) { +async function fetchDataPeriod(id: string) { showLoader(); rows.value = []; let formData = { @@ -267,7 +267,7 @@ function fetchDataPeriod(id: string) { : "0", }; - http + await http .put(config.API.salaryListPeriodORG(id), formData) .then((res) => { rows.value = res.data.result.data; @@ -278,9 +278,7 @@ function fetchDataPeriod(id: string) { messageError($q, err); }) .finally(() => { - setTimeout(() => { - hideLoader(); - }, 1000); + hideLoader(); }); } diff --git a/src/modules/13_salary/views/04_salaryLists.vue b/src/modules/13_salary/views/04_salaryLists.vue index c1277a66e..9b1f9883a 100644 --- a/src/modules/13_salary/views/04_salaryLists.vue +++ b/src/modules/13_salary/views/04_salaryLists.vue @@ -121,11 +121,9 @@ async function getRound() { store.isClosedRound = roundFilter.value.isClose; salaryPeriodId.value = roundFilter.value.id; - await Promise.all([ - getSnap(roundFilter.value.shortCode), - getAgency(roundFilter.value.revisionId), - getAgencyPosition(roundFilter.value.revisionId), - ]); + await getSnap(roundFilter.value.shortCode); + await getAgency(roundFilter.value.revisionId); + await getAgencyPosition(roundFilter.value.revisionId); } else { isLoad.value = false; roundFilter.value = "ไม่มีข้อมูล"; @@ -143,7 +141,7 @@ async function getRound() { /** * function เรียกรอบ */ -function getSnap(code: string) { +async function getSnap(code: string) { snapOptions.value = code == "OCT" ? [ @@ -232,7 +230,7 @@ async function getAgencyPosition(id: string) { agencyFilter.value = position ? position.id : "ALL"; if (agencyFilter.value && roundFilter.value.id && snapFilter.value) { - fetchSalalyPeriod( + await fetchSalalyPeriod( agencyFilter.value, roundFilter.value.id, snapFilter.value @@ -257,7 +255,6 @@ async function fetchSalalyPeriod( snap: string ) { if (rootId) { - showLoader(); isLoad.value = false; const body = { rootId: rootId, @@ -286,11 +283,6 @@ async function fetchSalalyPeriod( }) .catch((err) => { messageError($q, err); - }) - .finally(() => { - setTimeout(() => { - hideLoader(); - }, 800); }); } } diff --git a/src/modules/13_salary/views/05_salaryListsEmployee.vue b/src/modules/13_salary/views/05_salaryListsEmployee.vue index 8a5ba899a..bd7d5daae 100644 --- a/src/modules/13_salary/views/05_salaryListsEmployee.vue +++ b/src/modules/13_salary/views/05_salaryListsEmployee.vue @@ -112,11 +112,9 @@ async function getRound() { store.roundMainCode = roundFilter.value.shortCode; store.isClosedRound = roundFilter.value.isClose; - await Promise.all([ - getSnap(roundFilter.value.shortCode), - getAgency(roundFilter.value.revisionId), - getAgencyPosition(roundFilter.value.revisionId), - ]); + await getSnap(roundFilter.value.shortCode); + await getAgency(roundFilter.value.revisionId); + await getAgencyPosition(roundFilter.value.revisionId); } else { isLoad.value = false; roundFilter.value = "ไม่มีข้อมูล"; @@ -220,7 +218,7 @@ async function getAgencyPosition(id: string) { agencyFilter.value = position ? position.id : "ALL"; if (agencyFilter.value && roundFilter.value.id && snapFilter.value) { - fetchSalalyPeriod( + await fetchSalalyPeriod( agencyFilter.value, roundFilter.value.id, snapFilter.value @@ -245,7 +243,6 @@ async function fetchSalalyPeriod( snap: string ) { if (rootId) { - showLoader(); isLoad.value = false; const body = { rootId: rootId, @@ -263,11 +260,6 @@ async function fetchSalalyPeriod( }) .catch((err) => { messageError($q, err); - }) - .finally(() => { - setTimeout(() => { - hideLoader(); - }, 1500); }); } }