|
@@ -11,33 +11,44 @@ function qrCodeList(data, domId) {
|
|
|
// let goodsname = "名称:" + data.purchaseBuyName;
|
|
|
// let specifications = "规格:" + data.purchaseSerialNumber;
|
|
|
// let goodstime = "生产日期:" + data.purchaseCreateTime;
|
|
|
- let printContent = `<div><table><tr><td >`;
|
|
|
+ let cellStyle = 'style="width:100%; padding: 0; margin: 0;"';
|
|
|
+ let printContent = `<div><table style="width: 100%; border-collapse: collapse;"><tbody><tr ${cellStyle}><td ${cellStyle}>`;
|
|
|
for (var i = 0; i < data.length; i++) {
|
|
|
let currentData = data[i]
|
|
|
- printContent +=
|
|
|
- `<div style="width: 840px; height:100px;background-color: skyblue;"><div id="HT` +
|
|
|
- i +
|
|
|
- `" style="float: left;margin-top: 15px; border-right: 10px white solid"></div>`;
|
|
|
- printContent +=
|
|
|
- `<div id="LJJ` +
|
|
|
- i +
|
|
|
- `" style="float: left;margin-top: 5px;">
|
|
|
- <h1><strong>${currentData.showMsg[0].label +
|
|
|
- ': ' + currentData.showMsg[0].value}</strong></h1>
|
|
|
- <h1><strong>${currentData.showMsg[1].label +
|
|
|
- ': ' + currentData.showMsg[1].value}</strong></h1>
|
|
|
- </div></div>
|
|
|
- <div style="clear: both"></div>`;
|
|
|
+ //printContent +=
|
|
|
+ // `<div style="width: 500px; height:160px;background-color: skyblue;display: flex; justify-content: center; align-items: center;">
|
|
|
+ // <div id="HT` +
|
|
|
+ // i +
|
|
|
+ // `"style="border-right: 10px white solid"></div>`;
|
|
|
+ //printContent +=
|
|
|
+ // `<div id="LJJ` +
|
|
|
+ // i +
|
|
|
+ // `" style="margin-top: 5px;">
|
|
|
+ // <h1><strong>${currentData.showMsg[0].label +
|
|
|
+ // ': ' + currentData.showMsg[0].value}</strong></h1>
|
|
|
+ // <h1><strong>${currentData.showMsg[1].label +
|
|
|
+ // ': ' + currentData.showMsg[1].value}</strong></h1>
|
|
|
+ // <h1><strong>${currentData.showMsg[2].label +
|
|
|
+ // ': ' + currentData.showMsg[2].value}</strong></h1>
|
|
|
+ // </div></div>
|
|
|
+ // <div style="clear: both"></div>`;
|
|
|
+ printContent += `
|
|
|
+ <div style="width: 100%; height: auto; background-color: skyblue; display: flex; flex-direction: column; justify-content: space-between; align-items: center;">
|
|
|
+ <div id="HT${i}" style="border: 1px solid red;width: 170px;height:170px;margin-top:22px"></div>
|
|
|
+ <div id="LJJ${i}" style="text-align:left;margin-top: 5px">
|
|
|
+ <h3><strong>${currentData.showMsg[0].label}: </strong>${currentData.showMsg[0].value}<strong> ${currentData.showMsg[1].label}: </strong> ${currentData.showMsg[1].value}</h3>
|
|
|
+ <h3><strong>${currentData.showMsg[2].label}: </strong> ${currentData.showMsg[2].value}</h3>
|
|
|
+ </div>
|
|
|
+ </div>`;
|
|
|
}
|
|
|
printContent += `</td></tr></table></div>`;
|
|
|
document.body.innerHTML = document.getElementById(domId).innerHTML = printContent;
|
|
|
for (var i = 0; i < data.length; i++) {
|
|
|
for (let j = 0; j < 1; j++) {
|
|
|
new QRCode(document.getElementById("HT" + i), {
|
|
|
- text:
|
|
|
- sleep(1) + JSON.stringify(data[i].codeData),
|
|
|
- width: 120,
|
|
|
- height: 120,
|
|
|
+ text: sleep(1) + data[i].codeData,
|
|
|
+ width: 170,
|
|
|
+ height: 170,
|
|
|
colorDark: "#000000",
|
|
|
colorLight: "#ffffff",
|
|
|
correctLevel: QRCode.CorrectLevel.H,
|
|
@@ -55,6 +66,4 @@ function sleep(ms) {
|
|
|
while (new Date().getTime() < unixtime_ms + ms) { }
|
|
|
return "";
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
-export default qrCodeList
|
|
|
+export default qrCodeList
|