fcx
4 天以前 6ca81c89d606b5be26c8b8526b191ae8e773167b
pages/QC/SJ/Add.vue
@@ -253,22 +253,44 @@
    },
    submit() {
      // 检查是否已完成一致性核对
      // 检查是否需要一致性核对
      if (this.current && !this.formData.yzxChecked) {
        uni.showModal({
          title: "提示",
          content: "请先完成一致性核对后再提交检验",
          confirmText: "去核对",
          cancelText: "取消",
          success: (res) => {
            if (res.confirm) {
              this.toYzxSubmitFrom(this.formData.billNo);
            }
        // 先检查该物料是否维护了一致性核对项目
        this.$post({
          url: "/SJ/getYzxItem",
          data: {
            id: this.formData.id
          }
        }).then(res => {
          // 如果维护了一致性核对项目(components.length > 0),则要求完成核对
          if (res.data && res.data.length > 0) {
            uni.showModal({
              title: "提示",
              content: "请先完成一致性核对后再提交检验",
              confirmText: "去核对",
              cancelText: "取消",
              success: (modalRes) => {
                if (modalRes.confirm) {
                  this.toYzxSubmitFrom(this.formData.billNo);
                }
              }
            });
          } else {
            // 未维护一致性核对项目,允许直接提交
            this.submitInspection();
          }
        }).catch(() => {
          // 接口异常,允许提交
          this.submitInspection();
        });
        return;
      }
      
      // 已完成一致性核对或不需要核对,直接提交
      this.submitInspection();
    },
    submitInspection() {
      this.$post({
        url: "/SJ/SJQaSubmit",
        data: {
@@ -299,7 +321,7 @@
        }
      }).catch(err => {
        console.log("提交出错:", err);
        this.$showMessage("提交失败,请重试");
        this.$showMessage("提交失败,请重试");
      })
    },
@@ -600,8 +622,9 @@
    }
  },
  onShow() {
    //每次进入页面都会执行的方法
    this.init();
    // 每次进入页面都会执行的方法
    // 注释掉init()调用,避免覆盖一致性核对状态
    // this.init();
  }
};
</script>