From 99619fdc0a85a115f9e905c0133a5277a8e7a82f Mon Sep 17 00:00:00 2001 From: lb Date: Tue, 15 Aug 2023 10:41:43 +0800 Subject: [PATCH] =?UTF-8?q?bug=20PrintDom=20=E6=89=93=E5=8D=B0=E6=88=90?= =?UTF-8?q?=E5=8A=9F=E4=B9=9F=E4=BC=9A=E6=8F=90=E7=A4=BA=E5=A4=B1=E8=B4=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/PrintDom.vue | 63 ++++++++++++++------------ src/views/modules/pms/pallet/config.js | 2 +- 2 files changed, 35 insertions(+), 30 deletions(-) diff --git a/src/components/PrintDom.vue b/src/components/PrintDom.vue index a153d4c..0f4f876 100644 --- a/src/components/PrintDom.vue +++ b/src/components/PrintDom.vue @@ -183,9 +183,8 @@ export default { this.palletId = data; await this.printByApi(data); } else { - this.printByLocalData(data); + await this.printByLocalData(data); } - this.close(); }, @@ -202,6 +201,7 @@ export default { // 绘制HU号 await this.paintQrCode(data.hu || "- 无HU数据 -"); await this.handlePrint(); + await this.getPrintStatus(); }, initPrintPlugin() { @@ -253,9 +253,11 @@ export default { // 获取jobId this.lodop.On_Return = (TaskID, Value) => { this.jobId = Value; - this.$nextTick(() => { - this.getPrintStatus(resolve, reject); - }); + // this.$nextTick(() => { + // this.getPrintStatus(resolve, reject); + // }); + console.log('this.lodop.On_Return', this.lodop.On_Return, this.jobId) + resolve(); }; } // 纵向打印,宽度60mm,高度150mm,定义纸张名称 @@ -264,30 +266,33 @@ export default { this.lodop.PRINT(); }); }, - - getPrintStatus(resolve, reject) { - if (!this.jobId) return; - if (LODOP.CVERSION) { - LODOP.On_Return = (TaskID, Value) => { - // console.log("on return value: <", Value, ">"); - if (Value.toString() == "1") { - // 打印成功 - this.sendSuccess() - .then(() => { - this.$message.success("打印成功"); - this.$emit("refresh-list"); - resolve(); - }) - .catch((err) => { - this.$message.error(err); - reject(err); - }); - } else { - this.$message.error("打印失败"); - } - }; - } - LODOP.GET_VALUE("PRINT_STATUS_OK", this.jobId); + + getPrintStatus() { + return new Promise((resolve, reject) => { + if (!this.jobId || !this.lodop) reject(-1); + this.lodop.SET_PRINT_MODE("CATCH_PRINT_STATUS", true); + if (this.lodop.CVERSION) { + this.lodop.On_Return = (TaskID, Value) => { + console.log('this.lodop.On_Return', this.lodop.On_Return, this.jobId, Value) + if (Value.toString() == "1") { + // 打印成功 + this.sendSuccess() + .then(() => { + this.$message.success("打印成功"); + this.$emit("refresh-list"); + resolve(); + }) + .catch((err) => { + this.$message.error(err); + reject(err); + }); + } else { + this.$message.error("打印失败"); + } + }; + this.lodop.GET_VALUE("PRINT_STATUS_OK", this.jobId); + } + }); }, sendSuccess() { diff --git a/src/views/modules/pms/pallet/config.js b/src/views/modules/pms/pallet/config.js index 3f46cf4..75582c4 100644 --- a/src/views/modules/pms/pallet/config.js +++ b/src/views/modules/pms/pallet/config.js @@ -14,7 +14,7 @@ export default function () { { prop: "orderCode", label: "订单号" }, { prop: "realQty", label: "数量" }, { prop: "typeDictValue", label: "类型", filter: dictFilter('pallet_type') }, - { prop: "stifling", label: "熏蒸", }, + { prop: "stifling", label: "熏蒸", filter: val => val != null ? ['非熏蒸', '熏蒸'][val] : '-' }, { prop: "printTime", label: "打印时间", filter: timeFilter }, { prop: "createTime", label: "添加时间", filter: timeFilter }, {