Merge pull request #10967 from dataease/pr@v2.8@fix_hidden-area

fix(数据大屏): 数据大屏隐藏区域相关问题优化
This commit is contained in:
王嘉豪 2024-07-15 22:24:21 +08:00 committed by GitHub
commit f2069aa6f0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 22 additions and 4 deletions

View File

@ -12,6 +12,7 @@ import ContextMenuAsideDetails from '@/components/data-visualization/canvas/Cont
import ComposeShow from '@/components/data-visualization/canvas/ComposeShow.vue' import ComposeShow from '@/components/data-visualization/canvas/ComposeShow.vue'
import { composeStoreWithOut } from '@/store/modules/data-visualization/compose' import { composeStoreWithOut } from '@/store/modules/data-visualization/compose'
import RealTimeGroup from '@/components/data-visualization/RealTimeGroup.vue' import RealTimeGroup from '@/components/data-visualization/RealTimeGroup.vue'
import { contextmenuStoreWithOut } from '@/store/modules/data-visualization/contextmenu'
const dropdownMore = ref(null) const dropdownMore = ref(null)
const lockStore = lockStoreWithOut() const lockStore = lockStoreWithOut()
@ -19,6 +20,7 @@ const dvMainStore = dvMainStoreWithOut()
const snapshotStore = snapshotStoreWithOut() const snapshotStore = snapshotStoreWithOut()
const layerStore = layerStoreWithOut() const layerStore = layerStoreWithOut()
const composeStore = composeStoreWithOut() const composeStore = composeStoreWithOut()
const contextmenuStore = contextmenuStoreWithOut()
const { areaData, isCtrlOrCmdDown, isShiftDown, laterIndex } = storeToRefs(composeStore) const { areaData, isCtrlOrCmdDown, isShiftDown, laterIndex } = storeToRefs(composeStore)
@ -78,6 +80,7 @@ const hiddenAreaOnClick = (e, element) => {
} }
const onClick = (e, index) => { const onClick = (e, index) => {
contextmenuStore.hideContextMenu()
// laterIndex=0 // laterIndex=0
if (!curComponent.value) { if (!curComponent.value) {
composeStore.setLaterIndex(null) composeStore.setLaterIndex(null)
@ -198,12 +201,24 @@ const getIconName = item => {
} }
} }
const menuAsideHiddenClose = (param, element) => {
const iconDom = document.getElementById('close-button')
if (iconDom) {
iconDom.click()
}
if (param?.opt === 'rename') {
setTimeout(() => {
editComponentName(element)
}, 200)
}
}
const menuAsideClose = (param, index) => { const menuAsideClose = (param, index) => {
const iconDom = document.getElementById('close-button') const iconDom = document.getElementById('close-button')
if (iconDom) { if (iconDom) {
iconDom.click() iconDom.click()
} }
if (param.opt === 'rename') { if (param?.opt === 'rename') {
setTimeout(() => { setTimeout(() => {
editComponentName(getComponent(index)) editComponentName(getComponent(index))
}, 200) }, 200)
@ -292,7 +307,10 @@ const areaClick = area => {
effect="dark" effect="dark"
:hide-timeout="0" :hide-timeout="0"
> >
<span :class="'dropdownMore-' + index" @click="onClick(transformIndex(index))"> <span
:class="'dropdownMore-' + index"
@click="hiddenAreaOnClick($event, element)"
>
<el-icon class="component-base"> <el-icon class="component-base">
<Icon name="dv-more" class="opt-icon"></Icon> <Icon name="dv-more" class="opt-icon"></Icon>
</el-icon> </el-icon>
@ -300,7 +318,7 @@ const areaClick = area => {
<template #dropdown> <template #dropdown>
<context-menu-aside-details <context-menu-aside-details
:element="element" :element="element"
@close="menuAsideClose($event, index)" @close="menuAsideHiddenClose($event, element)"
></context-menu-aside-details> ></context-menu-aside-details>
</template> </template>
</el-dropdown> </el-dropdown>
@ -545,7 +563,6 @@ const areaClick = area => {
justify-content: flex-end; justify-content: flex-end;
align-items: center; align-items: center;
flex-grow: 1; flex-grow: 1;
cursor: none;
i { i {
font-size: 16px; font-size: 16px;
cursor: pointer; cursor: pointer;

View File

@ -108,6 +108,7 @@ export const copyStore = defineStore('copy', {
// -新ID映射关系 // -新ID映射关系
const idMap = {} const idMap = {}
const newComponent = deepCopyHelper(data, idMap) const newComponent = deepCopyHelper(data, idMap)
newComponent['category'] = 'base'
if (newComponent.canvasId.includes('Group')) { if (newComponent.canvasId.includes('Group')) {
newComponent.canvasId = 'canvas-main' newComponent.canvasId = 'canvas-main'
} }