|
|
@@ -5381,31 +5381,35 @@ const selectpYj = (event) => {
|
|
|
]
|
|
|
}
|
|
|
// hiprint.init()
|
|
|
- const hiprintTemplate = new hiprint.PrintTemplate({ template: jsondata1 })
|
|
|
+ const hiprintTemplate = new hiprint.PrintTemplate({ template: jsondata1 });
|
|
|
|
|
|
- for (let i = workData.value.start_liucheng; i <= workData.value.liucheng_total; i++) {
|
|
|
- (function(currentIndex) {
|
|
|
- // 创建一个基于当前索引的延迟
|
|
|
- const delay = (currentIndex - 1) * 3600; // 延迟时间
|
|
|
- setTimeout(() => {
|
|
|
- const printdata = {
|
|
|
- "scpch": getDocumentInfos.data[0].Gd_gdbh,
|
|
|
- "xsddh": getDocumentInfos.data[0].销售订单号,
|
|
|
- "mbh": getDocumentInfos.data[0].mabao,
|
|
|
- "lcdh": `${workData.value.liucheng_total}-${i}`,
|
|
|
- "qrcode": `${getDocumentInfos.data[0].Gd_gdbh}-${workData.value.liucheng_total}-${currentIndex}`,
|
|
|
- "gdsm": getDocumentInfos.data[0].version,
|
|
|
- "cpmc": getDocumentInfos.data[0].Gd_cpmc,
|
|
|
- "ztzs": workData.value.num,
|
|
|
- 'table': getDocumentInfos.data.gy_data.map(item => ({
|
|
|
- gxmc: item
|
|
|
- }))
|
|
|
- };
|
|
|
- hiprintTemplate.print2(printdata);
|
|
|
- // hiprintTemplate.toPdf(printdata,'流程单');
|
|
|
- }, delay);
|
|
|
- })(i); // 立即执行函数,传入当前的i值作为currentIndex
|
|
|
- }
|
|
|
+// 获取起始和结束值
|
|
|
+const start = workData.value.start_liucheng;
|
|
|
+const total = workData.value.liucheng_total;
|
|
|
+
|
|
|
+for (let i = start; i <= total; i++) {
|
|
|
+ (function(currentIndex, relativeIndex) { // 新增 relativeIndex 参数
|
|
|
+ console.log("currentIndex:", currentIndex, "relativeIndex:", relativeIndex);
|
|
|
+ const delay = relativeIndex * 3600; // 使用 relativeIndex 计算延迟
|
|
|
+ setTimeout(() => {
|
|
|
+ const printdata = {
|
|
|
+ "scpch": getDocumentInfos.data[0].Gd_gdbh,
|
|
|
+ "xsddh": getDocumentInfos.data[0].销售订单号,
|
|
|
+ "mbh": getDocumentInfos.data[0].mabao,
|
|
|
+ "lcdh": `${workData.value.liucheng_total}-${currentIndex}`,
|
|
|
+ "qrcode": `${getDocumentInfos.data[0].Gd_gdbh}-${workData.value.liucheng_total}-${currentIndex}`,
|
|
|
+ "gdsm": getDocumentInfos.data[0].version,
|
|
|
+ "cpmc": getDocumentInfos.data[0].Gd_cpmc,
|
|
|
+ "ztzs": workData.value.num,
|
|
|
+ 'table': getDocumentInfos.data.gy_data.map(item => ({
|
|
|
+ gxmc: item
|
|
|
+ }))
|
|
|
+ };
|
|
|
+ console.log("执行打印:", currentIndex);
|
|
|
+ hiprintTemplate.print2(printdata);
|
|
|
+ }, delay);
|
|
|
+ })(i, i - start + 1); // 传入 currentIndex 和 relativeIndex
|
|
|
+}
|
|
|
|
|
|
}
|
|
|
}
|