Hotfix: fixed filter when searching by id #1063

Merged
jon merged 6 commits from Hotfix-TicketFilter into master 2024-12-11 13:35:56 +00:00
2 changed files with 16 additions and 15 deletions

View File

@ -51,10 +51,6 @@ const props = defineProps({
type: Object,
default: null,
},
staticParams: {
type: Array,
default: () => [],
},
exprBuilder: {
type: Function,
default: null,
@ -102,20 +98,25 @@ onMounted(() => {
async function search() {
const staticParams = Object.entries(store.userParams);
arrayData.reset(['skip', 'page']);
const filter = {
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) {
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;
}
}
await arrayData.applyFilter(filter);
}

View File

@ -1,6 +1,6 @@
<script setup>
import axios from 'axios';
import { computed, ref, onMounted } from 'vue';
import { computed, ref, onBeforeMount } from 'vue';
import { useRoute, useRouter } from 'vue-router';
import { useStateStore } from 'stores/useStateStore';
import { useI18n } from 'vue-i18n';
@ -46,7 +46,7 @@ const userParams = {
from: null,
to: null,
};
onMounted(() => {
onBeforeMount(() => {
initializeFromQuery();
stateStore.rightDrawer = true;
if (!route.query.createForm) return;