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() },