riku
2025-04-22 45be153eaef9e1c1a3fe21515e9cbd785fba8e1f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/**
 * 线索统计
 */
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: '',
    },
    {
      name: '已完成',
      value: finished,
      diff: total == 0 ? '0%' : `${p1}%`,
    },
    {
      name: '待完成',
      value: unfinished,
      diff: total == 0 ? '0%' : `${p2}%`,
    },
  ];
}