fix(数据大屏): 修复组合移动在大屏那已经存在组合的情况下容易出现拖拽轨迹的问题

This commit is contained in:
wangjiahao 2024-04-18 10:01:55 +08:00
parent 07cf91cb32
commit 63d690e019

View File

@ -216,11 +216,10 @@ watch(
)
watch(
() => areaData.value.components,
() => {
() => areaData.value.components.length,
(val, oldVal) => {
groupAreaClickChange()
},
{ deep: true }
}
)
const initWatermark = (waterDomId = 'editor-canvas-main') => {
@ -1359,9 +1358,9 @@ const contextMenuShow = computed(() => {
const markLineShow = computed(() => isMainCanvas(canvasId.value))
//
const groupAreaClickChange = () => {
const groupAreaClickChange = async () => {
let groupAreaCom
const groupAreaHis = componentData.value.filter(ele => ele.id === 100000001)
const groupAreaHis = dvMainStore.componentData.filter(ele => ele.component === 'GroupArea')
if (groupAreaHis && groupAreaHis.length > 0) {
groupAreaCom = groupAreaHis[0]
}
@ -1369,7 +1368,8 @@ const groupAreaClickChange = () => {
if (areaData.value.components.length > 1) {
//
composeStore.calcComposeArea()
if (!groupAreaCom) {
const hist2 = dvMainStore.componentData.filter(ele => ele.component === 'GroupArea')
if (groupAreaHis.length === 0) {
//
groupAreaCom = findNewComponent('GroupArea', 'GroupArea')
dvMainStore.addComponent({ component: groupAreaCom, index: undefined })
@ -1379,7 +1379,9 @@ const groupAreaClickChange = () => {
groupAreaCom.style.width = areaData.value.style.width
groupAreaCom.style.height = areaData.value.style.height
} else if (groupAreaCom) {
dvMainStore.deleteComponentById(100000001)
groupAreaHis.forEach(ele => {
dvMainStore.deleteComponentById(ele.id)
})
}
}