diff --git a/core/core-frontend/src/components/data-visualization/canvas/ContextMenuDetails.vue b/core/core-frontend/src/components/data-visualization/canvas/ContextMenuDetails.vue index 4057a38ad8..5da20aa54e 100644 --- a/core/core-frontend/src/components/data-visualization/canvas/ContextMenuDetails.vue +++ b/core/core-frontend/src/components/data-visualization/canvas/ContextMenuDetails.vue @@ -81,14 +81,26 @@ const copy = () => { } const hide = () => { + if (curComponent.value && !isGroupArea.value) { + layerStore.hideComponentWithComponent() + } else if (areaData.value.components.length) { + areaData.value.components.forEach(component => { + layerStore.hideComponentWithComponent(component.id) + }) + } snapshotStore.recordSnapshotCache() - layerStore.hideComponent() menuOpt('hide') } const show = () => { + if (curComponent.value && !isGroupArea.value) { + layerStore.showComponent() + } else if (areaData.value.components.length) { + areaData.value.components.forEach(component => { + layerStore.showComponent(component.id) + }) + } snapshotStore.recordSnapshotCache() - layerStore.showComponent() menuOpt('show') } const categoryChange = type => { diff --git a/core/core-frontend/src/store/modules/data-visualization/layer.ts b/core/core-frontend/src/store/modules/data-visualization/layer.ts index 9d86f0117e..1ade02d738 100644 --- a/core/core-frontend/src/store/modules/data-visualization/layer.ts +++ b/core/core-frontend/src/store/modules/data-visualization/layer.ts @@ -60,6 +60,13 @@ export const layerStore = defineStore('layer', { } }, + hideComponentWithComponent(componentId?) { + const targetComponent = getComponentById(componentId) + // 隐藏 + if (targetComponent) { + targetComponent.isShow = false + } + }, hideComponent(componentId?) { const targetComponent = getComponentById(componentId) // 隐藏