@@ -7,7 +13,7 @@
{{ $t('commons.cancel') }}
- 导出PDF
+ {{ $t('panel.export_pdf') }}
@@ -36,6 +42,7 @@ export default {
},
data() {
return {
+ exportLoading: false,
activeName: '',
templateContentChange: '',
time: '',
@@ -82,15 +89,20 @@ export default {
},
save() {
const _this = this
- html2canvas(document.getElementById('exportPdf')).then(function(canvas) {
- const contentWidth = canvas.width
- const contentHeight = canvas.height
- const pageData = canvas.toDataURL('image/jpeg', 1.0)
- const PDF = new JsPDF('l', 'px', [contentWidth, contentHeight])
- PDF.addImage(pageData, 'JPEG', 0, 0, contentWidth, contentHeight)
- PDF.save(_this.panelName + '.pdf')
- }
- )
+ _this.exportLoading = true
+ setTimeout(() => {
+ html2canvas(document.getElementById('exportPdf')).then(function(canvas) {
+ _this.exportLoading = false
+ const contentWidth = canvas.width
+ const contentHeight = canvas.height
+ const pageData = canvas.toDataURL('image/jpeg', 1.0)
+ const PDF = new JsPDF('l', 'px', [contentWidth, contentHeight])
+ PDF.addImage(pageData, 'JPEG', 0, 0, contentWidth, contentHeight)
+ PDF.save(_this.panelName + '.pdf')
+ _this.$emit('closePreExport')
+ }
+ )
+ }, 50)
}
}
diff --git a/frontend/src/views/panel/list/PanelViewShow.vue b/frontend/src/views/panel/list/PanelViewShow.vue
index 623cdfd0d7..5f0535aa92 100644
--- a/frontend/src/views/panel/list/PanelViewShow.vue
+++ b/frontend/src/views/panel/list/PanelViewShow.vue
@@ -1,5 +1,11 @@
-
+
@@ -132,7 +138,8 @@ export default {
fullscreen: false,
pdfExportShow: false,
snapshotInfo: '',
- isShare: false
+ isShare: false,
+ dataLoading: false
}
},
computed: {
@@ -183,50 +190,62 @@ export default {
window.open(url, '_blank')
},
saveToTemplate() {
- this.templateSaveShow = true
- html2canvas(document.getElementById('canvasInfoTemp')).then(canvas => {
- const snapshot = canvas.toDataURL('image/jpeg', 0.1) // 0.2是图片质量
- if (snapshot !== '') {
- this.templateInfo = {
- name: this.$store.state.panel.panelInfo.name,
- snapshot: snapshot,
- templateStyle: JSON.stringify(this.canvasStyleData),
- templateData: JSON.stringify(this.componentData),
- templateType: 'self',
- nodeType: 'template',
- level: 1,
- pid: null,
- dynamicData: ''
+ this.dataLoading = true
+ setTimeout(() => {
+ html2canvas(document.getElementById('canvasInfoTemp')).then(canvas => {
+ this.templateSaveShow = true
+ this.dataLoading = false
+ const snapshot = canvas.toDataURL('image/jpeg', 0.1) // 0.2是图片质量
+ if (snapshot !== '') {
+ this.templateInfo = {
+ name: this.$store.state.panel.panelInfo.name,
+ snapshot: snapshot,
+ templateStyle: JSON.stringify(this.canvasStyleData),
+ templateData: JSON.stringify(this.componentData),
+ templateType: 'self',
+ nodeType: 'template',
+ level: 1,
+ pid: null,
+ dynamicData: ''
+ }
}
- }
- })
+ })
+ }, 50)
},
downloadToTemplate() {
- html2canvas(document.getElementById('canvasInfoTemp')).then(canvas => {
- const snapshot = canvas.toDataURL('image/jpeg', 0.1) // 0.2是图片质量
- if (snapshot !== '') {
- this.templateInfo = {
- name: this.$store.state.panel.panelInfo.name,
- templateType: 'self',
- snapshot: snapshot,
- panelStyle: JSON.stringify(this.canvasStyleData),
- panelData: JSON.stringify(this.componentData),
- dynamicData: ''
+ this.dataLoading = true
+ setTimeout(() => {
+ html2canvas(document.getElementById('canvasInfoTemp')).then(canvas => {
+ this.dataLoading = false
+ const snapshot = canvas.toDataURL('image/jpeg', 0.1) // 0.2是图片质量
+ if (snapshot !== '') {
+ this.templateInfo = {
+ name: this.$store.state.panel.panelInfo.name,
+ templateType: 'self',
+ snapshot: snapshot,
+ panelStyle: JSON.stringify(this.canvasStyleData),
+ panelData: JSON.stringify(this.componentData),
+ dynamicData: ''
+ }
+ const blob = new Blob([JSON.stringify(this.templateInfo)], { type: '' })
+ FileSaver.saveAs(blob, this.$store.state.panel.panelInfo.name + '-TEMPLATE.DE')
}
- const blob = new Blob([JSON.stringify(this.templateInfo)], { type: '' })
- FileSaver.saveAs(blob, this.$store.state.panel.panelInfo.name + '-TEMPLATE.DE')
- }
- })
+ })
+ }, 50)
},
downloadAsPDF() {
- html2canvas(document.getElementById('canvasInfoTemp')).then(canvas => {
- const snapshot = canvas.toDataURL('image/jpeg', 1) // 0.2是图片质量
- if (snapshot !== '') {
- this.snapshotInfo = snapshot
- this.pdfExportShow = true
- }
- })
+ this.dataLoading = true
+ setTimeout(() => {
+ html2canvas(document.getElementById('canvasInfoTemp')).then(canvas => {
+ const snapshot = canvas.toDataURL('image/jpeg', 1) // 是图片质量
+ this.dataLoading = false
+ if (snapshot !== '') {
+ this.snapshotInfo = snapshot
+ this.pdfExportShow = true
+ }
+ })
+ }, 50)
},
refreshTemplateInfo() {
this.templateInfo = {}