From 034ed279e4260964879bd158704f884c47c5a764 Mon Sep 17 00:00:00 2001 From: "DESKTOP-1R2VSQH\\Lenovo ThinkPad E490" Date: Thu, 28 Sep 2023 16:27:03 +0700 Subject: [PATCH] =?UTF-8?q?filter=20=E0=B8=A3=E0=B8=B2=E0=B8=A2=E0=B8=81?= =?UTF-8?q?=E0=B8=B2=E0=B8=A3=E0=B8=AA=E0=B8=AD=E0=B8=9A=E0=B9=81=E0=B8=82?= =?UTF-8?q?=E0=B9=88=E0=B8=87=E0=B8=82=E0=B8=B1=E0=B8=99=20/=20=E0=B8=84?= =?UTF-8?q?=E0=B8=B1=E0=B8=94=E0=B9=80=E0=B8=A5=E0=B8=B7=E0=B8=AD=E0=B8=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/05_placement/components/Main.vue | 34 ++++++++++++++++---- 1 file changed, 27 insertions(+), 7 deletions(-) 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 + ); + }); + } +}