diff --git a/src/components/ui/VnSearchbar.vue b/src/components/ui/VnSearchbar.vue index 2b6b59a6e..c3a3c0a03 100644 --- a/src/components/ui/VnSearchbar.vue +++ b/src/components/ui/VnSearchbar.vue @@ -63,10 +63,6 @@ const props = defineProps({ type: Function, default: undefined, }, - beforeSearch: { - type: Function, - default: undefined, - }, }); const searchText = ref(); @@ -102,22 +98,26 @@ onMounted(() => { async function search() { const staticParams = Object.entries(store.userParams); arrayData.reset(['skip', 'page']); - let filter = { params: { - ...Object.fromEntries(staticParams), search: searchText.value, }, - ...{ filter: props.filter }, }; - - if (props.whereFilter) { - filter.filter = { - where: props.whereFilter(searchText.value), + if (!(searchText.value && searchText.value !== '')) { + filter = { + params: { + ...Object.fromEntries(staticParams), + }, + ...{ filter: props.filter }, }; - delete filter.params.search; + + if (props.whereFilter) { + filter.filter = { + where: props.whereFilter(searchText.value), + }; + delete filter.params.search; + } } - if (props.beforeSearch) filter = props.beforeSearch(filter); await arrayData.applyFilter(filter); } diff --git a/src/pages/Ticket/Card/TicketCard.vue b/src/pages/Ticket/Card/TicketCard.vue index 8832cb8b0..73b6f5543 100644 --- a/src/pages/Ticket/Card/TicketCard.vue +++ b/src/pages/Ticket/Card/TicketCard.vue @@ -18,13 +18,6 @@ const { t } = useI18n(); url: 'Tickets/filter', label: t('card.search'), info: t('card.searchInfo'), - beforeSearch: (filter) => { - if (filter.params.search) { - delete filter.params.from; - delete filter.params.to; - } - return filter; - }, }" /> diff --git a/src/pages/Ticket/TicketList.vue b/src/pages/Ticket/TicketList.vue index 9fbdea3aa..eb03a4927 100644 --- a/src/pages/Ticket/TicketList.vue +++ b/src/pages/Ticket/TicketList.vue @@ -1,6 +1,6 @@