fix: refs #7936 improve error handling
gitea/salix-front/pipeline/pr-dev There was a failure building this commit Details

This commit is contained in:
Jorge Penadés 2024-11-28 11:41:22 +01:00
parent 1571bd55ea
commit 011b5814a7
2 changed files with 9 additions and 12 deletions

View File

@ -176,7 +176,8 @@ async function saveChanges(data) {
try { try {
await axios.post($props.saveUrl || $props.url + '/crud', changes); await axios.post($props.saveUrl || $props.url + '/crud', changes);
} catch (e) { } catch (e) {
return (isLoading.value = false); isLoading.value = false;
throw e;
} }
originalData.value = JSON.parse(JSON.stringify(formData.value)); originalData.value = JSON.parse(JSON.stringify(formData.value));
if (changes.creates?.length) await vnPaginateRef.value.fetch(); if (changes.creates?.length) await vnPaginateRef.value.fetch();

View File

@ -1,22 +1,21 @@
<script setup> <script setup>
import { ref, computed, capitalize } from 'vue'; import { ref, computed, capitalize } from 'vue';
import { useRouter } from 'vue-router'; import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useArrayData } from 'src/composables/useArrayData'; import { useArrayData } from 'src/composables/useArrayData';
import CrudModel from 'src/components/CrudModel.vue'; import CrudModel from 'src/components/CrudModel.vue';
import FetchData from 'src/components/FetchData.vue'; import FetchData from 'src/components/FetchData.vue';
import VnSelect from 'src/components/common/VnSelect.vue'; import VnSelect from 'src/components/common/VnSelect.vue';
const { push, currentRoute } = useRouter(); const route = useRoute();
const { t } = useI18n(); const { t } = useI18n();
const invoiceId = +currentRoute.value.params.id;
const arrayData = useArrayData(); const arrayData = useArrayData();
const invoiceIn = computed(() => arrayData.store.data); const invoiceIn = computed(() => arrayData.store.data);
const invoiceInCorrectionRef = ref(); const invoiceInCorrectionRef = ref();
const filter = { const filter = {
include: { relation: 'invoiceIn' }, include: { relation: 'invoiceIn' },
where: { correctingFk: invoiceId }, where: { correctingFk: route.params.id },
}; };
const columns = computed(() => [ const columns = computed(() => [
{ {
@ -70,8 +69,6 @@ const siiTypeInvoiceIns = ref([]);
const invoiceCorrectionTypes = ref([]); const invoiceCorrectionTypes = ref([]);
const requiredFieldRule = (val) => val || t('globals.requiredField'); const requiredFieldRule = (val) => val || t('globals.requiredField');
const onSave = (data) => data.deletes && push(`/invoice-in/${invoiceId}/summary`);
</script> </script>
<template> <template>
<FetchData <FetchData
@ -98,7 +95,6 @@ const onSave = (data) => data.deletes && push(`/invoice-in/${invoiceId}/summary`
:filter="filter" :filter="filter"
auto-load auto-load
primary-key="correctingFk" primary-key="correctingFk"
@save-changes="onSave"
:default-remove="false" :default-remove="false"
> >
<template #body="{ rows }"> <template #body="{ rows }">
@ -120,8 +116,8 @@ const onSave = (data) => data.deletes && push(`/invoice-in/${invoiceId}/summary`
:disable="row.invoiceIn.isBooked" :disable="row.invoiceIn.isBooked"
:filter-options="['description']" :filter-options="['description']"
> >
<template #option="{ opt }"> <template #option="{ opt, itemProps }">
<QItem> <QItem v-bind="itemProps">
<QItemSection> <QItemSection>
<QItemLabel>{{ opt.description }}</QItemLabel> <QItemLabel>{{ opt.description }}</QItemLabel>
</QItemSection> </QItemSection>
@ -142,8 +138,8 @@ const onSave = (data) => data.deletes && push(`/invoice-in/${invoiceId}/summary`
:filter-options="['code', 'description']" :filter-options="['code', 'description']"
:disable="row.invoiceIn.isBooked" :disable="row.invoiceIn.isBooked"
> >
<template #option="{ opt }"> <template #option="{ opt, itemProps }">
<QItem> <QItem v-bind="itemProps">
<QItemSection> <QItemSection>
<QItemLabel <QItemLabel
>{{ opt.code }} - >{{ opt.code }} -