diff --git a/core/frontend/src/views/panel/export/PDFPreExport.vue b/core/frontend/src/views/panel/export/PDFPreExport.vue index 76e0a58f1e..4833962431 100644 --- a/core/frontend/src/views/panel/export/PDFPreExport.vue +++ b/core/frontend/src/views/panel/export/PDFPreExport.vue @@ -130,6 +130,10 @@ export default { save() { const _this = this _this.exportLoading = true + // 保存原始的设备像素比值 + const originalDPR = window.devicePixelRatio + // 将设备像素比设置为1 + window.devicePixelRatio = 2 setTimeout(() => { _this.toExport = true setTimeout(() => { @@ -143,6 +147,7 @@ export default { PDF.addImage(pageData, 'JPEG', 0, 0, contentWidth, contentHeight) PDF.save(_this.panelName + '.pdf') _this.$emit('closePreExport') + window.devicePixelRatio = originalDPR }) }, 1500) }, 500) diff --git a/core/frontend/src/views/panel/list/PanelViewShow.vue b/core/frontend/src/views/panel/list/PanelViewShow.vue index eb9ff7790d..74d504d65d 100644 --- a/core/frontend/src/views/panel/list/PanelViewShow.vue +++ b/core/frontend/src/views/panel/list/PanelViewShow.vue @@ -462,8 +462,8 @@ export default { imageWrapperStyle() { if (this.exporting) { return { - width: '1280px', - height: '720px' + width: '2560px', + height: '1440px' } } else { return { @@ -720,6 +720,10 @@ export default { downloadAsImage() { this.dataLoading = true + // 保存原始的设备像素比值 + const originalDPR = window.devicePixelRatio + // 将设备像素比设置为1 + window.devicePixelRatio = 2 setTimeout(() => { this.exporting = this.changeExportingState() setTimeout(() => { @@ -738,6 +742,7 @@ export default { a.click() URL.revokeObjectURL(blob) document.body.removeChild(a) + window.devicePixelRatio = originalDPR setTimeout(() => { this.dataLoading = false }, 300) @@ -750,7 +755,10 @@ export default { // this.pdfExportShow = true // this.dataLoading = true - + // 保存原始的设备像素比值 + const originalDPR = window.devicePixelRatio + // 将设备像素比设置为1 + window.devicePixelRatio = 2 setTimeout(() => { this.exporting = this.changeExportingState() setTimeout(() => { @@ -764,6 +772,7 @@ export default { } }) }, 1500) + window.devicePixelRatio = originalDPR }, 500) }, refreshTemplateInfo() {