fix(数据大屏): 修复部分大屏应用后组件位置有变化问题

This commit is contained in:
wangjiahao 2024-06-03 15:43:15 +08:00
parent 4b40ccc521
commit a4d7978953
2 changed files with 8 additions and 6 deletions

View File

@ -152,7 +152,7 @@ export function initCanvasDataPrepare(dvId, busiFlag, callBack) {
})
}
export function initCanvasData(dvId, busiFlag, callBack) {
export async function initCanvasData(dvId, busiFlag, callBack) {
initCanvasDataPrepare(
dvId,
busiFlag,

View File

@ -79,7 +79,7 @@ const dvLayout = ref(null)
const canvasCenterRef = ref(null)
const state = reactive({
datasetTree: [],
scaleHistory: 100,
scaleHistory: null,
canvasId: 'canvas-main',
canvasInitStatus: false,
sourcePid: null,
@ -204,10 +204,10 @@ const doUseCache = flag => {
}
}
const initLocalCanvasData = () => {
const initLocalCanvasData = async () => {
const { opt, sourcePid, resourceId } = state
const busiFlg = opt === 'copy' ? 'dataV-copy' : 'dataV'
initCanvasData(resourceId, busiFlg, function () {
await initCanvasData(resourceId, busiFlg, function () {
state.canvasInitStatus = true
// afterInit
nextTick(() => {
@ -238,7 +238,9 @@ watch(
() => editMode.value,
val => {
if (val === 'edit') {
canvasStyleData.value.scale = state.scaleHistory
if (state.scaleHistory) {
canvasStyleData.value.scale = state.scaleHistory
}
initScroll()
} else {
previewScaleChange()
@ -288,7 +290,7 @@ onMounted(async () => {
if (canvasCache) {
canvasCacheOutRef.value?.dialogInit({ canvasType: 'dataV', resourceId: dvId })
} else {
initLocalCanvasData()
await initLocalCanvasData()
}
} else if (opt && opt === 'create') {
state.canvasInitStatus = false