diff --git a/src/modules/09_leave/components/03_ChangeRound/DialogForm.vue b/src/modules/09_leave/components/03_ChangeRound/DialogForm.vue index dd8665142..6423d2914 100644 --- a/src/modules/09_leave/components/03_ChangeRound/DialogForm.vue +++ b/src/modules/09_leave/components/03_ChangeRound/DialogForm.vue @@ -75,7 +75,6 @@ const initialPagination = ref({ // Pagination - page & change page & get new data const currentPage = ref(1); -const roundOp = ref([]); async function updatePagination(newPagination: any) { initialPagination.value = newPagination; // currentPage.value = 1; // set current page เป็น 1 เสมอเมื่อเปลี่ยน per row @@ -153,9 +152,10 @@ async function fetchDataOption() { }); }); - roundOp.value = option.filter( + const filterData = option.filter( (e) => e.name !== props.DataRow?.currentRound ); + dataStore.roundOp = filterData; }) .catch((err) => { messageError($q, err); @@ -202,7 +202,7 @@ watch( formData.reson = ""; formData.effectiveDate = null; } - if (props.modal === true) { + if (props.modal === true && dataStore.roundOp.length == 0) { currentPage.value = 1; await fetchDataOption(); } @@ -266,7 +266,7 @@ watch( emit-value map-options option-label="name" - :options="roundOp" + :options="dataStore.roundOp" option-value="id" lazy-rules hide-bottom-space diff --git a/src/modules/09_leave/stores/ChangeRoundStore.ts b/src/modules/09_leave/stores/ChangeRoundStore.ts index e24af76ac..80ed97d3c 100644 --- a/src/modules/09_leave/stores/ChangeRoundStore.ts +++ b/src/modules/09_leave/stores/ChangeRoundStore.ts @@ -21,6 +21,7 @@ const profileId = ref(""); export const useChangeRoundDataStore = defineStore( "changeRoundDataStore", () => { + const roundOp = ref([]); //ค้นหา คอลัมน์ คอลัมน์ที่แสดง const visibleColumns = ref([ "cardId", @@ -234,6 +235,7 @@ export const useChangeRoundDataStore = defineStore( totalListMain, maxPageMain, + roundOp }; } );