diff --git a/src/modules/05_placement/components/Main.vue b/src/modules/05_placement/components/Main.vue index 27332bb0d..af79afc85 100644 --- a/src/modules/05_placement/components/Main.vue +++ b/src/modules/05_placement/components/Main.vue @@ -168,6 +168,7 @@ const fetchYearOptions = async () => { }, ""); searchYear.value = maxNumber; DataStore.DataMainYearSet(searchYear.value); + yearOptionsFn.value = yearOptions; searchYear.value && fetchPlacementData(searchYear.value); }) .catch((e) => { @@ -175,7 +176,9 @@ const fetchYearOptions = async () => { }); }; const filterYear = () => { - fetchPlacementData(searchYear.value); + if (searchYear.value !== null) { + fetchPlacementData(searchYear.value); + } }; // ดูรายการสอบแข่งขัน หน้าต่อไป @@ -283,7 +286,6 @@ function filterFnexamTime(val: string, update: any) { if (val === "") { update(() => { examTimeOP2.value = examTimeOP; - examTime.value = ""; }); } else { update(() => { @@ -298,7 +300,6 @@ function filterFnExamtype(val: string, update: any) { if (val === "") { update(() => { examTypeOP2.value = examTypeOP.value; - examType.value = ""; }); } else { update(() => { @@ -308,6 +309,20 @@ function filterFnExamtype(val: string, update: any) { }); } } +const yearOptionsFn = ref([]); +function filterFnYear(val: string, update: any) { + if (val === "") { + update(() => { + yearOptionsFn.value = yearOptions; + }); + } else { + update(() => { + yearOptionsFn.value = yearOptions.filter( + (e: any) => e.name.toString().search(val) !== -1 + ); + }); + } +}