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 ช่อง"); }