From 63d690e019894b18ddf90a7ad729e6330f49f2a6 Mon Sep 17 00:00:00 2001 From: wangjiahao <1522128093@qq.com> Date: Thu, 18 Apr 2024 10:01:55 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=95=B0=E6=8D=AE=E5=A4=A7=E5=B1=8F):=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=BB=84=E5=90=88=E7=A7=BB=E5=8A=A8=E5=9C=A8?= =?UTF-8?q?=E5=A4=A7=E5=B1=8F=E9=82=A3=E5=B7=B2=E7=BB=8F=E5=AD=98=E5=9C=A8?= =?UTF-8?q?=E7=BB=84=E5=90=88=E7=9A=84=E6=83=85=E5=86=B5=E4=B8=8B=E5=AE=B9?= =?UTF-8?q?=E6=98=93=E5=87=BA=E7=8E=B0=E6=8B=96=E6=8B=BD=E8=BD=A8=E8=BF=B9?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../data-visualization/canvas/CanvasCore.vue | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/core/core-frontend/src/components/data-visualization/canvas/CanvasCore.vue b/core/core-frontend/src/components/data-visualization/canvas/CanvasCore.vue index 0da24a385e..6521d3c225 100644 --- a/core/core-frontend/src/components/data-visualization/canvas/CanvasCore.vue +++ b/core/core-frontend/src/components/data-visualization/canvas/CanvasCore.vue @@ -216,11 +216,10 @@ watch( ) watch( - () => areaData.value.components, - () => { + () => areaData.value.components.length, + (val, oldVal) => { groupAreaClickChange() - }, - { deep: true } + } ) const initWatermark = (waterDomId = 'editor-canvas-main') => { @@ -1359,9 +1358,9 @@ const contextMenuShow = computed(() => { const markLineShow = computed(() => isMainCanvas(canvasId.value)) // 点击事件导致选择区域变更 -const groupAreaClickChange = () => { +const groupAreaClickChange = async () => { let groupAreaCom - const groupAreaHis = componentData.value.filter(ele => ele.id === 100000001) + const groupAreaHis = dvMainStore.componentData.filter(ele => ele.component === 'GroupArea') if (groupAreaHis && groupAreaHis.length > 0) { groupAreaCom = groupAreaHis[0] } @@ -1369,7 +1368,8 @@ const groupAreaClickChange = () => { if (areaData.value.components.length > 1) { // 重新计算边界 composeStore.calcComposeArea() - if (!groupAreaCom) { + const hist2 = dvMainStore.componentData.filter(ele => ele.component === 'GroupArea') + if (groupAreaHis.length === 0) { // 如果不存在 新建视括组件 groupAreaCom = findNewComponent('GroupArea', 'GroupArea') dvMainStore.addComponent({ component: groupAreaCom, index: undefined }) @@ -1379,7 +1379,9 @@ const groupAreaClickChange = () => { groupAreaCom.style.width = areaData.value.style.width groupAreaCom.style.height = areaData.value.style.height } else if (groupAreaCom) { - dvMainStore.deleteComponentById(100000001) + groupAreaHis.forEach(ele => { + dvMainStore.deleteComponentById(ele.id) + }) } }