แก้บัค filter ออกคำสั่ง/ประกาศเกษียณอายุราชการ
This commit is contained in:
parent
b01e667f34
commit
1d61d79d13
3 changed files with 62 additions and 51 deletions
|
|
@ -72,19 +72,17 @@ const columns = ref<QTableProps["columns"]>([
|
|||
// ข้อมูลตาราง (จำลอง)
|
||||
const currentYear = new Date().getFullYear();
|
||||
const rows = ref<resMain[]>([]);
|
||||
const yearOptions = ref<any[]>([]);
|
||||
const yearOptions = ref<any>([{ id: "", year: "ทั้งหมด" }]);
|
||||
|
||||
onMounted(() => {
|
||||
filteryear();
|
||||
onMounted(async () => {
|
||||
await fetchRetirement(type.value, currentYear);
|
||||
// await fetchRetirement(type.value, currentYear);
|
||||
});
|
||||
// หาปีปัจจุบัน
|
||||
const filteryear = () => {
|
||||
yearOptions.value = [{ id: currentYear, name: currentYear + 543 }];
|
||||
yearOptions.value.push({ id: currentYear, name: currentYear + 543 });
|
||||
// fiscalyear.value = yearOptions[0].id;
|
||||
|
||||
yearOptionsFilter.value = [{ id: currentYear, name: currentYear + 543 }];
|
||||
yearOptionsFilter.value.push({ id: currentYear, name: currentYear + 543 });
|
||||
// yearOptions.value.push({ id: currentYear, name: currentYear + 543 });
|
||||
// yearOptionsFilter.value = [{ id: currentYear, name: currentYear + 543 }];
|
||||
// yearOptionsFilter.value.push({ id: currentYear, name: currentYear + 543 });
|
||||
fetchRetirement(type.value, currentYear);
|
||||
};
|
||||
// ประกาศเกษียณอายุราชการ
|
||||
|
|
@ -98,7 +96,7 @@ const fetchRetirement = async (type: string, year: any) => {
|
|||
rows.value = data.map((items: any) => ({
|
||||
id: items.id,
|
||||
Date: date2Thai(items.createdAt),
|
||||
year: items.year,
|
||||
year: items.year + 543,
|
||||
retireNumber: items.round,
|
||||
total: items.total,
|
||||
round: items.round,
|
||||
|
|
@ -106,6 +104,19 @@ const fetchRetirement = async (type: string, year: any) => {
|
|||
json: items.json,
|
||||
document: items.document,
|
||||
}));
|
||||
let option: any[] = [];
|
||||
data.map((items: any) => {
|
||||
option.push({
|
||||
id: items.year,
|
||||
year: (items.year + 543).toString(),
|
||||
typeReport: typeReportChangeName(items.typeReport), // เปลี่ยนสถานะ
|
||||
});
|
||||
});
|
||||
yearOptions.value = [{ id: 0, year: "ทั้งหมด" }];
|
||||
yearOptions.value.push(...option);
|
||||
|
||||
yearOptionsFilter.value = yearOptions.value;
|
||||
|
||||
actionOption.value = rows.value;
|
||||
rows.value.sort((a, b) => a.round - b.round); // เรียงรอบมากไปน้อย
|
||||
checkststus(rows.value);
|
||||
|
|
@ -144,10 +155,10 @@ const pagination = ref({
|
|||
rowsPerPage: 10,
|
||||
});
|
||||
|
||||
const filterSelector = (val: any, update: Function, year: any) => {
|
||||
const filterSelector = (val: any, update: Function) => {
|
||||
update(() => {
|
||||
yearOptions.value = yearOptionsFilter.value.filter(
|
||||
(v: any) => v.name.valueOf(val.toLowerCase()) > -1
|
||||
(v: any) => v.year.indexOf(val) > -1
|
||||
);
|
||||
});
|
||||
};
|
||||
|
|
@ -219,8 +230,9 @@ const typeReportChangeName = (val: string) => {
|
|||
map-options
|
||||
:options="yearOptions"
|
||||
option-value="id"
|
||||
option-label="name"
|
||||
option-label="year"
|
||||
lazy-rules
|
||||
use-input
|
||||
hide-bottom-space
|
||||
:readonly="false"
|
||||
:borderless="false"
|
||||
|
|
@ -228,7 +240,7 @@ const typeReportChangeName = (val: string) => {
|
|||
:hide-dropdown-icon="false"
|
||||
style="min-width: 150px"
|
||||
@filter="(inputValue:any,
|
||||
doneFn:Function) => filterSelector(inputValue, doneFn,'yearOptions'
|
||||
doneFn:Function) => filterSelector(inputValue, doneFn
|
||||
) "
|
||||
/>
|
||||
<!-- use-input -->
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue