From 5232df259548f8c9a69811f079c91d91326f1d72 Mon Sep 17 00:00:00 2001 From: alexm Date: Thu, 11 Jul 2024 15:03:39 +0200 Subject: [PATCH] feat: claimList better support vnTable, claimSummary redesign. BREAKING CHANGE: VnTable default-mode table --- src/components/VnTable/VnOrder.vue | 5 ++- src/components/VnTable/VnTable.vue | 12 ++++-- src/components/VnTable/VnVisibleColumn.vue | 8 ++++ src/composables/useArrayData.js | 10 ++--- src/pages/Claim/Card/ClaimSummary.vue | 23 +++++++---- src/pages/Claim/Card/ClaimSummaryAction.vue | 1 - src/pages/Claim/ClaimFilter.vue | 2 + src/pages/Claim/ClaimList.vue | 41 ++++++++++++++++++- src/pages/Customer/CustomerList.vue | 1 - src/pages/Entry/EntryLatestBuys.vue | 1 - src/pages/Entry/EntryList.vue | 1 - src/pages/InvoiceOut/InvoiceOutList.vue | 1 - .../InvoiceOut/InvoiceOutNegativeBases.vue | 1 - src/pages/Order/OrderLines.vue | 1 - src/pages/Order/OrderList.vue | 1 - src/pages/Route/Agency/AgencyList.vue | 3 +- src/pages/Route/Cmr/CmrList.vue | 1 + src/pages/Route/RouteList.vue | 1 - src/pages/Supplier/SupplierList.vue | 1 - src/pages/Travel/TravelList.vue | 1 - src/pages/Worker/Card/WorkerBalance.vue | 1 - src/pages/Worker/Card/WorkerFormation.vue | 1 - 22 files changed, 84 insertions(+), 34 deletions(-) diff --git a/src/components/VnTable/VnOrder.vue b/src/components/VnTable/VnOrder.vue index ac77c8ac6..63e5eecb4 100644 --- a/src/components/VnTable/VnOrder.vue +++ b/src/components/VnTable/VnOrder.vue @@ -5,7 +5,7 @@ const model = defineModel({ type: Object, required: true }); const $props = defineProps({ name: { type: String, - required: true, + default: '', }, label: { type: String, @@ -28,6 +28,7 @@ const hover = ref(); const arrayData = useArrayData($props.dataKey, { searchUrl: $props.searchUrl }); async function orderBy(name, direction) { + if (!name) return; switch (direction) { case 'DESC': direction = undefined; @@ -54,7 +55,7 @@ defineExpose({ orderBy }); > {{ label }} [], + }, }); const { notify } = useNotify(); @@ -30,8 +34,12 @@ function setUserConfigViewData(data, isLocal) { if (!data) return; // Importante: El name de las columnas de la tabla debe conincidir con el name de las variables que devuelve la view config if (!isLocal) localColumns.value = []; + // Array to Object + const skippeds = $props.skip.reduce((a, v) => ({ ...a, [v]: v }), {}); + for (let column of columns.value) { const { label, name } = column; + if (skippeds[name]) continue; column.visible = data[name] ?? true; if (!isLocal) localColumns.value.push({ name, label, visible: column.visible }); } diff --git a/src/composables/useArrayData.js b/src/composables/useArrayData.js index 1185db05a..3563e0dbd 100644 --- a/src/composables/useArrayData.js +++ b/src/composables/useArrayData.js @@ -149,7 +149,7 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) { store.filter = {}; if (params) store.userParams = { ...params }; - const response = await fetch({ append: false }); + const response = await fetch({}); return response; } @@ -162,7 +162,7 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) { store.userParams = userParams; arrayDataStore.reset(['skip', 'filter.skip', 'page']); - await fetch({ append: false }); + await fetch({}); return { filter, params }; } @@ -187,7 +187,7 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) { } store.order = order; - fetch({ append: false, updateRouter: true }); + fetch({}); index++; return { index, order }; @@ -201,7 +201,7 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) { if (index > -1) order.splice(index, 1); store.order = order; - fetch({ append: false, updateRouter: true }); + fetch({}); } function sanitizerParams(params, exprBuilder) { @@ -231,7 +231,7 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) { } async function refresh() { - if (Object.values(store.userParams).length) await fetch({ append: false }); + if (Object.values(store.userParams).length) await fetch({}); } function updateStateParams() { diff --git a/src/pages/Claim/Card/ClaimSummary.vue b/src/pages/Claim/Card/ClaimSummary.vue index 88ca48081..a34830631 100644 --- a/src/pages/Claim/Card/ClaimSummary.vue +++ b/src/pages/Claim/Card/ClaimSummary.vue @@ -211,7 +211,7 @@ async function changeState(value) { > - + -
+
Video - +
- + - + diff --git a/src/pages/Claim/Card/ClaimSummaryAction.vue b/src/pages/Claim/Card/ClaimSummaryAction.vue index b08504768..d875126cb 100644 --- a/src/pages/Claim/Card/ClaimSummaryAction.vue +++ b/src/pages/Claim/Card/ClaimSummaryAction.vue @@ -71,7 +71,6 @@ const columns = [