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() }) }