forked from github/dataease
refactor(仪表板): excel导出按钮防止重复点击#4925
This commit is contained in:
parent
9497e1db33
commit
2a111c4aa4
@ -115,6 +115,7 @@
|
|||||||
v-if="showChartInfoType==='enlarge' && hasDataPermission('export',panelInfo.privileges)&& showChartInfo && showChartInfo.type !== 'symbol-map'"
|
v-if="showChartInfoType==='enlarge' && hasDataPermission('export',panelInfo.privileges)&& showChartInfo && showChartInfo.type !== 'symbol-map'"
|
||||||
class="el-icon-picture-outline"
|
class="el-icon-picture-outline"
|
||||||
size="mini"
|
size="mini"
|
||||||
|
:disabled="imageDownloading"
|
||||||
@click="exportViewImg"
|
@click="exportViewImg"
|
||||||
>
|
>
|
||||||
{{ $t('chart.export_img') }}
|
{{ $t('chart.export_img') }}
|
||||||
@ -122,6 +123,7 @@
|
|||||||
<el-button
|
<el-button
|
||||||
v-if="showChartInfoType==='details'&& hasDataPermission('export',panelInfo.privileges)"
|
v-if="showChartInfoType==='details'&& hasDataPermission('export',panelInfo.privileges)"
|
||||||
size="mini"
|
size="mini"
|
||||||
|
:disabled="$store.getters.loadingMap[$store.getters.currentPath]"
|
||||||
@click="exportExcel"
|
@click="exportExcel"
|
||||||
>
|
>
|
||||||
<svg-icon
|
<svg-icon
|
||||||
@ -234,6 +236,7 @@ export default {
|
|||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
imageDownloading: false,
|
||||||
chartDetailsVisible: false,
|
chartDetailsVisible: false,
|
||||||
showChartInfo: {},
|
showChartInfo: {},
|
||||||
showChartTableInfo: {},
|
showChartTableInfo: {},
|
||||||
@ -697,7 +700,10 @@ export default {
|
|||||||
this.$refs['userViewDialog-canvas-main'].exportExcel()
|
this.$refs['userViewDialog-canvas-main'].exportExcel()
|
||||||
},
|
},
|
||||||
exportViewImg() {
|
exportViewImg() {
|
||||||
this.$refs['userViewDialog-canvas-main'].exportViewImg()
|
this.imageDownloading = true
|
||||||
|
this.$refs['userViewDialog-canvas-main'].exportViewImg(()=>{
|
||||||
|
this.imageDownloading = false
|
||||||
|
})
|
||||||
},
|
},
|
||||||
deselectCurComponent(e) {
|
deselectCurComponent(e) {
|
||||||
if (!this.isClickComponent) {
|
if (!this.isClickComponent) {
|
||||||
|
@ -144,6 +144,7 @@
|
|||||||
v-if="showChartInfoType==='enlarge' && hasDataPermission('export',panelInfo.privileges)&& showChartInfo && showChartInfo.type !== 'symbol-map'"
|
v-if="showChartInfoType==='enlarge' && hasDataPermission('export',panelInfo.privileges)&& showChartInfo && showChartInfo.type !== 'symbol-map'"
|
||||||
class="el-icon-picture-outline"
|
class="el-icon-picture-outline"
|
||||||
size="mini"
|
size="mini"
|
||||||
|
:disabled ="imageDownloading"
|
||||||
@click="exportViewImg"
|
@click="exportViewImg"
|
||||||
>
|
>
|
||||||
{{ $t('chart.export_img') }}
|
{{ $t('chart.export_img') }}
|
||||||
@ -151,6 +152,7 @@
|
|||||||
<el-button
|
<el-button
|
||||||
v-if="showChartInfoType==='details' && hasDataPermission('export',panelInfo.privileges)"
|
v-if="showChartInfoType==='details' && hasDataPermission('export',panelInfo.privileges)"
|
||||||
size="mini"
|
size="mini"
|
||||||
|
:disabled="$store.getters.loadingMap[$store.getters.currentPath]"
|
||||||
@click="exportExcel"
|
@click="exportExcel"
|
||||||
>
|
>
|
||||||
<svg-icon
|
<svg-icon
|
||||||
@ -306,6 +308,7 @@ export default {
|
|||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
imageDownloading: false,
|
||||||
innerRefreshTimer: null,
|
innerRefreshTimer: null,
|
||||||
mobileChartDetailsVisible: false,
|
mobileChartDetailsVisible: false,
|
||||||
chartDetailsVisible: false,
|
chartDetailsVisible: false,
|
||||||
@ -601,7 +604,10 @@ export default {
|
|||||||
this.$refs['userViewDialog'].exportExcel()
|
this.$refs['userViewDialog'].exportExcel()
|
||||||
},
|
},
|
||||||
exportViewImg() {
|
exportViewImg() {
|
||||||
this.$refs['userViewDialog'].exportViewImg()
|
this.imageDownloading = true
|
||||||
|
this.$refs['userViewDialog'].exportViewImg(()=>{
|
||||||
|
this.imageDownloading = false
|
||||||
|
})
|
||||||
},
|
},
|
||||||
pluginEditHandler(e) {
|
pluginEditHandler(e) {
|
||||||
this.$emit('trigger-plugin-edit', { e, id: this.element.id })
|
this.$emit('trigger-plugin-edit', { e, id: this.element.id })
|
||||||
|
@ -254,8 +254,8 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
exportViewImg() {
|
exportViewImg(callback) {
|
||||||
exportImg(this.chart.name)
|
exportImg(this.chart.name,callback)
|
||||||
},
|
},
|
||||||
setLastMapChart(data) {
|
setLastMapChart(data) {
|
||||||
this.lastMapChart = JSON.parse(JSON.stringify(data))
|
this.lastMapChart = JSON.parse(JSON.stringify(data))
|
||||||
|
@ -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 canvasID = document.getElementById('chartCanvas')
|
||||||
const a = document.createElement('a')
|
const a = document.createElement('a')
|
||||||
html2canvas(canvasID).then(canvas => {
|
html2canvas(canvasID).then(canvas => {
|
||||||
@ -227,6 +227,9 @@ export function exportImg(imgName) {
|
|||||||
a.click()
|
a.click()
|
||||||
URL.revokeObjectURL(blob)
|
URL.revokeObjectURL(blob)
|
||||||
document.body.removeChild(a)
|
document.body.removeChild(a)
|
||||||
|
callback()
|
||||||
|
}).catch(() => {
|
||||||
|
callback()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user