| | |
| | | }) |
| | | }, |
| | | cellStyle({row, column, rowIndex, columnIndex}) { |
| | | let warningColor = false; |
| | | // console.log(row, column, rowIndex, columnIndex); |
| | | //console.log(row, "row"); |
| | | Object.keys(row).forEach((key, index) => { |
| | | //遍历每行中每个数据的state |
| | | if (key === "repairMttcr" || key === "basicMtbfRegulate") { |
| | | //console.log(key, "row key"); |
| | | let val = row[key] |
| | | const numM = Number(val).toFixed(5); |
| | | if (numM.substring(0, numM.length - 1) === '0.0000' && val > 0) { |
| | | //定位该数据的坐标 |
| | | if (columnIndex === 2) { |
| | | warningColor = true; |
| | | } |
| | | } |
| | | } |
| | | }); |
| | | |
| | | if (warningColor) { |
| | | // red为想变成的单元格样式 |
| | | const numM1 = Number(row.repairMttcr).toFixed(5); |
| | | const numM2 = Number(row.basicMtbfRegulate).toFixed(5); |
| | | console.log(numM1,numM2,'234') |
| | | if (numM1.substring(0, numM1.length - 1) === '0.0000' && row.repairMttcr > 0 && column.property ==="repairMttcr") { |
| | | return 'color : red' |
| | | } else if (numM2.substring(0, numM1.length - 1) === '0.0000' && row.basicMtbfRegulate > 0 && column.property ==="basicMtbfRegulate") { |
| | | return 'color : red' |
| | | }else { |
| | | return '' |
| | | } |
| | | return ""; |
| | | // Object.keys(row).forEach((key, index) => { |
| | | // //遍历每行中每个数据的state |
| | | // if (key === "repairMttcr" || key === "basicMtbfRegulate") { |
| | | // //console.log(key, "row key"); |
| | | // let val = row[key] |
| | | // const numM = Number(val).toFixed(5); |
| | | // if (numM.substring(0, numM.length - 1) === '0.0000' && val > 0) { |
| | | // //定位该数据的坐标 |
| | | // if (columnIndex === 2) { |
| | | // warningColor = true; |
| | | // } |
| | | // } |
| | | // } |
| | | // }); |
| | | }, |
| | | } |
| | | } |