|
|
@ -5,13 +5,44 @@ import moment from "moment"; |
|
|
|
import '../style.less'; |
|
|
|
import { push } from 'react-router-redux'; |
|
|
|
import { Model } from 'echarts'; |
|
|
|
|
|
|
|
import {getPatrolPlan} from '../../patrolManage/actions/plan' |
|
|
|
|
|
|
|
const Information = (props) => { |
|
|
|
const { dispatch, actions, user, loading } = props |
|
|
|
const { patrolManage, issueHandle } = actions |
|
|
|
const [planedata,setplandata] = useState([]) |
|
|
|
const [xunjiandata,setxunjiandata] = useState([]) |
|
|
|
const topdata =[] |
|
|
|
|
|
|
|
|
|
|
|
const format = 'YYYY-MM-DD HH:mm:ss' |
|
|
|
const times = [moment().subtract(70, 'years').format(format), moment().format(format)] |
|
|
|
useEffect(()=>{ |
|
|
|
dispatch(getPatrolPlan()).then(async (res)=>{ |
|
|
|
const res2 = await dispatch(patrolManage.records(`patrolRecord/all/${times[0]}/${times[1]}/null/null`)) |
|
|
|
console.log(res2,'res2') |
|
|
|
setxunjiandata(res2?.payload?.data.filter(i=>parseInt(moment().format('YYYYMMDD'))=== parseInt(moment(i.inspectionTime ).format('YYYYMMDD')))) |
|
|
|
const count = res?.payload?.data?.rows?.filter(i=>{ |
|
|
|
// console.log(i?.frequency?.match(/^[0-9]*$/),'jjj')
|
|
|
|
if(i?.frequency.split('/')[i?.frequency.split('/').length-1]==='天'){ |
|
|
|
// console.log(i?.frequency?.match(/[\d.]/g).join(''),'jjj')
|
|
|
|
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]==='周'){ |
|
|
|
// 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('')) |
|
|
|
} |
|
|
|
else if(i?.frequency.split('/')[i?.frequency.split('/').length-1]==='月'){ |
|
|
|
// 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('')) |
|
|
|
} |
|
|
|
}) |
|
|
|
console.log(count,'count') |
|
|
|
setplandata(count) |
|
|
|
console.log(res,'res') |
|
|
|
}) |
|
|
|
},[]) |
|
|
|
console.log(xunjiandata,'xunjiandata') |
|
|
|
|
|
|
|
return ( |
|
|
|
<> |
|
|
@ -19,11 +50,11 @@ const Information = (props) => { |
|
|
|
<div className='shouyetopitem'> |
|
|
|
<div className='shouyetopitem-left' > |
|
|
|
<div>今日巡检</div> |
|
|
|
<div>0</div> |
|
|
|
<div>{planedata.length}</div> |
|
|
|
</div> |
|
|
|
<div className='shouyetopitem-right'> |
|
|
|
<div>完成巡检:2个</div> |
|
|
|
<div>巡检上报:2个</div> |
|
|
|
<div>完成巡检:{xunjiandata.length}个</div> |
|
|
|
<div>巡检上报:{xunjiandata.filter(i=>i?.alarm===true).length}个</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div className='shouyetopitem'> |
|
|
|