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