mirror of
https://github.com/dataease/dataease.git
synced 2026-05-24 06:18:10 +08:00
Merge branch 'dev-v2' into pr@dev-v2_dzz
This commit is contained in:
@@ -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>
|
||||
|
||||
@@ -83,34 +83,40 @@ export const copyStore = defineStore('copy', {
|
||||
return
|
||||
}
|
||||
const dataArray = this.copyData.data
|
||||
dataArray.forEach(data => {
|
||||
if (dvInfo.value.type === 'dataV') {
|
||||
if (isMouse) {
|
||||
data.style.top = menuTop
|
||||
data.style.left = menuLeft
|
||||
} else {
|
||||
data.style.top += 10
|
||||
data.style.left += 10
|
||||
}
|
||||
|
||||
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 {
|
||||
// 向下移动一个高度矩阵单位
|
||||
data.y = data.y + data.sizeY
|
||||
}
|
||||
// 旧-新ID映射关系
|
||||
const idMap = {}
|
||||
const newComponent = deepCopyHelper(data, idMap)
|
||||
dvMainStore.addCopyComponent(newComponent, idMap, this.copyData.copyCanvasViewInfo)
|
||||
if (dvInfo.value.type === 'dashboard') {
|
||||
if (dvMainStore.multiplexingStyleAdapt && this.copyData.copyFrom === 'multiplexing') {
|
||||
adaptCurThemeCommonStyle(newComponent)
|
||||
const data = dataArray[i]
|
||||
if (dvInfo.value.type === 'dataV') {
|
||||
if (isMouse) {
|
||||
data.style.top = menuTop
|
||||
data.style.left = menuLeft
|
||||
} else {
|
||||
data.style.top += 10
|
||||
data.style.left += 10
|
||||
}
|
||||
} else {
|
||||
// 向下移动一个高度矩阵单位
|
||||
data.y = data.y + data.sizeY
|
||||
}
|
||||
eventBus.emit('addDashboardItem-' + newComponent.canvasId, newComponent)
|
||||
// 旧-新ID映射关系
|
||||
const idMap = {}
|
||||
const newComponent = deepCopyHelper(data, idMap)
|
||||
dvMainStore.addCopyComponent(newComponent, idMap, copyDataTemp.copyCanvasViewInfo)
|
||||
if (dvInfo.value.type === 'dashboard') {
|
||||
if (dvMainStore.multiplexingStyleAdapt && copyDataTemp.copyFrom === 'multiplexing') {
|
||||
adaptCurThemeCommonStyle(newComponent)
|
||||
}
|
||||
eventBus.emit('addDashboardItem-' + newComponent.canvasId, newComponent)
|
||||
}
|
||||
i++
|
||||
}
|
||||
})
|
||||
if (dvInfo.value.type === 'dashboard') {
|
||||
//占位优化 整合定位
|
||||
eventBus.emit('doCanvasInit-canvas-main')
|
||||
}
|
||||
}, moveTime)
|
||||
snapshotStore.recordSnapshotCache()
|
||||
},
|
||||
cut() {
|
||||
|
||||
Reference in New Issue
Block a user