打印页面问题优化

This commit is contained in:
BianLzhaoMin 2024-08-14 13:06:44 +08:00
parent ada12001a0
commit d2067df999
2 changed files with 30 additions and 6 deletions

View File

@ -470,8 +470,8 @@
</el-dialog>
<!-- 入库单弹窗 -->
<el-dialog :visible.sync="openPrint" width="80%" append-to-body>
<div>
<el-dialog :visible.sync="openPrint" append-to-body>
<div id="print-content" style="max-width: 210mm">
<vue-easy-print
tableShow
ref="remarksPrintRef"
@ -535,7 +535,7 @@
<span>车辆信息</span>
</div> -->
</div>
<el-table :data="printTableData" class="table">
<el-table :data="printTableData" style="max-width: 210mm">
<!-- <el-table-column type="selection" width="55" align="center" />-->
<el-table-column
label="序号"
@ -930,7 +930,18 @@ export default {
},
//
print() {
this.$refs.remarksPrintRef.print()
const printContent = document.querySelector('#print-content')
//
printContent.style.width = '100%'
this.$refs.remarksPrintRef.print({
content: '#print-content',
options: {
pageSize: 'A4',
orientation: 'portrait',
// margins: { top: 10, right: 10, bottom: 10, left: 10 },
},
})
},
/** 删除按钮操作 */
handleDelete(row) {
@ -996,4 +1007,17 @@ export default {
width: 60px !important;
margin-bottom: 10px;
}
@media print {
#print-content {
width: 100%; /* 确保打印内容宽度为 100% */
max-width: 210mm; /* 纸张宽度A4 */
margin: auto; /* 居中对齐 */
}
@page {
size: A4; /* 设置纸张大小 */
margin: 20mm; /* 页面边距 */
}
}
</style>

View File

@ -42,11 +42,11 @@ module.exports = {
// target: `https://test-cc.zhgkxt.com`,//线上环境-南网
// target: `https://z.csgmall.com.cn`,
target: `http://192.168.2.160:39080`, //超
// target: `http://192.168.2.160:39080`, //超
// target: `http://10.40.92.81:8080`, //韩/
// target: `http://10.40.92.74:8080`,//旭/
// target: `http://10.40.92.138:28080`, //帅
// target: `http://192.168.2.216:39080`, //福
target: `http://192.168.2.218:39080`, //福
// target: `http://192.168.2.120:39080`, //跃
//******** 注意事项 ********* */