refactor: refs #8207 improve logic
gitea/salix-front/pipeline/pr-master This commit looks good
Details
gitea/salix-front/pipeline/pr-master This commit looks good
Details
This commit is contained in:
parent
661cc0b5ee
commit
9d8698fa2f
|
@ -130,19 +130,19 @@ const addFilter = async (filter, params) => {
|
||||||
await arrayData.addFilter({ filter, params });
|
await arrayData.addFilter({ filter, params });
|
||||||
};
|
};
|
||||||
|
|
||||||
async function fetch(params, keepRowsNumber = false) {
|
async function fetch(params, keepPagination = false) {
|
||||||
useArrayData(props.dataKey, params);
|
useArrayData(props.dataKey, params);
|
||||||
const { limit, skip } = arrayData.store;
|
const { limit, skip } = arrayData.store;
|
||||||
|
|
||||||
if (keepRowsNumber) {
|
if (!keepPagination) await arrayData.fetch({ append: false });
|
||||||
|
else {
|
||||||
arrayData.store.limit = limit + skip;
|
arrayData.store.limit = limit + skip;
|
||||||
arrayData.store.skip = 0;
|
arrayData.store.skip = 0;
|
||||||
}
|
await arrayData.fetch({ append: false });
|
||||||
await arrayData.fetch({ append: false });
|
|
||||||
if (keepRowsNumber) {
|
|
||||||
arrayData.store.limit = limit;
|
arrayData.store.limit = limit;
|
||||||
arrayData.store.skip = skip;
|
arrayData.store.skip = skip;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!store.hasMoreData) isLoading.value = false;
|
if (!store.hasMoreData) isLoading.value = false;
|
||||||
|
|
||||||
emit('onFetch', store.data);
|
emit('onFetch', store.data);
|
||||||
|
|
Loading…
Reference in New Issue