licp
2024-06-05 142ba3ed00220dcadf2a94e59664d5f1f027dbf4
src/components/do/b1-ins-order/add.vue
@@ -281,6 +281,12 @@
              v-model="addObj.remark" :readonly="active>1"></el-input>
          </div>
        </el-col>
        <el-col class="search_thing" :span="6" v-if="active==1">
          <div class="search_label">RTS:</div>
          <div class="search_input">
            <el-input size="small" placeholder="请输入" clearable v-model="RTS"></el-input>
          </div>
        </el-col>
      </el-row>
    </div>
    <div v-show="!configShow">
@@ -631,6 +637,8 @@
        bsm1Val: null,
        bsm1Dia: false,
        total:0,
        RTS:'',
        totalArr:[]
      }
    },
    watch: {
@@ -726,6 +734,32 @@
        this.addObj.companyId = selects.id
        this.selectUserDia = false
      },
      handleAsk(ask){
        let code = [">","<","=",">","<","≥","≤","±"];
        if(ask.includes('RTS')){
          if(ask.includes('&')){
            // 多个条件
            let arr0 = ask.split('&')
            arr0.forEach(m=>{
                let index = code.findIndex(b=>m.includes(b))
              if(index>-1){
                let arr = m.split(code[index]).find(b=>b)
                let num = eval(arr[0].replace(/RTS/g, this.RTS))
                m = code[index] + ''+ num
              }
            })
            return arr0.join('&')
          }else{
            // 单个条件
            let index = code.findIndex(b=>ask.includes(b))
            if(index>-1){
              let arr = ask.split(code[index]).find(b=>b)
              let num = eval(arr[0].replace(/RTS/g, this.RTS))
              return code[index] + ''+ num
            }
          }
        }
      },
      save() {
        if (!this.addObj.companyId) {
          this.$message.error('未选择客户单位')
@@ -749,11 +783,68 @@
          this.$message.error('请输入样品型号')
        } else if (!this.sampleList.every(m => m.standardMethodListId)) {
          this.$message.error('请选择检验标准')
        }else if (this.totalArr.find(a=>a.ask.includes('RTS'))&&!this.RTS) {
          this.$message.error('请输入RTS')
        } else {
          let sampleList = this.HaveJson(this.sampleList)
          let isRTS = this.totalArr.find(a=>a.ask.includes('RTS'))
          if(isRTS){
            sampleList.forEach(item=>{
              if(item.insProduct&&item.insProduct.length>0){
                item.insProduct.forEach(a=>{
                  let ask = this.handleAsk(a.ask)
                  if(ask){
                    a.ask = ask
                  }
                })
              }
              // 光纤带项目
              if(item.bushing&&item.bushing.length>0){
                item.bushing.forEach(a=>{
                  if(a.fiber&&a.fiber.length>0){
                    a.fiber.forEach(b=>{
                      if(b.productList&&b.productList.length>0){
                        b.productList.forEach(c=>{
                          let ask = this.handleAsk(c.ask)
                          if(ask){
                            c.ask = ask
                          }
                        })
                      }
                    })
                  }
                  if(a.fibers&&a.fibers.length>0){
                    a.fibers.forEach(b=>{
                      if(b.productList&&b.productList.length>0){
                        b.productList.forEach(c=>{
                          let ask = this.handleAsk(c.ask)
                          if(ask){
                            c.ask = ask
                          }
                        })
                      }
                      if(b.fiber&&b.fiber.length>0){
                        b.fiber.forEach(c=>{
                          if(c.productList&&c.productList.length>0){
                            c.productList.forEach(d=>{
                              let ask = this.handleAsk(d.ask)
                              if(ask){
                                d.ask = ask
                              }
                            })
                          }
                        })
                      }
                    })
                  }
                })
              }
            })
          }
          this.saveLoad = true
          this.$axios.post(this.$api.insOrder.addInsOrder, {
            insOrder: this.addObj,
            list: JSON.stringify(this.sampleList.map(a => {
            list: JSON.stringify(sampleList.map(a => {
              a.model = a.model + ((a.modelNum == null || a.modelNum == '' || a.modelNum == 'null') ? '' : (
                '-' + a.modelNum))
              return a
@@ -1352,12 +1443,12 @@
        done()
      },
      getTotal(){
        let arr = []
        this.totalArr = []
        this.total = 0;
        this.sampleList.forEach(item=>{
          if(item.insProduct&&item.insProduct.length>0){
            item.insProduct.forEach(a=>{
              arr.push(a)
               this.totalArr.push(a)
            })
          }
          if(item.bushing&&item.bushing.length>0){
@@ -1366,7 +1457,7 @@
                a.fiber.forEach(b=>{
                  if(b.productList&&b.productList.length>0){
                    b.productList.forEach(c=>{
                      arr.push(c)
                       this.totalArr.push(c)
                    })
                  }
                })
@@ -1375,14 +1466,14 @@
                a.fibers.forEach(b=>{
                  if(b.productList&&b.productList.length>0){
                    b.productList.forEach(c=>{
                      arr.push(c)
                       this.totalArr.push(c)
                    })
                  }
                  if(b.fiber&&b.fiber.length>0){
                    b.fiber.forEach(c=>{
                      if(c.productList&&c.productList.length>0){
                        c.productList.forEach(d=>{
                          arr.push(d)
                           this.totalArr.push(d)
                        })
                      }
                    })
@@ -1393,7 +1484,7 @@
          }
        })
        let mySet = new Set();
        let arr0 = arr.filter(item=>{
        let arr0 =  this.totalArr.filter(item=>{
          if(item.state == 1){
            let num1= mySet.size
            if(item.manHourGroup===''||!item.manHourGroup){