forked from github/dataease
Merge pull request #7940 from dataease/pr@dev@refacto_img-download
refactor(仪表板): 固定导出仪表板图片的默认像素比,优化不同设备的导出图片的清晰度差异
This commit is contained in:
commit
9467f3f80a
@ -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)
|
||||
|
@ -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() {
|
||||
|
Loading…
Reference in New Issue
Block a user