Merge branch 'nice_dev' into develop

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2023-09-07 11:12:10 +07:00
commit a1f3261bba
2 changed files with 25 additions and 28 deletions

View file

@ -288,34 +288,11 @@ watch(tab, async () => {
fecthlistInsignia();
});
const selectorInsignia = async () => {
const dataCopy = await DataStore.listInsignia;
rows.value =
DataStore.insignia != ""
? dataCopy.filter((x: any) => x.requestInsigniaId == DataStore.insignia)
: dataCopy;
};
const selectEmployeeClass = async (employeeClass: string) => {
if (employeeClass == "officer") {
let list = DataStore.listInsignia.filter(
(e: any) => e.employeeType === "ข้าราชการ กทม.สามัญ"
);
rows.value = list;
} else if (employeeClass === "perm") {
let list = DataStore.listInsignia.filter(
(e: any) => e.employeeType === "ลูกจ้างประจำ"
);
rows.value = list;
} else rows.value = DataStore.listInsignia;
};
const yearRound = ref<number>();
const selectorRound = async (round: number) => {
roundYear.value = round;
await fecthlistInsignia();
};
const rows = ref<any[]>([]);
const fecthlistInsignia = async () => {
showLoader();
await http
@ -324,7 +301,6 @@ const fecthlistInsignia = async () => {
)
.then(async (res) => {
await DataStore.fetchlistinsignia(res.data.result);
rows.value = DataStore.rows;
})
.catch((err) => {
messageError($q, err);
@ -441,7 +417,12 @@ const paginationLabel = (start: number, end: number, total: number) => {
:readonly="false"
:borderless="false"
style="min-width: 150px"
@update:model-value="selectorInsignia"
@update:model-value="
DataStore.searchDatatable(
DataStore.insignia,
DataStore.employeeClass
)
"
/>
</div>
<div>
@ -461,7 +442,10 @@ const paginationLabel = (start: number, end: number, total: number) => {
:borderless="false"
style="min-width: 150px"
@update:model-value="
selectEmployeeClass(DataStore.employeeClass)
DataStore.searchDatatable(
DataStore.insignia,
DataStore.employeeClass
)
"
/>
</div>
@ -521,7 +505,7 @@ const paginationLabel = (start: number, end: number, total: number) => {
</div>
</div>
<d-table
:rows="rows"
:rows="DataStore.rows"
:columns="columns"
:visible-columns="visibleColumns"
:filter="filter"

View file

@ -54,7 +54,19 @@ export const useBrrowDataStore = defineStore("insigniaBrrow", () => {
}));
rows.value = list
listInsignia.value = list
// selectInvoice(invoiceType.value)
searchDatatable(insignia.value, employeeClass.value)
}
const searchDatatable = (type: string, employeeClass: string) => {
if (type !== '' && employeeClass !== "all") {
rows.value = listInsignia.value.filter((e: any) => e.requestInsigniaId == type && e.profileType == employeeClass
)
} else if (type !== '' && employeeClass == "all") {
rows.value = listInsignia.value.filter((e: any) => e.requestInsigniaId == type
)
} else if (type == '' && employeeClass !== "all") {
rows.value = listInsignia.value.filter((e: any) => e.profileType == employeeClass
)
}
}
const status = (val: string) => {
@ -89,5 +101,6 @@ export const useBrrowDataStore = defineStore("insigniaBrrow", () => {
fetchDataInsignia,
profileType,
fetchlistinsignia,
searchDatatable,
};
});