|
@ -123,28 +123,49 @@ Page({ |
|
|
this.inspectedPoints = inspectedPoints; |
|
|
this.inspectedPoints = inspectedPoints; |
|
|
|
|
|
|
|
|
// 今日待检分布
|
|
|
// 今日待检分布
|
|
|
// let needInspectPoints = [];
|
|
|
let needInspectPoints = []; |
|
|
// subSystemPatrol.dayPatrolPlan.forEach((plan) => {
|
|
|
subSystemPatrol.dayPatrolPlan.forEach((plan) => { |
|
|
// const unit = plan.frequency.split('/')[1];
|
|
|
const unit = plan.frequency.split('/')[1]; |
|
|
// const frequency = plan.frequency.split('/')[0];
|
|
|
const frequency = Number(plan.frequency.split('次')[0]); |
|
|
// let record = [...patrolRecord];
|
|
|
let record = patrolRecord.filter(r => |
|
|
// switch (unit) {
|
|
|
moment(r.inspectionTime).isBefore(moment(this.day).endOf('day')) // 当前选定日期及之前的巡检记录
|
|
|
// case '周':
|
|
|
&& r.patrolPlanId === plan.id // 关联当前计划的记录
|
|
|
// record = patrolRecord.filter(r => moment(r.inspectionTime).isSame(this.day, 'day'));
|
|
|
); |
|
|
// break;
|
|
|
switch (unit) { |
|
|
// case '天':
|
|
|
case '月': |
|
|
// record = patrolRecord.filter(r => moment(r.inspectionTime).isSame(this.day, 'day'));
|
|
|
record = record.filter(r => moment(r.inspectionTime).isSame(this.day, 'month ')); |
|
|
// break;
|
|
|
break; |
|
|
// default:
|
|
|
case '周': |
|
|
// break;
|
|
|
record = record.filter(r => moment(r.inspectionTime).isSame(this.day, 'isoWeek')); |
|
|
// }
|
|
|
break; |
|
|
// })
|
|
|
case '天': |
|
|
|
|
|
record = record.filter(r => moment(r.inspectionTime).isSame(this.day, 'day')); |
|
|
|
|
|
break; |
|
|
|
|
|
default: |
|
|
|
|
|
break; |
|
|
|
|
|
} |
|
|
|
|
|
plan.points.forEach(p => { |
|
|
|
|
|
const index = needInspectPoints.findIndex(n => n.name === p.name) |
|
|
|
|
|
if (index === -1) { |
|
|
|
|
|
needInspectPoints.push({ name: p.name, value: frequency }); |
|
|
|
|
|
} else { |
|
|
|
|
|
needInspectPoints[index].value += frequency; |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
record.forEach(r => { |
|
|
|
|
|
const index = needInspectPoints.findIndex(n => n.name === r.points.itemData.name); |
|
|
|
|
|
if (index !== -1 && needInspectPoints[index].value > 0) { |
|
|
|
|
|
needInspectPoints[index].value -= 1; |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
this.initNeedChart(needInspectPoints) |
|
|
this.initAlreadyChart(inspectedPoints) |
|
|
this.initAlreadyChart(inspectedPoints) |
|
|
this.setData({ |
|
|
this.setData({ |
|
|
dayIssues: nextDayIssues, |
|
|
dayIssues: nextDayIssues, |
|
|
|
|
|
needInspectCount: needInspectPoints.reduce((accumulator, currentValue) => accumulator + currentValue.value, 0), |
|
|
inspectedCount: inspectedPoints.reduce((accumulator, currentValue) => accumulator + currentValue.value, 0), |
|
|
inspectedCount: inspectedPoints.reduce((accumulator, currentValue) => accumulator + currentValue.value, 0), |
|
|
|
|
|
|
|
|
}) |
|
|
}) |
|
|
}) |
|
|
}) |
|
|
}, |
|
|
}, |
|
@ -158,15 +179,6 @@ Page({ |
|
|
this.day = options.day; |
|
|
this.day = options.day; |
|
|
this.subType = options.subType; |
|
|
this.subType = options.subType; |
|
|
this.getData(); |
|
|
this.getData(); |
|
|
setTimeout(() => { |
|
|
|
|
|
this.initNeedChart([ |
|
|
|
|
|
{ value: 1048, name: '点位1' }, |
|
|
|
|
|
{ value: 735, name: '点位2' }, |
|
|
|
|
|
{ value: 580, name: '点位3' }, |
|
|
|
|
|
{ value: 580, name: '点位4' }, |
|
|
|
|
|
{ value: 580, name: '点位5' }, |
|
|
|
|
|
]) |
|
|
|
|
|
}, 1000) |
|
|
|
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|