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;
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();
};
}
// 60mm150mm
@ -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() {

View File

@ -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 },
{