From efeb1b51eb4f9d762ea760e73902c5c8be36cd58 Mon Sep 17 00:00:00 2001 From: puriphatt Date: Thu, 17 Apr 2025 16:23:52 +0700 Subject: [PATCH] feat: integrate date range selection in property management and workflow lists --- src/pages/04_flow-managment/MainPage.vue | 8 +-- src/pages/04_property-managment/MainPage.vue | 70 +++++++++++++------- src/stores/property/index.ts | 2 + 3 files changed, 53 insertions(+), 27 deletions(-) diff --git a/src/pages/04_flow-managment/MainPage.vue b/src/pages/04_flow-managment/MainPage.vue index ba335b77..1285a99c 100644 --- a/src/pages/04_flow-managment/MainPage.vue +++ b/src/pages/04_flow-managment/MainPage.vue @@ -283,8 +283,8 @@ async function fetchWorkflowList(mobileFetch?: boolean) { : statusFilter.value === 'statusACTIVE' ? 'ACTIVE' : 'INACTIVE', - startDate: pageState.searchDate[0] || undefined, - endDate: pageState.searchDate[1] || undefined, + startDate: pageState.searchDate[0], + endDate: pageState.searchDate[1], }); if (res) { workflowData.value = @@ -533,12 +533,12 @@ watch( class="col surface-2 flex items-center justify-center" > ({ type: {}, }); const statusFilter = ref<'all' | 'statusACTIVE' | 'statusINACTIVE'>('all'); -const refFilter = ref>(); const fieldSelected = ref<('order' | 'name' | 'type')[]>([ 'order', 'name', @@ -118,6 +118,7 @@ const pageState = reactive({ addModal: false, viewDrawer: false, isDrawerEdit: true, + searchDate: [], }); async function fetchPropertyList(mobileFetch?: boolean) { @@ -134,6 +135,8 @@ async function fetchPropertyList(mobileFetch?: boolean) { : statusFilter.value === 'statusACTIVE' ? 'ACTIVE' : 'INACTIVE', + startDate: pageState.searchDate[0], + endDate: pageState.searchDate[1], }); if (res) { propertyData.value = @@ -317,11 +320,14 @@ watch( fetchPropertyList(); }, ); -watch([() => pageState.inputSearch, propertyPageSize], () => { - propertyData.value = []; - propertyPage.value = 1; - fetchPropertyList(); -}); +watch( + [() => pageState.inputSearch, propertyPageSize, () => pageState.searchDate], + () => { + propertyData.value = []; + propertyPage.value = 1; + fetchPropertyList(); + }, +);