refactor: arrayData & VnCard refactor
gitea/salix-front/pipeline/pr-dev There was a failure building this commit
Details
gitea/salix-front/pipeline/pr-dev There was a failure building this commit
Details
This commit is contained in:
parent
b09cbe442c
commit
aec43cb1c5
|
@ -39,7 +39,7 @@ const arrayData = useArrayData(props.dataKey, {
|
||||||
|
|
||||||
onBeforeMount(async () => {
|
onBeforeMount(async () => {
|
||||||
if (!props.baseUrl) arrayData.store.filter.where = { id: route.params.id };
|
if (!props.baseUrl) arrayData.store.filter.where = { id: route.params.id };
|
||||||
await arrayData.fetch({ append: false });
|
await arrayData.fetch({ append: false, updateRouter: false });
|
||||||
});
|
});
|
||||||
|
|
||||||
if (props.baseUrl) {
|
if (props.baseUrl) {
|
||||||
|
|
|
@ -84,8 +84,10 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) {
|
||||||
}
|
}
|
||||||
|
|
||||||
Object.assign(filter, store.userFilter, exprFilter);
|
Object.assign(filter, store.userFilter, exprFilter);
|
||||||
Object.assign(store.filter, filter);
|
const where = Object.assign(filter?.where ?? {}, store.filter?.where ?? {});
|
||||||
const params = { filter: store.filter };
|
Object.assign(filter, store.filter);
|
||||||
|
filter.where = where;
|
||||||
|
const params = { filter };
|
||||||
|
|
||||||
Object.assign(params, userParams);
|
Object.assign(params, userParams);
|
||||||
params.filter.skip = store.skip;
|
params.filter.skip = store.skip;
|
||||||
|
@ -143,7 +145,7 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function addFilter({ filter, params }) {
|
async function addFilter({ filter, params }) {
|
||||||
if (filter) store.userFilter = Object.assign(store.userFilter, filter);
|
if (filter) store.filter = filter;
|
||||||
|
|
||||||
let userParams = { ...store.userParams, ...params };
|
let userParams = { ...store.userParams, ...params };
|
||||||
userParams = sanitizerParams(userParams, store?.exprBuilder);
|
userParams = sanitizerParams(userParams, store?.exprBuilder);
|
||||||
|
@ -157,7 +159,7 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function addFilterWhere(where) {
|
async function addFilterWhere(where) {
|
||||||
const storedFilter = { ...store.userFilter };
|
const storedFilter = { ...store.filter };
|
||||||
if (!storedFilter?.where) storedFilter.where = {};
|
if (!storedFilter?.where) storedFilter.where = {};
|
||||||
where = { ...storedFilter.where, ...where };
|
where = { ...storedFilter.where, ...where };
|
||||||
await addFilter({ filter: { where } });
|
await addFilter({ filter: { where } });
|
||||||
|
@ -187,7 +189,6 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) {
|
||||||
store.page += 1;
|
store.page += 1;
|
||||||
|
|
||||||
await fetch({ append: true });
|
await fetch({ append: true });
|
||||||
updateStateParams();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async function refresh() {
|
async function refresh() {
|
||||||
|
|
Loading…
Reference in New Issue