licp
2024-09-14 a28a7e0dc8992c39004ad0b34d2624390024f3af
src/components/do/b1-inspect-order-plan/Inspection.vue
@@ -323,47 +323,24 @@
          </el-radio-group> -->
        </div>
        <div style="display: flex;align-items: center;">
          <span v-if="casing.length>0&&tableLists.find(m=>m.templateId==currentTable)&&tableLists.find(m=>m.templateId==currentTable).templateName=='成品缆检验原始记录'">&nbsp;&nbsp;套管:</span>
          <el-select v-model="currentTab" placeholder="请选择" @change="m=>handleChange(m,3)" v-if="casing.length>0&&tableLists.find(m=>m.templateId==currentTable)&&tableLists.find(m=>m.templateId==currentTable).templateName=='成品缆检验原始记录'" size="small" :loading="getReportModelLoading" @focus="getReportModel(currentSample.id)">
            <el-option
              v-for="item in casing"
              :key="item.id"
              :label="item.color"
              :value="item.id">
              <span style="float: left">{{ item.color}}</span>
              <el-tag :type="item.state==1?'success':'danger'" style="float: right;margin-top: 5px;" size="small">{{ item.state==1?'已检':'未检' }}</el-tag>
            </el-option>
          </el-select>
          <span v-if="fibers.length>0&&tableLists.find(m=>m.templateId==currentTable)&&tableLists.find(m=>m.templateId==currentTable).templateName!='温度循环检验原始记录'">&nbsp;&nbsp;光纤带:</span>
          <el-select v-model="currentTab" placeholder="请选择" @change="m=>handleChange(m,1)" v-if="fibers.length>0&&tableLists.find(m=>m.templateId==currentTable)&&tableLists.find(m=>m.templateId==currentTable).templateName!='温度循环检验原始记录'" size="small" :loading="getReportModelLoading" @focus="getReportModel(currentSample.id)">
            <el-option
              v-for="item in fibers"
              :key="item.value"
              :label="item.code"
              :value="item.id">
              <span style="float: left">{{ item.code}}</span>
              <el-tag :type="item.state==1?'success':'danger'" style="float: right;margin-top: 5px;" size="small">{{ item.state==1?'已检':'未检' }}</el-tag>
            </el-option>
          </el-select>
          <span v-if="fiber.length>0&&tableLists.find(m=>m.templateId==currentTable)&&tableLists.find(m=>m.templateId==currentTable).templateName!='温度循环检验原始记录'">&nbsp;&nbsp;光纤:</span>
          <el-select v-model="currentTab" placeholder="请选择" @change="m=>handleChange(m,2)" v-if="fiber.length>0&&tableLists.find(m=>m.templateId==currentTable)&&tableLists.find(m=>m.templateId==currentTable).templateName!='温度循环检验原始记录'" size="small" :loading="getReportModelLoading" @focus="getReportModel(currentSample.id)">
            <el-option
              v-for="item in fiber"
              :label="item.bushColor+'-'+item.color"
              :key="item.id"
              :value="item.id">
              <span style="float: left">{{ item.bushColor+'-'+item.color }}</span>
              <el-tag :type="item.state==1?'success':'danger'" style="float: right;margin-top: 5px;" size="small">{{ item.state==1?'已检':'未检' }}</el-tag>
            </el-option>
          </el-select>
          <el-form :inline="true" :model="otherForm" class="form-inline" label-width="50px" style="padding-top: 0;padding-left: 10px;" v-if="PROJECT=='检测中心'">
            <el-form-item label="温度:" style="margin-bottom: 0;">
              <el-input v-model="otherForm.temperature" :disabled="state>1" size="small" placeholder="" style="width: 90px;" @change="m=>subOtherForm(m,'temperature')" ></el-input>
              <span style="margin-left: 4px;">℃</span>
            </el-form-item>
            <el-form-item label="湿度:" style="margin-bottom: 0;">
              <el-input v-model="otherForm.humidity" :disabled="state>1" size="small" placeholder="" style="width: 90px;" @change="m=>subOtherForm(m,'humidity')"></el-input>
              <span style="margin-left: 4px;">%</span>
            </el-form-item>
          </el-form>
          <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">
        <!-- <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> -->
      </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.includes('电路试验'))">
@@ -859,6 +836,25 @@
        <el-button type="primary" :loading="versionLoading" @click="saveVersion">确 定</el-button>
      </span>
    </el-dialog>
    <el-dialog title="试验信息" :visible.sync="experimentDia" width="400px">
      <div class="body" style="display: flex;padding: 10px;align-items: center;">
        <div class="search_label" style="width: 150px;"><span class="required-span">*</span>实验阶段</div>
        <div class="search_input" style="width: 100%;">
          <el-input clearable v-model="experimentInfo.term" size="small" placeholder=""></el-input>
        </div>
      </div>
      <div class="body" style="display: flex;padding: 10px;align-items: center;">
        <div class="search_label" style="width: 150px;"><span class="required-span">*</span>实验操作</div>
        <div class="search_input" style="width: 100%;">
          <el-input clearable v-model="experimentInfo.note" size="small" placeholder="" type="textarea"
          :rows="2"></el-input>
        </div>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button @click="experimentDia = false">取 消</el-button>
        <el-button type="primary" @click="submit0">确 定</el-button>
      </span>
    </el-dialog>
  </div>
</template>
@@ -879,6 +875,11 @@
    },
    data() {
      return {
        experimentDia:false,
        experimentInfo:{
          note:'',
          term:''
        },
        currentNum:0,
        versionLoading:false,
        versionDialogVisible:false,
@@ -968,7 +969,6 @@
        },
        upIndex: 0,
        changeType:null,
        getReportModelLoading:false,
        insOrder: {},
        sampleProduct: [],
        typeList: [],
@@ -1050,7 +1050,11 @@
        changeType:null,
        getDataTypeId:'',
        getDataType:null,
        num:0
        num:0,
        otherForm:{
          temperature:'',
          humidity:''
        }
      }
    },
    // 用于上传文件的信息
@@ -1104,6 +1108,14 @@
          this.sampleProduct = res.data.sampleProduct
          this.currentSample = this.HaveJson(this.sampleProduct[0])
          let insProduct = this.HaveJson(this.currentSample.insProduct)
          // 温度、湿度赋值
          if(insProduct&&insProduct.length>0){
            let {temperature,humidity} = insProduct[0];
            this.otherForm = {
              temperature:temperature?temperature:null,
              humidity:humidity?humidity:null,
            }
          }
          // 获取当前样品的检验项
          let list = await this.getCurrentProduct(this.currentSample.id,0)
          this.currentSample.insProduct = this.HaveJson(list)
@@ -1124,7 +1136,6 @@
            }
          })
          this.determineWhetherToCollectData()//是否需要数采
          this.getReportModel(this.currentSample.id)//获取套管、光纤带、光纤信息
          if (this.currentSample.index == undefined) this.currentSample['index'] = 1
          let bushing = this.currentSample.bushing
          this.getTableLists();//处理模板列表信息
@@ -1174,7 +1185,6 @@
                  }
                }
              })
              this.getReportModel(this.currentSample.id)//获取套管、光纤带、光纤信息
              // 去重模板,返回有几个模板
              const mySet1 = new Set();
              this.tableLists = this.currentSample.insProduct.filter(m => {
@@ -2040,6 +2050,25 @@
        this.saveInsContext()
      },
      // 热循环---结束
      // 保存湿度、温度数据
      subOtherForm(m,type){
        let ids = []
        for (let i in this.param) {
          ids.push(i)
        }
        this.$axios.post(this.$api.insOrderPlan.write,{
          [type]:Number(m),
          ids
        }, {
          headers: {
            'Content-Type': 'application/json'
          },
          noQs:true
        }).then(res => {
          if (res.code == 201) return
          this.$message.success('保存成功')
        })
      },
      // 权限获取
      getPower(){
        let power = JSON.parse(sessionStorage.getItem('power'))
@@ -2120,8 +2149,6 @@
            }
          }
        })
        // 获取套管,光纤带,光纤数据
        this.getReportModel(row.id)
        let bushing = this.currentSample.bushing
        if(bushing&&bushing.length>0){
          this.bushing = bushing
@@ -2150,19 +2177,6 @@
          return true
        }
      },
      // 获取套管,光纤带,光纤数据
      getReportModel(id){
        if(this.PROJECT!='检测中心'){
          return
        }
        this.getReportModelLoading = true
        this.$axios.post(this.$api.insOrderPlan.getReportModel+'?sampleId='+id, {}).then(res => {
          this.getReportModelLoading = false
          this.fibers = res.data['光纤带']
          this.fiber = res.data['光纤']
          this.casing = res.data['套管']
        })
      },
      // 套管,光纤带,光纤等切换,对应原始记录模板也要切换
      async handleChange(m,type){
        this.changeType = type
@@ -2184,8 +2198,6 @@
            })
            // 页面列表数据处理
            this.getTableLists0(list)
            // 获取套管,光纤带,光纤数据
            this.getReportModel(this.currentSample.id)
            // 向多线程保存数据
            this.worker.postMessage(JSON.stringify({
              type: 'saveData',
@@ -3139,13 +3151,25 @@
          this.$message.error('未输入不通过原因')
        }
      },
      handleSubmit(){
      submit0(){
        if(!this.experimentInfo.term){
          this.$message.error('请输入实验阶段')
          return
        }
        if(!this.experimentInfo.note){
          this.$message.error('请输入实验操作')
          return
        }
        this.experimentDia = false
        if(this.insOrder.orderType=='C'){
          this.verifyUser = this.insOrder.prepareUserId
          this.submit()
        }else{
          this.addVerifyDia = true
        }
      },
      handleSubmit(){
        this.experimentDia = true
      },
      submit() {
        if (this.verifyUser === null || this.verifyUser === '') {
@@ -3164,7 +3188,8 @@
                orderId: this.orderId,
                laboratory: this.sonLaboratory,
                verifyUser: this.verifyUser,
                entrustCode: this.insOrder.entrustCode
                entrustCode: this.insOrder.entrustCode,
                ...this.experimentInfo
              }).then(res => {
                if (res.code === 200) {
                  this.$message.success("操作成功")
@@ -3196,7 +3221,8 @@
                this.$axios.post(this.$api.insOrderPlan.submitPlan, {
                  orderId: this.orderId,
                  laboratory: this.sonLaboratory,
                  verifyUser: this.verifyUser
                  verifyUser: this.verifyUser,
                  ...this.experimentInfo
                }).then( res => {
                  if (res.code === 200) {
                    this.submitLoading = false;