// 综合风险 export function getRiskCount(data) { const { tag, countList } = data; const [first, second, third] = countList; const total = first + second + third; const p1 = Math.round((first / total) * 1000) / 10; const p2 = Math.round((second / total) * 1000) / 10; const p3 = Math.round((third / total) * 1000) / 10; if (total == 0) { return { period: tag, count: [], }; } else { return { period: tag, count: [ { name: '低风险', value: first, diff: total == 0 ? '0%' : `${p1}%`, color: '#13A34C', }, { name: '中风险', value: second, diff: total == 0 ? '0%' : `${p2}%`, color: '#FD9532', }, { name: '高风险', value: third, diff: total == 0 ? '0%' : `${p3}%`, color: '#D10C0C', }, ], }; } }