licp
2024-11-01 69ed1555e7be98d643e5cf9c55b591c44d52d1b9
src/components/do/b1-ins-order/add.vue
@@ -134,8 +134,8 @@
  <div class="ins_order_add" style=" display: block; ">
    <div v-show="!configShow&&!equipConfigShow&&!cableConfigShow">
      <el-row class="title">
        <el-col :span="6" style="padding-left: 20px;text-align: left;">委托单信息&nbsp;&nbsp;&nbsp;总价:<span
            style="color: #3A7BFA">¥{{total}}</span></el-col>
        <el-col :span="6" style="padding-left: 20px;text-align: left;">委托单信息&nbsp;&nbsp;&nbsp;单位成本总价:<span
            style="color: #3A7BFA">¥{{total.toFixed(2)}}</span></el-col>
        <el-col :span="18" style="text-align: right;">
          <el-select v-model="template" size="medium" placeholder="下单模板" style="margin-right: 10px;" v-show="active==1"
            @change="selectInsOrderTemplateById">
@@ -148,10 +148,7 @@
          <el-button size="medium" @click="templateDia=true" v-show="active==1">
            <span style="color: #3A7BFA;">保存模板</span>
          </el-button>
          <el-button size="medium" type="primary" @click="openCableConfig"
            v-if="active==1&&PROJECT=='装备电缆'&&addObj.sampleType!=undefined&&addObj.sampleType.indexOf('电缆')>-1">电缆配置</el-button>
          <el-button size="medium" type="primary" @click="openEquipConfig" v-if="active==1">子样品配置</el-button>
          <el-button size="medium" type="primary" @click="openConfig" v-if="addObj.sampleType==='光缆'">光纤配置</el-button>
          <el-button size="medium" type="primary" @click="save" :loading="saveLoad" v-show="active==1">提交</el-button>
          <!-- 审核 -->
          <el-button size="medium" @click="upInsOrderOfState(2)" :loading="saveLoad" v-show="active==3&&addObj.companyId"
@@ -996,6 +993,44 @@
        <el-button type="primary" @click="spliceTemperatureTest">保存</el-button>
      </span>
    </el-dialog>
    <!-- 功率容量--填写端口 -->
    <el-dialog title="填写端口" :visible.sync="powerShow"
      :close-on-click-modal="false" :close-on-press-escape="false"
      width="50%">
      <el-table
        :data="powerTable"
        border
        style="width: 100%">
        <el-table-column
          fixed
          prop="sample"
          label="样品"
          min-width="150">
        </el-table-column>
        <el-table-column
          prop="model"
          label="型号"
          min-width="120">
        </el-table-column>
        <el-table-column
          prop="inspectionItem"
          label="检验项"
          min-width="120">
        </el-table-column>
        <el-table-column
          prop="ask"
          label="端口"
          min-width="120">
          <template slot-scope="scope">
            <el-input-number v-model="scope.row.ask" :min="1" :max="100" label="端口" size="small"></el-input-number>
          </template>
        </el-table-column>
      </el-table>
      <span slot="footer" class="dialog-footer">
        <el-button @click="powerShow=false">取消</el-button>
        <el-button type="primary" @click="savePowerTest">保存</el-button>
      </span>
    </el-dialog>
    <el-dialog
      title="文件预览"
      :visible.sync="lookFileVisible"
@@ -1268,9 +1303,11 @@
          requiredUp: []
        },
        ruleInfo:{
          rule:null,
          rule:1,
          num:null,
        }
        },
        powerShow:false,
        powerTable:[]
      }
    },
    watch: {
@@ -1496,7 +1533,13 @@
        })
        this.circulateShow = false
        this.changeProductList0()
        this.currentMethod.insProduct = this.productList0
        if(this.sampleSelectionList.length>0){
          this.sampleSelectionList.forEach(item=>{
            item.insProduct = this.productList0
          })
        }else{
          this.currentMethod.insProduct = this.productList0
        }
        this.getProNum()
      },
      spliceTemperatureTest () {
@@ -1547,6 +1590,24 @@
          return
        }
        this.spliceTemperatureTest()
      },
      savePowerTest(){
        if(!this.powerTable.every(m=>m.ask))
        {
          this.$message.error('请填写完整数据')
        }
        let num = 0;
        let sampleList = this.HaveJson(this.sampleList)
        sampleList.forEach(item=>{
          item.insProduct.forEach(m=>{
            if(m.inspectionItem.includes('功率试验')&&m.state==1){
              m.ask = '端口数:'+this.powerTable[num].ask
              num++
            }
          })
        })
        this.saveMethod(sampleList)
        this.powerShow = false;
      },
      cleanTemperatureTest () {
        this.temperatureTest = []
@@ -1848,6 +1909,22 @@
          //   }
          // }
          let sampleList = this.HaveJson(this.sampleList)
          for (let i = 0; i < sampleList.length; i++) {
            if (sampleList[i].insProduct.length > 0) {
              let set = new Set()
              for (let j = 0; j < sampleList[i].insProduct.length; j++) {
                if(sampleList[i].insProduct[j].state == 1){
                  let num0 = set.size
                  set.add(sampleList[i].insProduct[j].inspectionItem+'-'+sampleList[i].insProduct[j].inspectionItemSubclass)
                  let num1 = set.size
                  if(num0==num1){
                    this.$message.error(sampleList[i].insProduct[j].inspectionItem+'-'+sampleList[i].insProduct[j].inspectionItemSubclass+'重复')
                    return
                  }
                }
              }
            }
          }
          let projectNum = this.totalArr.filter(a => a.state == 1).length
          if(projectNum==0){
            this.$confirm('检验项目为空,是否确认提交?', "提示", {
@@ -1858,13 +1935,22 @@
              this.saveMethod(sampleList)
            }).catch(() => {})
          }else{
            let isRTS = this.totalArr.find(a => a.ask != null && this.symbolList.find(b=>a.ask.includes(b)) && a.state == 1)
            let isRTS = this.totalArr.find(a => a.ask != null && this.symbolList.find(b=>a.ask&&a.ask.includes(b)) && a.state == 1)
            if (isRTS&&this.PROJECT=='检测中心') {
              this.editTable = this.handleData(sampleList,this.containsValue, 0)
              this.editTable.forEach(item => {
                item.value = item.modelNum
              })
              this.bsm3Dia = true;
              return
            }
            let isPower = this.totalArr.find(a => a.inspectionItem.includes('功率试验')&&a.state==1)
            if (isPower) {
              this.powerTable = this.totalArr.filter(a => a.inspectionItem.includes('功率试验')&&a.state==1)
              this.powerTable.forEach(a => {
                a.ask = null
              })
              this.powerShow = true;
              return
            }
            this.saveMethod(sampleList)
@@ -1911,7 +1997,6 @@
                 let min = Math.min(...splits)
                 let max = Math.max(...splits)
                 if(min==max){
                  console.log(2222);
                  isTrue = false
                 }
                //要求描述中不包含±以及区间的数字,则返回false
@@ -2008,7 +2093,7 @@
                  let arr = this.editTable.filter(b => b.sampleId == item.id)
                  for (var i=0;i<arr.length;i++){
                    if(a.ask){
                      if(a.ask.includes(arr[i].symbolItem)){
                      if(a.ask&&a.ask.includes(arr[i].symbolItem)){
                        let ask = calBack(a.ask, arr[i].symbolItem,arr[i].value)
                        if (ask) {
                          a.ask = ask
@@ -2574,7 +2659,8 @@
        if(row.section === null) {
          row.section = ""
        }
        let arr = this.productList.filter(m=>m.state==1&&row.section.includes(m.section)&&m.ask&&m.section.indexOf('[')==-1)
        // console.log(row,this.productList)
        let arr = this.productList.filter(m=>m.state==1&&m.bsmRow&&m.bsmRow.section==row.section&&row.section.includes(m.section)&&m.ask&&m.section.indexOf('[')==-1)
        if (row.bsm === '1' && row.section !== '' && row.section !== null && row.state === 1&&arr.length==0) {
          if (row.section.indexOf('[') > -1) {
            row.bsmRow = this.HaveJson(row)
@@ -2662,7 +2748,13 @@
        // }
        this.changeProductList0()
        this.currentMethod.insProduct = this.productList0
        if(this.sampleSelectionList.length>0){
          this.sampleSelectionList.forEach(item=>{
            item.insProduct = this.productList0
          })
        }else{
          this.currentMethod.insProduct = this.productList0
        }
        this.getProNum()
      },
      searchProject () {
@@ -3020,7 +3112,13 @@
          })
        }
        this.changeProductList0()
        this.currentMethod.insProduct = this.productList0
        if(this.sampleSelectionList.length>0){
          this.sampleSelectionList.forEach(item=>{
            item.insProduct = this.productList0
          })
        }else{
          this.currentMethod.insProduct = this.productList0
        }
        this.getProNum()
        this.$nextTick(() => {
          this.$refs.productTable.doLayout()
@@ -3066,36 +3164,6 @@
        const property = column['property'];
        return row[property] === value;
      },
      openConfig() {
        if (this.active === 1) {
          if (this.sampleIds.length === 0) {
            this.$message.error("未选择样品")
            return
          }
          this.configShow = true
        } else {
          if (this.sampleId === null) {
            this.$message.error('未选中样品')
            return
          }
          this.sampleIds = [this.sampleId]
          this.$axios.post(this.$api.insBushing.selectBushingBySampleId, {
            sampleId: this.sampleId
          }).then(res => {
            if (res.data.length === 0) {
              this.$message.error('该样品没有配置光纤')
              return
            }
            for (var i in this.sampleList) {
              if (this.sampleList[i].id = this.sampleId) {
                this.sampleList[i].bushing = res.data
                break
              }
            }
            this.configShow = true
          })
        }
      },
      openEquipConfig() {
        if (this.active === 1) {
          if (this.sampleIds.length === 0) {
@@ -3103,35 +3171,6 @@
            return
          }
          this.equipConfigShow = true
        } else {
          if (this.sampleId === null) {
            this.$message.error('未选中样品')
            return
          }
          // this.$axios.post(this.$api.insBushing.selectBushingBySampleId, {
          //   sampleId: this.sampleId
          // }).then(res => {
          //   if (res.data.length === 0) {
          //     this.$message.error('该样品没有配置光纤')
          //     return
          //   }
          //   for (var i in this.sampleList) {
          //     if (this.sampleList[i].id = this.sampleId) {
          //       this.sampleList[i].bushing = res.data
          //       break
          //     }
          //   }
          //   this.configShow = true
          // })
        }
      },
      openCableConfig() {
        if (this.active === 1) {
          if (this.sampleIds.length === 0) {
            this.$message.error("未选择样品")
            return
          }
          this.cableConfigShow = true
        } else {
          if (this.sampleId === null) {
            this.$message.error('未选中样品')
@@ -3200,7 +3239,13 @@
          }
        }
        this.changeProductList0()
        this.currentMethod.insProduct = this.productList0
        if(this.sampleSelectionList.length>0){
          this.sampleSelectionList.forEach(item=>{
            item.insProduct = this.productList0
          })
        }else{
          this.currentMethod.insProduct = this.productList0
        }
      },
      save1 () {
        if (this.bsm1DiaList.length > 0) {