zouyu
2024-08-08 c263fb316fc23d9db98ce711fda30d81c28d2d9c
src/components/do/b1-ins-order/add.vue
@@ -475,7 +475,7 @@
            <template slot-scope="scope">
              <el-input size="small" placeholder="要求值" v-model="scope.row.ask" clearable type="textarea"
                :autosize="{ minRows: 1, maxRows: 3}" @change="e=>requestChange(e,scope.row,'ask')"
                v-if="active==1&&isAskOnlyRead&&/[0-9]/.test(scope.row.ask)"></el-input>
                v-if="active==1&&isAskOnlyRead&&scope.row.inspectionValueType!='5'"></el-input>
              <span v-else>
                <!-- <template v-if="(scope.row.ask.indexOf('D')>-1
                ||scope.row.ask.indexOf('W')>-1
@@ -1573,7 +1573,7 @@
              isHaveBushing = false
            }
          })
          //过滤检测项:去除特殊项(bsm=1),
          //过滤检测项:去除特殊项
          let filterProductList = this.productListSelected.filter(ele=>ele.bsm==0&&/[0-9]/.test(ele.ask)).filter(ele=>{
              if(select[1].indexOf('通信')>=0 && ['光缆','光纤'].includes(select[2])){
                return !['温度循环','光纤接头损耗'].includes(ele.inspectionItem)
@@ -1585,13 +1585,14 @@
              }
              return true
          })
          //校验检验项的要求值和要求描述
          const isTrue = this.checkRequiredValueAndRemark(filterProductList)
          if(!isTrue){
            this.$message.error('检验项的要求值与要求描述不匹配, 请检查')
            return
          //校验检验项的要求值和要求描述,仅委托要求
          if(this.active==1&&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('松套管'))
@@ -1635,24 +1636,57 @@
          }
        }
      },
      /**
       * 校验委托要求的检验项的要求描述和要求值
       *
       */
      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&&ele.tell!=ele.ask){
                /**
                 * 判断情况
                 * 1.要求描述与要求描述相同
                 * 2.要求描述包含要求值
                 * 3.要求描述为3N-10N这种情况
                 * 4.要求描述为10±5这种情况
                 * 5.
                 */
                 let min = Math.min(...splits)
                 let max = Math.max(...splits)
                 if(min==max){
                  isTrue = false
                }else if(ele.tell.indexOf('±')>0&&ele.tell!=ele.ask){
                 }
                //要求描述中不包含±以及区间的数字,则返回false
                if((tell.indexOf('±')<0&&tell.indexOf('-')<0)){
                  isTrue = false
                }else if(ele.tell.indexOf('-')==0){
                  isTrue = false
                }else if(tell.indexOf('-')>0){
                  const splitTells = tell.split('-')
                  if(splitTells[0].indexOf(min)<0 || splitTells[1].indexOf(max)<0){
                    isTrue = false
                  }
                }else if(tell.indexOf('±')>0&&tell!=ele.ask){
                  //校验要求描述为10±5这种写法的情况
                  let splitNums = ele.tell.split('±')
                  if(splitNums.length<2){
                    isTrue = false
@@ -2401,6 +2435,11 @@
        this.$axios.post(this.$api.insOrder.selectInsOrderTemplateById + '?id=' + e).then(res => {
          if (res.code == 201) return
          let obj = JSON.parse(res.data)
          console.log(obj);
          //制单人设置为当前登录用户
          let user = JSON.parse(localStorage.getItem('user'))
          obj.addObj.custom = user.name
          obj.addObj.userId = user.userId
          this.addObj = obj.addObj;
          this.sampleList = obj.sampleList;
          this.selectTree = obj.selectTree
@@ -2956,9 +2995,8 @@
      getTotal() {
        this.totalArr = []
        this.total = 0;
        // console.log(this.sampleList)
        this.sampleList.forEach(item => {
          if (item.insProduct && item.insProduct.length > 0) {
          if (item.insProduct  && item.insProduct.length > 0) {
            item.insProduct.forEach(a => {
              this.totalArr.push(a)
            })