Browse Source

添加今日巡检数据

master
dengyinhuan 2 years ago
parent
commit
66039ac05a
  1. 43
      web/client/src/sections/shouye/containers/shouye.js
  2. 10
      web/client/src/sections/shouye/style.less

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

@ -5,13 +5,44 @@ 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'
const Information = (props) => { const Information = (props) => {
const { dispatch, actions, user, loading } = props const { dispatch, actions, user, loading } = props
const { patrolManage, issueHandle } = actions
const [planedata,setplandata] = useState([])
const [xunjiandata,setxunjiandata] = 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`))
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 ( return (
<> <>
@ -19,11 +50,11 @@ const Information = (props) => {
<div className='shouyetopitem'> <div className='shouyetopitem'>
<div className='shouyetopitem-left' > <div className='shouyetopitem-left' >
<div>今日巡检</div> <div>今日巡检</div>
<div>0</div> <div>{planedata.length}</div>
</div> </div>
<div className='shouyetopitem-right'> <div className='shouyetopitem-right'>
<div>完成巡检2</div> <div>完成巡检{xunjiandata.length}</div>
<div>巡检上报2</div> <div>巡检上报{xunjiandata.filter(i=>i?.alarm===true).length}</div>
</div> </div>
</div> </div>
<div className='shouyetopitem'> <div className='shouyetopitem'>

10
web/client/src/sections/shouye/style.less

@ -1,9 +1,12 @@
.shouyetop{ .shouyetop{
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
padding: 0 1.875rem;
.shouyetopitem{ .shouyetopitem{
width: 25%; width: 31%;
display: flex; display: flex;
padding: 0 2%;
align-items: center;
justify-content: space-between; justify-content: space-between;
box-shadow: 0 0 10px #F0F2F5; box-shadow: 0 0 10px #F0F2F5;
border:1px solid #F0F2F5; border:1px solid #F0F2F5;
@ -12,9 +15,14 @@
height: 7.125rem; height: 7.125rem;
.shouyetopitem-left{ .shouyetopitem-left{
width: 50%; width: 50%;
// display: flex;
// flex-direction: column;
// // align-items: center;
// justify-content: center;
} }
.shouyetopitem-right{ .shouyetopitem-right{
width: 50%; width: 50%;
font-size: 1.5625rem;
} }
} }
} }
Loading…
Cancel
Save