refactor: refs #8207 imrove 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
50fbf64cf9
commit
7048f96565
|
@ -130,10 +130,10 @@ const addFilter = async (filter, params) => {
|
||||||
await arrayData.addFilter({ filter, params });
|
await arrayData.addFilter({ filter, params });
|
||||||
};
|
};
|
||||||
|
|
||||||
async function fetch(params) {
|
async function fetch(params, keepRowsNumber = false) {
|
||||||
useArrayData(props.dataKey, params);
|
useArrayData(props.dataKey, params);
|
||||||
arrayData.reset(['filter.skip', 'skip', 'page']);
|
if (!keepRowsNumber) arrayData.reset(['filter.skip', 'skip', 'page']);
|
||||||
await arrayData.fetch({ append: false });
|
await arrayData.fetch({ append: false, keepRowsNumber });
|
||||||
if (!store.hasMoreData) isLoading.value = false;
|
if (!store.hasMoreData) isLoading.value = false;
|
||||||
|
|
||||||
emit('onFetch', store.data);
|
emit('onFetch', store.data);
|
||||||
|
|
|
@ -64,7 +64,11 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function fetch({ append = false, updateRouter = true, totalRows = null }) {
|
async function fetch({
|
||||||
|
append = false,
|
||||||
|
updateRouter = true,
|
||||||
|
keepRowsNumber = false,
|
||||||
|
}) {
|
||||||
if (!store.url) return;
|
if (!store.url) return;
|
||||||
|
|
||||||
cancelRequest();
|
cancelRequest();
|
||||||
|
@ -107,8 +111,9 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) {
|
||||||
|
|
||||||
if (params.filter.where || exprFilter)
|
if (params.filter.where || exprFilter)
|
||||||
params.filter.where = { ...params.filter.where, ...exprFilter };
|
params.filter.where = { ...params.filter.where, ...exprFilter };
|
||||||
if (totalRows) {
|
if (keepRowsNumber) {
|
||||||
params.filter.limit = totalRows;
|
const { limit, skip } = store;
|
||||||
|
params.filter.limit = limit + skip;
|
||||||
params.filter.skip = 0;
|
params.filter.skip = 0;
|
||||||
}
|
}
|
||||||
params.filter = JSON.stringify(params.filter);
|
params.filter = JSON.stringify(params.filter);
|
||||||
|
|
|
@ -354,13 +354,7 @@ const openTab = (id) =>
|
||||||
class="q-mr-sm"
|
class="q-mr-sm"
|
||||||
dense
|
dense
|
||||||
flat
|
flat
|
||||||
@click="
|
@click="tableRef.CrudModelRef.vnPaginateRef.fetch(undefined, true)"
|
||||||
() => {
|
|
||||||
const { limit, skip } = arrayData.store;
|
|
||||||
const nlimit = limit + skip;
|
|
||||||
arrayData.fetch({ totalRows: nlimit });
|
|
||||||
}
|
|
||||||
"
|
|
||||||
>
|
>
|
||||||
<QTooltip>{{ $t('globals.refresh') }}</QTooltip>
|
<QTooltip>{{ $t('globals.refresh') }}</QTooltip>
|
||||||
</QBtn>
|
</QBtn>
|
||||||
|
|
Loading…
Reference in New Issue