Merge pull request #3861 from dataease/pr@dev@fix_link_down

fix(公共链接): 下载pdf缺失图片
This commit is contained in:
wisonic-s 2022-11-24 18:22:15 +08:00 committed by GitHub
commit 69780dd3cf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 8 deletions

View File

@ -1,10 +1,6 @@
<template> <template>
<div <div
:id="previewMainDomId" :id="previewMainDomId"
v-loading="dataLoading"
:element-loading-text="$t('panel.data_loading')"
element-loading-spinner="el-icon-loading"
element-loading-background="rgba(220,220,220,1)"
class="bg" class="bg"
:style="customStyle" :style="customStyle"
@scroll="canvasScroll" @scroll="canvasScroll"
@ -618,7 +614,8 @@ export default {
}, },
downloadAsPDF() { downloadAsPDF() {
this.dataLoading = true this.dataLoading = true
const domId = this.canvasInfoTemp this.$emit('change-load-status', true)
const domId = this.previewMainDomId
setTimeout(() => { setTimeout(() => {
this.exporting = true this.exporting = true
this.backScreenShot = true this.backScreenShot = true
@ -629,6 +626,7 @@ export default {
html2canvas(document.getElementById(domId)).then(canvas => { html2canvas(document.getElementById(domId)).then(canvas => {
const snapshot = canvas.toDataURL('image/jpeg', 1) // const snapshot = canvas.toDataURL('image/jpeg', 1) //
this.dataLoading = false this.dataLoading = false
this.$emit('change-load-status', false)
this.exporting = false this.exporting = false
this.backScreenShot = false this.backScreenShot = false
if (snapshot !== '') { if (snapshot !== '') {
@ -636,7 +634,7 @@ export default {
this.pdfExportShow = true this.pdfExportShow = true
} }
}) })
}, 1500) }, 2500)
}, 500) }, 500)
}, },
closePreExport() { closePreExport() {

View File

@ -1,11 +1,18 @@
<template> <template>
<div style="width: 100%;height: 100vh;background-color: #f7f8fa"> <div
v-loading="dataLoading"
style="width: 100%;height: 100vh;background-color: #f7f8fa"
:element-loading-text="$t('panel.data_loading')"
element-loading-spinner="el-icon-loading"
element-loading-background="rgba(220,220,220,1)"
>
<Preview <Preview
v-if="show" v-if="show"
:component-data="mainCanvasComponentData" :component-data="mainCanvasComponentData"
:canvas-style-data="canvasStyleData" :canvas-style-data="canvasStyleData"
:panel-info="panelInfo" :panel-info="panelInfo"
:user-id="user" :user-id="user"
@change-load-status="setLoading"
/> />
</div> </div>
</template> </template>
@ -38,7 +45,8 @@ export default {
return { return {
canvasId: 'canvas-main', canvasId: 'canvas-main',
show: false, show: false,
panelInfo: {} panelInfo: {},
dataLoading: false
} }
}, },
computed: { computed: {
@ -55,6 +63,9 @@ export default {
this.viewLog() this.viewLog()
}, },
methods: { methods: {
setLoading(status) {
this.dataLoading = !!status
},
viewLog() { viewLog() {
const param = { const param = {
panelId: this.resourceId, panelId: this.resourceId,