เลื่อนเงืนเดือน

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-03-27 17:16:17 +07:00
parent 62b5651911
commit 1e25bfc4b6
6 changed files with 185 additions and 166 deletions

View file

@ -206,30 +206,32 @@ async function getAgencyPosition(id: string) {
* @param snap id รอบ
*/
function fetchSalalyPeriod(rootId: string, periodId: string, snap: string) {
showLoader();
isLoad.value = false;
const body = {
rootId: rootId,
salaryPeriodId: periodId,
snapshot: snap,
};
if (rootId !== "ALL") {
showLoader();
isLoad.value = false;
const body = {
rootId: rootId,
salaryPeriodId: periodId,
snapshot: snap,
};
http
.post(config.API.salaryListPeriodLatestEmp, body)
.then(async (res) => {
const data = res.data.result;
data && store.fetchPeriodLatest(data, store.tabGroup);
periodLatest.value = data;
isLoad.value = true;
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
setTimeout(() => {
hideLoader();
}, 800);
});
http
.post(config.API.salaryListPeriodLatestEmp, body)
.then(async (res) => {
const data = res.data.result;
data && store.fetchPeriodLatest(data, store.tabGroup);
periodLatest.value = data;
isLoad.value = true;
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
setTimeout(() => {
hideLoader();
}, 800);
});
}
}
/** function เปลี่ยนรอบการขั้นเงินเดือน*/
@ -238,9 +240,14 @@ async function onChangeRound() {
store.isClosedRound = roundFilter.value.isClose;
await getSnap(roundFilter.value.shortCode);
await getAgency(roundFilter.value.revisionId);
await getAgencyPosition(roundFilter.value.revisionId);
// await getAgency(roundFilter.value.revisionId);
// await getAgencyPosition(roundFilter.value.revisionId);
if (agencyFilter.value && roundFilter.value.id && snapFilter.value) {
fetchSalalyPeriod(
agencyFilter.value,
roundFilter.value.id,
snapFilter.value
);
store.tabType = "PENDING";
store.roundMainCode = roundFilter.value.shortCode;
} else {

View file

@ -206,40 +206,45 @@ async function getAgencyPosition(id: string) {
* @param snap id รอบ
*/
function fetchSalalyPeriod(rootId: string, periodId: string, snap: string) {
showLoader();
isLoad.value = false;
const body = {
rootId: rootId,
salaryPeriodId: periodId,
snapshot: snap,
};
if (rootId !== "ALL") {
showLoader();
isLoad.value = false;
const body = {
rootId: rootId,
salaryPeriodId: periodId,
snapshot: snap,
};
http
.post(config.API.salaryListPeriodLatest, body)
.then(async (res) => {
const data = res.data.result;
if (roundFilter.value.shortCode !== "SPECIAL") {
if (Object.values(data).includes(null)) {
isLoad.value = false;
http
.post(config.API.salaryListPeriodLatest, body)
.then(async (res) => {
const data = res.data.result;
console.log(roundFilter.value.shortCode);
if (roundFilter.value.shortCode !== "SPECIAL") {
if (Object.values(data).includes(null)) {
isLoad.value = false;
} else {
data && store.fetchPeriodLatest(data, store.tabGroup);
periodLatest.value = data;
isLoad.value = true;
}
} else {
data && store.fetchPeriodLatest(data, store.tabGroup);
periodLatest.value = data;
isLoad.value = true;
}
} else {
data && store.fetchPeriodLatest(data, store.tabGroup);
periodLatest.value = data;
isLoad.value = true;
}
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
setTimeout(() => {
hideLoader();
}, 800);
});
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
setTimeout(() => {
hideLoader();
}, 800);
});
}
}
/** function เปลี่ยนรอบการขั้นเงินเดือน*/
@ -249,15 +254,15 @@ async function onChangeRound() {
if (roundFilter.value.shortCode === "SPECIAL") {
store.tabGroup = "group1";
}
await getSnap(roundFilter.value.shortCode);
await getAgency(roundFilter.value.revisionId);
await getAgencyPosition(roundFilter.value.revisionId);
getSnap(roundFilter.value.shortCode);
// 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
// );
fetchSalalyPeriod(
agencyFilter.value,
roundFilter.value.id,
snapFilter.value
);
store.tabType = "PENDING";
store.roundMainCode = roundFilter.value.shortCode;
store.roundYear = roundFilter.value.year;