From ac421344d01575a3db5d281bc4c4c28deaff17ce Mon Sep 17 00:00:00 2001 From: jorgep Date: Mon, 9 Sep 2024 13:41:04 +0200 Subject: [PATCH] fix: refs #7909 add originFk --- src/components/common/VnLog.vue | 523 +++++++++++++++++--------------- 1 file changed, 277 insertions(+), 246 deletions(-) diff --git a/src/components/common/VnLog.vue b/src/components/common/VnLog.vue index 2163d54d4..ab522cfde 100644 --- a/src/components/common/VnLog.vue +++ b/src/components/common/VnLog.vue @@ -14,6 +14,7 @@ import VnJsonValue from '../common/VnJsonValue.vue'; import FetchData from '../FetchData.vue'; import VnSelect from './VnSelect.vue'; import VnUserLink from '../ui/VnUserLink.vue'; +import VnPaginate from '../ui/VnPaginate.vue'; const stateStore = useStateStore(); const validationsStore = useValidator(); @@ -66,9 +67,10 @@ const filter = { }, }, ], + where: { and: [{ originFk: route.params.id }] }, }; -const workers = ref(); +const paginate = ref(); const actions = ref(); const changeInput = ref(); const searchInput = ref(); @@ -235,9 +237,7 @@ async function openPointRecord(id, modelLog) { const locale = validations[modelLog.model]?.locale || {}; pointRecord.value = parseProps(propNames, locale, data); } -async function setLogTree() { - filter.where = { and: [{ originFk: route.params.id }] }; - const { data } = await getLogs(filter); +async function setLogTree(data) { 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) { @@ -377,8 +369,6 @@ async function clearFilter() { await applyFilter(); } -setLogTree(); - onUnmounted(() => { stateStore.rightDrawer = false; }); @@ -391,16 +381,6 @@ watch( ); + @@ -691,17 +723,16 @@ watch( - - - - +