Merge pull request #13148 from dataease/pr@dev-v2@fix_tab-move

fix(仪表板): 修复tab移出在仪表板可能出现组件重叠问题
This commit is contained in:
王嘉豪
2024-11-05 20:58:04 +08:00
committed by GitHub
3 changed files with 15 additions and 2 deletions

View File

@@ -349,7 +349,7 @@ const coordinates = ref([]) //坐标点集合
let lastTask = undefined
let isOverlay = false //是否正在交换位置
let moveTime = 200 //移动动画时间
let moveTime = 100 //移动动画时间
const itemMaxY = ref(0)
let itemMaxX = 0
@@ -874,6 +874,11 @@ function removeItemById(componentId) {
removeItem(index)
}
})
if (!isMainCanvas(canvasId.value)) {
nextTick(() => {
canvasInit()
})
}
}
}

View File

@@ -335,8 +335,9 @@ const componentMoveIn = component => {
component.style.left = 0
component.style.top = 0
tabItem.componentData.push(component)
refInstance.addItemBox(component) //在适当的时候初始化布局组件
nextTick(() => {
refInstance.addItemBox(component) //在适当的时候初始化布局组件
refInstance.canvasInitImmediately()
})
}
} else {

View File

@@ -133,6 +133,10 @@ const handleMouseDown = e => {
}
}
const canvasInitImmediately = () => {
cyGridster.value.canvasInit()
}
const canvasInit = (isFistLoad = true) => {
if (canvasActive.value) {
renderState.value = true
@@ -218,6 +222,7 @@ const moveOutFromTab = component => {
componentData: componentData.value
})
addItemBox(component)
canvasInit()
}, 500)
}
@@ -272,6 +277,8 @@ watch(
defineExpose({
addItemBox,
canvasInit,
canvasInitImmediately,
getBaseMatrixSize
})
</script>