| | |
| | | <el-button type="primary" @click="submit()">确 定</el-button> |
| | | </span> |
| | | </el-dialog> |
| | | <el-dialog title="数据采集" :visible.sync="dataGetDia" min-width="400px" :close-on-click-modal="false" :close-on-press-escape="false" :before-close="beforeDataGetDia"> |
| | | <el-dialog title="数据采集-计算数据选择" :visible.sync="dataGetDia" min-width="400px" :close-on-click-modal="false" :close-on-press-escape="false" :before-close="beforeDataGetDia"> |
| | | <div> |
| | | <table border="1" cellpadding="10" class="thermal-table"> |
| | | <tr> |
| | |
| | | <td>{{ item.child[0].name }}</td> |
| | | <td> |
| | | <el-checkbox-group |
| | | v-model="item.child[0].value" |
| | | :min="0" |
| | | :max="item.child[0].maxNum"> |
| | | <el-checkbox v-for="(n,j) in item.child[0].arr" :label="n" :key="j+'ppppppppp'">{{n}}</el-checkbox> |
| | | v-model="getDataIndex"> |
| | | <el-checkbox v-for="(n,j) in item.child[0].arr" :label="j" :key="j+'ppppppppp'">{{n}}</el-checkbox> |
| | | </el-checkbox-group> |
| | | </td> |
| | | </tr> |
| | |
| | | <td>{{ m.name }}</td> |
| | | <td> |
| | | <el-checkbox-group |
| | | v-model="m.value" |
| | | :min="0" |
| | | :max="m.maxNum"> |
| | | <el-checkbox v-for="(n,j) in m.arr" :label="n" :key="j+'bbbbbbbbbbbbbb'">{{n}}</el-checkbox> |
| | | v-model="getDataIndex"> |
| | | <el-checkbox v-for="(n,j) in m.arr" :label="j" :key="j+'bbbbbbbbbbbbbb'">{{n}}</el-checkbox> |
| | | </el-checkbox-group> |
| | | </td> |
| | | </tr> |
| | |
| | | </div> |
| | | <span slot="footer" class="dialog-footer"> |
| | | <el-button @click="beforeDataGetDia()">取 消</el-button> |
| | | <el-button type="primary" @click="submitDataGet()">确 定</el-button> |
| | | <el-button type="primary" @click="submitDataGet()" :loading="getDataIndexLoading">确 定</el-button> |
| | | </span> |
| | | </el-dialog> |
| | | </div> |
| | |
| | | worker0: null, |
| | | wareLength:[], |
| | | dataAcquisitionInfo:{}, |
| | | dataAcquisitionInfoNew:{}, |
| | | dataAcquisitionEidt:0, |
| | | dataAcquisitionEidtAble:false, |
| | | dataAcquisitionLoading:false, |
| | |
| | | child:[ |
| | | { |
| | | name:'1285nm~1330nm', |
| | | arr:[12,13], |
| | | maxNum:1, |
| | | value:[] |
| | | arr:[12,13,14,15], |
| | | }, |
| | | { |
| | | name:'1525nm~1575nm', |
| | | arr:[12,13], |
| | | maxNum:1, |
| | | value:[] |
| | | arr:[12,13,14,15], |
| | | }, |
| | | ] |
| | | }, |
| | |
| | | { |
| | | name:'截至波长', |
| | | arr:[12,13,14,15], |
| | | maxNum:3, |
| | | value:[] |
| | | } |
| | | ] |
| | | } |
| | | ] |
| | | ], |
| | | getDataIndex:[], |
| | | getDataIndexLoading:false |
| | | } |
| | | }, |
| | | computed: { |
| | |
| | | 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) |
| | | } |
| | | }; |
| | | this.dataAcquisitionInfoNew = this.HaveJson(res.data) |
| | | this.handleDataAcquisition(res.data) |
| | | }) |
| | | } |
| | | }, |
| | | handleDataAcquisition(data){ |
| | | this.dataAcquisitionInfo = {} |
| | | this.getData = [] |
| | | for (let i in data){ |
| | | let obj = { |
| | | faName:i, |
| | | child:[] |
| | | } |
| | | for(let j in data[i]){ |
| | | if(j!='frequency'&&!data[i][j].isCalculation){ |
| | | this.dataAcquisitionInfo[i+','+j] = { |
| | | value:data[i][j].result, |
| | | frequency:data[i].frequency |
| | | } |
| | | }else if(j!='frequency'&&data[i][j].isCalculation){ |
| | | let obj0 = { |
| | | name:j, |
| | | arr:data[i][j].result |
| | | } |
| | | obj.child.push(obj0) |
| | | } |
| | | } |
| | | if(obj.child.length>0){ |
| | | this.getData.push(obj) |
| | | } |
| | | } |
| | | if(this.getData.length>0){ |
| | | this.dataGetDia = true |
| | | } |
| | | 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) |
| | | } |
| | | }; |
| | | }, |
| | | beforeDataGetDia(done){ |
| | | this.$confirm('是否取消数据采集?', "提示", { |
| | |
| | | } |
| | | }).catch(() => {}) |
| | | }, |
| | | submitDataGet(){}, |
| | | submitDataGet(){ |
| | | if(this.getDataIndex.length==0){ |
| | | this.$message.error('请选择需要计算的数据') |
| | | return |
| | | } |
| | | this.getDataIndex.sort((a, b) => a - b); |
| | | for (let i in this.dataAcquisitionInfoNew){ |
| | | for(let j in this.dataAcquisitionInfoNew[i]){ |
| | | if(j!='frequency'&&this.dataAcquisitionInfoNew[i][j].isCalculation){ |
| | | let arr = [] |
| | | for(let k = 0;k<this.dataAcquisitionInfoNew[i][j].result.length;k++){ |
| | | if(this.getDataIndex.includes(k)){ |
| | | arr.push(this.dataAcquisitionInfoNew[i][j].result[k]) |
| | | } |
| | | } |
| | | if(arr.length>0){ |
| | | this.dataAcquisitionInfoNew[i][j].result = arr |
| | | } |
| | | } |
| | | } |
| | | } |
| | | this.getDataIndexLoading = true; |
| | | this.$axios.post(this.$api.deviceScope.formulaCalculation,{ |
| | | map:this.dataAcquisitionInfoNew |
| | | }, { |
| | | headers: { |
| | | 'Content-Type': 'application/json' |
| | | }, |
| | | noQs:true |
| | | }).then(res=>{ |
| | | this.getDataIndexLoading = false; |
| | | if(res.code!=200){ |
| | | return |
| | | } |
| | | this.handleDataAcquisition(res.data.map) |
| | | }) |
| | | }, |
| | | // 多线程 |
| | | startWorker() { |
| | | if (this.worker) { |