This commit is contained in:
parent
421b54cebe
commit
75ba4d4fd9
|
@ -84,7 +84,7 @@ const saveButtonRef = ref(null);
|
||||||
const watchChanges = ref();
|
const watchChanges = ref();
|
||||||
const formUrl = computed(() => $props.url);
|
const formUrl = computed(() => $props.url);
|
||||||
|
|
||||||
const emit = defineEmits(['onFetch', 'update:selected', 'saveChanges', 'dataError']);
|
const emit = defineEmits(['onFetch', 'update:selected', 'saveChanges']);
|
||||||
|
|
||||||
defineExpose({
|
defineExpose({
|
||||||
reload,
|
reload,
|
||||||
|
@ -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);
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -164,7 +164,7 @@ async function onSubmit() {
|
||||||
isLoading.value = true;
|
isLoading.value = true;
|
||||||
await saveChanges($props.saveFn ? formData.value : null);
|
await saveChanges($props.saveFn ? formData.value : null);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
emit('dataError', e);
|
throw e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -219,7 +219,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)
|
||||||
|
|
|
@ -9,15 +9,13 @@ import VnInput from 'src/components/common/VnInput.vue';
|
||||||
import FetchData from 'components/FetchData.vue';
|
import FetchData from 'components/FetchData.vue';
|
||||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import { useQuasar } from 'quasar';
|
|
||||||
|
|
||||||
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 quasar = useQuasar();
|
|
||||||
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 = {
|
||||||
|
@ -60,19 +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);
|
|
||||||
};
|
|
||||||
|
|
||||||
const errMessage = ref();
|
|
||||||
function showError(error) {
|
|
||||||
errMessage.value = error?.response?.data?.error?.message;
|
|
||||||
quasar.notify({
|
|
||||||
type: 'negative',
|
|
||||||
message: t(`${errMessage.value}`),
|
|
||||||
});
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@ -115,7 +100,6 @@ function showError(error) {
|
||||||
order="priority"
|
order="priority"
|
||||||
auto-load
|
auto-load
|
||||||
@on-fetch="onItemTagsFetched"
|
@on-fetch="onItemTagsFetched"
|
||||||
@data-error="(val) => showError(val)"
|
|
||||||
>
|
>
|
||||||
<template #body="{ rows, validate }">
|
<template #body="{ rows, validate }">
|
||||||
<QCard class="q-px-lg q-pt-md q-pb-sm" data-cy="itemTags">
|
<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"
|
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')"
|
||||||
|
@ -168,7 +152,7 @@ function showError(error) {
|
||||||
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
|
||||||
|
|
Loading…
Reference in New Issue