| | |
| | | comp = ask.map((m, i) => { |
| | | if (m.includes('=')) { |
| | | let str = m.split('=')[1] |
| | | console.log(res,str) |
| | | if(typeof res == 'string'&&typeof str == 'string'){ |
| | | console.log(res,str) |
| | | return res.trim() == str.trim() |
| | | }else{ |
| | | return eval(res) == eval(str) |
| | |
| | | }else{ |
| | | let valueList = []; |
| | | item.valueList.forEach(a => { |
| | | console.log(a) |
| | | valueList.push({ |
| | | name: `${this.comparisonList.find(e=>e.value==a.c).label}${a.r+1}`, |
| | | value: 0, |
| | | }) |
| | | }) |
| | | console.log(comValue) |
| | | for (var a in comValue) { |
| | | valueList.forEach(b => { |
| | | if (b.name == a) { |
| | |
| | | valueList.forEach(b => { |
| | | str = str.replace(b.name, b.value) |
| | | }) |
| | | console.log(str) |
| | | comResult = str |
| | | } |
| | | } catch (error) { |
| | | |
| | | } |
| | | // comResult = excelFunction.compute(item.v.f.replace(/=/g, ' '),comValue); |
| | | // switch (item.methodName) { |
| | | // case 'AVERAGE': |
| | | // let num = 0 |
| | | // for (var a in comValue) { |
| | | // num += comValue[a] |
| | | // } |
| | | // comResult = num / Object.keys(comValue).length |
| | | // break; |
| | | // case 'SUM': |
| | | // let sum = 0 |
| | | // for (var a in comValue) { |
| | | // sum += comValue[a] |
| | | // } |
| | | // comResult = sum |
| | | // break; |
| | | // case 'MEDIAN': |
| | | // let arr = [] |
| | | // for (var a in comValue) { |
| | | // arr.push(comValue[a]) |
| | | // } |
| | | // comResult = this.median(arr) |
| | | // break; |
| | | // case 'APS': |
| | | // let arr0 = [] |
| | | // for (var a in comValue) { |
| | | // arr0.push(comValue[a]) |
| | | // } |
| | | // comResult = Math.abs(arr0[0]) |
| | | // break; |
| | | // // case 'MAX': |
| | | // // let arr1 = [] |
| | | // // for (var a in comValue) { |
| | | // // arr1.push(eval(comValue[a])) |
| | | // // } |
| | | // // comResult = Math.max(...arr1) |
| | | // // break; |
| | | // // case 'MIN': |
| | | // // let arr2 = [] |
| | | // // for (var a in comValue) { |
| | | // // arr2.push(eval(comValue[a])) |
| | | // // } |
| | | // // comResult = Math.median(...arr2) |
| | | // // break; |
| | | // default: |
| | | // let valueList = []; |
| | | // item.valueList.forEach(a => { |
| | | // valueList.push({ |
| | | // name: `${this.comparisonList.find(e=>e.value==a.c).label}${a.r+1}`, |
| | | // value: 0, |
| | | // }) |
| | | // }) |
| | | // for (var a in comValue) { |
| | | // valueList.forEach(b => { |
| | | // if (b.name == a) { |
| | | // b.value = comValue[a] |
| | | // } |
| | | // }) |
| | | // } |
| | | // let str = item.v.f.replace(/=/g, ' '); |
| | | // valueList.forEach(b => { |
| | | // str = str.replace(b.name, b.value) |
| | | // }) |
| | | // str = str.replaceAll('MAX', 'Math.max') |
| | | // str = str.replaceAll('MIN', 'Math.min') |
| | | // str = str.replaceAll(',', ',') |
| | | // try { |
| | | // if(this.getInspectionValueType(item.i)==1){ |
| | | // comResult = eval(str) |
| | | // }else{ |
| | | // comResult = str |
| | | // } |
| | | // } catch (error) { |
| | | |
| | | // } |
| | | // break; |
| | | // } |
| | | try { |
| | | list.forEach(a => { |
| | | if (a[0].r == item.r && comResult !== '') { |