Merge pull request #9431 from dataease/pr@dev@refactor_export-details

refactor(仪表板): 公共链接禁用导出明细等问题
This commit is contained in:
王嘉豪 2024-04-29 10:42:35 +08:00 committed by GitHub
commit 68faeaea59
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 17 additions and 3 deletions

View File

@ -169,6 +169,17 @@
class="ds-icon-excel"
/>{{ $t('chart.export') }}Excel
</el-button>
<el-button
v-if="showChartInfoType==='details' && !userId && hasDataPermission('export',panelInfo.privileges)"
size="mini"
:disabled="$store.getters.loadingMap[$store.getters.currentPath] || dialogLoading"
@click="exportSourceDetails"
>
<svg-icon
icon-class="ds-excel"
class="ds-icon-excel"
/>{{ $t('chart.export_source') }}
</el-button>
</span>
<user-view-dialog
v-if="chartDetailsVisible"
@ -865,6 +876,9 @@ export default {
exportExcel() {
this.$refs['userViewDialog-canvas-main'].exportExcel()
},
exportSourceDetails() {
this.$refs['userViewDialog-canvas-main'].exportExcel()
},
exportViewImg() {
this.imageDownloading = true
this.$refs['userViewDialog-canvas-main'].exportViewImg(this.pixel, () => {

View File

@ -204,7 +204,7 @@
</el-button>
<el-button
v-if="showChartInfoType==='details' && hasDataPermission('export',panelInfo.privileges)"
v-if="showChartInfoType==='details' && !userId && hasDataPermission('export',panelInfo.privileges)"
size="mini"
:disabled="$store.getters.loadingMap[$store.getters.currentPath] || dialogLoading"
@click="exportSourceDetails"

View File

@ -536,7 +536,7 @@ export function exportExcelDownload(chart, snapshot, width, height, loadingWrapp
let method = innerExportDetails
const token = store.getters.token || getToken()
const linkToken = store.getters.linkToken || getLinkToken()
if (!token && linkToken) {
if (linkToken) {
method = exportDetails
loadingWrapper && (loadingWrapper.val = true)
}
@ -545,7 +545,7 @@ export function exportExcelDownload(chart, snapshot, width, height, loadingWrapp
request.proxy = { userId: panelInfo.proxy }
}
method(request).then((res) => {
if (!token && linkToken) {
if (linkToken) {
const blob = new Blob([res], { type: 'application/vnd.ms-excel' })
const link = document.createElement('a')
link.style.display = 'none'