Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
junjun 2022-11-30 17:23:12 +08:00
commit e719c97092

View File

@ -23,12 +23,14 @@
<el-button <el-button
size="mini" size="mini"
@click="cancel()" @click="cancel()"
>{{ $t('commons.cancel') }}</el-button> >{{ $t('commons.cancel') }}
</el-button>
<el-button <el-button
type="primary" type="primary"
size="mini" size="mini"
@click="save()" @click="save()"
>{{ $t('panel.export_pdf') }}</el-button> >{{ $t('panel.export_pdf') }}
</el-button>
</el-row> </el-row>
</el-row> </el-row>
</template> </template>
@ -41,7 +43,7 @@ import { pdfTemplateReplaceAll } from '@/utils/StringUtils.js'
export default { export default {
name: 'PDFPreExport', name: 'PDFPreExport',
components: { }, components: {},
props: { props: {
// eslint-disable-next-line vue/require-default-prop // eslint-disable-next-line vue/require-default-prop
panelName: { panelName: {
@ -131,16 +133,16 @@ export default {
_this.toExport = true _this.toExport = true
setTimeout(() => { setTimeout(() => {
html2canvas(document.getElementById('exportPdf')).then(function(canvas) { html2canvas(document.getElementById('exportPdf')).then(function(canvas) {
_this.exportLoading = false _this.exportLoading = false
const contentWidth = canvas.width const contentWidth = canvas.width / 4
const contentHeight = canvas.height const contentHeight = canvas.height / 4
const pageData = canvas.toDataURL('image/jpeg', 1.0) const pageData = canvas.toDataURL('image/jpeg', 1.0)
const lp = contentWidth > contentHeight ? 'l' : 'p' const lp = contentWidth > contentHeight ? 'l' : 'p'
const PDF = new JsPDF(lp, 'pt', [contentWidth, contentHeight]) const PDF = new JsPDF(lp, 'pt', [contentWidth, contentHeight])
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')
} }
) )
}, 1500) }, 1500)
}, 500) }, 500)
@ -151,17 +153,18 @@ export default {
</script> </script>
<style scoped> <style scoped>
.root_class { .root_class {
margin: 15px 0px 5px; margin: 15px 0px 5px;
text-align: center; text-align: center;
} }
.export_body_class{
border: 1px solid #dcdfe6 ;
height: 65vh;
overflow-y: auto;
}
.export_body_inner_class{ .export_body_class {
margin: 10px; border: 1px solid #dcdfe6;
} height: 65vh;
overflow-y: auto;
}
.export_body_inner_class {
margin: 10px;
}
</style> </style>