refactor(仪表板): 外部组件移入Tab时放入最底端,防止影响之前布局

This commit is contained in:
wangjiahao 2024-08-14 11:00:46 +08:00
parent 60a4f07d37
commit 2b908ed44f

View File

@ -116,7 +116,7 @@ import { dvMainStoreWithOut } from '@/store/modules/data-visualization/dvMain'
import { storeToRefs } from 'pinia' import { storeToRefs } from 'pinia'
import { guid } from '@/views/visualized/data/dataset/form/util' import { guid } from '@/views/visualized/data/dataset/form/util'
import eventBus from '@/utils/eventBus' import eventBus from '@/utils/eventBus'
import { canvasChangeAdaptor, findComponentIndexById } from '@/utils/canvasUtils' import { canvasChangeAdaptor, findComponentIndexById, isDashboard } from '@/utils/canvasUtils'
import DeCustomTab from '@/custom-component/de-tabs/DeCustomTab.vue' import DeCustomTab from '@/custom-component/de-tabs/DeCustomTab.vue'
import DePreview from '@/components/data-visualization/canvas/DePreview.vue' import DePreview from '@/components/data-visualization/canvas/DePreview.vue'
import { useEmitt } from '@/hooks/web/useEmitt' import { useEmitt } from '@/hooks/web/useEmitt'
@ -281,14 +281,16 @@ const componentMoveIn = component => {
if (refInstance) { if (refInstance) {
const matrixBase = refInstance.getBaseMatrixSize() // const matrixBase = refInstance.getBaseMatrixSize() //
canvasChangeAdaptor(component, matrixBase) canvasChangeAdaptor(component, matrixBase)
component.x = 1
component.y = 200
component.style.left = 0
component.style.top = 0
tabItem.componentData.push(component) tabItem.componentData.push(component)
nextTick(() => { if (isDashboard()) {
component.x = 1 nextTick(() => {
component.y = 1 refInstance.addItemBox(component) //
component.style.left = 0 })
component.style.top = 0 }
refInstance.addItemBox(component) //
})
} }
} }
}) })