From 6e099a34424ff973a647e06112946b454aca7b05 Mon Sep 17 00:00:00 2001 From: wangjiahao <1522128093@qq.com> Date: Tue, 5 Nov 2024 20:56:22 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E4=BB=AA=E8=A1=A8=E6=9D=BF):=20=E4=BF=AE?= =?UTF-8?q?=E5=A4=8Dtab=E7=A7=BB=E5=87=BA=E5=9C=A8=E4=BB=AA=E8=A1=A8?= =?UTF-8?q?=E6=9D=BF=E5=8F=AF=E8=83=BD=E5=87=BA=E7=8E=B0=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E9=87=8D=E5=8F=A0=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/data-visualization/canvas/CanvasCore.vue | 7 ++++++- .../src/custom-component/de-tabs/Component.vue | 3 ++- core/core-frontend/src/views/canvas/DeCanvas.vue | 7 +++++++ 3 files changed, 15 insertions(+), 2 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 ecd562365f..6857004247 100644 --- a/core/core-frontend/src/components/data-visualization/canvas/CanvasCore.vue +++ b/core/core-frontend/src/components/data-visualization/canvas/CanvasCore.vue @@ -349,7 +349,7 @@ const coordinates = ref([]) //坐标点集合 let lastTask = undefined let isOverlay = false //是否正在交换位置 -let moveTime = 200 //移动动画时间 +let moveTime = 100 //移动动画时间 const itemMaxY = ref(0) let itemMaxX = 0 @@ -874,6 +874,11 @@ function removeItemById(componentId) { removeItem(index) } }) + if (!isMainCanvas(canvasId.value)) { + nextTick(() => { + canvasInit() + }) + } } } diff --git a/core/core-frontend/src/custom-component/de-tabs/Component.vue b/core/core-frontend/src/custom-component/de-tabs/Component.vue index 5c5177dfd8..3d21ea46b8 100644 --- a/core/core-frontend/src/custom-component/de-tabs/Component.vue +++ b/core/core-frontend/src/custom-component/de-tabs/Component.vue @@ -335,8 +335,9 @@ const componentMoveIn = component => { component.style.left = 0 component.style.top = 0 tabItem.componentData.push(component) + refInstance.addItemBox(component) //在适当的时候初始化布局组件 nextTick(() => { - refInstance.addItemBox(component) //在适当的时候初始化布局组件 + refInstance.canvasInitImmediately() }) } } else { diff --git a/core/core-frontend/src/views/canvas/DeCanvas.vue b/core/core-frontend/src/views/canvas/DeCanvas.vue index dc13acdaf0..dc023710f4 100644 --- a/core/core-frontend/src/views/canvas/DeCanvas.vue +++ b/core/core-frontend/src/views/canvas/DeCanvas.vue @@ -133,6 +133,10 @@ const handleMouseDown = e => { } } +const canvasInitImmediately = () => { + cyGridster.value.canvasInit() +} + const canvasInit = (isFistLoad = true) => { if (canvasActive.value) { renderState.value = true @@ -218,6 +222,7 @@ const moveOutFromTab = component => { componentData: componentData.value }) addItemBox(component) + canvasInit() }, 500) } @@ -272,6 +277,8 @@ watch( defineExpose({ addItemBox, + canvasInit, + canvasInitImmediately, getBaseMatrixSize })