0
0
Fork 0

refactor: refs #7909 improve applyFilter

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