From 2a111c4aa48f949ff575cc0ef5863d0d3963638e Mon Sep 17 00:00:00 2001 From: ziyujiahao <1522128093@qq.com> Date: Fri, 31 Mar 2023 16:14:05 +0800 Subject: [PATCH] =?UTF-8?q?refactor(=E4=BB=AA=E8=A1=A8=E6=9D=BF):=20excel?= =?UTF-8?q?=E5=AF=BC=E5=87=BA=E6=8C=89=E9=92=AE=E9=98=B2=E6=AD=A2=E9=87=8D?= =?UTF-8?q?=E5=A4=8D=E7=82=B9=E5=87=BB#4925?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/canvas/components/editor/Preview.vue | 8 +++++++- .../src/components/canvas/customComponent/UserView.vue | 8 +++++++- .../components/canvas/customComponent/UserViewDialog.vue | 4 ++-- frontend/src/components/canvas/utils/utils.js | 5 ++++- 4 files changed, 20 insertions(+), 5 deletions(-) diff --git a/frontend/src/components/canvas/components/editor/Preview.vue b/frontend/src/components/canvas/components/editor/Preview.vue index 2e67e3ef24..214679c9d8 100644 --- a/frontend/src/components/canvas/components/editor/Preview.vue +++ b/frontend/src/components/canvas/components/editor/Preview.vue @@ -115,6 +115,7 @@ v-if="showChartInfoType==='enlarge' && hasDataPermission('export',panelInfo.privileges)&& showChartInfo && showChartInfo.type !== 'symbol-map'" class="el-icon-picture-outline" size="mini" + :disabled="imageDownloading" @click="exportViewImg" > {{ $t('chart.export_img') }} @@ -122,6 +123,7 @@ { + this.imageDownloading = false + }) }, deselectCurComponent(e) { if (!this.isClickComponent) { diff --git a/frontend/src/components/canvas/customComponent/UserView.vue b/frontend/src/components/canvas/customComponent/UserView.vue index e5de90d083..f4f5e244b9 100644 --- a/frontend/src/components/canvas/customComponent/UserView.vue +++ b/frontend/src/components/canvas/customComponent/UserView.vue @@ -144,6 +144,7 @@ v-if="showChartInfoType==='enlarge' && hasDataPermission('export',panelInfo.privileges)&& showChartInfo && showChartInfo.type !== 'symbol-map'" class="el-icon-picture-outline" size="mini" + :disabled ="imageDownloading" @click="exportViewImg" > {{ $t('chart.export_img') }} @@ -151,6 +152,7 @@ { + this.imageDownloading = false + }) }, pluginEditHandler(e) { this.$emit('trigger-plugin-edit', { e, id: this.element.id }) diff --git a/frontend/src/components/canvas/customComponent/UserViewDialog.vue b/frontend/src/components/canvas/customComponent/UserViewDialog.vue index cd958b81aa..9dfeda1a2a 100644 --- a/frontend/src/components/canvas/customComponent/UserViewDialog.vue +++ b/frontend/src/components/canvas/customComponent/UserViewDialog.vue @@ -254,8 +254,8 @@ export default { } } }, - exportViewImg() { - exportImg(this.chart.name) + exportViewImg(callback) { + exportImg(this.chart.name,callback) }, setLastMapChart(data) { this.lastMapChart = JSON.parse(JSON.stringify(data)) diff --git a/frontend/src/components/canvas/utils/utils.js b/frontend/src/components/canvas/utils/utils.js index 76647d2c5c..ff651c0dc8 100644 --- a/frontend/src/components/canvas/utils/utils.js +++ b/frontend/src/components/canvas/utils/utils.js @@ -212,7 +212,7 @@ export function checkViewTitle(opt, id, tile) { } } -export function exportImg(imgName) { +export function exportImg(imgName,callback) { const canvasID = document.getElementById('chartCanvas') const a = document.createElement('a') html2canvas(canvasID).then(canvas => { @@ -227,6 +227,9 @@ export function exportImg(imgName) { a.click() URL.revokeObjectURL(blob) document.body.removeChild(a) + callback() + }).catch(() => { + callback() }) }