From 78a13b744763b27138fbdd566dbe666ff4dba2b2 Mon Sep 17 00:00:00 2001 From: licp <lichunping@guanfang.com.cn> Date: 星期三, 27 三月 2024 15:16:06 +0800 Subject: [PATCH] 完成表格-结论修改 --- src/components/do/b1-inspect-order-plan/Inspection.vue | 95 ++++++++++++++++++++++++++++++++++------------- 1 files changed, 68 insertions(+), 27 deletions(-) diff --git a/src/components/do/b1-inspect-order-plan/Inspection.vue b/src/components/do/b1-inspect-order-plan/Inspection.vue index 5212e05..2b83064 100644 --- a/src/components/do/b1-inspect-order-plan/Inspection.vue +++ b/src/components/do/b1-inspect-order-plan/Inspection.vue @@ -412,6 +412,10 @@ 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++ @@ -425,6 +429,13 @@ } 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){ @@ -495,37 +506,66 @@ }) }) // 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 = []; @@ -551,14 +591,15 @@ 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; }) } -- Gitblit v1.9.3