riku
2024-08-12 65124213af664a68ad88ce7f6dcb133116d7702f
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
33
34
35
36
37
38
39
40
// 企业台账统计
export function getLedgerStat(dataList, time) {
  let stat = {
    time: time,
    totalMust: 0,
    finishedMust: 0,
    totalSelf: 0,
    finishedSelf: 0,
    percent: 0,
    percent2: 0
  };
  dataList.forEach(s => {
    //月度统计
    if (s.needUpdate) {
      //统计自巡查类型的台账,类别为-1(暂定)
      if (s.ledgerTypeId == -1) {
        stat.totalSelf++;
      } else {
        stat.totalMust++;
      }
      if (s.upLoad) {
        if (s.ledgerTypeId == -1) {
          stat.finishedSelf++;
        } else {
          stat.finishedMust++;
        }
      }
    }
  });
 
  stat.percent =
    stat.totalMust == 0
      ? 0
      : Math.round((stat.finishedMust / stat.totalMust) * 100);
  stat.percent2 =
    stat.totalSelf == 0
      ? 0
      : Math.round((stat.finishedSelf / stat.totalSelf) * 100);
  return stat;
}