From f75c57077eb56551eb59cd8d9a79ca21972041f6 Mon Sep 17 00:00:00 2001 From: wangjiahao <1522128093@qq.com> Date: Mon, 30 Oct 2023 15:26:39 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E4=BB=AA=E8=A1=A8?= =?UTF-8?q?=E6=9D=BF=E6=89=B9=E9=87=8F=E5=A4=8D=E5=88=B6=E5=8F=AF=E8=83=BD?= =?UTF-8?q?=E5=87=BA=E7=8E=B0=E7=9A=84=E9=87=8D=E5=90=88=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/dashboard/DbToolbar.vue | 13 +++++++++---- .../src/store/modules/data-visualization/copy.ts | 6 ++++-- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/core/core-frontend/src/components/dashboard/DbToolbar.vue b/core/core-frontend/src/components/dashboard/DbToolbar.vue index c6fe4756f4..9449b6f512 100644 --- a/core/core-frontend/src/components/dashboard/DbToolbar.vue +++ b/core/core-frontend/src/components/dashboard/DbToolbar.vue @@ -75,13 +75,17 @@ const closeEditCanvasName = () => { } const undo = () => { - snapshotStore.undo() - eventBus.emit('matrix-canvasInit', false) + if (snapshotIndex.value > 0) { + snapshotStore.undo() + eventBus.emit('matrix-canvasInit', false) + } } const redo = () => { - snapshotStore.redo() - eventBus.emit('matrix-canvasInit', false) + if (snapshotIndex.value !== snapshotStore.snapshotData.length - 1) { + snapshotStore.redo() + eventBus.emit('matrix-canvasInit', false) + } } const previewInner = () => { @@ -333,6 +337,7 @@ onMounted(() => { diff --git a/core/core-frontend/src/store/modules/data-visualization/copy.ts b/core/core-frontend/src/store/modules/data-visualization/copy.ts index 7bf6d6f98e..26bd184484 100644 --- a/core/core-frontend/src/store/modules/data-visualization/copy.ts +++ b/core/core-frontend/src/store/modules/data-visualization/copy.ts @@ -107,9 +107,11 @@ export const copyStore = defineStore('copy', { eventBus.emit('addDashboardItem-' + newComponent.canvasId, newComponent) } }) - if (dvInfo.value.type === 'dashboard') { + if (dvInfo.value.type === 'dashboard' && dataArray.length > 1) { //占位优化 整合定位 - eventBus.emit('doCanvasInit-canvas-main') + setTimeout(() => { + eventBus.emit('doCanvasInit-canvas-main') + }, 1000) } snapshotStore.recordSnapshotCache() },