licp
2024-07-23 58faef5c48c7491fe14e2a3ec0a0db4dba8967a6
src/components/do/b1-inspect-order-plan/Inspection.vue
@@ -209,9 +209,6 @@
  <div v-loading="loading" class="inspection">
    <el-row class="title">
      <el-col :span="12" style="padding-left: 20px;text-align: left;">检验单详情
        <!-- <span style="color: #3A7BFA;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;样品</span>
        <span v-if="currentFiberOpticTape" style="color: #3A7BFA;"> - 光纤带</span>
        <span v-if="currentFiberOptic" style="color: #3A7BFA;"> - 光纤</span> -->
      </el-col>
      <el-col :span="12" style="text-align: right;">
        <!-- <el-button size="small" type="primary" @click="fiberOpticVisible=true" v-if="fiberOptic.length>0">光纤切换</el-button>
@@ -299,10 +296,10 @@
            </el-form-item>
          </el-form>
          <el-button type="primary" size="small" v-if="dataAcquisitionEidt>0&&PROJECT=='检测中心'" @click="getDataAcquisitionDevice" :loading="dataAcquisitionLoading">数据采集</el-button>
          <el-button :type="dataAcquisitionEidtAble?'':'primary'" size="small" v-if="dataAcquisitionEidt>0&&PROJECT=='检测中心'" @click="dataAcquisitionEidtAble=!dataAcquisitionEidtAble">{{dataAcquisitionEidtAble?'关闭编辑':'编辑数采'}}</el-button>
          <el-button :type="dataAcquisitionEidtAble?'':'primary'" size="small" v-if="dataAcquisitionEidt>0&&PROJECT=='检测中心'&&collected" @click="dataAcquisitionEidtAble=!dataAcquisitionEidtAble">{{dataAcquisitionEidtAble?'关闭编辑':'编辑数采'}}</el-button>
        </div>
      </div>
      <div class="center-box" id="nav" v-loading="tableLoading" v-if="!tableLists.find(m=>m.templateId==currentTable)||tableLists.find(m=>m.templateId==currentTable).templateName!='温度循环检验原始记录'">
      <div class="center-box" id="nav" v-loading="tableLoading" v-if="!tableLists.find(m=>m.templateId==currentTable)||(tableLists.find(m=>m.templateId==currentTable).templateName!='温度循环检验原始记录'&&tableLists.find(m=>m.templateId==currentTable).templateName!='热循环检验原始记录')">
        <table border="1" class="tables" cellpadding="10" v-for="(item,index) in tableList" :key="index">
          <tbody>
            <tr v-for="(m,i) in item.arr" :key="i">
@@ -350,7 +347,6 @@
                      <el-option v-for="item in equipOptions" :key="item.value" :label="item.value" :value="item.value">
                      </el-option>
                    </el-select>
                    <!-- <el-button type="primary" icon="el-icon-document-copy" size="small" circle title="数采" v-if="n.isItADataAcquisitionDevice&&PROJECT=='检测中心'" @click="getDataAcquisitionDevice(n.v.v)"></el-button> -->
                  </template>
                  <template v-else-if="n.v.ps!=undefined && n.v.ps.value==='要求值' && state==1">
                    <span :style="`font-family:${n.v.ff} !important;`">{{getTell(n.i)}}</span>
@@ -410,7 +406,7 @@
          </tbody>
        </table>
      </div>
      <div v-loading="tableLoading" v-else>
      <div v-loading="tableLoading" v-else-if="tableLists.find(m=>m.templateId==currentTable).templateName=='温度循环检验原始记录'">
        <el-divider></el-divider>
        <h4 style="margin-bottom: 20px;font-size: 24px;font-weight: 400;text-align: center;">温度循环检验原始记录</h4>
        <el-form :inline="true" :model="wareForm" class="form-inline" label-width="100px" style="justify-content: flex-start;display: flex;align-items: center;width: 100%;">
@@ -571,6 +567,59 @@
           </template>
        </el-table>
      </div>
      <div v-loading="tableLoading" v-else-if="tableLists.find(m=>m.templateId==currentTable).templateName=='热循环检验原始记录'">
        <el-divider></el-divider>
        <h4 style="margin-bottom: 20px;font-size: 24px;font-weight: 400;text-align: center;">热循环检验原始记录</h4>
        <el-form :inline="true" :model="wareForm" class="form-inline" label-width="100px" style="justify-content: flex-start;display: flex;align-items: center;width: 100%;">
        <el-form-item label="型号:" style="margin-bottom: 0;">
          <el-input clearable v-model="wareForm0.model" disabled size="small" placeholder=""></el-input>
        </el-form-item>
        <el-form-item label="试验方法:" style="margin-bottom: 0;">
          <el-input clearable v-model="wareForm0.methodName" disabled size="small" placeholder=""></el-input>
        </el-form-item>
        <el-form-item label="循环次数:" style="margin-bottom: 0;">
          <el-input-number v-model="thermalCyclingInfo.inspectionItem" :min="1" :max="thermalCyclingInfo.max" label="" style="margin-top:4px" size="small" ></el-input-number>
        </el-form-item>
        </el-form>
        <el-divider></el-divider>
        <el-form :inline="true" :model="equipForm" label-width="100px" style="justify-content: flex-start;display: flex;align-items: center;width: 100%;">
          <el-form-item label="仪器名称:">
            <el-input clearable v-model="equipForm.value0" disabled size="small" placeholder=""></el-input>
          </el-form-item>
          <el-form-item label="仪器编号:">
            <el-select v-model="equipForm.code0" placeholder="请选择" size="small">
              <el-option
                v-for="item in equipOptions"
                :key="item.value"
                :label="item.value"
                :value="item.value">
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="仪器名称:" >
            <el-input clearable v-model="equipForm.value1" disabled size="small" placeholder=""></el-input>
          </el-form-item>
          <el-form-item label="仪器编号:">
            <el-select v-model="equipForm.code1" placeholder="请选择" size="small">
              <el-option
                v-for="item in equipOptions"
                :key="item.value"
                :label="item.value"
                :value="item.value">
              </el-option>
            </el-select>
          </el-form-item>
        </el-form>
        <table border="1" class="tables" cellpadding="10">
          <tr v-for="(item,index) in thermalCyclingInfo.arr">
            <td style="width: 100px;text-align: center;">{{ item }}</td>
            <td>
              <el-input clearable size="small" placeholder="温度"></el-input>
              <el-input clearable size="small" placeholder="直流电阻"></el-input>
            </td>
          </tr>
        </table>
      </div>
      <el-upload :action="action"
      :data="{
        orderId:id
@@ -689,6 +738,7 @@
  import ValueTable from '../../tool/value-table.vue'
  import file from '../../../util/file'
  import excelFunction from '../../../util/excelFountion'
import { number } from 'echarts'
  export default {
    props: ['sonLaboratory', 'orderId', 'state'],
    components: {
@@ -846,7 +896,14 @@
        dataAcquisitionInfo:{},
        dataAcquisitionEidt:0,
        dataAcquisitionEidtAble:false,
        dataAcquisitionLoading:false
        dataAcquisitionLoading:false,
        collected:false,
        // 热循环---开始
        thermalCyclingInfo:{
          max:0,
          inspectionItem:1,
          arr:[]
        }
      }
    },
    computed: {
@@ -949,7 +1006,7 @@
      equipForm:{
        deep:true,
        handler(val){
          if(this.tableLists.find(m=>m.templateId==this.currentTable)&&this.tableLists.find(m=>m.templateId==this.currentTable).templateName=='温度循环检验原始记录'&&this.equipOptions&&this.equipOptions.length>0){
          if(this.tableLists.find(m=>m.templateId==this.currentTable)&&(this.tableLists.find(m=>m.templateId==this.currentTable).templateName=='温度循环检验原始记录'||this.tableLists.find(m=>m.templateId==this.currentTable).templateName=='热循环检验原始记录')&&this.equipOptions&&this.equipOptions.length>0){
            this.param[this.currentSample.insProduct[0].id].equipValue = []
            this.param[this.currentSample.insProduct[0].id].equipName = []
            if(this.equipForm.code0){
@@ -1009,13 +1066,13 @@
    methods: {
      getDataAcquisitionDevice(){
        this.dataAcquisitionLoading = true
        this.$axios.get(this.$api.deviceScope.dataCollection+'?entrustCode='+this.insOrder.entrustCode+'&sampleCode='+this.currentSample.sampleCode).then(res=>{
        this.$axios.get(this.$api.deviceScope.dataCollection+'?entrustCode='+this.insOrder.entrustCode+'&sampleCode='+this.currentSample.sampleCode + '&id=' + this.currentSample.id).then(res=>{
          this.dataAcquisitionLoading = false
          if(res.code!=200){
            return
          }
          this.dataAcquisitionInfo = res.data
          let list = this.currentSample.insProduct[0].arr
          let list = this.tableList[0].arr
          list.forEach((item,index)=>{
            item.forEach(m=>{
              if(m.v.ps&&(m.v.ps.value=='检验子项'||m.v.ps.value=='检验项')){
@@ -1026,19 +1083,22 @@
                      num++
                    }
                  })
                  list[index].forEach(n=>{
                  list[index].forEach((n,i)=>{
                    if(n.v.ps&&n.v.ps.value&&typeof n.v.ps.value == 'string'&&n.v.ps.value.includes('检验值')){
                      if(n.v.ps.value.includes(this.dataAcquisitionInfo.frequency)){
                      let arr = n.v.ps.value.split('值')
                      if(arr[1] ==this.dataAcquisitionInfo.frequency){
                        setTimeout(()=>{
                          n.v.v = this.dataAcquisitionInfo[m.v.m]
                          this.$delete(n.v,'v')
                          this.$set(n.v,'v',this.dataAcquisitionInfo[m.v.m])
                          this.changeInput('',`${this.currentSample.insProduct[0].templateId}-${n.r}-${n.c}-${n.i}`,n)
                        },1000)
                      }else if(this.dataAcquisitionInfo.frequency>num){
                      }else if(Number(this.dataAcquisitionInfo.frequency)>num){
                        if(n.v.ps.value.includes(num)){
                          setTimeout(()=>{
                            n.v.v = this.dataAcquisitionInfo[m.v.m]
                            this.$delete(n.v,'v')
                            this.$set(n.v,'v',this.dataAcquisitionInfo[m.v.m])
                            this.changeInput('',`${this.currentSample.insProduct[0].templateId}-${n.r}-${n.c}-${n.i}`,n)
                          },200)
                          },1000)
                        }
                      }
                    }
@@ -1115,7 +1175,6 @@
        if(this.PROJECT!='检测中心'||!this.tableLists.find(m=>m.templateId==this.currentTable)||this.tableLists.find(m=>m.templateId==this.currentTable).templateName!='温度循环检验原始记录'){
          return
        }
        // this.$refs.wareTableData&&this.$refs.wareTableData.doLayout()
        if(m&&type){
          this.wareForm[type] = m
        }
@@ -1256,11 +1315,22 @@
            }
            arr2.push(obj)
          })
          console.log(arr2)
          this.wareTableData = arr2
        })
        this.getEquipOptions(true,this.currentSample.insProduct[0].id)
        // this.$refs.wareTableData&&this.$refs.wareTableData.doLayout()
      },
      thermalCyclingChange(){
        // this.wareTableDataLoading = true
        this.$axios.post(this.$api.insOrderPlan.temCycle,{
          sampleId:this.currentSample.id,
          inspectionItem:this.thermalCyclingInfo.inspectionItem
        }).then(res => {
          // this.wareTableDataLoading = false
          if (res.code == 201) return
          console.log(res.data)
          this.getEquipOptions(true,this.currentSample.insProduct[0].id)
        })
      },
      subOtherForm(m,type){
        let ids = []
@@ -1284,6 +1354,7 @@
        let power = JSON.parse(sessionStorage.getItem('power'))
        let fileDel = false
        let fileAdd = false
        let collected = false
        for (var i = 0; i < power.length; i++) {
               if (power[i].menuMethod == 'uploadFile') {
                  fileAdd = true
@@ -1291,11 +1362,15 @@
               if (power[i].menuMethod == 'delfile') {
                  fileDel = true
               }
          if (power[i].menuMethod == 'isItAllowedToModifyTheCollectedValues') {
                  collected = true
               }
            }
        if (!fileDel) {
               this.componentData0.do.splice(1, 1)
            }
        this.fileAdd = fileAdd
        this.collected = collected
      },
      async getCurrentProduct(id,type){
        this.tableLoading = true;
@@ -1541,7 +1616,7 @@
        this.excelMethodList = []
        this.widthList = this.tableList[0].style.columnlen;
        // 温度循环检验原始记录--开始
        if(this.tableLists.find(m=>m.templateId==this.currentTable)||this.tableLists.find(m=>m.templateId==this.currentTable).templateName!='温度循环检验原始记录'){
        if(this.tableLists.find(m=>m.templateId==this.currentTable)&&this.tableLists.find(m=>m.templateId==this.currentTable).templateName=='温度循环检验原始记录'){
          let ask = this.currentSample.insProduct[0].ask
          let askList = ask.split(';')
          this.numOptions = []
@@ -1567,6 +1642,19 @@
          this.wareFormChange()
        }
        // 温度循环检验原始记录---结束
        // 热循环检验原始记录---开始
        if(this.tableLists.find(m=>m.templateId==this.currentTable)&&this.tableLists.find(m=>m.templateId==this.currentTable).templateName=='热循环检验原始记录'){
          let ask = this.currentSample.insProduct[0].ask
          let askList = ask.split(';')
          this.thermalCyclingInfo.max = Number(askList[askList.length-1])
          let arr = []
          for (let i = 0; i < askList.length-1; i++) {
            arr.push(askList[i].split(',')[0])
          }
          this.thermalCyclingInfo.arr = arr;
          console.log(this.thermalCyclingInfo)
          this.thermalCyclingChange()
        }
        this.tableList.forEach(a => {
          let mcList = []
          a.template.forEach(b => {
@@ -1605,22 +1693,44 @@
            if (size1 < size2) {
              let str = ''
              let count4 = 0
              let isThree = 0
              a.template.forEach(c => {
                if (b.r === c.r) {
                  if (c.v.ps != undefined && c.v.ps.value === '检验项') {
                    if (count4 === 0) {
                      str += c.v.v
                      count4 += 1
                  if(c.v.ps != undefined && c.v.ps.value === '检验项分类'&&count4 === 0){
                    // 三级分类
                    isThree = 1
                  }else if(c.v.ps != undefined && c.v.ps.value === '检验项'&&count4 === 0){
                    // 二级分类
                    isThree = 0
                  }
                  if(isThree==0){
                    if (c.v.ps != undefined && c.v.ps.value === '检验项') {
                      if (count4 === 0) {
                        str += c.v.v
                        count4 += 1
                      }
                    } else if (c.v.ps != undefined && c.v.ps.value === '检验子项') {
                      if (count4 === 1) {
                        str += c.v.v
                        count4 += 1
                      }
                    }
                  } else if (c.v.ps != undefined && c.v.ps.value === '检验子项') {
                    if (count4 === 1) {
                      str += c.v.v
                      count4 += 1
                    }
                  }else if (c.v.ps != undefined && c.v.ps.value === '检验子子项'&&this.PROJECT=='装备电缆') {
                    if (count4 === 2) {
                      str += c.v.v
                      count4 += 1
                  }else if(isThree==1){
                    if (c.v.ps != undefined && c.v.ps.value === '检验项分类') {
                      if (count4 === 0) {
                        str += c.v.v
                        count4 += 1
                      }
                    }else if (c.v.ps != undefined && c.v.ps.value === '检验项') {
                      if (count4 === 1) {
                        str += c.v.v
                        count4 += 1
                      }
                    } else if (c.v.ps != undefined && c.v.ps.value === '检验子项') {
                      if (count4 === 2) {
                        str += c.v.v
                        count4 += 1
                      }
                    }
                  }
                }
@@ -1628,8 +1738,16 @@
              if (str != '') {
                let count2 = 0
                for (let i in this.currentSample.insProduct) {
                  if (this.currentSample.insProduct[i].templateId === a.templateId && this.currentSample
                  .insProduct[i].inspectionItem +(this.currentSample.insProduct[i].inspectionItemSubclass == null ? '' : this.currentSample.insProduct[i].inspectionItemSubclass)+(this.currentSample.insProduct[i].inspectionItemClass==null||this.PROJECT!='装备电缆'?'':this.currentSample.insProduct[i].inspectionItemClass) ===
                  let inspectionItemClass = this.currentSample.insProduct[i].inspectionItemClass==null||this.currentSample.insProduct[i].inspectionItemClass==undefined?'':this.currentSample.insProduct[i].inspectionItemClass
                  let inspectionItem = this.currentSample
                  .insProduct[i].inspectionItem==null||this.currentSample
                  .insProduct[i].inspectionItem==undefined?'':this.currentSample
                  .insProduct[i].inspectionItem
                  let inspectionItemSubclass = this.currentSample
                  .insProduct[i].inspectionItemSubclass==null||this.currentSample
                  .insProduct[i].inspectionItemSubclass==undefined?'':this.currentSample
                  .insProduct[i].inspectionItemSubclass
                  if (this.currentSample.insProduct[i].templateId === a.templateId && inspectionItemClass +inspectionItem+inspectionItemSubclass ===
                    str) {
                    ids.push({
                      r: b.r,
@@ -1796,18 +1914,19 @@
                if(equipValue[i].v){
                  let isItADataAcquisitionDevice = await this.determineWhetherToCollectData(equipValue[i].v)
                  this.param[a.id].equipValue[i].isItADataAcquisitionDevice = isItADataAcquisitionDevice
                  this.dataAcquisitionEidt = 0
                  if(this.param){
                    for (let key in this.param) {
                      this.param[key].equipValue.forEach(m=>{
                        if(m.isItADataAcquisitionDevice){
                          this.dataAcquisitionEidt++
                        }
                      })
                    }
                  }
                }else{
                  this.param[a.id].equipValue[i].isItADataAcquisitionDevice = false
                }
                this.dataAcquisitionEidt = 0
                if(this.param){
                  for (let key in this.param) {
                    this.param[key].equipValue.forEach(m=>{
                      if(m.isItADataAcquisitionDevice){
                        this.dataAcquisitionEidt++
                      }
                    })
                  }
                }
              }
            }
@@ -1831,7 +1950,6 @@
        this.handleExcelMethod()
      },
      changeInput(m, code, n) {
        console.log(m, code)
        if (n) {
          // if (this.PROJECT === '装备电缆') {
          //   let num2 = new this.$Big(n.v.v)
@@ -1864,7 +1982,8 @@
          switch (this.result.method){
            case 'saveInsContext':
              this.$nextTick(()=>{
                this.tableList = this.result.value.tableList
                // this.$delete(this.tableList[0],'arr')
                this.$set(this.tableList[0],'arr',this.result.value.tableList[0].arr)
                this.param = this.result.value.param
                for (var i in this.param){
                  if(this.param[i].insResult&&this.param[i].insResult.v&&this.param[i].insResult.v.v){
@@ -1875,21 +1994,31 @@
                    }
                  }
                }
                // let obj = this.param[code.split('-')[3]]
                // this.tableList[0].arr.forEach(item=>{
                //   item.forEach(m=>{
                //     if(obj&&obj.insResult&&m.c==obj.insResult.c&&m.r==obj.insResult.r){
                //       m.v.v = obj.insResult.v.v
                //     }
                //     if(obj&&obj.resValue&&m.c==obj.resValue.c&&m.r==obj.resValue.r){
                //       m.v.v = obj.resValue.v.v
                //     }
                //   })
                // })
                // console.log(this.tableList,this.param)
                this.saveInsContext()
              })
              break;
            case 'tableList':
              this.$nextTick(()=>{
                this.tableList = this.result.value
                this.$delete(this.tableList[0],'arr')
                this.$set(this.tableList[0],'arr',this.result.value[0].arr)
              })
              break;
            case 'getCurrentInsProduct':
              this.getCurrentInsProduct(this.result.value)
              break;
          }
          // if(this.result.method=='saveInsContext'){
          //   this.stopWorker(); // 处理完成后停止 Worker
          // }
        };
      },
      async determineWhetherToCollectData(managementNumber){
@@ -2090,7 +2219,6 @@
              this.equipOptions = res.data.map(m => {
                m.value = m.managementNumber
                m.label = m.deviceName
                m.isItADataAcquisitionDevice = m.isItADataAcquisitionDevice
                return m
              })
            }
@@ -2178,7 +2306,9 @@
              this.$axios.post(this.$api.insOrderPlan.submitPlan, {
                orderId: this.orderId,
                laboratory: this.sonLaboratory,
                verifyUser: this.verifyUser
                verifyUser: this.verifyUser,
                entrustCode: this.insOrder.entrustCode,
                sampleCode: this.currentSample.sampleCode
              }).then(res => {
                if (res.code === 200) {
                  this.$message.success("操作成功")
@@ -2231,6 +2361,7 @@
        return
      },
      saveInsContext() {
        // console.log(1111,this.param)
        if(this.param){
          this.$axios.post(this.$api.insOrderPlan.saveInsContext, {
            param: JSON.stringify(this.param)
@@ -2255,6 +2386,16 @@
            }
          }
        }
        this.dataAcquisitionEidt = 0
        if(this.param){
          for (let key in this.param) {
            this.param[key].equipValue.forEach(m=>{
              if(m.isItADataAcquisitionDevice){
                this.dataAcquisitionEidt++
              }
            })
          }
        }
        this.saveInsContext()
      },
      getAuthorizedPerson() {