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() {
|
save() {
|
||||||
const _this = this
|
const _this = this
|
||||||
_this.exportLoading = true
|
_this.exportLoading = true
|
||||||
|
// 保存原始的设备像素比值
|
||||||
|
const originalDPR = window.devicePixelRatio
|
||||||
|
// 将设备像素比设置为1
|
||||||
|
window.devicePixelRatio = 2
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
_this.toExport = true
|
_this.toExport = true
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
@ -143,6 +147,7 @@ export default {
|
|||||||
PDF.addImage(pageData, 'JPEG', 0, 0, contentWidth, contentHeight)
|
PDF.addImage(pageData, 'JPEG', 0, 0, contentWidth, contentHeight)
|
||||||
PDF.save(_this.panelName + '.pdf')
|
PDF.save(_this.panelName + '.pdf')
|
||||||
_this.$emit('closePreExport')
|
_this.$emit('closePreExport')
|
||||||
|
window.devicePixelRatio = originalDPR
|
||||||
})
|
})
|
||||||
}, 1500)
|
}, 1500)
|
||||||
}, 500)
|
}, 500)
|
||||||
|
@ -462,8 +462,8 @@ export default {
|
|||||||
imageWrapperStyle() {
|
imageWrapperStyle() {
|
||||||
if (this.exporting) {
|
if (this.exporting) {
|
||||||
return {
|
return {
|
||||||
width: '1280px',
|
width: '2560px',
|
||||||
height: '720px'
|
height: '1440px'
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
@ -720,6 +720,10 @@ export default {
|
|||||||
|
|
||||||
downloadAsImage() {
|
downloadAsImage() {
|
||||||
this.dataLoading = true
|
this.dataLoading = true
|
||||||
|
// 保存原始的设备像素比值
|
||||||
|
const originalDPR = window.devicePixelRatio
|
||||||
|
// 将设备像素比设置为1
|
||||||
|
window.devicePixelRatio = 2
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.exporting = this.changeExportingState()
|
this.exporting = this.changeExportingState()
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
@ -738,6 +742,7 @@ export default {
|
|||||||
a.click()
|
a.click()
|
||||||
URL.revokeObjectURL(blob)
|
URL.revokeObjectURL(blob)
|
||||||
document.body.removeChild(a)
|
document.body.removeChild(a)
|
||||||
|
window.devicePixelRatio = originalDPR
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.dataLoading = false
|
this.dataLoading = false
|
||||||
}, 300)
|
}, 300)
|
||||||
@ -750,7 +755,10 @@ export default {
|
|||||||
// this.pdfExportShow = true
|
// this.pdfExportShow = true
|
||||||
//
|
//
|
||||||
this.dataLoading = true
|
this.dataLoading = true
|
||||||
|
// 保存原始的设备像素比值
|
||||||
|
const originalDPR = window.devicePixelRatio
|
||||||
|
// 将设备像素比设置为1
|
||||||
|
window.devicePixelRatio = 2
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.exporting = this.changeExportingState()
|
this.exporting = this.changeExportingState()
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
@ -764,6 +772,7 @@ export default {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
}, 1500)
|
}, 1500)
|
||||||
|
window.devicePixelRatio = originalDPR
|
||||||
}, 500)
|
}, 500)
|
||||||
},
|
},
|
||||||
refreshTemplateInfo() {
|
refreshTemplateInfo() {
|
||||||
|
Loading…
Reference in New Issue
Block a user