diff --git a/core/core-frontend/src/views/template/component/DeTemplateImport.vue b/core/core-frontend/src/views/template/component/DeTemplateImport.vue index ed4eab0f8b..e5360331a5 100644 --- a/core/core-frontend/src/views/template/component/DeTemplateImport.vue +++ b/core/core-frontend/src/views/template/component/DeTemplateImport.vue @@ -172,7 +172,7 @@ const editTemplate = () => { nameCheck(nameCheckRequest).then(response => { save(state.templateInfo).then(response => { ElMessage.success(t('编辑成功')) - emits('refresh') + emits('refresh', { optType: 'refresh' }) emits('closeEditTemplateDialog') }) }) @@ -196,7 +196,7 @@ const importTemplate = () => { }).then(() => { save(state.templateInfo).then(response => { ElMessage.success(t('覆盖成功')) - emits('refresh') + emits('refresh', { optType: 'refresh' }) emits('closeEditTemplateDialog') }) }) @@ -205,7 +205,7 @@ const importTemplate = () => { nameCheck(nameCheckRequest).then(response => { save(state.templateInfo).then(response => { ElMessage.success(t('导入成功')) - emits('refresh') + emits('refresh', { optType: 'refresh' }) emits('closeEditTemplateDialog') }) }) @@ -235,7 +235,7 @@ const goFile = () => { } const doAddCategory = () => { - emits('addCategoryInfo') + emits('refresh', { optType: 'addCategory' }) } onMounted(() => { diff --git a/core/core-frontend/src/views/template/index.vue b/core/core-frontend/src/views/template/index.vue index ee0a2c6989..4397a9ff5a 100644 --- a/core/core-frontend/src/views/template/index.vue +++ b/core/core-frontend/src/views/template/index.vue @@ -123,7 +123,7 @@ :template-id="state.templateDialog.templateId" :opt-type="state.templateDialog.optType" :template-categories="state.templateCategories" - @addCategoryInfo="showTemplateEditDialog('new', null)" + @doTest="closeEditTemplateDialog" @refresh="showCurrentTemplate(state.currentTemplateId, state.currentTemplateLabel)" @closeEditTemplateDialog="closeEditTemplateDialog" /> @@ -144,7 +144,7 @@ :template-id="state.templateDialog.templateId" :opt-type="state.templateDialog.optType" :template-categories="state.templateCategories" - @refresh="showCurrentTemplate(state.currentTemplateId, state.currentTemplateLabel)" + @refresh="importRefresh" @closeEditTemplateDialog="closeEditTemplateDialog" /> @@ -351,6 +351,14 @@ const handleClick = (tab, event) => { getTree() } +const importRefresh = params => { + if (params.optType === 'refresh') { + showCurrentTemplate(state.currentTemplateId, state.currentTemplateLabel) + } else { + showTemplateEditDialog('new', null) + } +} + const showCurrentTemplate = (pid, label) => { state.currentTemplateId = pid state.currentTemplateLabel = label