fcx
4 天以前 6ca81c89d606b5be26c8b8526b191ae8e773167b
pages/QC/SJ/Add.vue
@@ -146,6 +146,7 @@
        statusUser: "",
        itemId: "",
        fSubmit: 0,
        yzxChecked: false, // 添加一致性核对状态字段
      },
      DAA020List: [],
@@ -252,6 +253,44 @@
    },
    submit() {
      // 检查是否需要一致性核对
      if (this.current && !this.formData.yzxChecked) {
        // 先检查该物料是否维护了一致性核对项目
        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: {
@@ -269,18 +308,20 @@
        if (res.statusCode === 200 || res.status === 0 || res.data === true || res.data.tbBillList === true) {
          this.$showMessage("成功提交检验");
          // 提交成功后跳转到列表页面
          // 提交成功后刷新页面数据
          this.init();
          // 1.5秒后跳转到列表页面
          setTimeout(() => {
            uni.navigateTo({
              url: '/pages/QC/SJ/List'
            });
          }, 1500); // 1.5秒后跳转,让用户看到成功提示
          }, 1500);
        } else {
          this.$showMessage(res.data.message || res.message || "提交失败");
        }
      }).catch(err => {
        console.log("提交出错:", err);
        this.$showMessage("提交失败,请重试");
        this.$showMessage("提交失败,请重试");
      })
    },
@@ -296,7 +337,11 @@
        }).then(res => {
          let tbBillListElement = res.data.tbBillList[0];
          if (tbBillListElement) {
            // 保存当前的yzxChecked状态
            const currentYzxChecked = this.formData.yzxChecked;
            this.formData = tbBillListElement;
            // 恢复yzxChecked状态,避免被服务器数据覆盖
            this.formData.yzxChecked = currentYzxChecked;
            this.$post({
              url: "/SJ/getQSItems",
              data: {
@@ -577,8 +622,9 @@
    }
  },
  onShow() {
    //每次进入页面都会执行的方法
    this.init();
    // 每次进入页面都会执行的方法
    // 注释掉init()调用,避免覆盖一致性核对状态
    // this.init();
  }
};
</script>