diff --git a/core/core-frontend/src/components/data-visualization/canvas/ComponentWrapper.vue b/core/core-frontend/src/components/data-visualization/canvas/ComponentWrapper.vue index 601daf7c89..e6dd2b8801 100644 --- a/core/core-frontend/src/components/data-visualization/canvas/ComponentWrapper.vue +++ b/core/core-frontend/src/components/data-visualization/canvas/ComponentWrapper.vue @@ -171,13 +171,11 @@ const handleInnerMouseDown = e => { onMounted(() => { currentInstance = getCurrentInstance() const methodName = 'componentImageDownload-' + config.value.id - useEmitt().emitter.off(methodName) - useEmitt({ - name: methodName, - callback: () => { + if (!useEmitt().emitter.all.get(methodName)?.length) { + useEmitt().emitter.on(methodName, () => { htmlToImage() - } - }) + }) + } }) const onClick = e => { 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 57e25d988d..027b9df466 100644 --- a/core/core-frontend/src/components/data-visualization/canvas/Shape.vue +++ b/core/core-frontend/src/components/data-visualization/canvas/Shape.vue @@ -1138,13 +1138,11 @@ onMounted(() => { }) settingAttribute() const methodName = 'componentImageDownload-' + element.value.id - useEmitt().emitter.off(methodName) - useEmitt({ - name: methodName, - callback: () => { + if (!useEmitt().emitter.all.get(methodName)?.length) { + useEmitt().emitter.on(methodName, () => { htmlToImage() - } - }) + }) + } }) diff --git a/core/core-frontend/src/components/visualization/UserViewEnlarge.vue b/core/core-frontend/src/components/visualization/UserViewEnlarge.vue index b26b140f42..3e13f52384 100644 --- a/core/core-frontend/src/components/visualization/UserViewEnlarge.vue +++ b/core/core-frontend/src/components/visualization/UserViewEnlarge.vue @@ -181,6 +181,7 @@ import { activeWatermarkCheckUser } from '@/components/watermark/watermark' import { getCanvasStyle } from '@/utils/style' import { exportPermission } from '@/utils/utils' import EmptyBackground from '../empty-background/src/EmptyBackground.vue' +import { supportExtremumChartType } from '@/views/chart/components/js/extremumUitl' const downLoading = ref(false) const dvMainStore = dvMainStoreWithOut() const dialogShow = ref(false) @@ -422,7 +423,12 @@ const openMessageLoading = cb => { const htmlToImage = () => { downLoading.value = true useEmitt().emitter.emit('renderChart-' + viewInfo.value.id) - const renderTime = viewInfo.value.type?.includes('table') ? 2000 : 500 + // 表格和支持最值图表的渲染时间为2000毫秒,其他图表为500毫秒。 + const renderTime = + viewInfo.value.type?.includes('table') || + supportExtremumChartType({ type: viewInfo.value.type }) + ? 2000 + : 500 setTimeout(() => { initWatermark() toPng(viewContainer.value) diff --git a/core/core-frontend/src/views/chart/components/js/extremumUitl.ts b/core/core-frontend/src/views/chart/components/js/extremumUitl.ts index f3efd025f5..e72176af04 100644 --- a/core/core-frontend/src/views/chart/components/js/extremumUitl.ts +++ b/core/core-frontend/src/views/chart/components/js/extremumUitl.ts @@ -109,7 +109,7 @@ const noChildrenFieldChart = chart => { * 支持最值图表的折线图,面积图,柱状图,分组柱状图 * @param chart */ -const supportExtremumChartType = chart => { +export const supportExtremumChartType = chart => { return ['line', 'area', 'bar', 'bar-group'].includes(chart.type) }