From 645ed32e654780a556eae9175fbe30989498dc6f Mon Sep 17 00:00:00 2001 From: wangjiahao <1522128093@qq.com> Date: Thu, 29 May 2025 17:26:54 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E5=9B=BE=E8=A1=A8):=20=E5=9B=BE=E8=A1=A8?= =?UTF-8?q?=E7=9A=84=E6=95=B0=E6=8D=AE=E5=AF=BC=E5=87=BA=E5=90=8D=E7=A7=B0?= =?UTF-8?q?=E4=BC=98=E5=8C=96=EF=BC=8C=E7=94=A8"=E4=BB=AA=E8=A1=A8?= =?UTF-8?q?=E6=9D=BF=E5=90=8D+=E5=9B=BE=E8=A1=A8=E5=90=8D+=E6=97=B6?= =?UTF-8?q?=E9=97=B4=20#16126?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../visualization/ComponentEditBar.vue | 2 +- .../components/visualization/UserViewEnlarge.vue | 2 +- .../src/views/chart/components/js/util.ts | 16 ++++++++++++++-- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/core/core-frontend/src/components/visualization/ComponentEditBar.vue b/core/core-frontend/src/components/visualization/ComponentEditBar.vue index ea8b5ffd29..f507b1a747 100644 --- a/core/core-frontend/src/components/visualization/ComponentEditBar.vue +++ b/core/core-frontend/src/components/visualization/ComponentEditBar.vue @@ -479,7 +479,7 @@ const exportAsExcel = () => { const chartExtRequest = dvMainStore.getLastViewRequestInfo(element.value.id) const viewInfo = dvMainStore.getViewDetails(element.value.id) const chart = { ...viewInfo, chartExtRequest, data: viewDataInfo, busiFlag: dvInfo.value.type } - exportExcelDownload(chart, () => { + exportExcelDownload(chart, dvInfo.value.name, () => { openMessageLoading(callbackExport) }) } diff --git a/core/core-frontend/src/components/visualization/UserViewEnlarge.vue b/core/core-frontend/src/components/visualization/UserViewEnlarge.vue index 207bc7ee65..2c2be072f4 100644 --- a/core/core-frontend/src/components/visualization/UserViewEnlarge.vue +++ b/core/core-frontend/src/components/visualization/UserViewEnlarge.vue @@ -377,7 +377,7 @@ const downloadViewDetails = (downloadType = 'view') => { busiFlag: dvInfo.value.type } exportLoading.value = true - exportExcelDownload(chart, () => { + exportExcelDownload(chart, dvInfo.value.name, () => { openMessageLoading(exportData) }) exportLoading.value = false diff --git a/core/core-frontend/src/views/chart/components/js/util.ts b/core/core-frontend/src/views/chart/components/js/util.ts index a2919b8d59..f20a5fe9a2 100644 --- a/core/core-frontend/src/views/chart/components/js/util.ts +++ b/core/core-frontend/src/views/chart/components/js/util.ts @@ -547,8 +547,20 @@ const getExcelDownloadRequest = (data, type?) => { } } -export const exportExcelDownload = (chart, callBack?) => { - const excelName = chart.title +function getChartExcelTitle(preFix, viewTitle) { + const now = new Date() + const pad = n => n.toString().padStart(2, '0') + const year = now.getFullYear() + const month = pad(now.getMonth() + 1) // 月份从 0 开始 + const day = pad(now.getDate()) + const hour = pad(now.getHours()) + const minute = pad(now.getMinutes()) + const second = pad(now.getSeconds()) + return `${preFix}_${viewTitle}_${year}${month}${day}_${hour}${minute}${second}` +} + +export const exportExcelDownload = (chart, preFix, callBack?) => { + const excelName = getChartExcelTitle(preFix, chart.title) let request: any = { proxy: null, dvId: chart.sceneId,