From c72fa5285160830153b9708212fa6357222a21f2 Mon Sep 17 00:00:00 2001 From: jorgep Date: Fri, 22 Nov 2024 13:03:23 +0100 Subject: [PATCH 01/15] fix: refs #8207 auto-refresh --- src/components/ui/VnPaginate.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/ui/VnPaginate.vue b/src/components/ui/VnPaginate.vue index b058dc642..aae18c503 100644 --- a/src/components/ui/VnPaginate.vue +++ b/src/components/ui/VnPaginate.vue @@ -132,7 +132,7 @@ const addFilter = async (filter, params) => { async function fetch(params) { useArrayData(props.dataKey, params); - arrayData.reset(['filter.skip', 'skip']); + arrayData.reset(['filter.skip', 'skip', 'page']); await arrayData.fetch({ append: false }); if (!store.hasMoreData) isLoading.value = false; From 50fbf64cf99af26fe9071519fc03c6020c9ad61c Mon Sep 17 00:00:00 2001 From: jorgep Date: Fri, 22 Nov 2024 13:33:35 +0100 Subject: [PATCH 02/15] fix: refs #8207 update btn wip --- src/composables/useArrayData.js | 6 +++++- src/pages/Monitor/Ticket/MonitorTickets.vue | 10 +++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/composables/useArrayData.js b/src/composables/useArrayData.js index b37fa1377..d8ee39355 100644 --- a/src/composables/useArrayData.js +++ b/src/composables/useArrayData.js @@ -64,7 +64,7 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) { } } - async function fetch({ append = false, updateRouter = true }) { + async function fetch({ append = false, updateRouter = true, totalRows = null }) { if (!store.url) return; cancelRequest(); @@ -107,6 +107,10 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) { if (params.filter.where || exprFilter) params.filter.where = { ...params.filter.where, ...exprFilter }; + if (totalRows) { + params.filter.limit = totalRows; + params.filter.skip = 0; + } params.filter = JSON.stringify(params.filter); store.isLoading = true; diff --git a/src/pages/Monitor/Ticket/MonitorTickets.vue b/src/pages/Monitor/Ticket/MonitorTickets.vue index d24230c64..6bae770d8 100644 --- a/src/pages/Monitor/Ticket/MonitorTickets.vue +++ b/src/pages/Monitor/Ticket/MonitorTickets.vue @@ -15,6 +15,7 @@ import { toCurrency, dateRange, dashIfEmpty } from 'src/filters'; import RightMenu from 'src/components/common/RightMenu.vue'; import MonitorTicketSearchbar from './MonitorTicketSearchbar.vue'; import MonitorTicketFilter from './MonitorTicketFilter.vue'; +import { useArrayData } from 'src/composables/useArrayData'; const DEFAULT_AUTO_REFRESH = 2 * 60 * 1000; // 2min in ms const { t } = useI18n(); @@ -30,6 +31,7 @@ from.setHours(0, 0, 0, 0); const to = new Date(from.getTime()); to.setDate(to.getDate() + 1); to.setHours(23, 59, 59, 999); +const arrayData = useArrayData('saleMonitorTickets'); function exprBuilder(param, value) { switch (param) { @@ -352,7 +354,13 @@ const openTab = (id) => class="q-mr-sm" dense flat - @click="$refs.tableRef.reload()" + @click=" + () => { + const { limit, skip } = arrayData.store; + const nlimit = limit + skip; + arrayData.fetch({ totalRows: nlimit }); + } + " > {{ $t('globals.refresh') }} From 7048f96565e8f607f6a60fa38cf5ab34d8f41dd7 Mon Sep 17 00:00:00 2001 From: jorgep Date: Fri, 22 Nov 2024 13:55:22 +0100 Subject: [PATCH 03/15] refactor: refs #8207 imrove logic --- src/components/ui/VnPaginate.vue | 6 +++--- src/composables/useArrayData.js | 11 ++++++++--- src/pages/Monitor/Ticket/MonitorTickets.vue | 8 +------- 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/src/components/ui/VnPaginate.vue b/src/components/ui/VnPaginate.vue index aae18c503..fd8b82395 100644 --- a/src/components/ui/VnPaginate.vue +++ b/src/components/ui/VnPaginate.vue @@ -130,10 +130,10 @@ const addFilter = async (filter, params) => { await arrayData.addFilter({ filter, params }); }; -async function fetch(params) { +async function fetch(params, keepRowsNumber = false) { useArrayData(props.dataKey, params); - arrayData.reset(['filter.skip', 'skip', 'page']); - await arrayData.fetch({ append: false }); + if (!keepRowsNumber) arrayData.reset(['filter.skip', 'skip', 'page']); + await arrayData.fetch({ append: false, keepRowsNumber }); if (!store.hasMoreData) isLoading.value = false; emit('onFetch', store.data); diff --git a/src/composables/useArrayData.js b/src/composables/useArrayData.js index d8ee39355..0588310e7 100644 --- a/src/composables/useArrayData.js +++ b/src/composables/useArrayData.js @@ -64,7 +64,11 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) { } } - async function fetch({ append = false, updateRouter = true, totalRows = null }) { + async function fetch({ + append = false, + updateRouter = true, + keepRowsNumber = false, + }) { if (!store.url) return; cancelRequest(); @@ -107,8 +111,9 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) { if (params.filter.where || exprFilter) params.filter.where = { ...params.filter.where, ...exprFilter }; - if (totalRows) { - params.filter.limit = totalRows; + if (keepRowsNumber) { + const { limit, skip } = store; + params.filter.limit = limit + skip; params.filter.skip = 0; } params.filter = JSON.stringify(params.filter); diff --git a/src/pages/Monitor/Ticket/MonitorTickets.vue b/src/pages/Monitor/Ticket/MonitorTickets.vue index 6bae770d8..380cdf8e1 100644 --- a/src/pages/Monitor/Ticket/MonitorTickets.vue +++ b/src/pages/Monitor/Ticket/MonitorTickets.vue @@ -354,13 +354,7 @@ const openTab = (id) => class="q-mr-sm" dense flat - @click=" - () => { - const { limit, skip } = arrayData.store; - const nlimit = limit + skip; - arrayData.fetch({ totalRows: nlimit }); - } - " + @click="tableRef.CrudModelRef.vnPaginateRef.fetch(undefined, true)" > {{ $t('globals.refresh') }} From 0eeb22d40a3b835663a90ac84b73cbf982faea77 Mon Sep 17 00:00:00 2001 From: jorgep Date: Fri, 22 Nov 2024 13:56:30 +0100 Subject: [PATCH 04/15] chore: refs #8207 drop useless code --- src/pages/Monitor/Ticket/MonitorTickets.vue | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/pages/Monitor/Ticket/MonitorTickets.vue b/src/pages/Monitor/Ticket/MonitorTickets.vue index 380cdf8e1..90f08b3f6 100644 --- a/src/pages/Monitor/Ticket/MonitorTickets.vue +++ b/src/pages/Monitor/Ticket/MonitorTickets.vue @@ -15,7 +15,6 @@ import { toCurrency, dateRange, dashIfEmpty } from 'src/filters'; import RightMenu from 'src/components/common/RightMenu.vue'; import MonitorTicketSearchbar from './MonitorTicketSearchbar.vue'; import MonitorTicketFilter from './MonitorTicketFilter.vue'; -import { useArrayData } from 'src/composables/useArrayData'; const DEFAULT_AUTO_REFRESH = 2 * 60 * 1000; // 2min in ms const { t } = useI18n(); @@ -31,7 +30,6 @@ from.setHours(0, 0, 0, 0); const to = new Date(from.getTime()); to.setDate(to.getDate() + 1); to.setHours(23, 59, 59, 999); -const arrayData = useArrayData('saleMonitorTickets'); function exprBuilder(param, value) { switch (param) { From 661cc0b5eedea43e4ca5dc8a3a83e332ef246ee4 Mon Sep 17 00:00:00 2001 From: jorgep Date: Fri, 22 Nov 2024 15:37:48 +0100 Subject: [PATCH 05/15] refactor: refs #8207 improve logic --- src/components/ui/VnPaginate.vue | 13 +++++++++++-- src/composables/useArrayData.js | 11 +---------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/components/ui/VnPaginate.vue b/src/components/ui/VnPaginate.vue index fd8b82395..66d5c11a5 100644 --- a/src/components/ui/VnPaginate.vue +++ b/src/components/ui/VnPaginate.vue @@ -132,8 +132,17 @@ const addFilter = async (filter, params) => { async function fetch(params, keepRowsNumber = false) { useArrayData(props.dataKey, params); - if (!keepRowsNumber) arrayData.reset(['filter.skip', 'skip', 'page']); - await arrayData.fetch({ append: false, keepRowsNumber }); + const { limit, skip } = arrayData.store; + + if (keepRowsNumber) { + arrayData.store.limit = limit + skip; + arrayData.store.skip = 0; + } + await arrayData.fetch({ append: false }); + if (keepRowsNumber) { + arrayData.store.limit = limit; + arrayData.store.skip = skip; + } if (!store.hasMoreData) isLoading.value = false; emit('onFetch', store.data); diff --git a/src/composables/useArrayData.js b/src/composables/useArrayData.js index 0588310e7..b37fa1377 100644 --- a/src/composables/useArrayData.js +++ b/src/composables/useArrayData.js @@ -64,11 +64,7 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) { } } - async function fetch({ - append = false, - updateRouter = true, - keepRowsNumber = false, - }) { + async function fetch({ append = false, updateRouter = true }) { if (!store.url) return; cancelRequest(); @@ -111,11 +107,6 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) { if (params.filter.where || exprFilter) params.filter.where = { ...params.filter.where, ...exprFilter }; - if (keepRowsNumber) { - const { limit, skip } = store; - params.filter.limit = limit + skip; - params.filter.skip = 0; - } params.filter = JSON.stringify(params.filter); store.isLoading = true; From 9d8698fa2fd7b37019d0484be4414c904c3c98fe Mon Sep 17 00:00:00 2001 From: jorgep Date: Fri, 22 Nov 2024 15:49:07 +0100 Subject: [PATCH 06/15] refactor: refs #8207 improve logic --- src/components/ui/VnPaginate.vue | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/components/ui/VnPaginate.vue b/src/components/ui/VnPaginate.vue index 66d5c11a5..6d25dc105 100644 --- a/src/components/ui/VnPaginate.vue +++ b/src/components/ui/VnPaginate.vue @@ -130,19 +130,19 @@ const addFilter = async (filter, params) => { await arrayData.addFilter({ filter, params }); }; -async function fetch(params, keepRowsNumber = false) { +async function fetch(params, keepPagination = false) { useArrayData(props.dataKey, params); const { limit, skip } = arrayData.store; - if (keepRowsNumber) { + if (!keepPagination) await arrayData.fetch({ append: false }); + else { arrayData.store.limit = limit + skip; arrayData.store.skip = 0; - } - await arrayData.fetch({ append: false }); - if (keepRowsNumber) { + await arrayData.fetch({ append: false }); arrayData.store.limit = limit; arrayData.store.skip = skip; } + if (!store.hasMoreData) isLoading.value = false; emit('onFetch', store.data); From 3a4c0e729af2556f2060a07edf35b253afa203da Mon Sep 17 00:00:00 2001 From: jorgep Date: Fri, 22 Nov 2024 15:52:22 +0100 Subject: [PATCH 07/15] refactor: refs #8207 improve logic --- src/components/ui/VnPaginate.vue | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/components/ui/VnPaginate.vue b/src/components/ui/VnPaginate.vue index 6d25dc105..ae9259315 100644 --- a/src/components/ui/VnPaginate.vue +++ b/src/components/ui/VnPaginate.vue @@ -136,11 +136,11 @@ async function fetch(params, keepPagination = false) { if (!keepPagination) await arrayData.fetch({ append: false }); else { - arrayData.store.limit = limit + skip; - arrayData.store.skip = 0; + store.limit = limit + skip; + store.skip = 0; await arrayData.fetch({ append: false }); - arrayData.store.limit = limit; - arrayData.store.skip = skip; + store.limit = limit; + store.skip = skip; } if (!store.hasMoreData) isLoading.value = false; From 8b52629b0b4a4d20f79eadfe98b882b2e0c93f85 Mon Sep 17 00:00:00 2001 From: jorgep Date: Fri, 22 Nov 2024 15:55:30 +0100 Subject: [PATCH 08/15] refactor: refs #8207 improve logic --- src/components/ui/VnPaginate.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/ui/VnPaginate.vue b/src/components/ui/VnPaginate.vue index ae9259315..cc15ddb28 100644 --- a/src/components/ui/VnPaginate.vue +++ b/src/components/ui/VnPaginate.vue @@ -132,10 +132,10 @@ const addFilter = async (filter, params) => { async function fetch(params, keepPagination = false) { useArrayData(props.dataKey, params); - const { limit, skip } = arrayData.store; if (!keepPagination) await arrayData.fetch({ append: false }); else { + const { limit, skip } = store; store.limit = limit + skip; store.skip = 0; await arrayData.fetch({ append: false }); From e10e0d01e6abc400fd693f5119ad10c2d5fe44e7 Mon Sep 17 00:00:00 2001 From: alexm Date: Sun, 24 Nov 2024 11:53:40 +0100 Subject: [PATCH 09/15] fix: zoneEventExclusion form dated --- src/pages/Zone/Card/ZoneEventExclusionForm.vue | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/pages/Zone/Card/ZoneEventExclusionForm.vue b/src/pages/Zone/Card/ZoneEventExclusionForm.vue index d131519c4..1027fc54f 100644 --- a/src/pages/Zone/Card/ZoneEventExclusionForm.vue +++ b/src/pages/Zone/Card/ZoneEventExclusionForm.vue @@ -43,7 +43,7 @@ const { t } = useI18n(); const { openConfirmationModal } = useVnConfirm(); const isNew = computed(() => props.isNewMode); -const dated = ref(null); +const dated = ref(props.date); const tickedNodes = ref(); const _excludeType = ref('all'); @@ -118,11 +118,7 @@ onMounted(() => { >