From 07c67b0df2d2a4edaa27bf5004b64ada27c2ac45 Mon Sep 17 00:00:00 2001 From: jorgep Date: Wed, 8 May 2024 12:30:44 +0200 Subject: [PATCH] feat: refs #6891 keep arrayData opts --- src/components/ui/VnPaginate.vue | 5 +++++ src/composables/useArrayData.js | 5 ++++- src/pages/Item/ItemList.vue | 1 + src/pages/Order/OrderList.vue | 1 + 4 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/components/ui/VnPaginate.vue b/src/components/ui/VnPaginate.vue index c00849512..190393d2f 100644 --- a/src/components/ui/VnPaginate.vue +++ b/src/components/ui/VnPaginate.vue @@ -42,6 +42,10 @@ const props = defineProps({ type: Object, default: null, }, + keepOpts: { + type: Array, + default: () => [], + }, offset: { type: Number, default: 0, @@ -76,6 +80,7 @@ const arrayData = useArrayData(props.dataKey, { order: props.order, userParams: props.userParams, exprBuilder: props.exprBuilder, + keepOpts: props.keepOpts, }); const store = arrayData.store; diff --git a/src/composables/useArrayData.js b/src/composables/useArrayData.js index 525cf6e6b..326ddff5d 100644 --- a/src/composables/useArrayData.js +++ b/src/composables/useArrayData.js @@ -47,7 +47,10 @@ export function useArrayData(key, userOptions) { if (isEmpty || !allowedOptions.includes(option)) continue; if (Object.prototype.hasOwnProperty.call(store, option)) { - store[option] = userOptions[option]; + const defaultOpts = userOptions[option]; + store[option] = userOptions.keepOpts?.includes(option) + ? Object.assign(defaultOpts, store[option]) + : defaultOpts; } } } diff --git a/src/pages/Item/ItemList.vue b/src/pages/Item/ItemList.vue index 39e190147..27acf3fdd 100644 --- a/src/pages/Item/ItemList.vue +++ b/src/pages/Item/ItemList.vue @@ -457,6 +457,7 @@ onUnmounted(() => (stateStore.rightDrawer = false)); :limit="12" :expr-builder="exprBuilder" :user-params="params" + :keep-opts="['userParams']" :offset="50" auto-load > diff --git a/src/pages/Order/OrderList.vue b/src/pages/Order/OrderList.vue index 203eaccd1..6d36d8b31 100644 --- a/src/pages/Order/OrderList.vue +++ b/src/pages/Order/OrderList.vue @@ -61,6 +61,7 @@ function navigate(id) { :limit="20" :order="['landed DESC', 'clientFk', 'id DESC']" :user-params="{ showEmpty: false }" + :keep-opts="['userParams']" auto-load >