| | |
| | | print() { |
| | | let printContent = document.getElementById("printContent"); |
| | | let palletcode=document.getElementById("palletcode"); |
| | | var printWindow = window.open("", ""); |
| | | printWindow.document.write(printContent.innerHTML); |
| | | printWindow.document.write(palletcode.innerHTML); |
| | | var printWindow = window.open("", "", "width=400,height=400"); |
| | | |
| | | // åå»ºå®æ´çHTMLç»æä»¥é¿å
空ç½é¡µ |
| | | printWindow.document.write(` |
| | | <!DOCTYPE html> |
| | | <html> |
| | | <head> |
| | | <meta charset="UTF-8"> |
| | | <title>æå°</title> |
| | | <style> |
| | | @page { |
| | | size: auto; |
| | | margin: 0; |
| | | } |
| | | |
| | | body { |
| | | margin: 0; |
| | | padding: 10px; |
| | | font-family: Arial, sans-serif; |
| | | background: white; |
| | | } |
| | | |
| | | .print-container { |
| | | width: 100%; |
| | | height: 100vh; |
| | | display: flex; |
| | | flex-direction: column; |
| | | justify-content: center; |
| | | align-items: center; |
| | | page-break-after: avoid; |
| | | } |
| | | |
| | | .qrcode-container { |
| | | display: flex; |
| | | justify-content: center; |
| | | align-items: center; |
| | | margin-bottom: 20px; |
| | | } |
| | | |
| | | .pallet-code { |
| | | display: flex; |
| | | justify-content: center; |
| | | align-items: center; |
| | | font-size: 18px; |
| | | font-weight: bold; |
| | | } |
| | | |
| | | canvas { |
| | | display: block !important; |
| | | margin: auto !important; |
| | | } |
| | | |
| | | @media print { |
| | | body { |
| | | margin: 0; |
| | | padding: 5mm; |
| | | } |
| | | |
| | | .print-container { |
| | | width: 100%; |
| | | height: 100vh; |
| | | page-break-after: avoid; |
| | | page-break-inside: avoid; |
| | | } |
| | | } |
| | | </style> |
| | | </head> |
| | | <body> |
| | | <div class="print-container"> |
| | | <div class="qrcode-container"> |
| | | ${printContent.innerHTML} |
| | | </div> |
| | | <div class="pallet-code"> |
| | | ${palletcode.innerHTML} |
| | | </div> |
| | | </div> |
| | | <script> |
| | | window.onload = function() { |
| | | setTimeout(function() { |
| | | window.print(); |
| | | window.close(); |
| | | }, 500); |
| | | }; |
| | | <\/script> |
| | | </body> |
| | | </html> |
| | | `); |
| | | |
| | | printWindow.document.close(); |
| | | printWindow.focus(); |
| | | printWindow.print(); |
| | | printWindow.close(); |
| | | |
| | | this.http |
| | | .post("api/palletCodeInfo/PrintStatusUp?printCode="+this.palletCode, null, "æ°æ®å¤çä¸") |
| | | .then((x) => { |