| | |
| | | |
| | | let code = '' |
| | | let tableList = [] |
| | | let tableList = null |
| | | let excelMethodList = [] |
| | | let comparisonList = [] |
| | | let currentSample = {} |
| | |
| | | value:null |
| | | } |
| | | let param = null |
| | | let currentTable = '' |
| | | self.onmessage = function(event) { |
| | | const data = JSON.parse(event.data); |
| | | if(currentTable!=data.currentTable){ |
| | | tableList = data.tableList; |
| | | } |
| | | currentTable = data.currentTable; |
| | | if(data.type&&data.type=='saveData'){ |
| | | tableList = data.tableList; |
| | | param = data.param; |
| | | return |
| | | } |
| | | code = data.code; |
| | | tableList = JSON.parse(JSON.stringify(data.tableList)); |
| | | if(tableList){ |
| | | let str = code.split('-') |
| | | let r = str[1] |
| | | let c = str[2] |
| | | tableList[0].arr.forEach((item,index)=>{ |
| | | item.forEach((m,i)=>{ |
| | | if(m.c==c&&m.r==r){ |
| | | tableList[0].arr[index] = data.tableList[0].arr[index] |
| | | } |
| | | }) |
| | | }) |
| | | }else{ |
| | | tableList = data.tableList; |
| | | } |
| | | if(param){ |
| | | let str = code.split('-') |
| | | let pId = str[3] |
| | | param[pId] = data.param[pId] |
| | | }else{ |
| | | param = data.param; |
| | | } |
| | | // tableList = data.tableList; |
| | | // param = data.param; |
| | | excelMethodList = JSON.parse(JSON.stringify(data.excelMethodList)); |
| | | comparisonList = JSON.parse(JSON.stringify(data.comparisonList)); |
| | | currentSample = JSON.parse(JSON.stringify(data.currentSample)); |
| | | param = data.param; |
| | | PROJECT = data.PROJECT |
| | | changeInput('', code); |
| | | }; |
| | |
| | | try{ |
| | | if(comResult==0){ |
| | | a[b].v.v = 0 |
| | | }else if(a[b].v.ct&&a[b].v.ct.fa&&typeof a[b].v.ct.fa == 'string'&&a[b].v.ct.fa.includes('.')){ |
| | | let num = 0 |
| | | let str = a[b].v.ct.fa.split('.')[1] |
| | | num = str.length |
| | | a[b].v.v = comResult?Number(comResult).toFixed(num):0 |
| | | }else{ |
| | | let val = parseFloat(comResult.toFixed(3)) |
| | | a[b].v.v = isNaN(val) ? '' : val |
| | | let val = parseFloat(Number(comResult).toFixed(3)) |
| | | a[b].v.v = isNaN(val) ? comResult : val |
| | | } |
| | | // console.log('a[b].v.ct', comResult) |
| | | // console.log('a[b].v.v', a[b].v.v) |
| | | }catch(error){ |
| | | a[b].v.v = comResult |
| | | console.log('error---', error) |
| | |
| | | * @returns 返回处理后的参数对象 |
| | | */ |
| | | function getParam(){ |
| | | for (var b in param){ |
| | | param[b].insValue = [] |
| | | param[b].comValue = [] |
| | | param[b].equipValue = [] |
| | | param[b].equipName = [] |
| | | param[b].resValue = null |
| | | param[b].insResult = null |
| | | } |
| | | tableList[0].arr.forEach(a=>{ |
| | | a.forEach(b=>{ |
| | | if(param[b.i]){ |
| | | param[b.i].insValue = [] |
| | | param[b.i].comValue = [] |
| | | param[b.i].equipValue = [] |
| | | param[b.i].equipName = [] |
| | | param[b.i].resValue = null |
| | | param[b.i].insResult = null |
| | | } |
| | | }) |
| | | }) |
| | | tableList[0].arr.forEach(a => { |
| | | a.forEach(b=>{ |
| | | if (b.v.ps != undefined &&typeof b.v.ps.value =='string'&& b.v.ps.value.includes('检验值')) { |
| | |
| | | str = str.replace(new RegExp(a, 'g'),arr[a]) |
| | | } |
| | | if(str.includes(',,')){ |
| | | str = str.replace(new RegExp(',,', 'g'),'') |
| | | str = str.replace(new RegExp(',,', 'g'),',') |
| | | } |
| | | if(str.includes(',,')){ |
| | | str = str.replace(new RegExp(',,', 'g'),',') |
| | | } |
| | | if(str.includes(',,')){ |
| | | str = str.replace(new RegExp(',,', 'g'),',') |
| | | } |
| | | // console.log('str', str) |
| | | if(str.includes('&"/"&')){ |