diff --git a/core/core-frontend/src/components/data-visualization/canvas/Shape.vue b/core/core-frontend/src/components/data-visualization/canvas/Shape.vue index 936e4e1a9d..a6c2234383 100644 --- a/core/core-frontend/src/components/data-visualization/canvas/Shape.vue +++ b/core/core-frontend/src/components/data-visualization/canvas/Shape.vue @@ -529,6 +529,7 @@ const handleMouseDownOnShape = e => { eventBus.emit('onTabMoveOut-' + tabMoveOutComponentId.value, deepCopy(element.value)) dvMainStore.setTabMoveOutComponentId(null) } + handleGroupComponent() } document.addEventListener('mousemove', move) @@ -648,6 +649,7 @@ const handleMouseDownOnPoint = (point, e) => { document.removeEventListener('mousemove', move) document.removeEventListener('mouseup', up) needSave && snapshotStore.recordSnapshotCache('shape-handleMouseDownOnPoint-up') + handleGroupComponent() } document.addEventListener('mousemove', move) @@ -847,6 +849,12 @@ const htmlToImage = () => { }, 200) } +const handleGroupComponent = () => { + if (element.value.canvasId.includes('Group')) { + composeStore.updateGroupBorder() + } +} + onMounted(() => { parentNode.value = document.querySelector('#editor-' + canvasId.value) // 用于 Group 组件 diff --git a/core/core-frontend/src/store/modules/data-visualization/compose.ts b/core/core-frontend/src/store/modules/data-visualization/compose.ts index cb92dca7b5..f5bca7ae78 100644 --- a/core/core-frontend/src/store/modules/data-visualization/compose.ts +++ b/core/core-frontend/src/store/modules/data-visualization/compose.ts @@ -52,6 +52,9 @@ export const composeStore = defineStore('compose', { setAreaData(data) { this.areaData = data }, + updateGroupBorder() { + // do updateGroupBorder + }, compose: function (canvasId = 'canvas-main') { const editor = this.editorMap[canvasId] diff --git a/core/core-frontend/src/views/template/component/DeTemplateList.vue b/core/core-frontend/src/views/template/component/DeTemplateList.vue index 969911dedc..9094a76ce3 100644 --- a/core/core-frontend/src/views/template/component/DeTemplateList.vue +++ b/core/core-frontend/src/views/template/component/DeTemplateList.vue @@ -55,7 +55,7 @@ const emits = defineEmits([ 'showCurrentTemplate', 'showTemplateEditDialog', 'categoryDelete', - 'templateEdit', + 'categoryEdit', 'templateImport' ]) @@ -86,7 +86,7 @@ const templateListComputed = computed(() => { const clickMore = (type, data) => { switch (type) { case 'edit': - templateEdit(data) + categoryEdit(data) break case 'delete': categoryDelete(data) @@ -114,8 +114,8 @@ const categoryDelete = template => { emits('categoryDelete', template.id) }) } -const templateEdit = template => { - emits('templateEdit', template) +const categoryEdit = template => { + emits('categoryEdit', template) } const templateImport = template => { emits('templateImport', template.id) diff --git a/core/core-frontend/src/views/template/index.vue b/core/core-frontend/src/views/template/index.vue index 01b286d32f..be7eabf5b4 100644 --- a/core/core-frontend/src/views/template/index.vue +++ b/core/core-frontend/src/views/template/index.vue @@ -34,9 +34,8 @@ :template-type="state.currentTemplateType" :template-list="state.templateCategories" @categoryDelete="categoryDelete" - @templateEdit="templateEdit" + @categoryEdit="categoryEdit" @showCurrentTemplate="showCurrentTemplate" - @templateImport="templateImport" @showTemplateEditDialog="showTemplateEditDialog" /> @@ -143,27 +142,6 @@ - - - - - { state.editTemplate = true } +const categoryEdit = templateInfo => { + showTemplateEditDialog('edit', templateInfo) +} + const templateEdit = templateInfo => { state.templateDialog.visible = true state.templateDialog.title = '编辑模版' @@ -482,9 +464,10 @@ const categoryClick = params => { const saveTemplateEdit = templateEditForm => { templateEditFormRef.value.validate(valid => { if (valid) { - save(templateEditForm).then(response => { - close() + save({ ...templateEditForm }).then(response => { + state.currentTemplateLabel = templateEditForm.name getTree() + close() }) } else { return false @@ -492,7 +475,6 @@ const saveTemplateEdit = templateEditForm => { }) } const close = () => { - templateEditFormRef.value.resetFields() state.editTemplate = false } const getTree = () => {