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, type: Object,
default: null, default: null,
}, },
staticParams: {
type: Array,
default: () => [],
},
exprBuilder: { exprBuilder: {
type: Function, type: Function,
default: null, default: null,
@ -102,20 +98,25 @@ onMounted(() => {
async function search() { async function search() {
const staticParams = Object.entries(store.userParams); const staticParams = Object.entries(store.userParams);
arrayData.reset(['skip', 'page']); arrayData.reset(['skip', 'page']);
let filter = {
const filter = {
params: { params: {
...Object.fromEntries(staticParams),
search: searchText.value, search: searchText.value,
}, },
...{ filter: props.filter },
}; };
if (!searchText.value) {
Outdated
Review

if (!searchText.value)

if (!searchText.value)
if (props.whereFilter) { filter = {
filter.filter = { params: {
where: props.whereFilter(searchText.value), ...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); await arrayData.applyFilter(filter);
} }

View File

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