/** * 线索统计 */ export function getClueStatistic(dataList) { let total = dataList.length, finished = 0, unfinished = 0; dataList.forEach(d => { d.finished ? finished++ : unfinished++; }); const p1 = Math.round((finished / total) * 1000) / 10; const p2 = Math.round((unfinished / total) * 1000) / 10; return [ { name: '总计', value: total, diff: '', clickable: false, }, { name: '已完成', value: finished, diff: total == 0 ? '0%' : `${p1}%`, clickable: false, }, { name: '待完成', value: unfinished, diff: total == 0 ? '0%' : `${p2}%`, clickable: false, }, ]; }