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

This commit is contained in:
Robert Ferrús 2025-01-27 08:57:24 +01:00
parent 421b54cebe
commit 75ba4d4fd9
2 changed files with 7 additions and 23 deletions

View File

@ -84,7 +84,7 @@ const saveButtonRef = ref(null);
const watchChanges = ref();
const formUrl = computed(() => $props.url);
const emit = defineEmits(['onFetch', 'update:selected', 'saveChanges', 'dataError']);
const emit = defineEmits(['onFetch', 'update:selected', 'saveChanges']);
defineExpose({
reload,
@ -149,7 +149,7 @@ function filter(value, update, filterOptions) {
(ref) => {
ref.setOptionIndex(-1);
ref.moveOptionSelection(1, true);
}
},
);
}
@ -164,7 +164,7 @@ async function onSubmit() {
isLoading.value = true;
await saveChanges($props.saveFn ? formData.value : null);
} catch (e) {
emit('dataError', e);
throw e;
}
}
@ -219,7 +219,7 @@ async function remove(data) {
if (preRemove.length) {
newData = newData.filter(
(form) => !preRemove.some((index) => index == form.$index)
(form) => !preRemove.some((index) => index == form.$index),
);
const changes = getChanges();
if (!changes.creates?.length && !changes.updates?.length)

View File

@ -9,15 +9,13 @@ 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();
const itemTagsRef = ref(null);
const itemTagsRef = ref();
const tagOptions = ref([]);
const valueOptionsMap = ref(new Map());
const quasar = useQuasar();
const getSelectedTagValues = async (tag) => {
if (!tag.tagFk && tag.tag.isFree) return;
const filter = {
@ -60,19 +58,6 @@ const insertTag = (rows) => {
itemTagsRef.value.formData[itemTagsRef.value.formData.length - 1].priority =
getHighestPriority(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>
@ -115,7 +100,6 @@ function showError(error) {
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">
@ -160,7 +144,7 @@ function showError(error) {
v-model="row.value"
:label="t('itemTags.value')"
:is-clearable="false"
@keyup.enter.stop="submitTags(row)"
@keyup.enter.stop="(data) => itemTagsRef.onSubmit(data)"
/>
<VnInput
:label="t('itemBasicData.relevancy')"
@ -168,7 +152,7 @@ function showError(error) {
v-model="row.priority"
:required="true"
:rules="validate('itemTag.priority')"
@keyup.enter.stop="submitTags(row)"
@keyup.enter.stop="(data) => itemTagsRef.onSubmit(data)"
/>
<div class="row justify-center" style="flex: 0">
<QIcon