refactor: refs #7909 improve applyFilter
gitea/salix-front/pipeline/pr-master This commit looks good Details

This commit is contained in:
Jorge Penadés 2024-08-29 16:28:59 +02:00
parent 77cb0ed7a8
commit c7bb0333bd
1 changed files with 3 additions and 10 deletions

View File

@ -69,6 +69,7 @@ const filter = {
], ],
}; };
const paginate = ref();
const actions = ref(); const actions = ref();
const changeInput = ref(); const changeInput = ref();
const searchInput = ref(); const searchInput = ref();
@ -237,7 +238,6 @@ async function openPointRecord(id, modelLog) {
} }
async function setLogTree(data) { async function setLogTree(data) {
filter.where = { and: [{ originFk: route.params.id }] }; filter.where = { and: [{ originFk: route.params.id }] };
// const { data } = await getLogs(filter);
logTree.value = getLogTree(data); logTree.value = getLogTree(data);
} }
@ -266,15 +266,7 @@ async function applyFilter() {
filter.where.and.push(selectedFilters.value); filter.where.and.push(selectedFilters.value);
} }
const { data } = await getLogs(filter); paginate.value.fetch(filter);
logTree.value = getLogTree(data);
}
async function getLogs(filter) {
return axios.get(props.url ?? `${props.model}Logs`, {
params: { filter: JSON.stringify(filter) },
});
} }
function setDate(type) { function setDate(type) {
@ -407,6 +399,7 @@ watch(
auto-load auto-load
/> />
<VnPaginate <VnPaginate
ref="paginate"
:data-key="`${model}Log`" :data-key="`${model}Log`"
:url="`${model}Logs`" :url="`${model}Logs`"
:filter="filter" :filter="filter"