Merge pull request #6424 from dataease/pr@dev-v2@fix_panel

fix: 修复仪表板批量复制可能出现的重合问题
This commit is contained in:
王嘉豪 2023-10-30 15:27:43 +08:00 committed by GitHub
commit 063c38929f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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()
},