From 70cf1a60082734dc0d864508378dc83645bbbb3c Mon Sep 17 00:00:00 2001 From: dataeaseShu Date: Thu, 7 Mar 2024 18:42:14 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E4=BB=AA=E8=A1=A8=E6=9D=BF):=20=E7=A7=BB?= =?UTF-8?q?=E5=8A=A8=E7=AB=AF=E5=B8=83=E5=B1=80=E5=A4=8D=E5=88=B6=E5=B7=B2?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=87=B3=E5=B8=83=E5=B1=80=E4=B8=AD=E7=9A=84?= =?UTF-8?q?=E5=9B=BE=E8=A1=A8=E4=BC=9A=E7=9B=B4=E6=8E=A5=E8=BF=9B=E5=85=A5?= =?UTF-8?q?=E5=B7=A6=E4=BE=A7=E6=97=A0=E9=9C=80=E5=86=8D=E5=B8=83=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/views/dashboard/MobileConfigPanel.vue | 32 ++++++++++++++++--- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/core/core-frontend/src/views/dashboard/MobileConfigPanel.vue b/core/core-frontend/src/views/dashboard/MobileConfigPanel.vue index fffbd75ff9..c33fbfbf21 100644 --- a/core/core-frontend/src/views/dashboard/MobileConfigPanel.vue +++ b/core/core-frontend/src/views/dashboard/MobileConfigPanel.vue @@ -2,12 +2,14 @@ import { ref, onMounted, unref, onBeforeUnmount, computed } from 'vue' import { ElMessage, ElMessageBox } from 'element-plus-secondary' import MobileBackgroundSelector from './MobileBackgroundSelector.vue' +import { findById } from '@/api/visualization/dataVisualization' import ComponentWrapper from '@/components/data-visualization/canvas/ComponentWrapper.vue' import { snapshotStoreWithOut } from '@/store/modules/data-visualization/snapshot' import { canvasSave } from '@/utils/canvasUtils' import { useEmitt } from '@/hooks/web/useEmitt' import { dvMainStoreWithOut } from '@/store/modules/data-visualization/dvMain' import { storeToRefs } from 'pinia' + const dvMainStore = dvMainStoreWithOut() const { componentData, canvasStyleData, canvasViewInfo, dvInfo } = storeToRefs(dvMainStore) const mobileLoading = ref(true) @@ -36,6 +38,9 @@ const mobileStatusChange = (type, value) => { } const handleLoad = () => { + componentData.value.forEach(ele => { + ele.inMobile = canvasDataPreview.includes(ele.id) + }) mobileStatusChange( 'panelInit', JSON.parse( @@ -57,8 +62,7 @@ const componentDataNotInMobile = computed(() => { const hanedleMessage = event => { if (event.data.type === 'panelInit') { - mobileLoading.value = false - handleLoad() + loadCanvasData() } if (event.data.type === 'delFromMobile') { @@ -94,7 +98,6 @@ const hanedleMessage = event => { } } }) - saveCanvasWithCheckFromMobile() } } @@ -105,6 +108,22 @@ const saveCanvasWithCheckFromMobile = () => { ElMessage.success('保存成功') }) } +let canvasDataPreview = [] +const loadCanvasData = () => { + findById(dvInfo.value.id, 'dashboard') + .then(res => { + const canvasInfo = res.data + const canvasDataResult = JSON.parse(canvasInfo.componentData) as unknown as Array<{ + inMobile: boolean + id: string + }> + canvasDataPreview = (canvasDataResult || []).filter(ele => !!ele.inMobile).map(ele => ele.id) + handleLoad() + }) + .finally(() => { + mobileLoading.value = false + }) +} onMounted(() => { window.addEventListener('message', hanedleMessage) dvMainStore.setMobileInPc(true) @@ -184,7 +203,12 @@ const save = () => { - +