公章bug
This commit is contained in:
		
							parent
							
								
									d9dc57e7b0
								
							
						
					
					
						commit
						b1bacdf86c
					
				| 
						 | 
				
			
			@ -1191,40 +1191,19 @@ export default {
 | 
			
		|||
    printCheck() {
 | 
			
		||||
      // 获取打印内容的容器
 | 
			
		||||
      const printContent = this.$refs.remarksPrintRefCheck.$el;
 | 
			
		||||
 | 
			
		||||
      // 获取公章canvas元素
 | 
			
		||||
      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(() => {
 | 
			
		||||
          this.$refs.remarksPrintRefCheck.print({
 | 
			
		||||
          // 自定义打印内容
 | 
			
		||||
          content: printContent.innerHTML
 | 
			
		||||
          });
 | 
			
		||||
      }, 1000);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        // 打印完成后移除图像
 | 
			
		||||
      // 添加一个类来隐藏页面其他部分
 | 
			
		||||
      document.body.classList.add('printing');
 | 
			
		||||
      // 调用打印方法
 | 
			
		||||
      window.print();
 | 
			
		||||
      // 打印完成后移除类并移除图像
 | 
			
		||||
      window.onafterprint = () => {
 | 
			
		||||
        document.body.classList.remove('printing');
 | 
			
		||||
        printContent.removeChild(img);
 | 
			
		||||
      };
 | 
			
		||||
    },
 | 
			
		||||
    
 | 
			
		||||
    //领料单打印
 | 
			
		||||
    print() {
 | 
			
		||||
        print() {
 | 
			
		||||
      this.$refs.remarksPrintRef.print();
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -1298,4 +1277,15 @@ export default {
 | 
			
		|||
  width: 70px !important;
 | 
			
		||||
  margin-bottom: 10px;
 | 
			
		||||
}
 | 
			
		||||
@media print {
 | 
			
		||||
  body.printing {
 | 
			
		||||
    visibility: hidden;
 | 
			
		||||
  }
 | 
			
		||||
  body.printing .el-dialog {
 | 
			
		||||
    visibility: visible;
 | 
			
		||||
    position: absolute;
 | 
			
		||||
    left: 0;
 | 
			
		||||
    top: 0;
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
</style>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue