ปรับ filter บันทึกผลการได้รับพระราชทาน

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2023-09-06 17:31:37 +07:00
parent 1c271edc5a
commit 74f4f8991b
2 changed files with 47 additions and 21 deletions

View file

@ -56,28 +56,45 @@ export const useResultDataStore = defineStore("insigniaResult", () => {
}));
rows.value = alllist
listInsignia.value = alllist
selectInvoice(invoiceType.value)
// selectInvoice(invoiceType.value)
// console.log(invoiceType.value, employeeClass.value);
searchData(invoiceType.value, employeeClass.value);
}
const selectInvoice = (invoice: string) => {
console.log(invoice);
if (invoice === "noDate") {
let list = listInsignia.value.filter((e: any) => e.datepay === null)
const searchData = (invoice: string, employeeClass: string) => {
if (invoice !== 'all' && employeeClass !== 'all') {
let list = listInsignia.value.filter((e: any) => convertDatepay(e.datepay) === invoice && e.employeeType === profileType(employeeClass))
rows.value = list
} else if (invoice === "haveDate") {
let list = listInsignia.value.filter((e: any) => e.datepay !== null)
} else if (invoice !== 'all' && employeeClass === 'all') {
let list = listInsignia.value.filter((e: any) => convertDatepay(e.datepay) === invoice)
rows.value = list
} else rows.value = listInsignia.value
}
const selectEmployeeClass = (employeeClass: string) => {
if (employeeClass == "officer") {
let list = listInsignia.value.filter((e: any) => e.employeeType === "ข้าราชการ กทม.สามัญ")
rows.value = list
} else if (employeeClass === "perm") {
let list = listInsignia.value.filter((e: any) => e.employeeType === "ลูกจ้างประจำ")
rows.value = list
} else rows.value = listInsignia.value
} else if (invoice === 'all' && employeeClass !== 'all') {
let list = listInsignia.value.filter((e: any) => e.employeeType === profileType(employeeClass))
rows.value = list
}
}
// const selectInvoice = (invoice: string) => {
// if (employeeClass.value !== 'all') {
// if (invoice !== "all") {
// let list = listInsignia.value.filter((e: any) => convertDatepay(e.datepay) === invoice && e.employeeType === profileType(employeeClass.value))
// rows.value = list
// } else rows.value = listInsignia.value.filter((e: any) => e.employeeType === profileType(employeeClass.value))
// }
// else {
// if (invoice !== 'all') {
// rows.value = listInsignia.value.filter((e: any) => convertDatepay(e.datepay) === invoice)
// } else rows.value = listInsignia.value
// }
// }
// const selectEmployeeClass = (employeeClass: string) => {
// if (employeeClass == "officer") {
// let list = listInsignia.value.filter((e: any) => e.employeeType === "ข้าราชการ กทม.สามัญ")
// rows.value = list
// } else if (employeeClass === "perm") {
// let list = listInsignia.value.filter((e: any) => e.employeeType === "ลูกจ้างประจำ")
// rows.value = list
// } else rows.value = listInsignia.value
// }
const status = (val: string) => {
switch (val) {
case "PENDING":
@ -98,6 +115,14 @@ export const useResultDataStore = defineStore("insigniaResult", () => {
return "ลูกจ้างประจำ";
}
}
const convertDatepay = (val: any) => {
switch (val) {
case null:
return "noDate";
default:
return "haveDate";
}
}
return {
rows,
insignia,
@ -113,7 +138,8 @@ export const useResultDataStore = defineStore("insigniaResult", () => {
status,
profileType,
fetchlistinsignia,
selectInvoice,
selectEmployeeClass,
searchData,
// selectInvoice,
// selectEmployeeClass,
};
});