แก้ไข filter ประกาศเกษียณอายุราชการ

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2023-10-03 11:58:37 +07:00
parent f773550bfd
commit e0caef0908
3 changed files with 14 additions and 4 deletions

View file

@ -114,8 +114,18 @@ const fetchRetirement = async (type: string, year: any) => {
});
});
yearOptions.value = [{ id: 0, year: "ทั้งหมด" }];
yearOptions.value.push(...option);
// yearOptions.value.push(...option);
if (option.length !== 0) {
const double_name = [...new Set(option.map((item: any) => item.id))];
for (let i = 1; i <= double_name.length; i++) {
const type = double_name[i - 1];
const listtype = {
id: type,
year: (Number(type) + 543).toString(),
};
yearOptions.value.push(listtype);
}
}
yearOptionsFilter.value = yearOptions.value;
if (yearOptionsFilter.value.length == 1) {
fiscalyear.value = yearOptionsFilter.value[0].id;
@ -159,7 +169,6 @@ const pagination = ref({
page: 1,
rowsPerPage: 10,
});
const filterSelector = (val: any, update: Function) => {
update(() => {
yearOptions.value = yearOptionsFilter.value.filter(