Merge pull request #6427 from dataease/pr@dev-v2@refactor_matrix

refactor: 矩阵移动定位优化
This commit is contained in:
王嘉豪 2023-10-30 15:50:04 +08:00 committed by GitHub
commit 6d4a1e99b6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -83,7 +83,15 @@ export const copyStore = defineStore('copy', {
return
}
const dataArray = this.copyData.data
dataArray.forEach(data => {
let i = 0
const copyDataTemp = this.copyData
const moveTime = dataArray.length > 1 ? 300 : 10
const timeId = setInterval(function () {
if (i >= dataArray.length) {
clearInterval(timeId)
} else {
const data = dataArray[i]
if (dvInfo.value.type === 'dataV') {
if (isMouse) {
data.style.top = menuTop
@ -99,20 +107,16 @@ export const copyStore = defineStore('copy', {
// 旧-新ID映射关系
const idMap = {}
const newComponent = deepCopyHelper(data, idMap)
dvMainStore.addCopyComponent(newComponent, idMap, this.copyData.copyCanvasViewInfo)
dvMainStore.addCopyComponent(newComponent, idMap, copyDataTemp.copyCanvasViewInfo)
if (dvInfo.value.type === 'dashboard') {
if (dvMainStore.multiplexingStyleAdapt && this.copyData.copyFrom === 'multiplexing') {
if (dvMainStore.multiplexingStyleAdapt && copyDataTemp.copyFrom === 'multiplexing') {
adaptCurThemeCommonStyle(newComponent)
}
eventBus.emit('addDashboardItem-' + newComponent.canvasId, newComponent)
}
})
if (dvInfo.value.type === 'dashboard' && dataArray.length > 1) {
//占位优化 整合定位
setTimeout(() => {
eventBus.emit('doCanvasInit-canvas-main')
}, 1000)
i++
}
}, moveTime)
snapshotStore.recordSnapshotCache()
},
cut() {