| | |
| | | let arrs = [] |
| | | let set = new Set() |
| | | let count1 = 0 |
| | | let conclusionList=[];//结论列表 |
| | | let finalList = [];//最终值列表 |
| | | conclusionList = a.template.filter(n=>n.v.ps!=undefined&&n.v.ps.value==='结论') |
| | | finalList = a.template.filter(n=>n.v.ps!=undefined&&n.v.ps.value==='最终值') |
| | | a.template.forEach(b=>{ |
| | | if (b.v.ps!=undefined&&b.v.ps.value==='序号'){ |
| | | count1++ |
| | |
| | | } |
| | | if (b.v.ps!=undefined&&b.v.ps.value==='最终值'){ |
| | | b.v.v = '' |
| | | } |
| | | if (b.v.ps!=undefined&&b.v.ps.value==='结论'){ |
| | | conclusionList.forEach((n,i)=>{ |
| | | if(n.r==b.r&&n.c==b.c){ |
| | | b.v.f = `(${this.comparisonList.find(j=>j.value==(finalList[i].r-1)).label}${finalList[i].r+1})` |
| | | } |
| | | }) |
| | | } |
| | | set.add(b.r) |
| | | if(b.v.f){ |
| | |
| | | }) |
| | | }) |
| | | // console.log('当前的方法',item.methodName) |
| | | let comResult = 0 |
| | | switch(item.methodName){ |
| | | case 'AVERAGE': |
| | | let sum = 0 |
| | | for(var a in comValue){ |
| | | sum += comValue[a] |
| | | } |
| | | comResult = sum / Object.keys(comValue).length |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | list.map(a=>{ |
| | | if(a[0].r == item.r){ |
| | | for(var b in a){ |
| | | if(a[b].c == item.c){ |
| | | a[b].v.v = comResult.toFixed(2) |
| | | break |
| | | } |
| | | } |
| | | } |
| | | return a |
| | | }) |
| | | this.changeInput(comResult,`${code.split('-')[0]}-${item.r}-${item.c}-${id}`)//改变最终值 |
| | | if(item.methodName=='自定义方法'&&item.v.ps&&item.v.ps.value=='结论'){ |
| | | if(this.tableList.find(m=>m.id==item.i)){ |
| | | let ask = this.tableList.find(m=>m.id==item.i).ask.split('&'); |
| | | let res = Object.values(comValue)[0] |
| | | let comp = ask.map((m,i)=>{ |
| | | if(m.includes('=')){ |
| | | return res == m.split('=')[1] |
| | | } |
| | | if(m.includes('≥')){ |
| | | return res >= m.split('≥')[1] |
| | | } |
| | | if(m.includes('≤')){ |
| | | return res <= m.split('≤')[1] |
| | | } |
| | | if(m.includes('<')){ |
| | | return res < m.split('<')[1] |
| | | } |
| | | if(m.includes('>')){ |
| | | return res > m.split('>')[1] |
| | | } |
| | | }) |
| | | if(comp.every(m=>m)){ |
| | | item.v.v = 1 |
| | | }else{ |
| | | item.v.v = 0 |
| | | } |
| | | } |
| | | }else{ |
| | | let comResult = 0; |
| | | switch(item.methodName){ |
| | | case 'AVERAGE': |
| | | let sum = 0 |
| | | for(var a in comValue){ |
| | | sum += comValue[a] |
| | | } |
| | | comResult = sum / Object.keys(comValue).length |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | list.map(a=>{ |
| | | if(a[0].r == item.r){ |
| | | for(var b in a){ |
| | | if(a[b].c == item.c){ |
| | | a[b].v.v = parseFloat(comResult.toFixed(2)) |
| | | break |
| | | } |
| | | } |
| | | } |
| | | return a |
| | | }) |
| | | this.changeInput(comResult,`${code.split('-')[0]}-${item.r}-${item.c}-${id}`)//改变最终值 |
| | | } |
| | | } |
| | | }) |
| | | }, |
| | | handleExcelMethod(){ |
| | | if(this.excelMethodList.length>0){ |
| | | this.excelMethodList.map(item=>{ |
| | | item.methodName = item.v.f.split('=')[1].split('(')&&item.v.f.split('=')[1].split('(')[0]?item.v.f.split('=')[1].split('(')[0]:'自定义方法'; |
| | | item.methodName = item.v.f.split('=').length>1&&item.v.f.split('=')[1].split('(')&&item.v.f.split('=')[1].split('(')[0]?item.v.f.split('=')[1].split('(')[0]:'自定义方法'; |
| | | let valueList = []; |
| | | if(item.v.f.includes(':')){ |
| | | valueList = []; |
| | |
| | | item.valueList = valueList; |
| | | }else{ |
| | | valueList = [] |
| | | let regex= /[\+\-\*\%\(\)\s]/g |
| | | let regex= /[=\+\-\*\%\(\)\s]/g |
| | | let mode = item.v.f.replace(regex, ' ').split(' '); |
| | | mode.forEach(m=>{ |
| | | mode.filter(m=>m).forEach(m=>{ |
| | | let r = m.split('')[1]-1 |
| | | let c = this.comparisonList.find(j=>j.label==m.split('')[0]).value |
| | | valueList.push({c,r}) |
| | | }) |
| | | } |
| | | item.valueList = valueList; |
| | | return item; |
| | | }) |
| | | } |