From 2ee4f0e65ce48a88b92f512db52d4392f962d391 Mon Sep 17 00:00:00 2001 From: Jon Date: Wed, 18 Dec 2024 08:19:07 +0100 Subject: [PATCH 1/6] fix: remove params when searching by id on VnSearchbar --- src/components/ui/VnSearchbar.vue | 14 ++++++++++++-- src/pages/Order/Card/OrderCatalog.vue | 3 ++- src/pages/Zone/Card/ZoneLocationsTree.vue | 8 +++++++- 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/src/components/ui/VnSearchbar.vue b/src/components/ui/VnSearchbar.vue index 4e90245d6..92babfcc6 100644 --- a/src/components/ui/VnSearchbar.vue +++ b/src/components/ui/VnSearchbar.vue @@ -63,6 +63,10 @@ const props = defineProps({ type: Function, default: undefined, }, + searchRemoveParams: { + type: Boolean, + default: true, + }, }); const searchText = ref(); @@ -101,12 +105,18 @@ async function search() { const filter = { params: { - ...Object.fromEntries(staticParams), search: searchText.value, }, - ...{ filter: props.filter }, + filter: props.filter, }; + if (!props.searchRemoveParams || !searchText.value) { + filter.params = { + ...Object.fromEntries(staticParams), + search: searchText.value, + }; + } + if (props.whereFilter) { filter.filter = { where: props.whereFilter(searchText.value), diff --git a/src/pages/Order/Card/OrderCatalog.vue b/src/pages/Order/Card/OrderCatalog.vue index 26133a7eb..2ede429a0 100644 --- a/src/pages/Order/Card/OrderCatalog.vue +++ b/src/pages/Order/Card/OrderCatalog.vue @@ -1,7 +1,7 @@