From cd2c03d461cfa64d078252b816ebbf682a75ba25 Mon Sep 17 00:00:00 2001 From: AnandaTon Date: Wed, 6 Dec 2023 12:07:56 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B9=81=E0=B8=81=E0=B9=89=E0=B9=84=E0=B8=82?= =?UTF-8?q?=E0=B8=84=E0=B8=A7=E0=B8=B2=E0=B8=A1=E0=B8=96=E0=B8=B9=E0=B8=81?= =?UTF-8?q?=E0=B8=95=E0=B9=89=E0=B8=AD=E0=B8=87=E0=B8=A3=E0=B8=B2=E0=B8=A2?= =?UTF-8?q?=E0=B8=81=E0=B8=B2=E0=B8=A3=E0=B8=A5=E0=B8=87=E0=B9=80=E0=B8=A7?= =?UTF-8?q?=E0=B8=A5=E0=B8=B2=E0=B8=9E=E0=B8=B4=E0=B9=80=E0=B8=A8=E0=B8=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../09_leave/stores/SpecialTimeStore.ts | 2 ++ .../09_leave/views/SpecialTimeMain.vue | 21 ++++++++++++------- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/src/modules/09_leave/stores/SpecialTimeStore.ts b/src/modules/09_leave/stores/SpecialTimeStore.ts index 281eca92b..e23509aaa 100644 --- a/src/modules/09_leave/stores/SpecialTimeStore.ts +++ b/src/modules/09_leave/stores/SpecialTimeStore.ts @@ -104,6 +104,7 @@ export const useSpecialTimeStore = defineStore("LeaveSpecialTime", () => { }) .finally(() => { hideLoader(); + console.log(month.value); }); }; @@ -118,6 +119,7 @@ export const useSpecialTimeStore = defineStore("LeaveSpecialTime", () => { console.log(pageSize.value); fetchData(); + console.log("page"); } //--------------|ฟิลเตอร์|--------------------------------------// diff --git a/src/modules/09_leave/views/SpecialTimeMain.vue b/src/modules/09_leave/views/SpecialTimeMain.vue index 3868106c5..bfb17f3fe 100644 --- a/src/modules/09_leave/views/SpecialTimeMain.vue +++ b/src/modules/09_leave/views/SpecialTimeMain.vue @@ -140,12 +140,6 @@ function filterFn() { dataSpecialTime.fetchData(); } -/**Hook */ -onMounted(async () => { - console.log("test"); - await dataSpecialTime.fetchData(); -}); - /** Function Date */ const dateMonth = ref({ month: new Date().getMonth(), @@ -159,10 +153,22 @@ const updateMonth = async (e: DataDateMonthObject) => { dataSpecialTime.month = dateMonth.value.month + 1; dataSpecialTime.year = dateMonth.value.year; // filterKeyword.value = ""; + await dataSpecialTime.fetchData(); + console.log(dateMonth); } - await dataSpecialTime.fetchData(); }; +/**Hook */ +onMounted(async () => { + //อัพเดทเป็นวันปัจจุบันเมื่อเข้าหน้านี้ + const toDay = ref(new Date()); + const monthToday = toDay.value.getMonth(); + const yearToday = toDay.value.getFullYear(); + dataSpecialTime.month = monthToday + 1; + dataSpecialTime.year = yearToday; + await dataSpecialTime.fetchData(); +}); + //แปลงเดือนเป็นไทย const monthYearThai = (val: any) => { if (val == null) return ""; @@ -255,7 +261,6 @@ const monthYearThai = (val: any) => {