Поддержка тегов для форм и обработка close события

This commit is contained in:
brusnitsyn
2025-11-05 16:59:56 +09:00
parent c79fab5756
commit 404ef4f07d
3 changed files with 492 additions and 22 deletions

View File

@@ -12,6 +12,7 @@ import Card from "../../Components/Card/Card.vue";
import FormGroup from "../../Components/Form/FormGroup.vue";
import Calendar from "../../Components/Calendar/Calendar.vue";
import Collapsible from "../../Components/Collapsible/Collapsible.vue";
import TagsInput from "../../Components/Input/TagsInput.vue";
const props = defineProps({
templateId: {
@@ -51,6 +52,7 @@ const loadTemplateData = async (templateId) => {
uploadForm.value.name = template.name
uploadForm.value.description = template.description || ''
uploadForm.value.variables = template.variables || []
uploadForm.value.tags = template.tags || []
isTemplateLoaded.value = true
})
}
@@ -62,6 +64,8 @@ const { formData: uploadForm, errors, reset, loading, submit, setFile: setFileTo
variables: []
})
const emits = defineEmits(['close'])
watch(() => stage.value, (value) => {
if (value === 'variables') description.value = 'Опишите найденные в документе переменные'
else description.value = ''
@@ -128,7 +132,7 @@ const submitForm = () => {
uploadForm.value.variables = [...templateVariables.value]
router.post(`/templates/update`, uploadForm.value, {
onSuccess: () => {
open.value = false
emits('close')
}
})
}
@@ -137,6 +141,7 @@ const afterCloseModal = () => {
stage.value = 'upload'
uploadedFile.value = null
reset()
emits('close')
}
const widthOfStage = computed(() => {
@@ -415,6 +420,7 @@ const getRootIndex = (variable) => {
<div v-if="stage === 'upload'" class="flex flex-col gap-y-1">
<Input v-model:value="uploadForm.name" label="Наименование" />
<Input v-model:value="uploadForm.description" label="Описание" />
<TagsInput v-model="uploadForm.tags" label="Теги" />
<div class="mt-2.5">
<Button block text-align="center" v-if="!isUpdateFile" @click="isUpdateFile = true">
Загрузить обновленный шаблон