fix select filter ระบบลา
This commit is contained in:
parent
123a74e911
commit
1f80bda5ff
3 changed files with 55 additions and 37 deletions
|
|
@ -22,7 +22,6 @@ const mixin = useCounterMixin();
|
||||||
const leaveStore = useLeavelistDataStore();
|
const leaveStore = useLeavelistDataStore();
|
||||||
|
|
||||||
const { date2Thai, dateToISO, showLoader, hideLoader, messageError } = mixin;
|
const { date2Thai, dateToISO, showLoader, hideLoader, messageError } = mixin;
|
||||||
const { fetchListLeave } = leaveStore;
|
|
||||||
|
|
||||||
const $q = useQuasar(); //ใช้ noti quasar
|
const $q = useQuasar(); //ใช้ noti quasar
|
||||||
|
|
||||||
|
|
@ -39,20 +38,29 @@ const maxPage = ref<number>(1);
|
||||||
|
|
||||||
//** เรียกข้อมูลจาก API*/
|
//** เรียกข้อมูลจาก API*/
|
||||||
async function fecthLeaveList() {
|
async function fecthLeaveList() {
|
||||||
showLoader();
|
querySting.status = await (querySting.status == null
|
||||||
await http
|
? "ALL"
|
||||||
.post(config.API.leaveList(), querySting)
|
: querySting.status);
|
||||||
.then((res) => {
|
querySting.type = await (querySting.type == null
|
||||||
const data = res.data.result;
|
? "00000000-0000-0000-0000-000000000000"
|
||||||
maxPage.value = Math.ceil(data.total / querySting.pageSize);
|
: querySting.type);
|
||||||
fetchListLeave(data.data); /** ส่งข้อมูลไป stores*/
|
|
||||||
})
|
if (querySting.status != null && querySting.type != null) {
|
||||||
.catch((err) => {
|
showLoader();
|
||||||
messageError($q, err);
|
await http
|
||||||
})
|
.post(config.API.leaveList(), querySting)
|
||||||
.finally(() => {
|
.then((res) => {
|
||||||
hideLoader();
|
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;
|
// const data = APIDATA.data;
|
||||||
// maxPage.value = Math.ceil(data.length / querySting.pageSize);
|
// maxPage.value = Math.ceil(data.length / querySting.pageSize);
|
||||||
}
|
}
|
||||||
|
|
@ -74,6 +82,7 @@ async function updatePaging(
|
||||||
querySting.page = newPage;
|
querySting.page = newPage;
|
||||||
querySting.pageSize = pageSize ? pageSize : querySting.pageSize;
|
querySting.pageSize = pageSize ? pageSize : querySting.pageSize;
|
||||||
querySting.keyword = dateFilter ? dateFilter.keyword : querySting.keyword;
|
querySting.keyword = dateFilter ? dateFilter.keyword : querySting.keyword;
|
||||||
|
|
||||||
await fecthLeaveList();
|
await fecthLeaveList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -38,23 +38,32 @@ const maxPage = ref<number>(1);
|
||||||
|
|
||||||
//** เรียกข้อมูลจาก API*/
|
//** เรียกข้อมูลจาก API*/
|
||||||
async function fecthLeaveList() {
|
async function fecthLeaveList() {
|
||||||
showLoader();
|
querySting.status = await (querySting.status == null
|
||||||
await http
|
? "ALL"
|
||||||
.post(config.API.leaveListDelete(), querySting)
|
: querySting.status);
|
||||||
.then((res) => {
|
querySting.type = await (querySting.type == null
|
||||||
const data = res.data.result;
|
? "00000000-0000-0000-0000-000000000000"
|
||||||
console.log(data);
|
: querySting.type);
|
||||||
|
|
||||||
maxPage.value = Math.ceil(data.total / querySting.pageSize);
|
if (querySting.status != null && querySting.type != null) {
|
||||||
console.log(maxPage.value);
|
showLoader();
|
||||||
fetchListLeaveReject(data.data); /** ส่งข้อมูลไป stores*/
|
await http
|
||||||
})
|
.post(config.API.leaveListDelete(), querySting)
|
||||||
.catch((err) => {
|
.then((res) => {
|
||||||
messageError($q, err);
|
const data = res.data.result;
|
||||||
})
|
console.log(data);
|
||||||
.finally(() => {
|
|
||||||
hideLoader();
|
maxPage.value = Math.ceil(data.total / querySting.pageSize);
|
||||||
});
|
console.log(maxPage.value);
|
||||||
|
fetchListLeaveReject(data.data); /** ส่งข้อมูลไป stores*/
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
messageError($q, err);
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
hideLoader();
|
||||||
|
});
|
||||||
|
}
|
||||||
// const data = APIDATA.data;
|
// const data = APIDATA.data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -23,12 +23,12 @@ const props = defineProps({
|
||||||
const emit = defineEmits(["update:querySting"]);
|
const emit = defineEmits(["update:querySting"]);
|
||||||
|
|
||||||
/** formFilter*/
|
/** formFilter*/
|
||||||
const filter = reactive<DateFilter>({
|
// const filter = reactive<DateFilter>({
|
||||||
year: new Date().getFullYear(), //*ปีในการยื่นขอใบลา(ใช้เป็น คศ.)
|
// year: new Date().getFullYear(), //*ปีในการยื่นขอใบลา(ใช้เป็น คศ.)
|
||||||
type: "00000000-0000-0000-0000-000000000000", //*Id ประเภทการลา
|
// type: "00000000-0000-0000-0000-000000000000", //*Id ประเภทการลา
|
||||||
status: "ALL", //*สถานะการของลา
|
// status: "ALL", //*สถานะการของลา
|
||||||
keyword: "", //keyword ค้นหา
|
// keyword: "", //keyword ค้นหา
|
||||||
});
|
// });
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* function update ข้อมูลการค้นหา (QuerySting)
|
* function update ข้อมูลการค้นหา (QuerySting)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue