// 企业台账统计 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; }