fix: fixed filter when searching by id
gitea/salix-front/pipeline/pr-master There was a failure building this commit Details

This commit is contained in:
Jon Elias 2024-12-10 14:06:34 +01:00
parent 0198a25972
commit a6f970cec8
3 changed files with 22 additions and 5 deletions

View File

@ -51,10 +51,6 @@ const props = defineProps({
type: Object,
default: null,
},
staticParams: {
type: Array,
default: () => [],
},
exprBuilder: {
type: Function,
default: null,
@ -67,6 +63,10 @@ const props = defineProps({
type: Function,
default: undefined,
},
beforeSearch: {
type: Function,
default: undefined,
},
});
const searchText = ref();
@ -103,7 +103,7 @@ async function search() {
const staticParams = Object.entries(store.userParams);
arrayData.reset(['skip', 'page']);
const filter = {
let filter = {
params: {
...Object.fromEntries(staticParams),
search: searchText.value,
@ -117,6 +117,7 @@ async function search() {
};
delete filter.params.search;
}
if (props.beforeSearch) filter = props.beforeSearch(filter);
await arrayData.applyFilter(filter);
}
</script>

View File

@ -18,6 +18,13 @@ 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;
},
}"
/>
</template>

View File

@ -455,6 +455,15 @@ function setReference(data) {
data-key="TicketList"
:label="t('Search ticket')"
:info="t('You can search by ticket id or alias')"
:before-search="
(filter) => {
if (filter.params.search) {
delete filter.params.from;
delete filter.params.to;
}
return filter;
}
"
/>
<RightMenu>
<template #right-panel>