From d2efbb204ff5d3397c10cc4a54b4daefb05d3c66 Mon Sep 17 00:00:00 2001 From: jorgep Date: Fri, 22 Mar 2024 14:57:36 +0100 Subject: [PATCH] feat: refs #5186 use arrayData in summary --- src/components/ui/CardDescriptor.vue | 28 ++++++------- src/components/ui/CardSummary.vue | 42 ++++++++++--------- src/i18n/en/index.js | 7 ++-- src/i18n/es/index.js | 7 ++-- src/pages/InvoiceIn/Card/InvoiceInSummary.vue | 2 +- src/pages/Parking/Card/ParkingCard.vue | 3 +- src/pages/Parking/Card/ParkingDescriptor.vue | 12 +++++- src/pages/Parking/Card/ParkingSummary.vue | 9 ++-- src/pages/Parking/ParkingList.vue | 4 +- src/router/modules/parking.js | 1 + .../integration/parking/parkingList.spec.js | 2 +- 11 files changed, 61 insertions(+), 56 deletions(-) diff --git a/src/components/ui/CardDescriptor.vue b/src/components/ui/CardDescriptor.vue index 4a08daaf5..97aa91728 100644 --- a/src/components/ui/CardDescriptor.vue +++ b/src/components/ui/CardDescriptor.vue @@ -41,7 +41,12 @@ const state = useState(); const slots = useSlots(); const { t } = useI18n(); const { viewSummary } = useSummaryDialog(); -const { store } = useArrayData($props.dataKey); +const arrayData = useArrayData($props.dataKey || $props.module, { + url: $props.url, + filter: $props.filter, + skip: 0, +}); +const { store } = arrayData; const entity = computed(() => store.data); const isLoading = ref(false); @@ -49,24 +54,15 @@ defineExpose({ getData, }); onBeforeMount(async () => { - if ($props.url) { - await getData(); - watch( - () => $props.url, - async (newUrl, lastUrl) => { - if (newUrl == lastUrl) return; - await getData(); - } - ); - } + await getData(); + watch( + () => $props.url, + async () => await getData() + ); }); async function getData() { - const arrayData = useArrayData($props.dataKey, { - url: $props.url, - filter: $props.filter, - skip: 0, - }); + store.url = $props.url; isLoading.value = true; try { const { data } = await arrayData.fetch({ append: false, updateRouter: false }); diff --git a/src/components/ui/CardSummary.vue b/src/components/ui/CardSummary.vue index f5f61155c..cdf19d492 100644 --- a/src/components/ui/CardSummary.vue +++ b/src/components/ui/CardSummary.vue @@ -1,11 +1,10 @@