bug PrintDom 打印成功也会提示失败
This commit is contained in:
		@@ -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() {
 | 
			
		||||
 
 | 
			
		||||
@@ -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 },
 | 
			
		||||
    {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user