|
|
@ -5,7 +5,7 @@ import moment from "moment"; |
|
|
|
import '../style.less'; |
|
|
|
import { push } from 'react-router-redux'; |
|
|
|
import { Model } from 'echarts'; |
|
|
|
import { getPatrolPlan } from '../../patrolManage/actions/plan' |
|
|
|
import {getPatrolPlan} from '../../patrolManage/actions/plan' |
|
|
|
import XColumn from '../components/charts/xColumn' |
|
|
|
import StackColumn from '../components/charts/stackColumn' |
|
|
|
import AlarmStatistics from '../components/alarm/alarmStatistics' |
|
|
@ -14,42 +14,50 @@ import Column from '../components/charts/column' |
|
|
|
const Information = (props) => { |
|
|
|
const { dispatch, actions, user, loading, clientHeight } = props |
|
|
|
const { patrolManage, issueHandle } = actions |
|
|
|
const [planedata, setplandata] = useState([]) |
|
|
|
const [xunjiandata, setxunjiandata] = useState([]) |
|
|
|
const [shijiandata, setshijiandata] = useState([]) |
|
|
|
const [planedata,setplandata] = useState([]) |
|
|
|
const [xunjiandata,setxunjiandata] = useState([]) |
|
|
|
const [shijiandata,setshijiandata] = useState([]) |
|
|
|
|
|
|
|
const [chartData1, setChartData1] = useState([]) |
|
|
|
const [chartData2, setChartData2] = useState([]) |
|
|
|
const [chartData3, setChartData3] = useState([]) |
|
|
|
const [chartData4, setChartData4] = useState([]) |
|
|
|
|
|
|
|
const topdata = [] |
|
|
|
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`)) |
|
|
|
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 => { |
|
|
|
if (i?.frequency.split('/')[i?.frequency.split('/').length - 1] === '天') { |
|
|
|
return parseInt(moment().format('YYYYMMDD')) <= parseInt(moment(i.endTime).format('YYYYMMDD')) |
|
|
|
} else if (i?.frequency.split('/')[i?.frequency.split('/').length - 1] === '周') { |
|
|
|
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('')) |
|
|
|
useEffect(()=>{ |
|
|
|
dispatch(getPatrolPlan()).then(async (res)=>{ |
|
|
|
const res2 = await dispatch(patrolManage.records(`patrolRecord/all/${times[0]}/${times[1]}/null/null`)) |
|
|
|
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=>{ |
|
|
|
// 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] === '月') { |
|
|
|
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('')) |
|
|
|
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') |
|
|
|
|
|
|
|
|
|
|
|
calcChartData(res2?.payload?.data) |
|
|
|
}) |
|
|
|
}, []) |
|
|
|
|
|
|
|
},[]) |
|
|
|
console.log(xunjiandata,'xunjiandata') |
|
|
|
|
|
|
|
const calcChartData = (data) => { |
|
|
|
let arr = [] |
|
|
@ -67,38 +75,38 @@ const Information = (props) => { |
|
|
|
|
|
|
|
return ( |
|
|
|
<> |
|
|
|
<div className='shouyetop'> |
|
|
|
<div className='shouyetopitem'> |
|
|
|
<div className='shouyetopitem-left' > |
|
|
|
<div>今日巡检</div> |
|
|
|
<div>{planedata.length}</div> |
|
|
|
</div> |
|
|
|
<div className='shouyetopitem-right'> |
|
|
|
<div>完成巡检:{xunjiandata.length}个</div> |
|
|
|
<div>巡检上报:{xunjiandata.filter(i => i?.alarm === true).length}个</div> |
|
|
|
</div> |
|
|
|
<div className='shouyetop'> |
|
|
|
<div className='shouyetopitem'> |
|
|
|
<div className='shouyetopitem-left' > |
|
|
|
<div>今日巡检</div> |
|
|
|
<div>{planedata.length}</div> |
|
|
|
</div> |
|
|
|
<div className='shouyetopitem'> |
|
|
|
<div className='shouyetopitem-left' > |
|
|
|
<div>今日事件</div> |
|
|
|
<div>{xunjiandata.filter(i => i?.alarm === true).length}</div> |
|
|
|
</div> |
|
|
|
<div className='shouyetopitem-right'> |
|
|
|
<div>已处理:个</div> |
|
|
|
<div>未处理:2个</div> |
|
|
|
</div> |
|
|
|
<div className='shouyetopitem-right'> |
|
|
|
<div>完成巡检:{xunjiandata.length}个</div> |
|
|
|
<div>巡检上报:{xunjiandata.filter(i=>i?.alarm===true).length}个</div> |
|
|
|
</div> |
|
|
|
<div className='shouyetopitem'> |
|
|
|
<div className='shouyetopitem-left' > |
|
|
|
<div>今日预警</div> |
|
|
|
<div>0</div> |
|
|
|
</div> |
|
|
|
<div className='shouyetopitem-right'> |
|
|
|
<div>已下发:2个</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div className='shouyetopitem'> |
|
|
|
<div className='shouyetopitem-left' > |
|
|
|
<div>今日事件</div> |
|
|
|
<div>{xunjiandata.filter(i=>i?.alarm===true).length}</div> |
|
|
|
</div> |
|
|
|
<div className='shouyetopitem-right'> |
|
|
|
<div>已处理:个</div> |
|
|
|
<div>未处理:2个</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div className='shouyetopitem'> |
|
|
|
<div className='shouyetopitem-left' > |
|
|
|
<div>今日预警</div> |
|
|
|
<div>0</div> |
|
|
|
</div> |
|
|
|
<div className='shouyetopitem-right'> |
|
|
|
<div>已下发:2个</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<Card className='shouye-chart-card'> |
|
|
|
</div> |
|
|
|
<Card className='shouye-chart-card'> |
|
|
|
<div style={{ display: 'flex', justifyContent: 'space-between' }}> |
|
|
|
<div style={{ width: '45%' }}> |
|
|
|
<XColumn |
|
|
@ -128,7 +136,7 @@ const Information = (props) => { |
|
|
|
) |
|
|
|
} |
|
|
|
|
|
|
|
function mapStateToProps(state) { |
|
|
|
function mapStateToProps (state) { |
|
|
|
const { auth, global } = state; |
|
|
|
return { |
|
|
|
user: auth.user, |
|
|
@ -137,4 +145,4 @@ function mapStateToProps(state) { |
|
|
|
}; |
|
|
|
} |
|
|
|
|
|
|
|
export default connect(mapStateToProps)(Information); |
|
|
|
export default connect(mapStateToProps)(Information); |