From 984463d62bf3bdeafdcf90d0f6bfb017cc1962ba Mon Sep 17 00:00:00 2001 From: dataeaseShu Date: Tue, 24 Sep 2024 10:33:28 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E5=B5=8C=E5=85=A5=E5=BC=8F):=20=E5=90=8C?= =?UTF-8?q?=E4=B8=80=E4=B8=AA=E9=A1=B5=E9=9D=A2=E4=B8=8A=EF=BC=8C=E5=B5=8C?= =?UTF-8?q?=E5=85=A5=E6=9D=A5=E8=87=AA=E4=B8=8D=E5=90=8C=E4=BB=AA=E8=A1=A8?= =?UTF-8?q?=E6=9D=BF=E6=88=96=E6=95=B0=E6=8D=AE=E5=A4=A7=E5=B1=8F=E7=9A=84?= =?UTF-8?q?=E5=9B=BE=E8=A1=A8=EF=BC=8C=E4=BB=85=E8=83=BD=E6=B8=B2=E6=9F=93?= =?UTF-8?q?=E5=87=BA=E4=B8=80=E4=B8=AA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/pages/panel/ViewWrapper.vue | 24 ++++++++++--------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/core/core-frontend/src/pages/panel/ViewWrapper.vue b/core/core-frontend/src/pages/panel/ViewWrapper.vue index 509abf2033..31296b686d 100644 --- a/core/core-frontend/src/pages/panel/ViewWrapper.vue +++ b/core/core-frontend/src/pages/panel/ViewWrapper.vue @@ -13,7 +13,7 @@ import { XpackComponent } from '@/components/plugin' const { wsCache } = useCache() const interactiveStore = interactiveStoreWithOut() const embeddedStore = useEmbedded() -const embeddedParams = inject('embeddedParams') as object +const embeddedParamsDiv = inject('embeddedParams') as object const config = ref() const viewInfo = ref() const userViewEnlargeRef = ref() @@ -28,6 +28,8 @@ const state = reactive({ chartId: null }) +const embeddedParams = embeddedParamsDiv?.chartId ? embeddedParamsDiv : embeddedStore + // 目标校验: 需要校验targetSourceId 是否是当前可视化资源ID const winMsgHandle = event => { const msgInfo = event.data @@ -44,29 +46,29 @@ const checkPer = async resourceId => { if (!window.DataEaseBi || !resourceId) { return true } - const request = { busiFlag: embeddedStore.busiFlag } + const request = { busiFlag: embeddedParams.busiFlag } await interactiveStore.setInteractive(request) - const key = embeddedStore.busiFlag === 'dataV' ? 'screen-weight' : 'panel-weight' + const key = embeddedParams.busiFlag === 'dataV' ? 'screen-weight' : 'panel-weight' return check(wsCache.get(key), resourceId, 1) } onBeforeMount(async () => { - const checkResult = await checkPer(embeddedStore.dvId) + const checkResult = await checkPer(embeddedParams.dvId) if (!checkResult) { return } - state.chartId = embeddedStore.dvId + state.chartId = embeddedParams.dvId window.addEventListener('message', winMsgHandle) // 添加外部参数 let attachParams - await getOuterParamsInfo(embeddedStore.dvId).then(rsp => { + await getOuterParamsInfo(embeddedParams.dvId).then(rsp => { dvMainStore.setNowPanelOuterParamsInfo(rsp.data) }) // div嵌入 - if (embeddedStore.outerParams) { + if (embeddedParams.outerParams) { try { - const outerPramsParse = JSON.parse(embeddedStore.outerParams) + const outerPramsParse = JSON.parse(embeddedParams.outerParams) attachParams = outerPramsParse.attachParams dvMainStore.setEmbeddedCallBack(outerPramsParse.callBackFlag || 'no') } catch (e) { @@ -75,11 +77,11 @@ onBeforeMount(async () => { return } } - const chartId = embeddedParams?.chartId || embeddedStore.chartId + const chartId = embeddedParams?.chartId initCanvasData( - embeddedStore.dvId, - embeddedStore.busiFlag, + embeddedParams.dvId, + embeddedParams.busiFlag, function ({ canvasDataResult, canvasStyleResult, dvInfo, canvasViewInfoPreview }) { state.canvasDataPreview = canvasDataResult state.canvasStylePreview = canvasStyleResult