Browse Source

接入告警信息数据

master
dengyinhuan 2 years ago
parent
commit
58c25dc1fb
  1. 2
      web/client/src/sections/patrolManage/components/xiafagaojin.js
  2. 56
      web/client/src/sections/patrolManage/containers/yujingguanli.js
  3. 76
      web/client/src/sections/shouye/components/alarm/alarmStatistics.js
  4. 21
      web/client/src/sections/shouye/containers/shouye.js

2
web/client/src/sections/patrolManage/components/xiafagaojin.js

@ -39,7 +39,7 @@ const PlanModal = ({ visible, onCancel, dispatch, type, curRecord, tableRef, che
}).then(()=>{
dispatch(issueHandle.modifyPatrolRecordIssueHandle(curRecord?.patrolRecordIssueHandles[0]?.id,{
isgaojing:true,
yujingshijian:moment().format('YYYY-MM-DD')
yujingshijian:moment().format('YYYY-MM-DD HH:mm:ss')
})),
onCancel();
onHandle()

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

@ -17,6 +17,7 @@ function YujingGuanli (props) {
const [visible, setVisible] = useState(false);
const [type, setType] = useState();
const [curRecord, setCurRecord] = useState();
const [tabs,settabs] = useState(1)
const [data,setdata]= useState([])
const [tableList, settableList] = useState([])
const [name, setName] = useState('');
@ -25,7 +26,7 @@ function YujingGuanli (props) {
const [search, setSearch] = useState({ name: null, time: [times[0], times[1]], state: 'null' })
const STATE_TEXT = { 1: '待制定计划', 2: '待审核', 3: '计划驳回', 4: '待维修', 5: '待验收', 6: '验收通过', 7: '验收不通过', }
const onChange = (key) => {
console.log(key);
settabs(key)
};
const renderOptionText = (currentState) => {
let text = '待制定计划'
@ -176,13 +177,13 @@ function YujingGuanli (props) {
return (
<>
<Tabs
defaultActiveKey="1"
activeKey={tabs}
onChange={onChange}
style={{marginLeft:'20px',marginRight:'20px'}}
items={[
{
label: `未告警`,
key: '1',
key: 1,
children: <ProTable
columns={columns}
actionRef={tableRef}
@ -199,14 +200,16 @@ function YujingGuanli (props) {
// }
// })
const res = await dispatch(patrolManage.records(`patrolRecord/all/${times[0]}/${times[1]}/true/null`));
const data = res?.payload?.data?.filter(i=>{
const data = res?.payload?.data?.filter(i=>{
return i?.patrolRecordIssueHandles[0]?.yanshoucishu>2&&i?.patrolRecordIssueHandles[0]?.isgaojing!==true
&&res?.payload?.data?.filter(j=>j?.pointId===i?.pointId
&&j?.points?.project?.id===i?.points?.project?.id&&
parseInt(moment(i?.patrolRecordIssueHandles[0].yujingshijian).format('YYYYMMDD'))<parseInt(moment(j?.patrolRecordIssueHandles[0]?.yujingshijian).format('YYYYMMDD'))
).length===0
&&res?.payload?.data?.filter(j=>j?.pointId===i?.pointId&&j?.points?.project?.id===i?.points?.project?.id
&&j?.patrolRecordIssueHandles[0]?.yujingshijian
&&i?.patrolRecordIssueHandles[0]?.yujingshijian&&
parseInt(moment(i?.patrolRecordIssueHandles[0].yujingshijian).format('YYYYMMDDHHMMSS'))<parseInt(moment(j?.patrolRecordIssueHandles[0]?.yujingshijian).format('YYYYMMDDHHMMSS'))
).length===0
})
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)));
}}
@ -214,7 +217,7 @@ function YujingGuanli (props) {
},
{
label: `已告警`,
key: '2',
key: 2,
children: <ProTable
columns={columns1}
actionRef={tableRef}
@ -226,12 +229,15 @@ function YujingGuanli (props) {
request={async (params = {}) => {
const res = await dispatch(patrolManage.records(`patrolRecord/all/${times[0]}/${times[1]}/true/null`));
const data = res?.payload?.data?.filter(i=>{
return i?.patrolRecordIssueHandles[0]?.isgaojing===true&&
res?.payload?.data?.filter(j=>j?.pointId===i?.pointId
&&j?.points?.project?.id===i?.points?.project?.id&&
parseInt(moment(i?.patrolRecordIssueHandles[0].yujingshijian).format('YYYYMMDD'))<=parseInt(moment(j?.patrolRecordIssueHandles[0]?.yujingshijian).format('YYYYMMDD'))
).length===0
})
return i?.patrolRecordIssueHandles[0]?.isgaojing===true&&i?.patrolRecordIssueHandles[0]?.yujingafchishu===null
// &&res?.payload?.data?.filter(j=>
// {
// return j?.pointId===i?.pointId
// &&j?.points?.project?.id===i?.points?.project?.id&&i?.patrolRecordIssueHandles[0]?.yujingshijian&&
// parseInt(moment(i?.patrolRecordIssueHandles[0].yujingshijian).format('YYYYMMDDHHMMSS'))<parseInt(moment(j?.patrolRecordIssueHandles[0]?.yujingshijian).format('YYYYMMDDHHMMSS'))
// }).length===0
})
console.log(data,'data')
setDataSource2(data.filter(i=>i?.points?.project?.name.match(params.name)));
}}
@ -253,12 +259,15 @@ function YujingGuanli (props) {
onHandle={async ()=>{
const res = await dispatch(patrolManage.records(`patrolRecord/all/${times[0]}/${times[1]}/true/null`));
const data2 = res?.payload?.data?.filter(i=>{
return i?.patrolRecordIssueHandles[0]?.isgaojing===true&&
res?.payload?.data?.filter(j=>j?.pointId===i?.pointId
&&j?.points?.project?.id===i?.points?.project?.id&&
parseInt(i?.patrolRecordIssueHandles[0].yujingshijian)<parseInt(j?.patrolRecordIssueHandles[0]?.yujingshijian)
).length===0
})
return i?.patrolRecordIssueHandles[0]?.isgaojing===true&&i?.patrolRecordIssueHandles[0]?.yujingafchishu===null
// &&res?.payload?.data?.filter(j=>
// {
// return j?.pointId===i?.pointId
// &&j?.points?.project?.id===i?.points?.project?.id&&i?.patrolRecordIssueHandles[0]?.yujingshijian&&
// parseInt(moment(i?.patrolRecordIssueHandles[0].yujingshijian).format('YYYYMMDDHHMMSS'))<parseInt(moment(j?.patrolRecordIssueHandles[0]?.yujingshijian).format('YYYYMMDDHHMMSS'))
// }).length===0
})
console.log(data,'data')
const data = res?.payload?.data?.filter(i=>{
return i?.patrolRecordIssueHandles[0]?.yanshoucishu>2&&i?.patrolRecordIssueHandles[0]?.isgaojing!==true
&&res?.payload?.data?.filter(j=>j?.pointId===i?.pointId
@ -268,8 +277,9 @@ function YujingGuanli (props) {
})
console.log(res,'res')
// setDataSource(res?.payload?.data.filter(i=>i?.points?.project?.name.match(params.name)));
setDataSource(data.filter(i=>i?.points?.project?.name.match()));
setDataSource2(data2.filter(i=>i?.points?.project?.name.match()));
setDataSource(data);
setDataSource2(data2);
settabs(2)
}}
tableRef={tableRef}
/> : null

76
web/client/src/sections/shouye/components/alarm/alarmStatistics.js

@ -1,32 +1,70 @@
'use strict'
import React, { Component } from 'react';
import { Row, Col, Tooltip } from 'antd';
import AutoRollComponent from './autorollcomponent';
import { connect } from 'react-redux';
import AutoRollComponent from './autorollcomponent'
import moment from 'moment';
class AlarmStatistics extends Component {
constructor(props) {
super(props);
this.state = {
alarmList: [
{ item: '点位1', count: 214 },
{ item: '点位2', count: 135 },
{ item: '点位3', count: 88 },
{ item: '点位4', count: 63 },
{ item: '点位5', count: 56 },
{ item: '点位6', count: 115 },
{ item: '点位7', count: 67 },
{ item: '点位8', count: 144 },
{ item: '点位9', count: 21 },
{ item: '点位10', count: 83 },
// { item: '点位1', count: 214 },
// { item: '点位2', count: 135 },
// { item: '点位3', count: 88 },
// { item: '点位4', count: 63 },
// { item: '点位5', count: 56 },
// { item: '点位6', count: 115 },
// { item: '点位7', count: 67 },
// { item: '点位8', count: 144 },
// { item: '点位9', count: 21 },
// { item: '点位10', count: 83 },
]
}
}
async componentDidMount(){
const { dispatch, user,actions,depUser} = this.props;
const { patrolManage } = actions
const times = [moment().subtract(70, 'years').format(format), moment().format(format)];
const format = 'YYYY-MM-DD HH:mm:ss';
const res = await dispatch(patrolManage.records(`patrolRecord/all/${times[0]}/${times[1]}/true/null`));
const data = res?.payload?.data?.filter(i=>{
return i?.patrolRecordIssueHandles[0]?.yanshoucishu>2&&i?.patrolRecordIssueHandles[0]?.isgaojing!==true
&&res?.payload?.data?.filter(j=>j?.pointId===i?.pointId&&j?.points?.project?.id===i?.points?.project?.id
&&j?.patrolRecordIssueHandles[0]?.yujingshijian
&&i?.patrolRecordIssueHandles[0]?.yujingshijian&&
parseInt(moment(i?.patrolRecordIssueHandles[0].yujingshijian).format('YYYYMMDDHHMMSS'))<parseInt(moment(j?.patrolRecordIssueHandles[0]?.yujingshijian).format('YYYYMMDDHHMMSS'))
).length===0
})
const obj = {};
data.map((i)=>{
if(obj[i.pointId]){
obj[i.pointId] = {name:i.points.itemData.name,count:obj[i.pointId].count+1}
// return ({name:i.points.itemData.name,count:obj[i.pointId].count+1})
}
else{
obj[i.pointId] = {name:i.points.itemData.name,count:1}
}
})
console.log(data,'data')
const dd= Object.keys(obj).map(i=>{
return ({item:obj[i].name,count:obj[i].count})
})
console.log(obj,'obj')
this.setState({
alarmList:dd
})
}
render() {
const { height } = this.props;
const { alarmList } = this.state;
let max = null, content = null;
let data = alarmList.sort((a, b) => b.count - a.count);
max = data[0].count;
let data = alarmList.sort((a, b) => b?.count - a?.count);
max = data[0]?.count;
// console.log(alarmList,'alarmList')
content = <div style={{ padding: '0px 10px 30px 30px' }}>
{
alarmList.map((wd, i) => {
@ -56,5 +94,13 @@ class AlarmStatistics extends Component {
);
}
}
export default AlarmStatistics;
function mapStateToProps (state) {
const { auth, global ,depUser} = state
return {
user: auth.user,
actions: global.actions,
depUser: depUser.data || [],
}
}
export default connect(mapStateToProps)(AlarmStatistics);
// export default AlarmStatistics;

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

@ -68,7 +68,7 @@ const Information = (props) => {
if (ext1) {
ext1.value++;
} else {
arr1.push({ name: l.point.name, value: 1 })
arr1.push({ name: l.point?.name, value: 1 })
}
} else {//修好了
let ext4 = arr4.find(a => a.name === l.point.name);
@ -127,12 +127,23 @@ const Information = (props) => {
<div className='shouyetopitem'>
<div className='shouyetopitem-left' >
<div>今日预警</div>
<div>{shijiandata.filter(i => i?.alarm === true && i?.patrolRecordIssueHandles[0]?.yujingshijian && moment(i?.patrolRecordIssueHandles[0]?.yujingshijian).format
('YYYYMMDD') === moment().format('YYYYMMDD') && i?.patrolRecordIssueHandles[0]?.isgaojing !== true).length}</div>
<div>{shijiandata.filter(i=>{
return i?.patrolRecordIssueHandles[0]?.yanshoucishu>2&&i?.patrolRecordIssueHandles[0]?.isgaojing!==true
&&shijiandata?.filter(j=>j?.pointId===i?.pointId&&j?.points?.project?.id===i?.points?.project?.id
&&j?.patrolRecordIssueHandles[0]?.yujingshijian
&&i?.patrolRecordIssueHandles[0]?.yujingshijian&&moment(i?.patrolRecordIssueHandles[0]?.yujingshijian).format
('YYYYMMDD') === moment().format('YYYYMMDD')&&
parseInt(moment(i?.patrolRecordIssueHandles[0].yujingshijian).format('YYYYMMDDHHMMSS'))<parseInt(moment(j?.patrolRecordIssueHandles[0]?.yujingshijian).format('YYYYMMDDHHMMSS'))
).length===0
}).length}</div>
</div>
<div className='shouyetopitem-right'>
<div>已下发{shijiandata.filter(i => i?.alarm === true && i?.patrolRecordIssueHandles[0]?.yujingshijian && moment(i?.patrolRecordIssueHandles[0]?.yujingshijian).format
('YYYYMMDD') === moment().format('YYYYMMDD') && i?.patrolRecordIssueHandles[0]?.isgaojing === true && i?.patrolRecordIssueHandles[0]?.yujingafchishu === 1).length}</div>
<div>已下发{shijiandata.filter(i=>{
return i?.patrolRecordIssueHandles[0]?.isgaojing===true&&i?.patrolRecordIssueHandles[0]?.yujingafchishu===null
&&i?.patrolRecordIssueHandles[0]?.yujingshijian
&&moment(i?.patrolRecordIssueHandles[0]?.yujingshijian).format
('YYYYMMDD') === moment().format('YYYYMMDD')
}).length}</div>
</div>
</div>
</div>

Loading…
Cancel
Save