| | |
| | | } |
| | | let isToExponential = '' |
| | | let list2 = [] |
| | | let isPoint = '' |
| | | |
| | | excelMethodList.forEach(item => { |
| | | if (item.valueList&&item.valueList.length>0&&item.valueList.find(m => m.r == r && m.c == c)) { |
| | | var comValue = {} |
| | |
| | | // console.log(ask,res,item.v.f) |
| | | if(ask){ |
| | | comp = ask.map((m, i) => { |
| | | console.log('m----', m) |
| | | if (m.includes('RTS')) { |
| | | m = m.replace('RTS*', '') |
| | | } |
| | |
| | | return eval(res) == eval(str) |
| | | } |
| | | } else if (m.includes('≥')) { |
| | | console.log('eval(res)---', eval(res)) |
| | | console.log('eval(str)---', eval(str)) |
| | | if(typeof res =='string'&&res.includes('/')){ |
| | | return handleMoreParam(res,m.split('≥')[1],'≥') |
| | | }else{ |
| | |
| | | } |
| | | }) |
| | | } |
| | | console.log(tableList) |
| | | // console.log(tableList) |
| | | } |
| | | result = { |
| | | method:'saveInsContext', |
| | |
| | | let comResult = '' |
| | | try { |
| | | if(getInspectionValueType(item.i)==1){ |
| | | // let ask = currentSample.insProduct.find(m => m.id == item.i).ask?currentSample.insProduct.find(m => m.id == item.i).ask.split('&'):null; |
| | | // let tell = currentSample.insProduct.find(m => m.id == item.i).tell?currentSample.insProduct.find(m => m.id == item.i).tell.split('&'):null; |
| | | comResult = compute(item.v.f.replace(/=/g, ' '),comValue) |
| | | let tell = currentSample.insProduct.find(m => m.id == item.i).tell?currentSample.insProduct.find(m => m.id == item.i).tell.split('&'):null; |
| | | isPoint = tell[0].includes('/') // 判断要求值是否为分数 |
| | | console.log('comValue---', comValue) |
| | | comResult = compute(item.v.f.replace(/=/g, ' '),comValue, isPoint) |
| | | console.log('comResult---', comResult) |
| | | let list3 = list2.map(item=>item+'') |
| | | isToExponential = list3.some(val => val.includes('e+')) |
| | | // 装备项目检验值转化 |
| | | if (PROJECT === '装备电缆' && isToExponential) { |
| | | let num2 = new Big(comResult) |
| | | comResult = num2.toExponential() |
| | | comResult = num2.toExponential(1) |
| | | } |
| | | }else{ |
| | | let valueList = []; |
| | |
| | | * @param comValue 对象类型,表示要替换的单元格值,键为单元格名称,值为替换后的值 |
| | | * @returns 返回计算后的结果,如果计算失败则返回0 |
| | | */ |
| | | function compute(f,comValue){ |
| | | function compute(f,comValue, isPoint){ |
| | | try { |
| | | let str = f |
| | | // 获取单元格对应值 |
| | |
| | | } |
| | | if(str.includes('&"/"&')){ |
| | | return str.replace(new RegExp('&"/"&', 'g'),'/').replace(new RegExp('//', 'g'),'') |
| | | return str.replaceAll('&"/"&', '/').replaceAll('//','') |
| | | } else if (isPoint) { |
| | | return str.replace('ABS', '').replace(/\(|\)/g, '') |
| | | }else { |
| | | return eval(str) |
| | | } |