Browse Source

完善今日巡检计算

master
dengyinhuan 2 years ago
parent
commit
7cf724ee43
  1. 8
      web/client/src/sections/patrolManage/containers/yujingguanli.js
  2. 44
      web/client/src/sections/shouye/containers/shouye.js

8
web/client/src/sections/patrolManage/containers/yujingguanli.js

@ -209,8 +209,8 @@ function YujingGuanli (props) {
&&moment(i?.patrolRecordIssueHandles[0].yanshoushijian).valueOf()<moment(j?.patrolRecordIssueHandles[0]?.yanshoushijian).valueOf()
).length===0
})
console.log(res,'res')
console.log(data,'data')
// console.log(res,'res')
// console.log(data,'data')
// setDataSource(res?.payload?.data.filter(i=>i?.points?.project?.name.match(params.name)));
setDataSource(data.filter(i=>i?.points?.project?.name.match(params.name)));
}}
@ -239,7 +239,7 @@ function YujingGuanli (props) {
// }).length===0
})
console.log(data,'data')
setDataSource2(data.filter(i=>i?.points?.project?.name.match(params.name)));
setDataSource2(data.filter(i=>i?.points?.project?.name.match(params.name)).sort((a, b) => moment(b.patrolRecordIssueHandles[0].yanshoushijian).valueOf() - moment(a.patrolRecordIssueHandles[0].yanshoushijian).valueOf()));
}}
/>,
@ -279,7 +279,7 @@ function YujingGuanli (props) {
console.log(res,'res')
// setDataSource(res?.payload?.data.filter(i=>i?.points?.project?.name.match(params.name)));
setDataSource(data);
setDataSource2(data2);
setDataSource2(data2.sort((a, b) => moment(b.patrolRecordIssueHandles[0].yanshoushijian).valueOf() - moment(a.patrolRecordIssueHandles[0].yanshoushijian).valueOf()));
settabs(2)
}}
tableRef={tableRef}

44
web/client/src/sections/shouye/containers/shouye.js

@ -32,25 +32,39 @@ const Information = (props) => {
console.log(res2,'res2')
setshijiandata(res2?.payload?.data)
setxunjiandata(res2?.payload?.data.filter(i=>parseInt(moment().format('YYYYMMDD'))=== parseInt(moment(i.inspectionTime ).format('YYYYMMDD'))))
const count = res?.payload?.data?.rows?.filter(i=>{
let num = 0
res?.payload?.data?.rows?.map(i=>{
// console.log(i?.frequency?.match(/^[0-9]*$/),'jjj')
if(i?.frequency.split('/')[i?.frequency.split('/').length-1]==='天'){
if(i?.frequency.split('/')[i?.frequency.split('/').length-1]==='天' && parseInt(moment().format('YYYYMMDD'))<=parseInt(moment(i.endTime).format('YYYYMMDD'))){
// console.log(i?.frequency?.match(/[\d.]/g).join(''),'jjj')
return parseInt(moment().format('YYYYMMDD'))<=parseInt(moment(i.endTime).format('YYYYMMDD'))
num = num + parseInt(i?.frequency?.match(/[\d.]/g).join(''))
// return parseInt(moment().format('YYYYMMDD'))<=parseInt(moment(i.endTime).format('YYYYMMDD'))
// console.log('是的',i?.frequency.split('/')[i?.frequency.split('/').length-1])
}else if(i?.frequency.split('/')[i?.frequency.split('/').length-1]==='周'){
if(parseInt(moment().format('YYYYMMDD'))<=parseInt(moment(i.endTime).format('YYYYMMDD'))&&res2?.payload?.data?.filter(j=>j.patrolPlanId===i.id
&&moment(j.inspectionTim).week()===moment().week()).length<parseInt(i?.frequency?.match(/[\d.]/g).join(''))){
num = num + (parseInt(i?.frequency?.match(/[\d.]/g).join('')) - res2?.payload?.data?.filter(j=>j.patrolPlanId===i.id
&&moment(j.inspectionTim).week()===moment().week()).length)
}
// console.log(i?.frequency?.match(/^[0-9]*$/),'jjj')
return parseInt(moment().format('YYYYMMDD'))<=parseInt(moment(i.endTime).format('YYYYMMDD'))&&res2?.payload?.data?.filter(j=>j.patrolPlanId===i.id
&&moment(j.inspectionTim).week()===moment().week()).length<parseInt(i?.frequency?.match(/[\d.]/g).join(''))
// return parseInt(moment().format('YYYYMMDD'))<=parseInt(moment(i.endTime).format('YYYYMMDD'))&&res2?.payload?.data?.filter(j=>j.patrolPlanId===i.id
// &&moment(j.inspectionTim).week()===moment().week()).length<parseInt(i?.frequency?.match(/[\d.]/g).join(''))
}
else if(i?.frequency.split('/')[i?.frequency.split('/').length-1]==='月'){
if(parseInt(moment().format('YYYYMMDD'))<=parseInt(moment(i.endTime).format('YYYYMMDD'))&&res2?.payload?.data?.filter(j=>j.patrolPlanId===i.id
&&moment(j.inspectionTim).month()===moment().month()).length<parseInt(i?.frequency?.match(/[\d.]/g).join(''))){
num = num+ (parseInt(i?.frequency?.match(/[\d.]/g).join('')) - res2?.payload?.data?.filter(j=>j.patrolPlanId===i.id
&&moment(j.inspectionTim).month()===moment().month()).length)
}
// console.log(i?.frequency?.match(/^[0-9]*$/),'jjj')
return parseInt(moment().format('YYYYMMDD'))<=parseInt(moment(i.endTime).format('YYYYMMDD'))&&res2?.payload?.data?.filter(j=>j.patrolPlanId===i.id
&&moment(j.inspectionTim).month()===moment().month()).length<parseInt(i?.frequency?.match(/[\d.]/g).join(''))
// num = num+
// return parseInt(moment().format('YYYYMMDD'))<=parseInt(moment(i.endTime).format('YYYYMMDD'))&&res2?.payload?.data?.filter(j=>j.patrolPlanId===i.id
// &&moment(j.inspectionTim).month()===moment().month()).length<parseInt(i?.frequency?.match(/[\d.]/g).join(''))
}
})
console.log(count,'count')
setplandata(count)
console.log(num,'count')
setplandata(num)
console.log(res,'res')
@ -71,24 +85,24 @@ const Information = (props) => {
arr1.push({ name: l.point?.name, value: 1 })
}
} else {//修好了
let ext4 = arr4.find(a => a.name === l.point.name);
let ext4 = arr4.find(a => a?.name === l?.point?.name);
if (ext4) {
ext4.cost += parseFloat(l.patrolRecordIssueHandles[0]?.cost);
} else {
arr4.push({ name: l.point.name, cost: parseFloat(l.patrolRecordIssueHandles[0]?.cost) })
arr4.push({ name: l?.point?.name, cost: parseFloat(l?.patrolRecordIssueHandles[0]?.cost) })
}
}
//右上
let ext2 = arr2.find(a => a.name === l.point.name);
let ext2 = arr2.find(a => a?.name === l?.point?.name);
if (ext2) {
ext2.num++;
if(repairOk){
ext2.repairNum += l.patrolRecordIssueHandles[0]?.yanshoucishu;
}
} else {
let repairNum = repairOk ? l.patrolRecordIssueHandles[0]?.yanshoucishu : 0;
arr2.push({ name: l.point.name, num: 1, repairNum })
let repairNum = repairOk ? l?.patrolRecordIssueHandles[0]?.yanshoucishu : 0;
arr2?.push({ name: l?.point?.name, num: 1, repairNum })
}
})
arr1.sort((a, b) => b.value - a.value);
@ -107,7 +121,7 @@ const Information = (props) => {
<div className='shouyetopitem'>
<div className='shouyetopitem-left' >
<div>今日巡检</div>
<div>{planedata.length}</div>
<div>{planedata}</div>
</div>
<div className='shouyetopitem-right'>
<div>完成巡检{xunjiandata.length}</div>

Loading…
Cancel
Save