8713-testToMaster #1539
|
@ -69,6 +69,10 @@ const props = defineProps({
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: true,
|
default: true,
|
||||||
},
|
},
|
||||||
|
excludeParams: {
|
||||||
|
type: Object,
|
||||||
|
default: null,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const searchText = ref();
|
const searchText = ref();
|
||||||
|
@ -135,6 +139,12 @@ async function search() {
|
||||||
};
|
};
|
||||||
delete filter.params.search;
|
delete filter.params.search;
|
||||||
}
|
}
|
||||||
|
if (props.excludeParams) {
|
||||||
|
filter.params = {
|
||||||
|
...filter.params,
|
||||||
|
exclude: props.excludeParams,
|
||||||
|
};
|
||||||
|
}
|
||||||
await arrayData.applyFilter(filter);
|
await arrayData.applyFilter(filter);
|
||||||
searchText.value = undefined;
|
searchText.value = undefined;
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,12 +74,13 @@ export function useArrayData(key, userOptions) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function fetch({ append = false, updateRouter = true }) {
|
async function fetch(fetchOptions) {
|
||||||
|
let { append = false, updateRouter = true } = fetchOptions;
|
||||||
if (!store.url) return;
|
if (!store.url) return;
|
||||||
|
|
||||||
cancelRequest();
|
cancelRequest();
|
||||||
canceller = new AbortController();
|
canceller = new AbortController();
|
||||||
const { params, limit } = setCurrentFilter();
|
let { params, limit } = setCurrentFilter();
|
||||||
|
|
||||||
let exprFilter;
|
let exprFilter;
|
||||||
if (store?.exprBuilder) {
|
if (store?.exprBuilder) {
|
||||||
|
@ -97,7 +98,10 @@ export function useArrayData(key, userOptions) {
|
||||||
if (!params?.filter?.order?.length) delete params?.filter?.order;
|
if (!params?.filter?.order?.length) delete params?.filter?.order;
|
||||||
|
|
||||||
params.filter = JSON.stringify(params.filter);
|
params.filter = JSON.stringify(params.filter);
|
||||||
|
if (fetchOptions?.exclude) {
|
||||||
|
params = { ...params, ...fetchOptions.exclude };
|
||||||
|
delete params.exclude;
|
||||||
|
}
|
||||||
store.isLoading = true;
|
store.isLoading = true;
|
||||||
const response = await axios.get(store.url, {
|
const response = await axios.get(store.url, {
|
||||||
signal: canceller.signal,
|
signal: canceller.signal,
|
||||||
|
@ -145,8 +149,11 @@ export function useArrayData(key, userOptions) {
|
||||||
async function applyFilter({ filter, params }, fetchOptions = {}) {
|
async function applyFilter({ filter, params }, fetchOptions = {}) {
|
||||||
if (filter) store.userFilter = filter;
|
if (filter) store.userFilter = filter;
|
||||||
store.filter = {};
|
store.filter = {};
|
||||||
|
if (params?.exclude) {
|
||||||
|
fetchOptions = { ...fetchOptions, exclude: params.exclude };
|
||||||
|
delete params.exclude;
|
||||||
|
}
|
||||||
if (params) store.userParams = { ...params };
|
if (params) store.userParams = { ...params };
|
||||||
|
|
||||||
const response = await fetch(fetchOptions);
|
const response = await fetch(fetchOptions);
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
|
@ -445,6 +445,9 @@ function setReference(data) {
|
||||||
:array-data-props="{
|
:array-data-props="{
|
||||||
url: 'Tickets/filter',
|
url: 'Tickets/filter',
|
||||||
order: ['shippedDate DESC', 'shippedHour ASC', 'zoneLanding ASC', 'id'],
|
order: ['shippedDate DESC', 'shippedHour ASC', 'zoneLanding ASC', 'id'],
|
||||||
|
label: t('Search items'),
|
||||||
|
excludeParams: { ...userParams },
|
||||||
|
searchRemoveParams: true,
|
||||||
exprBuilder,
|
exprBuilder,
|
||||||
}"
|
}"
|
||||||
>
|
>
|
||||||
|
|
Loading…
Reference in New Issue