fix: 修复仪表板批量复制可能出现的重合问题

This commit is contained in:
wangjiahao 2023-10-30 15:26:39 +08:00
parent d470e2b1c9
commit f75c57077e
2 changed files with 13 additions and 6 deletions

View File

@ -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(() => {
<el-icon
class="toolbar-hover-icon"
:class="{ 'toolbar-icon-disabled': snapshotIndex < 1 }"
:disabled="snapshotIndex < 1"
@click="undo()"
>
<Icon name="icon_undo_outlined"></Icon>

View File

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