bug PrintDom 打印成功也会提示失败

This commit is contained in:
lb 2023-08-15 10:41:43 +08:00
parent d1bc97f42a
commit 99619fdc0a
2 changed files with 35 additions and 30 deletions

View File

@ -183,9 +183,8 @@ export default {
this.palletId = data; this.palletId = data;
await this.printByApi(data); await this.printByApi(data);
} else { } else {
this.printByLocalData(data); await this.printByLocalData(data);
} }
this.close(); this.close();
}, },
@ -202,6 +201,7 @@ export default {
// HU // HU
await this.paintQrCode(data.hu || "- 无HU数据 -"); await this.paintQrCode(data.hu || "- 无HU数据 -");
await this.handlePrint(); await this.handlePrint();
await this.getPrintStatus();
}, },
initPrintPlugin() { initPrintPlugin() {
@ -253,9 +253,11 @@ export default {
// jobId // jobId
this.lodop.On_Return = (TaskID, Value) => { this.lodop.On_Return = (TaskID, Value) => {
this.jobId = Value; this.jobId = Value;
this.$nextTick(() => { // this.$nextTick(() => {
this.getPrintStatus(resolve, reject); // this.getPrintStatus(resolve, reject);
}); // });
console.log('this.lodop.On_Return', this.lodop.On_Return, this.jobId)
resolve();
}; };
} }
// 60mm150mm // 60mm150mm
@ -265,29 +267,32 @@ export default {
}); });
}, },
getPrintStatus(resolve, reject) { getPrintStatus() {
if (!this.jobId) return; return new Promise((resolve, reject) => {
if (LODOP.CVERSION) { if (!this.jobId || !this.lodop) reject(-1);
LODOP.On_Return = (TaskID, Value) => { this.lodop.SET_PRINT_MODE("CATCH_PRINT_STATUS", true);
// console.log("on return value: <", Value, ">"); if (this.lodop.CVERSION) {
if (Value.toString() == "1") { this.lodop.On_Return = (TaskID, Value) => {
// console.log('this.lodop.On_Return', this.lodop.On_Return, this.jobId, Value)
this.sendSuccess() if (Value.toString() == "1") {
.then(() => { //
this.$message.success("打印成功"); this.sendSuccess()
this.$emit("refresh-list"); .then(() => {
resolve(); this.$message.success("打印成功");
}) this.$emit("refresh-list");
.catch((err) => { resolve();
this.$message.error(err); })
reject(err); .catch((err) => {
}); this.$message.error(err);
} else { reject(err);
this.$message.error("打印失败"); });
} } else {
}; this.$message.error("打印失败");
} }
LODOP.GET_VALUE("PRINT_STATUS_OK", this.jobId); };
this.lodop.GET_VALUE("PRINT_STATUS_OK", this.jobId);
}
});
}, },
sendSuccess() { sendSuccess() {

View File

@ -14,7 +14,7 @@ export default function () {
{ prop: "orderCode", label: "订单号" }, { prop: "orderCode", label: "订单号" },
{ prop: "realQty", label: "数量" }, { prop: "realQty", label: "数量" },
{ prop: "typeDictValue", label: "类型", filter: dictFilter('pallet_type') }, { prop: "typeDictValue", label: "类型", filter: dictFilter('pallet_type') },
{ prop: "stifling", label: "熏蒸", }, { prop: "stifling", label: "熏蒸", filter: val => val != null ? ['非熏蒸', '熏蒸'][val] : '-' },
{ prop: "printTime", label: "打印时间", filter: timeFilter }, { prop: "printTime", label: "打印时间", filter: timeFilter },
{ prop: "createTime", label: "添加时间", filter: timeFilter }, { prop: "createTime", label: "添加时间", filter: timeFilter },
{ {