From 50298e9976ca1d35edc0524ccf5d1a2d792747e9 Mon Sep 17 00:00:00 2001 From: setthawutttty Date: Fri, 17 Nov 2023 11:06:24 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B9=81=E0=B8=81=E0=B9=89=20=E0=B9=80?= =?UTF-8?q?=E0=B8=9B=E0=B8=A5=E0=B8=B5=E0=B9=88=E0=B8=A2=E0=B8=99=E0=B9=81?= =?UTF-8?q?=E0=B8=9B=E0=B8=A5=E0=B8=87=E0=B8=A3=E0=B8=AD=E0=B8=9A=E0=B8=81?= =?UTF-8?q?=E0=B8=B2=E0=B8=A3=E0=B8=9B=E0=B8=8F=E0=B8=B4=E0=B8=9A=E0=B8=B1?= =?UTF-8?q?=E0=B8=95=E0=B8=B4=E0=B8=87=E0=B8=B2=E0=B8=99=E0=B8=82=E0=B8=AD?= =?UTF-8?q?=E0=B8=87=E0=B8=9C=E0=B8=B9=E0=B9=89=E0=B9=83=E0=B8=8A=E0=B9=89?= =?UTF-8?q?=E0=B8=87=E0=B8=B2=E0=B8=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../09_leave/stores/ChangeRoundStore.ts | 28 +++---------------- .../09_leave/views/ChangeRoundMain.vue | 23 ++++++++++++++- 2 files changed, 26 insertions(+), 25 deletions(-) diff --git a/src/modules/09_leave/stores/ChangeRoundStore.ts b/src/modules/09_leave/stores/ChangeRoundStore.ts index 78b433bf5..3a4b6eca4 100644 --- a/src/modules/09_leave/stores/ChangeRoundStore.ts +++ b/src/modules/09_leave/stores/ChangeRoundStore.ts @@ -103,26 +103,7 @@ export const useChangeRoundDataStore = defineStore( style: "font-size: 14px", }, ]); - const dataList = [ - { - cardId: '3514210651232', - prefix: "นางสาว", - firstName: "กัณฐิมา", - lastName: "กาฬสินธุ์", - roundStart: "07:00", - roundEnd: "11:00", - effectiveDate: new Date("2023-11-01T03:08:43.217"), - }, - { - cardId: '1231231231234', - prefix: "นายสาว", - firstName: "test", - lastName: "test", - roundStart: "07:00", - roundEnd: "16:00", - effectiveDate: new Date("2023-11-01T03:08:43.217"), - }, - ] + // ข้อมูลในตาราง const rows = ref([]); @@ -140,9 +121,9 @@ export const useChangeRoundDataStore = defineStore( rowsHistory.value = datalistHistory; } - function fetchDataForCardId(dataDetail: any, check: string) { + function fetchDataForCardId(dataDetail: any, data: any) { if (dataDetail) { - const filteredData = dataList.filter((e) => { + const filteredData = data.filter((e:any) => { return (!dataDetail.cardId || e.cardId === dataDetail.cardId) && (!dataDetail.firstName || e.firstName === dataDetail.firstName) && (!dataDetail.lastName || e.lastName === dataDetail.lastName); @@ -150,7 +131,7 @@ export const useChangeRoundDataStore = defineStore( if (filteredData.length > 0) { checkCilck.value = false; - rows.value = filteredData.map((e) => ({ + rows.value = filteredData.map((e:any) => ({ cardId: e.cardId, prefix: e.prefix, firstName: e.firstName, @@ -179,7 +160,6 @@ export const useChangeRoundDataStore = defineStore( rowsHistory, fetchDatainHistory, visibleColumnsHistory, - dataList, fetchDataForCardId, checkCilck }; diff --git a/src/modules/09_leave/views/ChangeRoundMain.vue b/src/modules/09_leave/views/ChangeRoundMain.vue index 223d57c5b..aeafcf589 100644 --- a/src/modules/09_leave/views/ChangeRoundMain.vue +++ b/src/modules/09_leave/views/ChangeRoundMain.vue @@ -47,8 +47,29 @@ function closeDialog() { /** Function ค้นหาข้อมูล */ function searchData() { + const data = [ + { + cardId: "3514210651232", + prefix: "นางสาว", + firstName: "กัณฐิมา", + lastName: "กาฬสินธุ์", + roundStart: "07:00", + roundEnd: "11:00", + effectiveDate: new Date("2023-11-01T03:08:43.217"), + }, + { + cardId: "1231231231234", + prefix: "นายสาว", + firstName: "test", + lastName: "test", + roundStart: "07:00", + roundEnd: "16:00", + effectiveDate: new Date("2023-11-01T03:08:43.217"), + }, + ]; + if (formData.cardId || formData.firstName || formData.lastName) { - dataStore.fetchDataForCardId(formData, "click"); + dataStore.fetchDataForCardId(formData, data); } else { dialogMessageNotify($q, "กรุณากรอกข้อมูลอย่างน้อย 1 ช่อง"); }