diff --git a/core/core-frontend/src/components/data-visualization/canvas/Shape.vue b/core/core-frontend/src/components/data-visualization/canvas/Shape.vue index 027b9df466..687e8f6bcc 100644 --- a/core/core-frontend/src/components/data-visualization/canvas/Shape.vue +++ b/core/core-frontend/src/components/data-visualization/canvas/Shape.vue @@ -1107,12 +1107,14 @@ const dragCollision = computed(() => { const htmlToImage = () => { downLoading.value = true + useEmitt().emitter.emit('l7-prepare-picture', element.value.id) setTimeout(() => { activeWatermarkCheckUser(viewDemoInnerId.value, 'canvas-main', scale.value) downloadCanvas2('img', componentInnerRef.value, '图表', () => { // do callback removeActiveWatermark(viewDemoInnerId.value) downLoading.value = false + useEmitt().emitter.emit('l7-unprepare-picture', element.value.id) }) }, 200) } diff --git a/core/core-frontend/src/components/visualization/UserViewEnlarge.vue b/core/core-frontend/src/components/visualization/UserViewEnlarge.vue index 3e13f52384..e8eb8fbed4 100644 --- a/core/core-frontend/src/components/visualization/UserViewEnlarge.vue +++ b/core/core-frontend/src/components/visualization/UserViewEnlarge.vue @@ -420,9 +420,12 @@ const openMessageLoading = cb => { customClass }) } +// 地图 +const mapChartTypes = ['bubble-map', 'flow-map', 'heat-map', 'map', 'symbolic-map'] const htmlToImage = () => { - downLoading.value = true + downLoading.value = mapChartTypes.includes(viewInfo.value.type) ? false : true useEmitt().emitter.emit('renderChart-' + viewInfo.value.id) + useEmitt().emitter.emit('l7-prepare-picture', viewInfo.value.id) // 表格和支持最值图表的渲染时间为2000毫秒,其他图表为500毫秒。 const renderTime = viewInfo.value.type?.includes('table') || @@ -438,12 +441,14 @@ const htmlToImage = () => { a.setAttribute('download', viewInfo.value.title) a.href = dataUrl a.click() + useEmitt().emitter.emit('l7-unprepare-picture', viewInfo.value.id) useEmitt().emitter.emit('renderChart-' + viewInfo.value.id) initWatermark() }) .catch(error => { downLoading.value = false initWatermark() + useEmitt().emitter.emit('l7-unprepare-picture', viewInfo.value.id) useEmitt().emitter.emit('renderChart-' + viewInfo.value.id) console.error('oops, something went wrong!', error) }) diff --git a/core/core-frontend/src/views/dashboard/DashboardPreviewShow.vue b/core/core-frontend/src/views/dashboard/DashboardPreviewShow.vue index 940befd60c..d97274f19e 100644 --- a/core/core-frontend/src/views/dashboard/DashboardPreviewShow.vue +++ b/core/core-frontend/src/views/dashboard/DashboardPreviewShow.vue @@ -115,13 +115,20 @@ const loadCanvasData = (dvId, weight?) => { } ) } - +// 地图类图表,需要预先准备图片 +const mapChartTypes = ['bubble-map', 'flow-map', 'heat-map', 'map', 'symbolic-map'] const downloadH2 = type => { downloadStatus.value = true + const mapElementIds = + state.canvasDataPreview + ?.filter(ele => mapChartTypes.includes(ele.innerType)) + .map(ele => ele.id) || [] + mapElementIds.forEach(id => useEmitt().emitter.emit('l7-prepare-picture', id)) nextTick(() => { const vueDom = previewCanvasContainer.value.querySelector('.canvas-container') downloadCanvas2(type, vueDom, state.dvInfo.name, () => { downloadStatus.value = false + mapElementIds.forEach(id => useEmitt().emitter.emit('l7-unprepare-picture', id)) }) }) }