From c4fad7881f1cf667f5653cf6d36bdc16ef981267 Mon Sep 17 00:00:00 2001 From: jianneng-fit2cloud Date: Thu, 27 Feb 2025 18:32:11 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E5=9B=BE=E8=A1=A8):=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E5=9C=A8=E7=BC=96=E8=BE=91=E5=9B=BE=E8=A1=A8=E6=97=B6=EF=BC=8C?= =?UTF-8?q?=E6=94=BE=E5=A4=A7=E5=9B=BE=E8=A1=A8=E5=90=8E=E5=88=B0=E5=A4=84?= =?UTF-8?q?=E5=9B=BE=E7=89=87=E4=B8=8D=E6=90=BA=E5=B8=A6=E6=9C=80=E5=80=BC?= =?UTF-8?q?=E6=A0=87=E7=AD=BE=E7=9A=84=E9=97=AE=E9=A2=98=EF=BC=8C=E4=BB=A5?= =?UTF-8?q?=E5=8F=8A=E6=94=BE=E5=A4=A7=E5=90=8E=E5=85=B3=E9=97=AD=EF=BC=8C?= =?UTF-8?q?=E5=9C=A8=E5=9B=BE=E8=A1=A8=E5=8F=B3=E4=BE=A7=E5=AF=BC=E5=87=BA?= =?UTF-8?q?=E5=9B=BE=E7=89=87=E4=B8=8D=E6=88=90=E5=8A=9F=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../data-visualization/canvas/ComponentWrapper.vue | 10 ++++------ .../src/components/data-visualization/canvas/Shape.vue | 10 ++++------ .../src/components/visualization/UserViewEnlarge.vue | 8 +++++++- .../src/views/chart/components/js/extremumUitl.ts | 2 +- 4 files changed, 16 insertions(+), 14 deletions(-) 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) }