From 39de69248d06b94b1a5e884c12640ccbe2ef267b Mon Sep 17 00:00:00 2001 From: wisonic Date: Mon, 29 Jul 2024 18:24:12 +0800 Subject: [PATCH] =?UTF-8?q?refactor(=E5=9B=BE=E8=A1=A8):=20=E9=80=8F?= =?UTF-8?q?=E8=A7=86=E8=A1=A8=E6=A0=91=E5=BD=A2=E6=A8=A1=E5=BC=8F=E6=9A=82?= =?UTF-8?q?=E4=B8=8D=E6=94=AF=E6=8C=81=E5=B8=A6=E6=A0=BC=E5=BC=8F=E5=AF=BC?= =?UTF-8?q?=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../visualization/ComponentEditBar.vue | 16 ++++++++++++++-- .../components/visualization/UserViewEnlarge.vue | 9 +++++++-- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/core/core-frontend/src/components/visualization/ComponentEditBar.vue b/core/core-frontend/src/components/visualization/ComponentEditBar.vue index dc75986ba2..4a77ec67dd 100644 --- a/core/core-frontend/src/components/visualization/ComponentEditBar.vue +++ b/core/core-frontend/src/components/visualization/ComponentEditBar.vue @@ -117,9 +117,13 @@ Excel Excel(带格式) + Excel(带格式) + 图片 @@ -147,9 +151,11 @@ Excel Excel(带格式) + Excel(带格式) + 图片 @@ -386,6 +392,12 @@ const exportAsFormattedExcel = () => { const chart = dvMainStore.getViewDetails(element.value.id) exportPivotExcel(s2Instance, chart) } + +const enableFormattedExport = computed(() => { + const chart = dvMainStore.getViewDetails(element.value.id) as ChartObj + const mode = chart?.customAttr?.basicStyle?.tableLayoutMode + return mode === 'grid' +}) const exportAsExcel = () => { const viewDataInfo = dvMainStore.getViewDataDetails(element.value.id) const chartExtRequest = dvMainStore.getLastViewRequestInfo(element.value.id) diff --git a/core/core-frontend/src/components/visualization/UserViewEnlarge.vue b/core/core-frontend/src/components/visualization/UserViewEnlarge.vue index 31aeb2d579..20e18c203d 100644 --- a/core/core-frontend/src/components/visualization/UserViewEnlarge.vue +++ b/core/core-frontend/src/components/visualization/UserViewEnlarge.vue @@ -52,9 +52,10 @@ icon="Download" size="middle" :loading="exportLoading" + :disabled="!enableFormattedExport" @click="exportAsFormattedExcel" > - 导出Excel(带格式) + 导出Excel(带格式) @@ -298,7 +299,11 @@ const exportAsFormattedExcel = () => { const chart = dvMainStore.getViewDetails(viewInfo.value.id) exportPivotExcel(s2Instance, chart) } - +const enableFormattedExport = computed(() => { + const chart = dvMainStore.getViewDetails(viewInfo.value.id) as ChartObj + const mode = chart?.customAttr?.basicStyle?.tableLayoutMode + return mode === 'grid' +}) const exportData = () => { useEmitt().emitter.emit('data-export-center', { activeName: 'IN_PROGRESS' }) }