forked from verdnatura/salix-front
Improve reactivity of card descriptor
This commit is contained in:
parent
90bfba0290
commit
740eedbe44
|
@ -59,6 +59,10 @@ const $props = defineProps({
|
|||
type: Function,
|
||||
default: null,
|
||||
},
|
||||
clearStoreOnUnmount: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
});
|
||||
|
||||
const emit = defineEmits(['onFetch', 'onDataSaved']);
|
||||
|
@ -91,7 +95,12 @@ onMounted(async () => {
|
|||
});
|
||||
|
||||
onUnmounted(() => {
|
||||
state.unset($props.model);
|
||||
// Restauramos los datos originales en el store si se realizaron cambios en el formulario pero no se guardaron, evitando modificaciones erróneas.
|
||||
if (hasChanges.value) {
|
||||
state.set($props.model, originalData.value);
|
||||
return;
|
||||
}
|
||||
if ($props.clearStoreDataOnUnmount) state.unset($props.model);
|
||||
});
|
||||
|
||||
const isLoading = ref(false);
|
||||
|
|
|
@ -61,6 +61,7 @@ const onFilterTravelSelected = (formData, id) => {
|
|||
:url-update="`Entries/${route.params.id}`"
|
||||
model="entry"
|
||||
auto-load
|
||||
:clear-store-on-unmount="false"
|
||||
>
|
||||
<template #form="{ data }">
|
||||
<VnRow class="row q-gutter-md q-mb-md">
|
||||
|
|
|
@ -97,17 +97,6 @@ const getEntryRedirectionFilter = (entry) => {
|
|||
});
|
||||
};
|
||||
|
||||
const refetchEntryDescriptorData = async () => {
|
||||
await entryDescriptorRef.value.getData();
|
||||
};
|
||||
|
||||
watch(
|
||||
() => route.name,
|
||||
async (_, from) => {
|
||||
if (from === 'EntryBasicData') await refetchEntryDescriptorData();
|
||||
}
|
||||
);
|
||||
|
||||
const showEntryReport = () => {
|
||||
openReport(`Entries/${route.params.id}/entry-order-pdf`);
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue