From de0c4eea547da85a1d1fb51244541840d47e9d81 Mon Sep 17 00:00:00 2001 From: wangjiahao <1522128093@qq.com> Date: Thu, 7 Nov 2024 16:52:05 +0800 Subject: [PATCH] =?UTF-8?q?refactor(=E6=95=B0=E6=8D=AE=E5=A4=A7=E5=B1=8F):?= =?UTF-8?q?=20=E6=95=B0=E6=8D=AE=E5=A4=A7=E5=B1=8F=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E6=89=B9=E9=87=8F=E9=9A=90=E8=97=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../canvas/ContextMenuDetails.vue | 16 ++++++++++++++-- .../store/modules/data-visualization/layer.ts | 7 +++++++ 2 files changed, 21 insertions(+), 2 deletions(-) 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) // 隐藏