From dff1297e317870a032978e2949a54c382a7d236a Mon Sep 17 00:00:00 2001 From: wangjiahao <1522128093@qq.com> Date: Wed, 31 Jan 2024 15:25:31 +0800 Subject: [PATCH] =?UTF-8?q?refactor(=E4=BB=AA=E8=A1=A8=E6=9D=BF):=20?= =?UTF-8?q?=E5=9B=BA=E5=AE=9A=E5=AF=BC=E5=87=BA=E4=BB=AA=E8=A1=A8=E6=9D=BF?= =?UTF-8?q?=E5=9B=BE=E7=89=87=E7=9A=84=E9=BB=98=E8=AE=A4=E5=83=8F=E7=B4=A0?= =?UTF-8?q?=E6=AF=94=EF=BC=8C=E4=BC=98=E5=8C=96=E4=B8=8D=E5=90=8C=E8=AE=BE?= =?UTF-8?q?=E5=A4=87=E7=9A=84=E5=AF=BC=E5=87=BA=E5=9B=BE=E7=89=87=E7=9A=84?= =?UTF-8?q?=E6=B8=85=E6=99=B0=E5=BA=A6=E5=B7=AE=E5=BC=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/views/panel/export/PDFPreExport.vue | 5 +++++ .../src/views/panel/list/PanelViewShow.vue | 15 ++++++++++++--- 2 files changed, 17 insertions(+), 3 deletions(-) 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() {