From caaaeab417ca1090c72b47148f51658b9aac66c9 Mon Sep 17 00:00:00 2001 From: limengnan <420004014@qq.com> Date: Tue, 24 Jun 2025 11:31:58 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=89=8D=E7=AB=AFsrc/views/d?= =?UTF-8?q?ata-visualization=E7=9B=AE=E5=BD=95=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MultiplexPreviewShow.vue | 4 +- .../data-visualization/PreviewCanvas.vue | 77 ++++++++++++++---- .../PreviewCanvasMobile.vue | 37 ++++++--- .../views/data-visualization/PreviewHead.vue | 21 ++++- .../src/views/data-visualization/index.vue | 81 ++++++++++++------- 5 files changed, 161 insertions(+), 59 deletions(-) diff --git a/core/core-frontend/src/views/data-visualization/MultiplexPreviewShow.vue b/core/core-frontend/src/views/data-visualization/MultiplexPreviewShow.vue index 7430064..ef443ff 100644 --- a/core/core-frontend/src/views/data-visualization/MultiplexPreviewShow.vue +++ b/core/core-frontend/src/views/data-visualization/MultiplexPreviewShow.vue @@ -129,7 +129,7 @@ const init = () => { componentData.value?.forEach(item => { curMultiplexTargetComponentsInfo.value.push({ id: item.id, - label: item.label, + label: item.name, icon: item.icon, multiplexActive: false, component: item.component @@ -580,7 +580,7 @@ span { .wrapper-content { width: 100%; height: 100%; - background-size: 100% 100% !important; + background-size: 100% 100% !important; } } :deep(.ed-tree){ diff --git a/core/core-frontend/src/views/data-visualization/PreviewCanvas.vue b/core/core-frontend/src/views/data-visualization/PreviewCanvas.vue index e85f462..6d1af1a 100644 --- a/core/core-frontend/src/views/data-visualization/PreviewCanvas.vue +++ b/core/core-frontend/src/views/data-visualization/PreviewCanvas.vue @@ -17,6 +17,8 @@ import { downloadCanvas2 } from '@/utils/imgUtils' import { isLink, setTitle } from '@/utils/utils' import EmptyBackground from '../../components/empty-background/src/EmptyBackground.vue' import { useRoute } from 'vue-router' +import { filterEnumMapSync } from '@/utils/componentUtils' +import CanvasOptBar from '@/components/visualization/CanvasOptBar.vue' const routeWatch = useRoute() const dvMainStore = dvMainStoreWithOut() @@ -31,7 +33,12 @@ const state = reactive({ dvInfo: null, curPreviewGap: 0, initState: true, - showPosition: null + editPreview: false, + showPosition: 'preview', + showOffset: { + top: 3, + left: 3 + } }) const props = defineProps({ @@ -57,7 +64,8 @@ const loadCanvasDataAsync = async (dvId, dvType, ignoreParams = false) => { sourceDvId: jumpParam.sourceDvId, sourceViewId: jumpParam.sourceViewId, sourceFieldId: null, - targetDvId: dvId + targetDvId: dvId, + resourceTable: state.editPreview ? 'snapshot' : 'core' } try { // 刷新跳转目标仪表板联动信息 @@ -111,34 +119,45 @@ const loadCanvasDataAsync = async (dvId, dvType, ignoreParams = false) => { await initCanvasData( dvId, - dvType, - function ({ + { busiFlag: dvType, resourceTable: state.editPreview ? 'snapshot' : 'core' }, + async function ({ canvasDataResult, canvasStyleResult, dvInfo, canvasViewInfoPreview, curPreviewGap }) { + state.dvInfo = dvInfo + if (state.dvInfo.status) { + if (jumpParam || (!ignoreParams && attachParam)) { + await filterEnumMapSync(canvasDataResult) + } + } state.canvasDataPreview = canvasDataResult state.canvasStylePreview = canvasStyleResult state.canvasViewInfoPreview = canvasViewInfoPreview - state.dvInfo = dvInfo + if (state.editPreview) { + state.dvInfo.status = 1 + } state.curPreviewGap = curPreviewGap - if (jumpParam) { - dvMainStore.addViewTrackFilter(jumpParam) - } - if (!ignoreParams) { - state.initState = false - dvMainStore.addOuterParamsFilter(attachParam) - state.initState = true + if (state.dvInfo.status) { + if (jumpParam) { + dvMainStore.addViewTrackFilter(jumpParam) + } + if (!ignoreParams) { + state.initState = false + dvMainStore.addOuterParamsFilter(attachParam) + state.initState = true + } } + if (props.publicLinkStatus) { // 设置浏览器title为当前仪表板名称 document.title = dvInfo.name setTitle(dvInfo.name) } initBrowserTimer() - nextTick(() => { + await nextTick(() => { onInitReady({ resourceId: dvId }) }) } @@ -165,7 +184,9 @@ watch( ) let p = null +let p1 = null const XpackLoaded = () => p(true) +const initIframe = () => p1(true) onMounted(async () => { useEmitt({ name: 'canvasDownload', @@ -173,14 +194,19 @@ onMounted(async () => { downloadH2(type) } }) - await new Promise(r => (p = r)) - const dvId = embeddedStore.dvId || router.currentRoute.value.query.dvId + await Promise.all([new Promise(r => (p = r)), new Promise(r => (p1 = r))]) + let dvId = embeddedStore.dvId || router.currentRoute.value.query.dvId + if (router.currentRoute.value.query.jumpInfoParam && router.currentRoute.value.query.dvId) { + dvId = router.currentRoute.value.query.dvId + } // 检查外部参数 const ignoreParams = router.currentRoute.value.query.ignoreParams === 'true' const isPopWindow = router.currentRoute.value.query.popWindow === 'true' const isFrameFlag = window.self !== window.top + state.editPreview = router.currentRoute.value.query.editPreview === 'true' dvMainStore.setIframeFlag(isFrameFlag) dvMainStore.setIsPopWindow(isPopWindow) + state.showPosition = state.editPreview ? 'edit-preview' : 'preview' const { dvType, callBackFlag, taskId, showWatermark } = router.currentRoute.value.query if (!!taskId) { dvMainStore.setCanvasAttachInfo({ taskId, showWatermark }) @@ -197,6 +223,11 @@ const dataVKeepSize = computed(() => { return state.canvasStylePreview?.screenAdaptor === 'keep' }) +const freezeStyle = computed(() => [ + { '--top-show-offset': state.showOffset.top }, + { '--left-show-offset': state.showOffset.left } +]) + defineExpose({ loadCanvasDataAsync }) @@ -208,7 +239,14 @@ defineExpose({ v-loading="!state.initState" :class="{ 'canvas_keep-size': dataVKeepSize }" ref="previewCanvasContainer" + :style="freezeStyle" > + + +