From cc702f8d62c082c8f4b97b44e094fb8b8c7b97d8 Mon Sep 17 00:00:00 2001 From: licp <lichunping@guanfang.com.cn> Date: 星期三, 31 七月 2024 15:16:06 +0800 Subject: [PATCH] 修改检验任务bug --- src/components/do/b1-inspect-order-plan/Inspection.vue | 245 ++++++++++++++++++++++++++++++------------------ 1 files changed, 151 insertions(+), 94 deletions(-) diff --git a/src/components/do/b1-inspect-order-plan/Inspection.vue b/src/components/do/b1-inspect-order-plan/Inspection.vue index 2423696..003f684 100644 --- a/src/components/do/b1-inspect-order-plan/Inspection.vue +++ b/src/components/do/b1-inspect-order-plan/Inspection.vue @@ -230,9 +230,9 @@ <template> <div v-loading="loading" class="inspection"> <el-row class="title"> - <el-col :span="12" style="padding-left: 20px;text-align: left;" v-once>妫�楠屽崟璇︽儏 + <el-col :span="12" style="padding-left: 20px;text-align: left;" >妫�楠屽崟璇︽儏 </el-col> - <el-col :span="12" style="text-align: right;" v-once> + <el-col :span="12" style="text-align: right;"> <!-- <el-button size="small" type="primary" @click="fiberOpticVisible=true" v-if="fiberOptic.length>0">鍏夌氦鍒囨崲</el-button> <el-button size="small" type="primary" @click="fiberOpticTapeVisible=true" v-if="fiberOpticTape.length>0">鍏夌氦甯﹀垏鎹�</el-button> <el-button size="small" type="primary" @click="bushingVisible=true" v-if="bushing.length>0">濂楃鍒囨崲</el-button> --> @@ -317,12 +317,12 @@ <span style="margin-left: 4px;">%</span> </el-form-item> </el-form> - <el-button type="primary" size="small" v-if="dataAcquisitionEidt>0&&PROJECT=='妫�娴嬩腑蹇�'&&state==1" @click="getDataAcquisitionDevice" :loading="dataAcquisitionLoading">鏁版嵁閲囬泦</el-button> - <el-button :type="dataAcquisitionEidtAble?'':'primary'" size="small" v-if="dataAcquisitionEidt>0&&PROJECT=='妫�娴嬩腑蹇�'&&collected&&state==1" @click="dataAcquisitionEidtAble=!dataAcquisitionEidtAble">{{dataAcquisitionEidtAble?'鍏抽棴缂栬緫':'缂栬緫鏁伴噰'}}</el-button> + <el-button type="primary" size="small" v-if="(dataAcquisitionEidt>0||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="(dataAcquisitionEidt>0)&&PROJECT=='妫�娴嬩腑蹇�'&&collected&&state==1" @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!='娓╁害寰幆妫�楠屽師濮嬭褰�'&&!tableLists.find(m=>m.templateId==currentTable).templateName.includes('鐑惊鐜�')&&!tableLists.find(m=>m.templateId==currentTable).templateName.includes('娓╁崌璇曢獙'))"> - <table border="1" class="tables" cellpadding="10" v-for="(item,index) in tableList" :key="index"> + <table border="1" class="tables" cellpadding="10" v-for="(item,index) in tableList" :key="index+currentTable+currentSample.id"> <tbody> <tr v-for="(m,i) in item.arr" :key="i"> <td :id='item.templateId+"-"+n.i+"-"+n.r+"-"+n.c' v-for="(n,j) in m" :key="j" @@ -376,6 +376,7 @@ <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> </template> + <template v-else-if="n.v.ps!=undefined && n.v.ps.value==='璁$畻鍊�' && state==1"><span :style="`font-family:${n.v.ff} !important;`">{{ toFixed(n.v.v,n.v.ct) }}</span></template> <template v-else-if="n.v.ps!=undefined && n.v.ps.value==='鏈�缁堝��' && state==1"> <!-- <el-input class="table_input" type="textarea" :disabled="getInspectionItemType(n.i) == 1 || (n.u != userId && n.u != undefined && n.u != '')" @@ -424,7 +425,7 @@ v-if="currentFiberOptic" class="el-icon-caret-right table_caret" @click="caretOptic(1)"></i> </div> </template> - <span v-else :style="`font-family:${n.v.ff} !important;`" v-html="getValue(n.v)" v-once></span> + <span v-else :style="`font-family:${n.v.ff} !important;`" v-html="getValue(n.v)" ></span> </div> </td> </tr> @@ -504,20 +505,20 @@ <el-table-column label="搴忓彿" type="index" - width="60" + width="59" align="center" > </el-table-column> <el-table-column prop="bushColor" label="绠¤壊鏍�" - width="80" + width="75" align="center"> </el-table-column> <el-table-column prop="code" label="鍏夌氦甯︾紪鍙�" - width="110" + width="105" align="center"> </el-table-column> <el-table-column @@ -531,7 +532,7 @@ prop="value0" label="澶栫" align="center" - width="80" :key="(new Date().getTime())+'1234567'"> + width="100" :key="(new Date().getTime())+'1234567'"> <template slot="header"> {{ '澶栫'+(index+1) }} </template> @@ -543,7 +544,7 @@ prop="value1" label="鍐呯" align="center" - width="80" :key="(new Date().getTime())+'23333333'"> + width="100" :key="(new Date().getTime())+'23333333'"> <template slot="header"> {{ '鍐呯'+(index+1) }} </template> @@ -959,6 +960,7 @@ inspectionItemClass:null, }, thermalCyclingLoading:false, + temDataAcquisition:false, } }, computed: { @@ -1049,11 +1051,48 @@ }, currentTable(val1, val0) { if (val0 != null && val1 != val0) { - this.tableLists.forEach((m, i) => { + this.tableLists.forEach(async (m, i) => { if (m.templateId == val1) { - this.tableList = null; - this.tableList = [(this.tableLists[i])]; - this.handleTableData() + let list = await this.getCurrentProduct(this.currentSample.id,0) + this.currentSample.insProduct = this.HaveJson(list) + // console.log(this.currentSample) + this.currentSample.insProduct.forEach(a => { + this.param[a.id] = { + insValue: [], + comValue: [], + resValue: null, + equipValue: [], + equipName: [], + insResult: null + } + }) + this.getReportModel(this.currentSample.id) + const mySet1 = new Set(); + this.tableLists = this.currentSample.insProduct.filter(m => { + let num0 = mySet1.size; + if (m.templateId != null&&m.template != null) { + try { + mySet1.add(JSON.stringify({ + template: m.template, + templateId: m.templateId + })) + } catch (error) { + console.log(222,error); + } + } + let num1 = mySet1.size; + if (num1 > num0) { + return m + } + }); + if (this.tableLists && this.tableLists.length > 0) { + this.tableList = null; + this.tableList = this.tableLists.filter(m => m.templateId == val1) + this.handleTableData() + } + // this.$delete(this.tableList,0) + // this.$set(this.tableList, 0, m) + // this.handleTableData() } }) } @@ -1121,80 +1160,63 @@ methods: { // 鏁版嵁閲囬泦 getDataAcquisitionDevice(){ - this.dataAcquisitionLoading = true - 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 + if(this.tableLists.find(m=>m.templateId==this.currentTable)&&this.tableLists.find(m=>m.templateId==this.currentTable).templateName=='娓╁害寰幆妫�楠屽師濮嬭褰�'){ + // 娓╁害寰幆妫�楠屽師濮嬭褰�----鏁伴噰----PK8000 + let temperature = this.wareForm.inspectionItemSubclass; + if(typeof temperature == 'string'&&temperature.includes('(甯告俯)')){ + temperature = `20鈩�(甯告俯)` + }else{ + temperature = temperature + '鈩�' } - this.dataAcquisitionInfo = res.data - try { - // 鍚� Worker 鍙戦�佹秷鎭紝寮�濮嬪鐞嗛�昏緫 - this.worker0.postMessage(JSON.stringify({ - dataAcquisitionInfo: this.dataAcquisitionInfo, - list:this.tableList[0].arr - })); - } catch (error) { - console.log(1111,error); - } - // 鐩戝惉 Worker 杩斿洖鐨勭粨鏋� - this.worker0.onmessage = (event) => { - let result = JSON.parse(event.data); - if(result.method=='changeInput'){ - let {list,n} = result.value - this.$set(this.tableList[0],'arr',list) - this.changeInput('',`${this.currentSample.insProduct[0].templateId}-${n.r}-${n.c}-${n.i}`,n) + this.dataAcquisitionLoading = true + this.$axios.post(this.$api.deviceScope.temDataAcquisition,{ + entrustCode:this.insOrder.entrustCode, + sampleCode:this.currentSample.sampleCode, + model:this.wareForm0.model, + cycles:this.wareForm.inspectionItem, + temperature:temperature, + }, { + headers: { + 'Content-Type': 'application/json' + }, + noQs:true + }).then(res=>{ + this.dataAcquisitionLoading = false + if(res.code!=200){ + return } - }; - // let list = this.tableList[0].arr - // list.forEach((item,index)=>{ - // let num = 0; - // let str = '' - // item.forEach(m=>{ - // if(m.v.ps&&(m.v.ps.value=='妫�楠屽瓙椤�'||m.v.ps.value=='妫�楠岄」')){ - // if(m.v.ps&&m.v.ps.value=='妫�楠岄」'){ - // if(num==0){ - // str = m.v.v+',' - // num++ - // } - // } - // if(m.v.ps&&m.v.ps.value=='妫�楠屽瓙椤�'){ - // if(num==1){ - // str = str+m.v.v - // } - // } - // if(this.dataAcquisitionInfo[str]){ - // let num = 0; - // list[index].forEach(n=>{ - // if(n.v.ps&&n.v.ps.value&&typeof n.v.ps.value == 'string'&&n.v.ps.value.includes('妫�楠屽��')){ - // num++ - // } - // }) - // list[index].forEach((n,i)=>{ - // if(n.v.ps&&n.v.ps.value&&typeof n.v.ps.value == 'string'&&n.v.ps.value.includes('妫�楠屽��')){ - // let arr = n.v.ps.value.split('鍊�') - // if(arr[1] ==this.dataAcquisitionInfo.frequency){ - // setTimeout(()=>{ - // this.$delete(n.v,'v') - // this.$set(n.v,'v',this.dataAcquisitionInfo[str]) - // this.changeInput('',`${this.currentSample.insProduct[0].templateId}-${n.r}-${n.c}-${n.i}`,n) - // },1000) - // }else if(Number(this.dataAcquisitionInfo.frequency)>num){ - // if(n.v.ps.value.includes(num)){ - // setTimeout(()=>{ - // this.$delete(n.v,'v') - // this.$set(n.v,'v',this.dataAcquisitionInfo[str]) - // this.changeInput('',`${this.currentSample.insProduct[0].templateId}-${n.r}-${n.c}-${n.i}`,n) - // },1000) - // } - // } - // } - // }) - // } - // } - // }) - // }) - }) + // console.log(res.data) + this.wareFormChange() + }) + }else{ + // 涓�鑸殑鏁版嵁閲囬泦 + this.dataAcquisitionLoading = true + 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 + try { + // 鍚� Worker 鍙戦�佹秷鎭紝寮�濮嬪鐞嗛�昏緫 + this.worker0.postMessage(JSON.stringify({ + dataAcquisitionInfo: this.dataAcquisitionInfo, + list:this.tableList[0].arr + })); + } catch (error) { + console.log(1111,error); + } + // 鐩戝惉 Worker 杩斿洖鐨勭粨鏋� + this.worker0.onmessage = (event) => { + let result = JSON.parse(event.data); + if(result.method=='changeInput'){ + let {list,n} = result.value + this.$set(this.tableList[0],'arr',list) + this.changeInput('',`${this.currentSample.insProduct[0].templateId}-${n.r}-${n.c}-${n.i}`,n) + } + }; + }) + } }, // 澶氱嚎绋� startWorker() { @@ -1221,7 +1243,11 @@ }, // 娓╁害寰幆---寮�濮� changeItem(row){ - if(row.value0&&row.value1){ + if(row.value0&&!row.value1){ + this.$set(row,'comValue',Number(row.value0).toFixed(3)) + }else if(!row.value0&&row.value1){ + this.$set(row,'comValue',Number(row.value1).toFixed(3)) + }else if(row.value0&&row.value1){ this.$set(row,'comValue',((Number(row.value0)+Number(row.value1))/2).toFixed(3)) }else{ return @@ -1705,6 +1731,7 @@ let fileDel = false let fileAdd = false let collected = false + let temDataAcquisition = false for (var i = 0; i < power.length; i++) { if (power[i].menuMethod == 'uploadFile') { fileAdd = true @@ -1715,12 +1742,16 @@ if (power[i].menuMethod == 'isItAllowedToModifyTheCollectedValues') { collected = true } + if (power[i].menuMethod == 'temDataAcquisition') { + temDataAcquisition = true + } } if (!fileDel) { this.componentData0.do.splice(1, 1) } this.fileAdd = fileAdd this.collected = collected + this.temDataAcquisition = temDataAcquisition }, async getCurrentProduct(id,type){ this.tableLoading = true; @@ -2370,7 +2401,8 @@ comparisonList:this.comparisonList, currentSample:this.currentSample, PROJECT:this.PROJECT, - param:this.param + param:this.param, + currentTable:this.currentTable })); } catch (error) { console.log(444,error); @@ -2716,6 +2748,14 @@ this.$message.error("璇锋寚瀹氬鏍镐汉鍛�") return } + if(!this.otherForm.humidity){ + this.$message.error("璇疯緭鍏ユ箍搴�") + return + } + if(!this.otherForm.temperature){ + this.$message.error("璇疯緭鍏ユ俯搴�") + return + } this.addVerifyDia = false this.submitLoading = true; this.$axios.post(this.$api.insOrderPlan.checkSubmitPlan, { @@ -2728,8 +2768,7 @@ orderId: this.orderId, laboratory: this.sonLaboratory, verifyUser: this.verifyUser, - entrustCode: this.insOrder.entrustCode, - sampleCode: this.currentSample.sampleCode + entrustCode: this.insOrder.entrustCode }).then(res => { if (res.code === 200) { this.$message.success("鎿嶄綔鎴愬姛") @@ -2782,7 +2821,7 @@ return }, saveInsContext() { - // console.log(1111,this.param) + console.log(1111,this.param) try { if(this.param){ this.$axios.post(this.$api.insOrderPlan.saveInsContext, { @@ -2798,7 +2837,8 @@ this.worker.postMessage(JSON.stringify({ type: 'saveData', tableList:this.tableList, - param:this.param + param:this.param, + currentTable:this.currentTable })); } }catch (error) { @@ -2806,11 +2846,25 @@ } }, changeEquip(val, n) { + this.tableList[0].arr.forEach((item,index)=>{ + item.forEach((m,i)=>{ + if(this.param[m.i]){ + this.param[m.i].state = 1 + } + }) + }) + for (let i in this.param) { + if(this.param[i].state!=1){ + delete this.param[i] + } + } for (let i in this.equipOptions) { if (this.equipOptions[i].value === val) { for (let i1 in this.param[n.i].equipName) { if (this.param[n.i].equipName[i1].i === n.i && this.param[n.i].equipName[i1].r === n.r) { + this.$delete(this.param[n.i].equipValue[i1].v,'v') this.$set(this.param[n.i].equipValue[i1].v,'v',val) + this.$delete(this.param[n.i].equipName[i1].v,'v') this.$set(this.param[n.i].equipName[i1].v,'v',this.equipOptions[i].label) this.param[n.i].equipValue[i1].isItADataAcquisitionDevice = this.equipOptions[i].isItADataAcquisitionDevice } @@ -2833,11 +2887,14 @@ getAuthorizedPerson() { this.$axios.get(this.$api.user.getUserMenu).then(res => { let data = [] + let userName = JSON.parse(localStorage.getItem("user")).name; res.data.forEach(a => { - data.push({ + if(a.name !== userName) { + data.push({ label: a.name, value: a.id }) + } }) this.personList = data }) -- Gitblit v1.9.3