zss
2024-09-13 9bce6d06fc72b109ebfe1fa779c57e1d62a43b57
src/components/do/b1-inspect-order-plan/Inspection.vue
@@ -181,6 +181,10 @@
    display: inline-flex;
    align-items: center;
  }
  .history-btn{
    display: flex;
    align-items: center;
  }
</style>
<style>
  .inspection .el-form-item__label {
@@ -254,18 +258,18 @@
      </el-col>
      <el-col :span="12" style="text-align: right;">
        <el-button size="small" type="primary" @click="sampleVisible=true;uploadSample()">样品切换</el-button>
        <el-button size="small" type="primary" @click="taskVisible=true">任务切换</el-button>
        <el-button size="small" type="primary" @click="taskVisible=true" v-show="!isLook">任务切换</el-button>
        <el-button size="small" type="primary" @click="handleSubmit" v-if="state==1"
          :loading="submitLoading">提交</el-button>
        <!-- 复核 -->
        <el-button size="small" type="primary" @click="upInsReview(1)" :loading="reviewLoading"
          v-if="state>1">继续试验</el-button>
        <el-button size="small" @click="upInsReview(0)" v-if="state>1" type="danger">再次试验</el-button>
        <el-button size="small" @click="upInsReview(2)" v-if="state>1">结束试验</el-button>
          v-if="state>1&&!isLook">继续试验</el-button>
        <el-button size="small" @click="upInsReview(0)" v-if="state>1&&!isLook" type="danger">再次试验</el-button>
        <el-button size="small" @click="upInsReview(2)" v-if="state>1&&!isLook">结束试验</el-button>
        <el-button size="small" @click="$emit('goback')">返回</el-button>
      </el-col>
    </el-row>
    <div class="search">
    <div class="search" v-show="!isLook">
      <el-form :inline="true" :model="searchForm" class="form-inline" label-width="100px" label-position="right">
        <el-form-item label="委托编号:">
          <el-input clearable v-model="insOrder.entrustCode" disabled size="small" placeholder="请输入"></el-input>
@@ -351,6 +355,11 @@
          </el-select>
          <el-button type="primary" size="small" v-if="(isGet||tableLists.find(m=>m.templateId==currentTable)&&tableLists.find(m=>m.templateId==currentTable).templateName=='温度循环检验原始记录'&&temDataAcquisition)&&PROJECT=='检测中心'&&state==1" @click="getDataAcquisitionDevice" :loading="dataAcquisitionLoading">数据采集</el-button>
          <el-button :type="dataAcquisitionEidtAble?'':'primary'" size="small" v-if="(isGet||(tableLists.find(m=>m.templateId==currentTable)&&tableLists.find(m=>m.templateId==currentTable).templateName=='温度循环检验原始记录'))&&PROJECT=='检测中心'&&collected&&state==1" @click="dataAcquisitionEidtAble=!dataAcquisitionEidtAble">{{dataAcquisitionEidtAble?'关闭编辑':'编辑数采'}}</el-button>
        </div>
        <div class="history-btn" v-if="isLook">
          <el-button type="primary" icon="el-icon-arrow-left" size="small" @click="goHistory(-1)">上一条记录</el-button>
          <span style="font-size: 14px;margin: 0 10px;">当前第{{num}}条</span>
          <el-button type="primary" size="small" @click="goHistory(1)">下一条记录<i class="el-icon-arrow-right el-icon--right"></i></el-button>
        </div>
      </div>
      <!-- 常规检验原始记录 -->
@@ -470,87 +479,6 @@
            </tr>
          </tbody>
        </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="sagForm" class="form-inline" label-width="120px" 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="sagForm.sampleCode" disabled size="small" placeholder=""></el-input>
          </el-form-item>
          <el-form-item label="型号" style="margin-bottom: 0;">
            <el-input clearable v-model="sagForm.model" disabled size="small" placeholder=""></el-input>
          </el-form-item>
          <el-form-item label="检验依据" style="margin-bottom: 0;">
            <el-input clearable v-model="sagForm.inspection" disabled size="small" placeholder=""></el-input>
          </el-form-item>
          <el-form-item label="设备编号" style="margin-bottom: 0;">
            <el-input clearable v-model="sagForm.methodName" disabled size="small" placeholder=""></el-input>
          </el-form-item>
          <el-form-item label="额定拉断力/kN" style="margin-bottom: 0;">
            <el-input clearable v-model="sagForm.tensileForce" disabled size="small" placeholder=""></el-input>
          </el-form-item>
          <el-form-item label="跨距长度/m" style="margin-bottom: 0;">
            <el-input clearable v-model="sagForm.spanLength" disabled size="small" placeholder=""></el-input>
          </el-form-item>
          <el-form-item label="载荷/kN" style="margin-bottom: 0;">
            <el-input clearable v-model="sagForm.load" disabled size="small" placeholder=""></el-input>
          </el-form-item>
        </el-form>
        <el-divider></el-divider>
        <div class="container">
          <el-button class="right-button" type="primary" size="small" @click="addSag">添 加</el-button>
        </div>
        <el-table :data="sagData" class="custom-table" border>
          <el-table-column label="高度 h mm" prop="height" align="center">
          </el-table-column>
          <el-table-column label="弧垂  mm" prop="sag" align="center">
          </el-table-column>
          <el-table-column label="导线温度℃" align="center">
            <el-table-column label="1" prop="one" align="center">
              <template slot-scope="scope">
                <el-input v-model="scope.row.one"  style="width: 100%;"></el-input>
              </template>
            </el-table-column>
            <el-table-column label="2" prop="two" align="center">
              <template slot-scope="scope">
                <el-input v-model="scope.row.two"  style="width: 100%;"></el-input>
              </template>
            </el-table-column>
            <el-table-column label="3" prop="three" align="center">
              <template slot-scope="scope">
                <el-input v-model="scope.row.three"  style="width: 100%;"></el-input>
              </template>
            </el-table-column>
            <el-table-column label="4" prop="four" align="center">
              <template slot-scope="scope">
                <el-input v-model="scope.row.four"  style="width: 100%;"></el-input>
              </template>
            </el-table-column>
            <el-table-column label="5" prop="five" align="center">
              <template slot-scope="scope">
                <el-input v-model="scope.row.five"  style="width: 100%;"></el-input>
              </template>
            </el-table-column>
            <el-table-column label="6" prop="six" align="center">
              <template slot-scope="scope">
                <el-input v-model="scope.row.six"  style="width: 100%;"></el-input>
              </template>
            </el-table-column>
          </el-table-column>
          <el-table-column label="平均温度℃" prop="average" align="center">
          </el-table-column>
          <el-table-column label="室温℃" prop="temperature" align="center">
          </el-table-column>
          <el-table-column label="张力kN" prop="remark" align="center">
          </el-table-column>
          <el-table-column label="操作" align="center">
            <template slot-scope="scope">
              <el-button type="text" size="small" @click="deleteSag(scope.$index)"><span style="color:red">删除</span></el-button>
            </template>
          </el-table-column>
        </el-table>
      </div>
      <!-- 温度循环检验原始记录 -->
      <div v-loading="tableLoading" v-else-if="tableLists.find(m=>m.templateId==currentTable).templateName=='温度循环检验原始记录'">
@@ -800,8 +728,8 @@
      <!-- 电路试验 -->
      <div v-else-if="tableLists.find(m=>m.templateId==currentTable).templateName.includes('电路试验')" style="width: 100%;overflow-x: auto;overflow-y: visible;">
        <!-- <Circuit></Circuit> -->
        <CircuitParameters1 v-if="currentTableState==0" :insProduct="currentSample.insProduct" :orderId="id" :sampleId="currentSample.id" :state="state" :num="currentSample.num1"></CircuitParameters1>
        <CircuitParameters2 v-if="currentTableState==1" :insProduct="currentSample.insProduct" :orderId="id" :sampleId="currentSample.id" :state="state" :num="currentSample.num1"></CircuitParameters2>
        <CircuitParameters1 v-if="currentTableState==0" :insProduct="currentSample.insProduct" :orderId="id" :sampleId="currentSample.id" :state="state" :num="currentSample.num1" :isLook="isLook" :currentNum="currentNum"></CircuitParameters1>
        <CircuitParameters2 v-if="currentTableState==1" :insProduct="currentSample.insProduct" :orderId="id" :sampleId="currentSample.id" :state="state" :num="currentSample.num1" :isLook="isLook" :currentNum="currentNum"></CircuitParameters2>
      </div>
      <el-upload :action="action"
      :data="{
@@ -939,7 +867,7 @@
  import CircuitParameters1 from './circuit-parameters1.vue'
  import CircuitParameters2 from './circuit-parameters2.vue'
  export default {
    props: ['sonLaboratory', 'orderId', 'state','inspectorList','version','orderStateId'],
    props: ['sonLaboratory', 'orderId', 'state','inspectorList','version','orderStateId','isLook','num1'],
    components: {
      ValueTable,
      Circuit,
@@ -948,19 +876,10 @@
    },
    data() {
      return {
        currentNum:0,
        versionLoading:false,
        versionDialogVisible:false,
        currentTableState:0,
        sagData: [],
        sagForm: {
          sampleCode: null,
          model: null,
          inspection: null,
          methodName: null,
          tensileForce: null,
          spanLength: null,
          load: null
        },
        dataGetDia:false,
        wareTableDataLoading:false,
        fileAdd:false,
@@ -1128,6 +1047,7 @@
        changeType:null,
        getDataTypeId:'',
        getDataType:null,
        num:0
      }
    },
    // 用于上传文件的信息
@@ -1144,6 +1064,8 @@
    created() {
      this.componentData.entity.sonLaboratory = this.sonLaboratory;
      this.id = this.orderId;
      this.currentTableState = this.version
      this.num = this.num1
      this.getUserInfo()
    },
    mounted() {
@@ -1154,7 +1076,6 @@
      this.scrollInit()
      this.getPower()
      this.startWorker()
      this.currentTableState = this.version
    },
    watch: {
      // 监听任务id,获取任务信息
@@ -1321,7 +1242,7 @@
              })
            }
            // 保存数据
            this.saveInsContext()
            this.saveInsContext(this.currentSample.insProduct[0].id)
          }
        }
      },
@@ -1331,22 +1252,6 @@
      this.stopWorker();
    },
    methods: {
      // 删除行
      deleteSag(index) {
        this.sagData.splice(index, 1)
      },
      // 添加弧垂检测
      addSag() {
        this.sagData.push({
          sampleCode: null,
          model: null,
          inspection: null,
          methodName: null,
          tensileForce: null,
          spanLength: null,
          load: null
        })
      },
      // 数据采集
      getDataAcquisitionDevice(){
        if(this.tableLists.find(m=>m.templateId==this.currentTable)&&this.tableLists.find(m=>m.templateId==this.currentTable).templateName=='温度循环检验原始记录'){
@@ -2171,7 +2076,12 @@
      // 根据类型、任务id、实验室来获取样品的检验项信息
      async getCurrentProduct(id,type){
        this.tableLoading = true;
        let res = await this.$axios.post(this.$api.insOrderPlan.getInsProduct+'?id='+id+'&type='+type+'&laboratory='+this.sonLaboratory)
        let res = null;
        if(!this.isLook){
          res = await this.$axios.post(this.$api.insOrderPlan.getInsProduct+'?id='+id+'&type='+type+'&laboratory='+this.sonLaboratory)
        }else{
          res = await this.$axios.post(this.$api.insOrderPlan.getInsProduct2+'?id='+id+'&type='+type+'&laboratory='+this.sonLaboratory+'&num='+this.num)
        }
        this.tableLoading = false;
        return res.data
      },
@@ -2215,7 +2125,7 @@
        }
        // 处理页面列表数据
        this.getTableLists();
        this.currentKey = row.index
        this.currentKey = row.index?row.index:0
        this.currentTab = null;
        // 向多线程去保存页面列表数据,后端传参,当前模板信息
        this.worker.postMessage(JSON.stringify({
@@ -2830,7 +2740,9 @@
        if(getDataType=='getDataType'){
          this.getDataType = 2;
        }
        let currentInsItemId = null//当前检验项id
        if (n) {
          currentInsItemId = JSON.parse(JSON.stringify(n.i))
          // 需要科学计数法的可以走这里
          if (this.PROJECT === '检测中心') {
            if(this.tableList.find(ele=>ele.inspectionItem=='体积电阻率')){
@@ -2872,11 +2784,13 @@
          this.result = JSON.parse(event.data);
          switch (this.result.method){
            case 'saveInsContext':
              console.log(`output->`,11111111111111)
              this.$nextTick(()=>{
                // this.$delete(this.tableList[0],'arr')
                this.$set(this.tableList[0],'arr',this.result.value.tableList[0].arr)
                this.param = this.result.value.param
                if(this.result.value.currentInsItemId){
                  currentInsItemId = this.result.value.currentInsItemId
                }
                // 特殊处理一下结论,会有这种特殊情况
                for (var i in this.param){
                  if(this.param[i].insResult&&this.param[i].insResult.v&&this.param[i].insResult.v.v){
@@ -2887,33 +2801,34 @@
                    }
                  }
                }
                this.saveInsContext(currentInsItemId)
                // 如果是数采可编辑输入的情况,可以直接保存数据
                if(this.getDataType==2){
                  this.saveInsContext()
                }else{
                  if(this.isGet&&!this.dataAcquisitionEidtAble){
                    if(this.result.value.getDataTypeId==''){
                      // 如果是数采不可编辑输入的情况,且最后一个数采没有完成,则不保存数据
                      return
                    }
                    // 保存数据
                    setTimeout(()=>{
                      this.saveInsContext()
                    },2000)
                  }else if(this.isGet&&this.dataAcquisitionEidtAble){
                    if(this.getDataType==1){
                      if(this.result.value.getDataTypeId==''){
                        // 如果是数采可编辑输入的情况,且最后一个数采没有完成,则不保存数据
                        return
                      }
                      this.saveInsContext()
                    }else{
                      this.saveInsContext()
                    }
                  }else{
                    this.saveInsContext()
                  }
                }
                // if(this.getDataType==2){
                //   this.saveInsContext(currentInsItemId)
                // }else{
                //   if(this.isGet&&!this.dataAcquisitionEidtAble){
                //     if(this.result.value.getDataTypeId==''){
                //       // 如果是数采不可编辑输入的情况,且最后一个数采没有完成,则不保存数据
                //       return
                //     }
                //     // 保存数据
                //     setTimeout(()=>{
                //       this.saveInsContext(currentInsItemId)
                //     },2000)
                //   }else if(this.isGet&&this.dataAcquisitionEidtAble){
                //     if(this.getDataType==1){
                //       if(this.result.value.getDataTypeId==''){
                //         // 如果是数采可编辑输入的情况,且最后一个数采没有完成,则不保存数据
                //         return
                //       }
                //       this.saveInsContext(currentInsItemId)
                //     }else{
                //       this.saveInsContext(currentInsItemId)
                //     }
                //   }else{
                //     this.saveInsContext(currentInsItemId)
                //   }
                // }
              })
              break;
            case 'tableList':
@@ -3313,12 +3228,18 @@
        }
      },
      // 统一在这里保存数据
      saveInsContext() {
      saveInsContext(currentInsItemId) {
        try {
          console.log(1111,this.param)
          if(this.param){
            let param = null
            if(currentInsItemId){
              param = {[currentInsItemId] : this.param[currentInsItemId]}
            }else{
              param = this.param
            }
            this.$axios.post(this.$api.insOrderPlan.saveInsContext, {
              param: JSON.stringify(this.param),
              param: JSON.stringify(param),
              currentTable:this.currentTable,
              num:this.currentSample.num1
            }).then(res => {
@@ -3388,7 +3309,7 @@
          }
        }
        // 保存数据
        this.saveInsContext()
        this.saveInsContext(n.i)
      },
      getAuthorizedPerson() {
        this.$axios.get(this.$api.user.getUserMenu).then(res => {
@@ -3632,6 +3553,20 @@
          }
          this.versionDialogVisible = false
        })
      },
      async goHistory(num){
        if(this.num==1&&num==-1){
          this.$message.error('当前是第一条记录')
          return
        }else if(this.num1==this.num&&num==1){
          this.$message.error('当前是最后一条记录')
          return
        }
        this.num = this.num + num
        this.tableLoading = true
        await this.handleChangeSample(this.currentSample)
        this.currentNum++
        this.tableLoading = false
      }
    }
  }