diff --git a/src/modules/13_salary/views/salaryLists.vue b/src/modules/13_salary/views/salaryLists.vue index 7fb57561b..7a4a8cb9a 100644 --- a/src/modules/13_salary/views/salaryLists.vue +++ b/src/modules/13_salary/views/salaryLists.vue @@ -46,7 +46,7 @@ const loading = ref(false); const nextPage = ref(1); /**function เรียกข้อมูลรอบการขึ้นเงินเดือน*/ -function getRound() { +async function getRound() { showLoader(); http .get( @@ -81,13 +81,13 @@ function getRound() { await getAgency(roundFilter.value.revisionId); await getAgencyPosition(roundFilter.value.revisionId); - if (agencyFilter.value && roundFilter.value.id && snapFilter.value) { - await fetchSalalyPeriod( - agencyFilter.value, - roundFilter.value.id, - snapFilter.value - ); - } + // if (agencyFilter.value && roundFilter.value.id && snapFilter.value) { + // await fetchSalalyPeriod( + // agencyFilter.value, + // roundFilter.value.id, + // snapFilter.value + // ); + // } }) .catch((e) => { messageError($q, e); @@ -164,13 +164,21 @@ function getAgencyPosition(id: string) { if (id) { http .get(config.API.keycloakPositionByid(id)) - .then(async (res) => { + .then((res) => { const data = res.data.result; const position = agencyOptions.value?.find( (e: DataOption) => e.id === data.rootId ); agencyFilter.value = position ? position.id : ""; + + if (agencyFilter.value && roundFilter.value.id && snapFilter.value) { + fetchSalalyPeriod( + agencyFilter.value, + roundFilter.value.id, + snapFilter.value + ); + } }) .catch((err) => { messageError($q, err); @@ -184,7 +192,11 @@ function getAgencyPosition(id: string) { * @param periodId id รอบการขึ้นเงินเดือน * @param snap id รอบ */ -function fetchSalalyPeriod(rootId: string, periodId: string, snap: string) { +async function fetchSalalyPeriod( + rootId: string, + periodId: string, + snap: string +) { showLoader(); isLoad.value = false; const body = { @@ -193,7 +205,7 @@ function fetchSalalyPeriod(rootId: string, periodId: string, snap: string) { snapshot: snap, }; - http + await http .post(config.API.salaryListPeriodLatest, body) .then(async (res) => { const data = res.data.result; @@ -219,11 +231,11 @@ async function onChangeRound() { await getAgency(roundFilter.value.revisionId); await getAgencyPosition(roundFilter.value.revisionId); if (agencyFilter.value && roundFilter.value.id && snapFilter.value) { - await fetchSalalyPeriod( - agencyFilter.value, - roundFilter.value.id, - snapFilter.value - ); + // await fetchSalalyPeriod( + // agencyFilter.value, + // roundFilter.value.id, + // snapFilter.value + // ); store.tabType = "PENDING"; store.roundMainCode = roundFilter.value.shortCode; } else {