|
|
@ -694,7 +694,7 @@ export default { |
|
|
availableQty: row.availableQty || 0, |
|
|
availableQty: row.availableQty || 0, |
|
|
site: this.scheduleData.site |
|
|
site: this.scheduleData.site |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 调用打印功能 |
|
|
// 调用打印功能 |
|
|
this.printCarrierLabel(printData) |
|
|
this.printCarrierLabel(printData) |
|
|
}, |
|
|
}, |
|
|
@ -704,7 +704,7 @@ export default { |
|
|
try { |
|
|
try { |
|
|
// 生成二维码(使用 QRCode.js 或者使用在线二维码API) |
|
|
// 生成二维码(使用 QRCode.js 或者使用在线二维码API) |
|
|
const qrCodeUrl = `https://api.qrserver.com/v1/create-qr-code/?size=120x120&data=${encodeURIComponent(data.carrierNo)}` |
|
|
const qrCodeUrl = `https://api.qrserver.com/v1/create-qr-code/?size=120x120&data=${encodeURIComponent(data.carrierNo)}` |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 打印HTML模板 |
|
|
// 打印HTML模板 |
|
|
const printContent = ` |
|
|
const printContent = ` |
|
|
<div style="width: 100mm; font-family: Arial, sans-serif; padding: 10px; position: relative;"> |
|
|
<div style="width: 100mm; font-family: Arial, sans-serif; padding: 10px; position: relative;"> |
|
|
@ -712,12 +712,12 @@ export default { |
|
|
<div style="position: absolute; top: 10px; left: 10px;"> |
|
|
<div style="position: absolute; top: 10px; left: 10px;"> |
|
|
<img src="${qrCodeUrl}" style="width: 80px; height: 80px; border: 1px solid #ddd;" alt="QR Code"/> |
|
|
<img src="${qrCodeUrl}" style="width: 80px; height: 80px; border: 1px solid #ddd;" alt="QR Code"/> |
|
|
</div> |
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 标题 --> |
|
|
<!-- 标题 --> |
|
|
<div style="text-align: center; font-size: 20px; font-weight: bold; margin-bottom: 15px; padding-top: 5px;"> |
|
|
<div style="text-align: center; font-size: 20px; font-weight: bold; margin-bottom: 15px; padding-top: 5px;"> |
|
|
固定载具标签 |
|
|
固定载具标签 |
|
|
</div> |
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 信息表格 --> |
|
|
<!-- 信息表格 --> |
|
|
<table style="width: 100%; border-collapse: collapse; font-size: 14px; margin-top: 10px;"> |
|
|
<table style="width: 100%; border-collapse: collapse; font-size: 14px; margin-top: 10px;"> |
|
|
<tr> |
|
|
<tr> |
|
|
@ -741,14 +741,14 @@ export default { |
|
|
<td style="padding: 8px; border: 1px solid #333; font-size: 18px; font-weight: bold; color: #e74c3c;">${data.availableQty}</td> |
|
|
<td style="padding: 8px; border: 1px solid #333; font-size: 18px; font-weight: bold; color: #e74c3c;">${data.availableQty}</td> |
|
|
</tr> |
|
|
</tr> |
|
|
</table> |
|
|
</table> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 打印时间 --> |
|
|
<!-- 打印时间 --> |
|
|
<div style="text-align: center; margin-top: 15px; font-size: 11px; color: #999; border-top: 1px dashed #ccc; padding-top: 10px;"> |
|
|
<div style="text-align: center; margin-top: 15px; font-size: 11px; color: #999; border-top: 1px dashed #ccc; padding-top: 10px;"> |
|
|
打印时间: ${this.dayjs(new Date()).format('YYYY-MM-DD HH:mm:ss')} |
|
|
打印时间: ${this.dayjs(new Date()).format('YYYY-MM-DD HH:mm:ss')} |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
` |
|
|
` |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 创建打印窗口 |
|
|
// 创建打印窗口 |
|
|
const printWindow = window.open('', '_blank') |
|
|
const printWindow = window.open('', '_blank') |
|
|
printWindow.document.write(` |
|
|
printWindow.document.write(` |
|
|
@ -770,13 +770,13 @@ export default { |
|
|
</html> |
|
|
</html> |
|
|
`) |
|
|
`) |
|
|
printWindow.document.close() |
|
|
printWindow.document.close() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 延迟打印,确保二维码图片加载完成 |
|
|
// 延迟打印,确保二维码图片加载完成 |
|
|
setTimeout(() => { |
|
|
setTimeout(() => { |
|
|
printWindow.print() |
|
|
printWindow.print() |
|
|
printWindow.close() |
|
|
printWindow.close() |
|
|
}, 500) |
|
|
}, 500) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.$message.success('正在打印载具标签...') |
|
|
this.$message.success('正在打印载具标签...') |
|
|
} catch (error) { |
|
|
} catch (error) { |
|
|
this.$message.error('打印失败: ' + error.message) |
|
|
this.$message.error('打印失败: ' + error.message) |
|
|
|