Merge pull request 'feat: refs #8387 crudModel' (!1206) from 8387-itemTagCrudModelFront into dev
gitea/salix-front/pipeline/head This commit looks good Details

Reviewed-on: #1206
Reviewed-by: Alex Moreno <alexm@verdnatura.es>
This commit is contained in:
Robert Ferrús 2025-01-27 11:38:12 +00:00
commit 73f421f19e
2 changed files with 6 additions and 10 deletions

View File

@ -149,7 +149,7 @@ function filter(value, update, filterOptions) {
(ref) => { (ref) => {
ref.setOptionIndex(-1); ref.setOptionIndex(-1);
ref.moveOptionSelection(1, true); ref.moveOptionSelection(1, true);
} },
); );
} }
@ -215,7 +215,7 @@ async function remove(data) {
if (preRemove.length) { if (preRemove.length) {
newData = newData.filter( newData = newData.filter(
(form) => !preRemove.some((index) => index == form.$index) (form) => !preRemove.some((index) => index == form.$index),
); );
const changes = getChanges(); const changes = getChanges();
if (!changes.creates?.length && !changes.updates?.length) if (!changes.creates?.length && !changes.updates?.length)

View File

@ -13,10 +13,9 @@ import axios from 'axios';
const route = useRoute(); const route = useRoute();
const { t } = useI18n(); const { t } = useI18n();
const itemTagsRef = ref(null); const itemTagsRef = ref();
const tagOptions = ref([]); const tagOptions = ref([]);
const valueOptionsMap = ref(new Map()); const valueOptionsMap = ref(new Map());
const getSelectedTagValues = async (tag) => { const getSelectedTagValues = async (tag) => {
if (!tag.tagFk && tag.tag.isFree) return; if (!tag.tagFk && tag.tag.isFree) return;
const filter = { const filter = {
@ -59,10 +58,6 @@ const insertTag = (rows) => {
itemTagsRef.value.formData[itemTagsRef.value.formData.length - 1].priority = itemTagsRef.value.formData[itemTagsRef.value.formData.length - 1].priority =
getHighestPriority(rows); getHighestPriority(rows);
}; };
const submitTags = async (data) => {
itemTagsRef.value.onSubmit(data);
};
</script> </script>
<template> <template>
@ -149,7 +144,7 @@ const submitTags = async (data) => {
v-model="row.value" v-model="row.value"
:label="t('itemTags.value')" :label="t('itemTags.value')"
:is-clearable="false" :is-clearable="false"
@keyup.enter.stop="submitTags(row)" @keyup.enter.stop="(data) => itemTagsRef.onSubmit(data)"
/> />
<VnInput <VnInput
:label="t('itemBasicData.relevancy')" :label="t('itemBasicData.relevancy')"
@ -157,7 +152,7 @@ const submitTags = async (data) => {
v-model="row.priority" v-model="row.priority"
:required="true" :required="true"
:rules="validate('itemTag.priority')" :rules="validate('itemTag.priority')"
@keyup.enter.stop="submitTags(row)" @keyup.enter.stop="(data) => itemTagsRef.onSubmit(data)"
/> />
<div class="row justify-center" style="flex: 0"> <div class="row justify-center" style="flex: 0">
<QIcon <QIcon
@ -197,4 +192,5 @@ const submitTags = async (data) => {
<i18n> <i18n>
es: es:
Tags can not be repeated: Las etiquetas no pueden repetirse 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> </i18n>