¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div> |
| | | <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> |
| | | </tr> |
| | | <tr> |
| | | <td style="font-size: 16px;background-color: #F0F1F5;">è§æ ¼åå·</td> |
| | | <td>{{item.model}}</td> |
| | | <td style="font-size: 16px;background-color: #F0F1F5;">è¯éªæ¹æ³</td> |
| | | <td>{{item.methodS}}</td> |
| | | <td style="font-size: 16px;background-color: #F0F1F5;">设å¤ç¼å·</td> |
| | | <td> |
| | | <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" |
| | | :value="item.value"> |
| | | </el-option> |
| | | </el-select> |
| | | </td> |
| | | </tr> |
| | | <tr> |
| | | <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> |
| | | </tr> |
| | | <tr> |
| | | <td style="font-size: 16px;background-color: #F0F1F5;">å®éªåæ ·åæ£æ¥</td> |
| | | <td colspan="2"> |
| | | <el-select v-model="item.beforeCheck" placeholder="è¯·éæ©" size="small" :disabled="state>1" @change="save(item)"> |
| | | <el-option |
| | | v-for="item in options" |
| | | :key="item.value" |
| | | :label="item.label" |
| | | :value="item.value"> |
| | | </el-option> |
| | | </el-select> |
| | | </td> |
| | | <td style="font-size: 16px;background-color: #F0F1F5;">å®éªåæ ·åæ£æ¥</td> |
| | | <td colspan="2"> |
| | | <el-select v-model="item.afterCheck" placeholder="è¯·éæ©" size="small" :disabled="state>1" @change="save(item)"> |
| | | <el-option |
| | | v-for="item in options" |
| | | :key="item.value" |
| | | :label="item.label" |
| | | :value="item.value"> |
| | | </el-option> |
| | | </el-select> |
| | | </td> |
| | | </tr> |
| | | <tr style="background-color: #F0F1F5;"> |
| | | <td colspan="2">æ¶é´</td> |
| | | <td colspan="1">温度</td> |
| | | <td colspan="1">湿度</td> |
| | | <td colspan="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> |
| | | </td> |
| | | <td colspan="1"> |
| | | <el-input v-model="m.temperature" placeholder="温度" size="small" @blur ="handleReplace(m,'â','temperature',item)" :disabled="state>1"></el-input> |
| | | </td> |
| | | <td colspan="1"> |
| | | <el-input v-model="m.humidity" placeholder="湿度" size="small" @blur ="handleReplace(m,'%rh','humidity',item)" :disabled="state>1"></el-input> |
| | | </td> |
| | | <td colspan="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> |
| | | </td> |
| | | </tr> |
| | | </template> |
| | | </table> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | export default { |
| | | props:['insProduct','orderId','sampleId','state','isLook','num'], |
| | | data() { |
| | | return { |
| | | equipOptions:[], |
| | | insProductList:[], |
| | | options:[ |
| | | {value: 'å®å¥½', label: 'å®å¥½'}, |
| | | {value: 'ç ´æ', label: 'ç ´æ'} |
| | | ] |
| | | } |
| | | }, |
| | | watch:{ |
| | | insProduct:{ |
| | | deep:true, |
| | | handler:function(newVal,oldVal){ |
| | | this.init() |
| | | } |
| | | } |
| | | }, |
| | | mounted() { |
| | | this.init() |
| | | }, |
| | | methods: { |
| | | init(){ |
| | | this.insProductList = this.HaveJson(this.insProduct) |
| | | this.insProductList.forEach(item=>{ |
| | | if(!item.insProductResult){ |
| | | // åå§å |
| | | this.$set(item,'list',[]) |
| | | item.list.push({}) |
| | | item.list.forEach(m=>{ |
| | | this.$set(m,'time','') |
| | | this.$set(m,'temperature','') |
| | | this.$set(m,'humidity','') |
| | | }) |
| | | this.$set(item,'equipValue','') |
| | | this.$set(item,'equipName','') |
| | | this.$set(item,'beforeCheck','') |
| | | this.$set(item,'afterCheck','') |
| | | }else{ |
| | | // èµå¼ |
| | | this.$set(item,'list',JSON.parse(item.insProductResult.insValue)) |
| | | item.list.forEach(m=>{ |
| | | this.$set(m,'time',m.time) |
| | | 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) |
| | | this.$set(item,'beforeCheck',item.insProductResult.beforeCheck) |
| | | this.$set(item,'afterCheck',item.insProductResult.afterCheck) |
| | | } |
| | | }) |
| | | }, |
| | | deleteList(arr,i,item){ |
| | | if(arr.length>1){ |
| | | arr.splice(i,1) |
| | | this.save(item) |
| | | }else{ |
| | | this.$message({ |
| | | type: 'warning', |
| | | message: 'ä¸è½åå é¤äº' |
| | | }) |
| | | } |
| | | }, |
| | | addList(arr,i){ |
| | | arr.splice(i+1,0,{ |
| | | time:'', |
| | | temperature:'', |
| | | humidity:'' |
| | | }) |
| | | }, |
| | | async methodFocus(item){ |
| | | this.equipOptions = await this.getEquipOptions(item) |
| | | }, |
| | | // è·å设å¤é项 id:为æ£éªé¡¹id |
| | | async getEquipOptions(m) { |
| | | let arr = [] |
| | | let res = await this.$axios.post(this.$api.deviceScope.selectDeviceByCategory, { |
| | | inspectionItem: m.inspectionItem, |
| | | inspectionItemSubclass: m.inspectionItemSubclass |
| | | }) |
| | | if (res.code === 200 && res.data) { |
| | | arr = res.data.map(m => { |
| | | m.value = m.managementNumber |
| | | m.label = m.deviceName |
| | | return m |
| | | }) |
| | | } |
| | | return arr |
| | | }, |
| | | /** |
| | | * å¤ç设å¤ä¿¡æ¯ |
| | | * |
| | | * @param {any} m - æ°ç设å¤å¼ |
| | | * @param {Object} item - 设å¤å¯¹è±¡ |
| | | */ |
| | | handleEquip(m,item){ |
| | | this.$delete(item, 'equipValue') |
| | | this.$set(item, 'equipValue', m) |
| | | this.$delete(item, 'equipName') |
| | | this.$set(item, 'equipName', this.equipOptions.find(m=>m.value==item.equipValue).label) |
| | | this.save(item) |
| | | }, |
| | | /** |
| | | * æ¿æ¢ææ¬ä¸çæå®åä½ |
| | | * |
| | | * @param {Object} m - éè¦ä¿®æ¹çææ¬å¯¹è±¡ |
| | | * @param {string} unit - è¦æ¿æ¢çåä½ |
| | | * @param {any} v - æªä½¿ç¨çåæ°ï¼ä¿ç以å¹é
å
¶ä»éè½½ï¼ |
| | | * @returns {void} æ è¿åå¼ |
| | | */ |
| | | handleReplace(m,unit,v,item){ |
| | | if(m[v]&&!`${m[v]}`.includes(unit)){ |
| | | m[v] = m[v]+unit |
| | | } |
| | | if(m[v]){ |
| | | this.save(item) |
| | | } |
| | | }, |
| | | save(item){ |
| | | this.$axios.post(this.$api.insOrderPlan.saveInsContext3, { |
| | | insProductId:item.id, |
| | | insValue:JSON.stringify(item.list), |
| | | equipValue:item.equipValue, |
| | | equipName:item.equipName, |
| | | num:this.num, |
| | | beforeCheck:item.beforeCheck, |
| | | afterCheck:item.afterCheck, |
| | | }, { |
| | | headers: { |
| | | 'Content-Type': 'application/json' |
| | | }, |
| | | noQs:true}).then(res => { |
| | | if (res.code === 201) { |
| | | this.$message.error('ä¿å失败') |
| | | return |
| | | } |
| | | this.$message.success('å·²ä¿å') |
| | | }).catch(err => { |
| | | console.log(err) |
| | | }) |
| | | }, |
| | | }, |
| | | } |
| | | </script> |
| | | |
| | | <style scoped> |
| | | .thermal-table{ |
| | | min-width: calc(100% - 10px); |
| | | margin: 5px 5px 0; |
| | | table-layout: fixed; |
| | | } |
| | | .thermal-table td { |
| | | min-width: 70px; |
| | | text-align: center; |
| | | font-size: 14px; |
| | | word-wrap: break-word; |
| | | white-space: normal; |
| | | padding: 5px; |
| | | } |
| | | .thermal-table .el-input{ |
| | | display: flex; |
| | | align-items: center; |
| | | } |
| | | </style> |