forked from github/dataease
fix(公共连接): 导出excel没有遮罩没有按钮失效
This commit is contained in:
parent
955ec94fdf
commit
5d99219c7c
@ -144,7 +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"
|
:disabled="imageDownloading"
|
||||||
@click="exportViewImg"
|
@click="exportViewImg"
|
||||||
>
|
>
|
||||||
{{ $t('chart.export_img') }}
|
{{ $t('chart.export_img') }}
|
||||||
@ -152,7 +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]"
|
:disabled="$store.getters.loadingMap[$store.getters.currentPath] || dialogLoading"
|
||||||
@click="exportExcel"
|
@click="exportExcel"
|
||||||
>
|
>
|
||||||
<svg-icon
|
<svg-icon
|
||||||
@ -308,6 +308,7 @@ export default {
|
|||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
dialogLoading: false,
|
||||||
imageDownloading: false,
|
imageDownloading: false,
|
||||||
innerRefreshTimer: null,
|
innerRefreshTimer: null,
|
||||||
mobileChartDetailsVisible: false,
|
mobileChartDetailsVisible: false,
|
||||||
@ -601,7 +602,10 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
exportExcel() {
|
exportExcel() {
|
||||||
this.$refs['userViewDialog'].exportExcel()
|
this.dialogLoading = true
|
||||||
|
this.$refs['userViewDialog'].exportExcel(() => {
|
||||||
|
this.dialogLoading = false
|
||||||
|
})
|
||||||
},
|
},
|
||||||
exportViewImg() {
|
exportViewImg() {
|
||||||
this.imageDownloading = true
|
this.imageDownloading = true
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<de-container
|
<de-container
|
||||||
v-loading="$store.getters.loadingMap[$store.getters.currentPath]"
|
v-loading="$store.getters.loadingMap[$store.getters.currentPath] || linkLoading"
|
||||||
:class="isAbsoluteContainer ? 'abs-container' : ''"
|
:class="isAbsoluteContainer ? 'abs-container' : ''"
|
||||||
>
|
>
|
||||||
<de-main-container
|
<de-main-container
|
||||||
@ -120,7 +120,8 @@ export default {
|
|||||||
return {
|
return {
|
||||||
refId: null,
|
refId: null,
|
||||||
element: {},
|
element: {},
|
||||||
lastMapChart: null
|
lastMapChart: null,
|
||||||
|
linkLoading: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@ -239,28 +240,28 @@ export default {
|
|||||||
mounted() {
|
mounted() {
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
exportExcel() {
|
exportExcel(callBack) {
|
||||||
const _this = this
|
const _this = this
|
||||||
if (this.isOnlyDetails) {
|
if (this.isOnlyDetails) {
|
||||||
_this.exportExcelDownload()
|
_this.exportExcelDownload(null, null, null, callBack)
|
||||||
} else {
|
} else {
|
||||||
if (this.showChartCanvas) {
|
if (this.showChartCanvas) {
|
||||||
html2canvas(document.getElementById('chartCanvas')).then(canvas => {
|
html2canvas(document.getElementById('chartCanvas')).then(canvas => {
|
||||||
const snapshot = canvas.toDataURL('image/jpeg', 1)
|
const snapshot = canvas.toDataURL('image/jpeg', 1)
|
||||||
_this.exportExcelDownload(snapshot, canvas.width, canvas.height)
|
_this.exportExcelDownload(snapshot, canvas.width, canvas.height, callBack)
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
_this.exportExcelDownload()
|
_this.exportExcelDownload(null, null, null, callBack)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
exportViewImg(callback) {
|
exportViewImg(callback) {
|
||||||
exportImg(this.chart.name,callback)
|
exportImg(this.chart.name, callback)
|
||||||
},
|
},
|
||||||
setLastMapChart(data) {
|
setLastMapChart(data) {
|
||||||
this.lastMapChart = JSON.parse(JSON.stringify(data))
|
this.lastMapChart = JSON.parse(JSON.stringify(data))
|
||||||
},
|
},
|
||||||
exportExcelDownload(snapshot, width, height) {
|
exportExcelDownload(snapshot, width, height, callBack) {
|
||||||
const excelHeader = JSON.parse(JSON.stringify(this.chart.data.fields)).map(item => item.name)
|
const excelHeader = JSON.parse(JSON.stringify(this.chart.data.fields)).map(item => item.name)
|
||||||
const excelTypes = JSON.parse(JSON.stringify(this.chart.data.fields)).map(item => item.deType)
|
const excelTypes = JSON.parse(JSON.stringify(this.chart.data.fields)).map(item => item.deType)
|
||||||
const excelHeaderKeys = JSON.parse(JSON.stringify(this.chart.data.fields)).map(item => item.dataeaseName)
|
const excelHeaderKeys = JSON.parse(JSON.stringify(this.chart.data.fields)).map(item => item.dataeaseName)
|
||||||
@ -291,7 +292,7 @@ export default {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
const request = {
|
const request = {
|
||||||
proxy:null,
|
proxy: null,
|
||||||
viewId: this.chart.id,
|
viewId: this.chart.id,
|
||||||
viewName: excelName,
|
viewName: excelName,
|
||||||
header: excelHeader,
|
header: excelHeader,
|
||||||
@ -309,6 +310,7 @@ export default {
|
|||||||
const linkToken = this.$store.getters.linkToken || getLinkToken()
|
const linkToken = this.$store.getters.linkToken || getLinkToken()
|
||||||
if (!token && linkToken) {
|
if (!token && linkToken) {
|
||||||
method = exportDetails
|
method = exportDetails
|
||||||
|
this.linkLoading = true
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.panelInfo.proxy) {
|
if (this.panelInfo.proxy) {
|
||||||
@ -323,6 +325,11 @@ export default {
|
|||||||
document.body.appendChild(link)
|
document.body.appendChild(link)
|
||||||
link.click()
|
link.click()
|
||||||
document.body.removeChild(link)
|
document.body.removeChild(link)
|
||||||
|
this.linkLoading = false
|
||||||
|
callBack && callBack()
|
||||||
|
}).catch(() => {
|
||||||
|
this.linkLoading = false
|
||||||
|
callBack && callBack()
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user