zss
2024-08-08 12dceacf931f4f29b1613eb06da8fd46d6375ebb
src/components/do/b1-ins-order/add.vue
@@ -1585,16 +1585,24 @@
              }
              return true
          })
          //校验检验项的要求值和要求描述
          /* //校验检验项的要求值和要求描述
          const isTrue = this.checkRequiredValueAndRemark(filterProductList)
          if(!isTrue){
            this.$message.error('检验项的要求值与要求描述不匹配, 请检查')
            return
          } */
           //校验检验项的要求值和要求描述,仅委托要求
          if(this.isAskOnlyRead){
            const isTrue = this.checkRequiredValueAndRemark(filterProductList)
              if(!isTrue){
                this.$message.error('检验项的要求值与要求描述不匹配, 请检查')
                return
              }
          }
          console.log('isHaveBushing===', this.totalArr)
          // inspectionItem
          let spcialItem = null//this.totalArr.find(a => a.state == 1 && a.inspectionItem.includes('松套管'))
          let spcialItem = this.totalArr.find(a => a.state == 1 && a.inspectionItem.includes('松套管'))
          // console.log('isHaveBushing===', isHaveBushing)
          if (productListSelected && select[2] === '光缆' && isHaveBushing === false) {
            this.$message.error('光缆温度循环项目必须进行光纤配置')
@@ -1635,7 +1643,7 @@
          }
        }
      },
      checkRequiredValueAndRemark(data){
      /* checkRequiredValueAndRemark(data){
        let isTrue = true
        try{
          data.forEach(ele=>{
@@ -1678,7 +1686,62 @@
          isTrue = false
        }
        return isTrue
      }, */
      /**
       * 校验委托要求的检验项的要求描述和要求值
       *
       */
      checkRequiredValueAndRemark(data){
          let isTrue = true
        try{
          data.forEach(ele=>{
            //判断(≤,≥,>,<,=)这几种情况
            //判断要求值中的数字是否包含在要求描述中
            if(['≤','≥','>','<','='].includes(ele.ask[0])){
              const askVal = ele.ask.substring(1,ele.ask.length)
              if(isNaN(askVal) || ele.tell.indexOf(askVal)<0){
                isTrue = false
              }
            }
            //判断范围(10-25),要求值必须是-
            if(ele.ask.indexOf('-')>0 && ele.ask.length>1){
            //要求描述的~和要求值的-,等效
              let tell = ele.tell
              if(ele.tell.indexOf('~')>0){
                tell = ele.tell.replace('~','-')
              }
              const splits = ele.ask.split('-')
              //满足格式要求,并且两个都是数字
              if(splits.length==2 && !isNaN(splits[0]) && !isNaN(splits[1])){
              let min = Math.min(...splits)
              let max = Math.max(...splits)
              //判断±的情况
                if(ele.tell.indexOf('±')<0&&tell.indexOf(ele.ask)<0){
                  isTrue = false
                }else if(ele.tell.indexOf('±')>0&&ele.tell!=ele.ask){
                  let splitNums = ele.tell.split('±')
                  if(splitNums.length<2){
                    isTrue = false
                  }else{
                    let minTell = Number(splitNums[0])-Number(splitNums[1])
                    let maxTell = Number(splitNums[0])+Number(splitNums[1])
                    if(minTell!=min || maxTell!=max){
                      isTrue = false
                    }
                  }
                }
              }else{
                isTrue = false
              }
            }
          })
        }catch(error){
          console.log(error);
          isTrue = false
        }
        return isTrue
      },
      save0(){
        if(this.editTable.every(m=>m.value)){
          let sampleList = this.handleData(this.HaveJson(this.sampleList),this.handleAsk,1)