feat: refs #7957 simplify fn to
gitea/salix-front/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Jorge Penadés 2024-12-17 10:16:28 +01:00
parent e08f718975
commit b1ad357bda
1 changed files with 6 additions and 9 deletions

View File

@ -86,18 +86,14 @@ if (props.redirect)
let arrayData = useArrayData(props.dataKey, arrayDataProps); let arrayData = useArrayData(props.dataKey, arrayDataProps);
let store = arrayData.store; let store = arrayData.store;
const to = computed(() => { const to = computed(() => {
const { params } = arrayData.getCurrentFilter();
params.search = searchText.value || undefined;
const url = { path: route.path, query: { ...(route.query ?? {}) } }; const url = { path: route.path, query: { ...(route.query ?? {}) } };
const searchUrl = arrayData.store.searchUrl; const searchUrl = arrayData.store.searchUrl;
const currentFilter = {
...arrayData.store.currentFilter,
search: searchText.value || undefined,
};
for (const key in params) { if (searchUrl) url.query[searchUrl] = JSON.stringify(currentFilter);
const val = params[key];
if (typeof val === 'object' && !Array.isArray(val) && !(val instanceof Date))
params[key] = JSON.stringify(val);
}
if (searchUrl) url.query[searchUrl] = JSON.stringify(params);
return url; return url;
}); });
@ -158,6 +154,7 @@ async function search() {
</RouterLink> </RouterLink>
<VnInput <VnInput
id="searchbar" id="searchbar"
ref="input"
v-model.trim="searchText" v-model.trim="searchText"
:placeholder="t(props.label)" :placeholder="t(props.label)"
dense dense