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

View file

@ -540,7 +540,7 @@ const paginationLabel = (start: number, end: number, total: number) => {
:borderless="false" :borderless="false"
style="min-width: 150px" style="min-width: 150px"
@update:model-value=" @update:model-value="
DataStore.selectInvoice(DataStore.invoiceType) DataStore.searchData(DataStore.invoiceType,DataStore.employeeClass)
" "
/> />
</div> </div>
@ -561,7 +561,7 @@ const paginationLabel = (start: number, end: number, total: number) => {
:borderless="false" :borderless="false"
style="min-width: 150px" style="min-width: 150px"
@update:model-value=" @update:model-value="
DataStore.selectEmployeeClass(DataStore.employeeClass) DataStore.searchData(DataStore.invoiceType,DataStore.employeeClass)
" "
/> />
</div> </div>