Поддержка тегов для форм и обработка close события
This commit is contained in:
@@ -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">
|
||||
Загрузить обновленный шаблон
|
||||
|
||||
Reference in New Issue
Block a user