diff --git a/core/core-frontend/src/utils/canvasUtils.ts b/core/core-frontend/src/utils/canvasUtils.ts index a59498aa2f..d1ff7e2468 100644 --- a/core/core-frontend/src/utils/canvasUtils.ts +++ b/core/core-frontend/src/utils/canvasUtils.ts @@ -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, diff --git a/core/core-frontend/src/views/data-visualization/index.vue b/core/core-frontend/src/views/data-visualization/index.vue index fc3775cbda..2f58c0be5f 100644 --- a/core/core-frontend/src/views/data-visualization/index.vue +++ b/core/core-frontend/src/views/data-visualization/index.vue @@ -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