licp
2024-12-31 5c8aaba66c16b1a143fdec27e29ad36eaefd1e3a
src/components/do/b1-inspect-order-plan/humidity.vue
@@ -3,7 +3,7 @@
    <table border="1" cellpadding="10" class="thermal-table" style="margin-bottom: 20px;">
      <template v-for="(item,index) in insProductList">
        <tr>
          <td style="font-size: 18px;font-weight: 500;background-color: #F0F1F5;padding: 10px 0;box-sizing: border-box;" colspan="6">{{ item.inspectionItemSubclass }}</td>
          <td style="font-size: 18px;font-weight: 500;background-color: #F0F1F5;padding: 10px 0;box-sizing: border-box;" :colspan="insProductList&&insProductList.find(m=>m.list0.length==6)?7:6">{{ item.inspectionItemSubclass }}</td>
        </tr>
        <tr>
          <td style="font-size: 16px;background-color: #F0F1F5;">规格型号</td>
@@ -11,12 +11,12 @@
          <td style="font-size: 16px;background-color: #F0F1F5;">试验方法</td>
          <td>{{item.methodS}}</td>
          <td style="font-size: 16px;background-color: #F0F1F5;">设备编号</td>
          <td>
          <td :colspan="insProductList&&insProductList.find(m=>m.list0.length==6)?2:1">
            <el-select v-model="item.equipValue" placeholder="请选择" size="small" :disabled="state>1" @focus="methodFocus(item)" @change="m=>handleEquip(m,item)">
              <el-option
                v-for="item in equipOptions"
                :key="item.value"
                :label="item.label"
                :label="item.value"
                :value="item.value">
              </el-option>
            </el-select>
@@ -26,11 +26,11 @@
          <td style="font-size: 16px;background-color: #F0F1F5;">试验要求</td>
          <td colspan="3" style="text-align: left;">{{item.tell}}</td>
          <td style="font-size: 16px;background-color: #F0F1F5;">设备名称</td>
          <td>{{ item.equipName }}</td>
          <td :colspan="insProductList&&insProductList.find(m=>m.list0.length==6)?2:1">{{ item.equipName }}</td>
        </tr>
        <tr>
          <td style="font-size: 16px;background-color: #F0F1F5;">实验前样品检查</td>
          <td colspan="2">
          <td :colspan="item.beforeCheck=='破损'?1:(insProductList&&insProductList.find(m=>m.list0.length==6)?3:2)">
            <el-select v-model="item.beforeCheck" placeholder="请选择" size="small" :disabled="state>1" @change="save(item)">
              <el-option
                v-for="item in options"
@@ -40,8 +40,12 @@
              </el-option>
            </el-select>
          </td>
          <td v-if="item.beforeCheck=='破损'">
            <el-input v-model="item.beforeNote" placeholder="破损说明" size="small" :disabled="state>1" style="display: inline-block;width: 100%;" @change="save(item)" type="textarea"
              :rows="3"></el-input>
          </td>
          <td style="font-size: 16px;background-color: #F0F1F5;">实验后样品检查</td>
          <td colspan="2">
          <td :colspan="item.afterCheck=='破损'?1:2">
            <el-select v-model="item.afterCheck" placeholder="请选择" size="small" :disabled="state>1" @change="save(item)">
              <el-option
                v-for="item in options"
@@ -51,19 +55,32 @@
              </el-option>
            </el-select>
          </td>
          <td v-if="item.afterCheck=='破损'" :colspan="insProductList&&insProductList.find(m=>m.list0.length==6)?2:1">
            <el-input v-model="item.afterNote" placeholder="破损说明" size="small" :disabled="state>1" style="display: inline-block;width: 100%;" @change="save(item)" type="textarea"
              :rows="3"></el-input>
          </td>
        </tr>
        <tr v-if="item.inspectionItemSubclass&&item.inspectionItemSubclass.includes('低')">
          <td>电调结果</td>
          <td v-for="(m,i) in item.list0" :key="i">
            <el-input v-model="m.value" :placeholder="'第'+(i+1)+'次'" size="small" :disabled="state>1" style="display: inline-block;width: 50%;" @change="save(item)"></el-input>
            <el-button icon="el-icon-minus" circle size="mini" type="danger"
           :disabled="state>1" style="margin: 5px;display: inline-block;" @click="deleteList(item.list0,i,m)" ></el-button>
            <el-button icon="el-icon-plus" circle size="mini" type="primary" :disabled="state>1" style="margin: 5px;display: inline-block;" v-if="i==item.list0.length-1&&i<5" @click="addList(item.list0,item.list0.length-1)"></el-button>
          </td>
        </tr>
        <tr style="background-color: #F0F1F5;">
          <td colspan="2">时间</td>
          <td colspan="1">温度</td>
          <td colspan="1">湿度</td>
          <td colspan="2">操作</td>
          <td  :colspan="insProductList&&insProductList.find(m=>m.list0.length==6)?3:2">操作</td>
        </tr>
        <tr v-for="(m,i) in item.list" :key="i+item.id">
          <td colspan="2">
            <el-time-picker
            v-model="m.time"
            placeholder="时间" size="small" editable format="HH:mm" value-format="HH:mm" style="width: 100%;" @change="save(item)" :disabled="state>1">
          </el-time-picker>
          <el-date-picker
          v-model="m.time"
          placeholder="时间" size="small" editable format="yyyy-MM-dd HH:mm" value-format="yyyy-MM-dd HH:mm" style="width: 100%;" @change="save(item)" :disabled="state>1" type="datetime">
          </el-date-picker>
          </td>
          <td colspan="1">
            <el-input v-model="m.temperature" placeholder="温度" size="small" @change   ="a=>handleReplace(m,'℃','temperature',item)" :disabled="state>1"></el-input>
@@ -71,10 +88,10 @@
          <td colspan="1">
            <el-input v-model="m.humidity" placeholder="湿度" size="small" @change   ="a=>handleReplace(m,'%rh','humidity',item)" :disabled="state>1"></el-input>
          </td>
          <td colspan="2">
          <td  :colspan="insProductList&&insProductList.find(m=>m.list0.length==6)?3:2">
            <el-button icon="el-icon-minus" circle size="mini" type="danger"
            @click="deleteList(item.list,i,item)" :disabled="state>1" style="margin: 5px;"></el-button>
            <el-button icon="el-icon-plus" circle size="mini" type="primary" @click="addList(item.list,i)" :disabled="state>1" style="margin: 5px;"></el-button>
            <el-button icon="el-icon-plus" circle size="mini" type="primary" @click="addList(item.list,i,'out')" :disabled="state>1" style="margin: 5px;"></el-button>
          </td>
        </tr>
      </template>
@@ -113,7 +130,9 @@
        if(!item.insProductResult){
          // 初始化
          this.$set(item,'list',[])
          this.$set(item,'list0',[])
          item.list.push({})
          item.list0.push({})
          item.list.forEach(m=>{
            this.$set(m,'time','')
            this.$set(m,'temperature','')
@@ -123,6 +142,8 @@
          this.$set(item,'equipName','')
          this.$set(item,'beforeCheck','')
          this.$set(item,'afterCheck','')
          this.$set(item,'afterNote','')
          this.$set(item,'beforeNote','')
        }else{
          // 赋值
          this.$set(item,'list',JSON.parse(item.insProductResult.insValue))
@@ -131,10 +152,21 @@
            this.$set(m,'temperature',m.temperature)
            this.$set(m,'humidity',m.humidity)
          })
          this.$set(item,'equipValue',item.insProductResult.equipValue)
          this.$set(item,'equipName',item.insProductResult.equipName)
          if(item.insProductResult.comValue){
            this.$set(item,'list0',JSON.parse(item.insProductResult.comValue))
            item.list0.forEach((m,i)=>{
              this.$set(m,'value',m.value)
            })
          }else{
            this.$set(item,'list0',[])
            item.list0.push({})
          }
          this.$set(item,'equipValue',item.insProductResult.equipValue?JSON.parse(item.insProductResult.equipValue)[0].v:'')
          this.$set(item,'equipName',item.insProductResult.equipName?JSON.parse(item.insProductResult.equipName)[0].v:'')
          this.$set(item,'beforeCheck',item.insProductResult.beforeCheck)
          this.$set(item,'afterCheck',item.insProductResult.afterCheck)
          this.$set(item,'afterNote',item.insProductResult.afterNote)
          this.$set(item,'beforeNote',item.insProductResult.beforeNote)
        }
      })
    },
@@ -149,12 +181,18 @@
        })
      }
    },
    addList(arr,i){
      arr.splice(i+1,0,{
        time:'',
        temperature:'',
        humidity:''
      })
    addList(arr,i,type){
      if(type=='out'){
        arr.splice(i+1,0,{
          value:'',
        })
      }else{
        arr.splice(i+1,0,{
          time:'',
          temperature:'',
          humidity:''
        })
      }
    },
    async methodFocus(item){
      this.equipOptions = await this.getEquipOptions(item)
@@ -208,11 +246,14 @@
      this.$axios.post(this.$api.insOrderPlan.saveInsContext3, {
        insProductId:item.id,
        insValue:JSON.stringify(item.list),
        comValue:JSON.stringify(item.list0),
        equipValue:item.equipValue,
        equipName:item.equipName,
        num:this.num,
        beforeCheck:item.beforeCheck,
        afterCheck:item.afterCheck,
        afterNote:item.afterNote,
        beforeNote:item.beforeNote,
      }, {
      headers: {
        'Content-Type': 'application/json'