zouyu
2023-09-15 a6a4092ce1899bd020bc15cff43f0977c87e6be8
src/components/view/rawInsDetail.vue
@@ -194,6 +194,7 @@
          <template slot-scope="scope">
            <el-input
              :disabled="detailId != null"
              @blur="assertTest(scope.row)"
              v-model="scope.row.required"
              placeholder="请输入标准值"
            ></el-input>
@@ -202,6 +203,7 @@
        <el-table-column prop="internal" label="内控值" min-width="150">
          <template slot-scope="scope">
            <el-input
              @blur="assertTest(scope.row)"
              :disabled="detailId != null"
              v-model="scope.row.internal"
              placeholder="请输入内控值"
@@ -424,6 +426,23 @@
    }
  },
  methods: {
    assertTest(row){
      let fuArr=['>', '<', '=']
      if(!fuArr.includes(row.required[0])){
        this.$message({
                    message: "标准值["+row.required+"]格式首位应包含>,<或者=",
                    type: 'warning'
                });
                return
      }
      if(!fuArr.includes(row.internal[0])){
        this.$message({
                    message: "内控值["+row.internal+"]格式首位应包含>,<或者=",
                    type: 'warning'
                });
                return
      }
    },
    // 设备树过滤搜索
    filterNode(value, data) {
      if (!value) return true;
@@ -456,20 +475,45 @@
    },
    // 新增检验单
    async addNewRawInspect() {
      //TODO:
      console.log(this.projectTable);
      if(this.projectTable.length>0){
        let filterTable= this.projectTable.filter(item=>{
        return item.required===''||item.internal===''||
        item.required===null||item.internal===null||item.name===''
        })
        if(filterTable.length>0) {
          this.$message({
                    message: "项目名称,标准值和内控值不能为空!",
                    type: 'warning'
                });
          return
        }
      }
      this.projectTable.forEach(i => {
        // 将列表转换为字符串
        i.testValue = i.testValueList.join(",");
      });
      this.detailInfo.rawInsProducts = this.projectTable;
      const res = await this.$axios.post(
      this.$axios.post(
        this.$api.url.addRawInspects,
        { ...this.detailInfo },
        { headers: { "Content-Type": "application/json" } }
      );
      this.detailId = res.data;
      this.getDetailInfo();
      this.$message.success(res.message);
      this.goBack();
      ).then(res=>{
        console.log(res);
        if(res.code=="201"){
          this.$message({
                    message: res.message,
                    type: 'warning'
                });
         return
        }else{
          // this.detailId = res.data;
          // this.getDetailInfo();
          // // this.$message.success(res.message);
          // this.goBack();
        }
      });
    },
    // 修改项目的检测值改变结论