公章bug
This commit is contained in:
parent
d9dc57e7b0
commit
b1bacdf86c
|
|
@ -1191,34 +1191,13 @@ export default {
|
||||||
printCheck() {
|
printCheck() {
|
||||||
// 获取打印内容的容器
|
// 获取打印内容的容器
|
||||||
const printContent = this.$refs.remarksPrintRefCheck.$el;
|
const printContent = this.$refs.remarksPrintRefCheck.$el;
|
||||||
|
// 添加一个类来隐藏页面其他部分
|
||||||
// 获取公章canvas元素
|
document.body.classList.add('printing');
|
||||||
const canvas = document.getElementById('canvas');
|
|
||||||
// 将canvas转换为图像
|
|
||||||
const imgData = canvas.toDataURL('image/png');
|
|
||||||
// 创建一个新的图像元素
|
|
||||||
const img = new Image();
|
|
||||||
img.src = imgData;
|
|
||||||
|
|
||||||
// 等待图像加载完成
|
|
||||||
img.onload = () => {
|
|
||||||
console.log('Image loaded:', img);
|
|
||||||
// 将图像插入到打印内容中
|
|
||||||
img.style.display = 'block'; // 确保图像可见
|
|
||||||
img.style.zIndex = '9999'; // 确保图像在最上层
|
|
||||||
// 将图像插入到打印内容中
|
|
||||||
printContent.appendChild(img);
|
|
||||||
console.log('content:', printContent.innerHTML);
|
|
||||||
// 调用打印方法
|
// 调用打印方法
|
||||||
setTimeout(() => {
|
window.print();
|
||||||
this.$refs.remarksPrintRefCheck.print({
|
// 打印完成后移除类并移除图像
|
||||||
// 自定义打印内容
|
window.onafterprint = () => {
|
||||||
content: printContent.innerHTML
|
document.body.classList.remove('printing');
|
||||||
});
|
|
||||||
}, 1000);
|
|
||||||
|
|
||||||
|
|
||||||
// 打印完成后移除图像
|
|
||||||
printContent.removeChild(img);
|
printContent.removeChild(img);
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
@ -1298,4 +1277,15 @@ export default {
|
||||||
width: 70px !important;
|
width: 70px !important;
|
||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
}
|
}
|
||||||
|
@media print {
|
||||||
|
body.printing {
|
||||||
|
visibility: hidden;
|
||||||
|
}
|
||||||
|
body.printing .el-dialog {
|
||||||
|
visibility: visible;
|
||||||
|
position: absolute;
|
||||||
|
left: 0;
|
||||||
|
top: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue