feat: refs #8387 changes
gitea/salix-front/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Robert Ferrús 2025-01-15 10:33:49 +01:00
parent 51fb940adb
commit 0b9788d38b
2 changed files with 15 additions and 7 deletions

View File

@ -83,7 +83,7 @@ const saveButtonRef = ref(null);
const watchChanges = ref();
const formUrl = computed(() => $props.url);
const emit = defineEmits(['onFetch', 'update:selected', 'saveChanges']);
const emit = defineEmits(['onFetch', 'update:selected', 'saveChanges', 'dataError']);
defineExpose({
reload,
@ -161,11 +161,7 @@ async function onSubmit() {
isLoading.value = true;
await saveChanges($props.saveFn ? formData.value : null);
} catch (e) {
const errMessage = e?.response?.data?.error?.message;
quasar.notify({
type: 'negative',
message: t(`${errMessage}`),
});
emit('dataError', e);
}
}

View File

@ -9,6 +9,7 @@ import VnInput from 'src/components/common/VnInput.vue';
import FetchData from 'components/FetchData.vue';
import VnSelect from 'src/components/common/VnSelect.vue';
import axios from 'axios';
import { useQuasar } from 'quasar';
const route = useRoute();
const { t } = useI18n();
@ -16,7 +17,7 @@ const { t } = useI18n();
const itemTagsRef = ref(null);
const tagOptions = ref([]);
const valueOptionsMap = ref(new Map());
const quasar = useQuasar();
const getSelectedTagValues = async (tag) => {
if (!tag.tagFk && tag.tag.isFree) return;
const filter = {
@ -63,6 +64,15 @@ const insertTag = (rows) => {
const submitTags = async (data) => {
itemTagsRef.value.onSubmit(data);
};
const errMessage = ref();
function showError(error) {
errMessage.value = error?.response?.data?.error?.message;
quasar.notify({
type: 'negative',
message: t(`${errMessage.value}`),
});
}
</script>
<template>
@ -105,6 +115,7 @@ const submitTags = async (data) => {
order="priority"
auto-load
@on-fetch="onItemTagsFetched"
@data-error="(val) => showError(val)"
>
<template #body="{ rows, validate }">
<QCard class="q-px-lg q-pt-md q-pb-sm" data-cy="itemTags">
@ -197,4 +208,5 @@ const submitTags = async (data) => {
<i18n>
es:
Tags can not be repeated: Las etiquetas no pueden repetirse
The value must be a number or a range of numbers: El valor debe ser un número o un rango de números
</i18n>