diff --git a/api/app/lib/controllers/bigScreen/leader.js b/api/app/lib/controllers/bigScreen/leader.js index 4cddcaf..079e06e 100644 --- a/api/app/lib/controllers/bigScreen/leader.js +++ b/api/app/lib/controllers/bigScreen/leader.js @@ -6,7 +6,7 @@ const moment = require("moment"); function getPlanCount(startTime,endTime,frequencyUnit){ switch(frequencyUnit){ case '天': - return Math.ceil(moment(endTime).diff(startTime, 'days')) + return Math.ceil(moment(endTime).diff(startTime, 'days'))+1 case '周': return Math.ceil(moment(endTime).diff(startTime, 'weeks')) case '月': @@ -61,7 +61,7 @@ async function findPatrolRecords(ctx, next) { }) planCount=getPlanCount(startTime,endTime,frequencyUnit) - } else if (moment(c.startTime).isSameOrAfter(moment(startTime)) && moment(c.startTime).isSameOrBefore(moment(endTime))) { + } else if (moment(c.startTime).isSameOrAfter(moment(startTime)) && moment(c.endTime).isSameOrBefore(moment(endTime))) { done = await models.PatrolRecord.count({ where: { inspectionTime: { $between: [c.startTime, endTime] }, @@ -77,15 +77,15 @@ async function findPatrolRecords(ctx, next) { patrolPlanId: c.id } }) - planCount=getPlanCount(c.startTime,endTime,frequencyUnit) - } else if (moment(c.startTime).isAfter(moment(startTime)) && moment(c.endTime).isBefore(moment(endTime))) { + planCount=getPlanCount(startTime,c.endTime,frequencyUnit) + } else if (moment(c.startTime).isAfter(moment(startTime)) && moment(c.startTime).isBefore(moment(endTime))) { done = await models.PatrolRecord.count({ where: { inspectionTime: { $between: [c.startTime, c.endTime] }, patrolPlanId: c.id } }) - planCount=getPlanCount(startTime,c.endTime,frequencyUnit) + planCount=getPlanCount(c.startTime,endTime,frequencyUnit) } let dones = await models.PatrolRecord.count({ where: { diff --git a/web-screen/client/src/sections/bigScreen/components/leader/left.js b/web-screen/client/src/sections/bigScreen/components/leader/left.js index 46915a5..d8593c4 100644 --- a/web-screen/client/src/sections/bigScreen/components/leader/left.js +++ b/web-screen/client/src/sections/bigScreen/components/leader/left.js @@ -277,7 +277,7 @@ const Left = props => {
- {`${plan > 0 ? ((done / done + plan) * 100).toFixed(2) : 0}%`} + {`${plan > 0 ? ((done / (done + plan)) * 100).toFixed(0) : 0}%`}
当前巡检完成率