fix(公共链接): 下载pdf缺失图片

This commit is contained in:
fit2cloud-chenyw 2022-11-24 18:14:06 +08:00
parent 4f9f0fb12e
commit 8dec16b918
2 changed files with 17 additions and 8 deletions

View File

@ -1,10 +1,6 @@
<template>
<div
: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"
:style="customStyle"
@scroll="canvasScroll"
@ -614,7 +610,8 @@ export default {
},
downloadAsPDF() {
this.dataLoading = true
const domId = this.canvasInfoTemp
this.$emit('change-load-status', true)
const domId = this.previewMainDomId
setTimeout(() => {
this.exporting = true
this.backScreenShot = true
@ -625,6 +622,7 @@ export default {
html2canvas(document.getElementById(domId)).then(canvas => {
const snapshot = canvas.toDataURL('image/jpeg', 1) //
this.dataLoading = false
this.$emit('change-load-status', false)
this.exporting = false
this.backScreenShot = false
if (snapshot !== '') {
@ -632,7 +630,7 @@ export default {
this.pdfExportShow = true
}
})
}, 1500)
}, 2500)
}, 500)
},
closePreExport() {

View File

@ -1,11 +1,18 @@
<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
v-if="show"
:component-data="mainCanvasComponentData"
:canvas-style-data="canvasStyleData"
:panel-info="panelInfo"
:user-id="user"
@change-load-status="setLoading"
/>
</div>
</template>
@ -38,7 +45,8 @@ export default {
return {
canvasId: 'canvas-main',
show: false,
panelInfo: {}
panelInfo: {},
dataLoading: false
}
},
computed: {
@ -55,6 +63,9 @@ export default {
this.viewLog()
},
methods: {
setLoading(status) {
this.dataLoading = !!status
},
viewLog() {
const param = {
panelId: this.resourceId,