fix select filter ระบบลา

This commit is contained in:
Warunee Tamkoo 2023-12-27 13:51:40 +07:00
parent 123a74e911
commit 1f80bda5ff
3 changed files with 55 additions and 37 deletions

View file

@ -22,7 +22,6 @@ const mixin = useCounterMixin();
const leaveStore = useLeavelistDataStore();
const { date2Thai, dateToISO, showLoader, hideLoader, messageError } = mixin;
const { fetchListLeave } = leaveStore;
const $q = useQuasar(); // noti quasar
@ -39,20 +38,29 @@ const maxPage = ref<number>(1);
//** API*/
async function fecthLeaveList() {
showLoader();
await http
.post(config.API.leaveList(), querySting)
.then((res) => {
const data = res.data.result;
maxPage.value = Math.ceil(data.total / querySting.pageSize);
fetchListLeave(data.data); /** ส่งข้อมูลไป stores*/
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
querySting.status = await (querySting.status == null
? "ALL"
: querySting.status);
querySting.type = await (querySting.type == null
? "00000000-0000-0000-0000-000000000000"
: querySting.type);
if (querySting.status != null && querySting.type != null) {
showLoader();
await http
.post(config.API.leaveList(), querySting)
.then((res) => {
const data = res.data.result;
maxPage.value = Math.ceil(data.total / querySting.pageSize);
leaveStore.fetchListLeave(data.data); /** ส่งข้อมูลไป stores*/
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
}
// const data = APIDATA.data;
// maxPage.value = Math.ceil(data.length / querySting.pageSize);
}
@ -74,6 +82,7 @@ async function updatePaging(
querySting.page = newPage;
querySting.pageSize = pageSize ? pageSize : querySting.pageSize;
querySting.keyword = dateFilter ? dateFilter.keyword : querySting.keyword;
await fecthLeaveList();
}