Merge pull request #7382 from dataease/pr@dev-v2@fix_group

Pr@dev v2@fix group
This commit is contained in:
王嘉豪 2023-12-27 10:37:39 +08:00 committed by GitHub
commit 8a98d5c6bd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 23 additions and 30 deletions

View File

@ -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

View File

@ -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]

View File

@ -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)

View File

@ -34,9 +34,8 @@
:template-type="state.currentTemplateType"
:template-list="state.templateCategories"
@categoryDelete="categoryDelete"
@templateEdit="templateEdit"
@categoryEdit="categoryEdit"
@showCurrentTemplate="showCurrentTemplate"
@templateImport="templateImport"
@showTemplateEditDialog="showTemplateEditDialog"
/>
</div>
@ -143,27 +142,6 @@
</div>
</template>
</el-dialog>
<!--导入templateDialog-->
<el-dialog
:title="state.templateDialog.title"
v-model="state.templateDialog.visible"
:show-close="true"
:destroy-on-close="true"
class="de-dialog-form"
width="600px"
>
<de-template-import
v-if="state.templateDialog.visible"
:pid="state.templateDialog.pid"
:template-id="state.templateDialog.templateId"
:opt-type="state.templateDialog.optType"
:template-categories="state.templateCategories"
@doTest="closeEditTemplateDialog"
@refresh="showCurrentTemplate(state.currentTemplateId, state.currentTemplateLabel)"
@closeEditTemplateDialog="closeEditTemplateDialog"
/>
</el-dialog>
<!--导入templateDialog-->
<el-dialog
:title="state.templateDialog.title"
@ -468,6 +446,10 @@ const showTemplateEditDialog = (type, templateInfo) => {
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 = () => {