|
|
@ -1,6 +1,7 @@ |
|
|
|
import React, { useEffect, useRef, useState } from 'react'; |
|
|
|
import { Skeleton, Button, Pagination, Select, Popconfirm, Table, Tooltip } from '@douyinfe/semi-ui'; |
|
|
|
import { connect } from 'react-redux'; |
|
|
|
import { push } from 'react-router-redux'; |
|
|
|
import Header from '../components/header'; |
|
|
|
import Body from '../components/body' |
|
|
|
import Card from '../components/card' |
|
|
@ -13,7 +14,8 @@ import AutoRollComponent from '../components/AutoRollComponent' |
|
|
|
let interrupt |
|
|
|
let repair |
|
|
|
let overviewScrollbar; |
|
|
|
const Bigscreen = ({ dispatch, actions, user, match, history, clientHeight, groupStatisticOnline }) => { |
|
|
|
const Bigscreen = (props) => { |
|
|
|
const { dispatch, actions, user, match, history, clientHeight, groupStatisticOnline, ...restProps } = props |
|
|
|
|
|
|
|
const [InterruptRank, setInterruptRank] = useState([]) |
|
|
|
const [online, setOnline] = useState([]) |
|
|
@ -30,27 +32,37 @@ const Bigscreen = ({ dispatch, actions, user, match, history, clientHeight, grou |
|
|
|
const [xData, setXData] = useState([])//横坐标 |
|
|
|
const self = useRef({ myChart: null }); |
|
|
|
|
|
|
|
// const [queryUserId, setQueryUserId] = useState('') |
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
let groupId = JSON.parse(localStorage.getItem('project_group'))?.find(v => user?.id == v.userId)?.projectGroupId |
|
|
|
statisticOnline(groupId) |
|
|
|
|
|
|
|
let groupIdLocal = JSON.parse(localStorage.getItem('project_group'))?.find(v => user?.id == v.userId)?.projectGroupId |
|
|
|
|
|
|
|
let search = restProps?.location?.search || ''; |
|
|
|
let params = new URLSearchParams(search); |
|
|
|
// let userId = params.get('pomsU') |
|
|
|
let groupId = params.get('pomsPG') |
|
|
|
|
|
|
|
// setQueryUserId(userId) |
|
|
|
|
|
|
|
let groupId_ = groupId || groupIdLocal |
|
|
|
|
|
|
|
statisticOnline(groupId_) |
|
|
|
//计算当前时间,定时更新 |
|
|
|
timeRequest(groupId) |
|
|
|
dispatch(actions.projectGroup.groupStatisticAlarm({ groupId })).then(res => { |
|
|
|
timeRequest(groupId_) |
|
|
|
dispatch(actions.projectGroup.groupStatisticAlarm({ groupId: groupId_ })).then(res => { |
|
|
|
if (res.success) { |
|
|
|
setMockData(res.payload.data) |
|
|
|
} |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
dispatch(actions.projectGroup.groupProject({ groupId })).then(res => { |
|
|
|
dispatch(actions.projectGroup.groupProject({ groupId: groupId_ })).then(res => { |
|
|
|
if (res.success) { |
|
|
|
setGroupProject(res.payload.data?.map(v => ({ ...v, value: (Math.random() * 20).toFixed(0) })) || []) |
|
|
|
setProportion([...res.payload.data?.slice(0, 3)?.map(v => ({ name: v.name || v.pepProjectName, value: (Math.random() * 20).toFixed(0) })), { value: 20, name: '其它' }]) |
|
|
|
} |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
const interruptDom = document.getElementById("interrupt"); |
|
|
|
if (interruptDom) { |
|
|
|
interrupt = new PerfectScrollbar("#interrupt", { |
|
|
@ -65,6 +77,7 @@ const Bigscreen = ({ dispatch, actions, user, match, history, clientHeight, grou |
|
|
|
} |
|
|
|
|
|
|
|
}, []) |
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
const overview = document.getElementById("alarmRank"); |
|
|
|
if (overview) { |
|
|
@ -108,7 +121,7 @@ const Bigscreen = ({ dispatch, actions, user, match, history, clientHeight, grou |
|
|
|
const newArray = mockData.slice(0, 20) |
|
|
|
setAlarmData(newArray) |
|
|
|
|
|
|
|
}else{ |
|
|
|
} else { |
|
|
|
setAlarmData(mockData) |
|
|
|
} |
|
|
|
}, [mockData]) |
|
|
@ -182,7 +195,7 @@ const Bigscreen = ({ dispatch, actions, user, match, history, clientHeight, grou |
|
|
|
|
|
|
|
return ( |
|
|
|
<div className='project-group'> |
|
|
|
<Header match={match} history={history} /> |
|
|
|
<Header match={match} history={history} {...props} /> |
|
|
|
<Body> |
|
|
|
<div style={{ width: "100%", height: '100%' }}> |
|
|
|
<div style={{ width: '100%', height: "45%", display: 'flex' }}> |
|
|
@ -288,7 +301,7 @@ const Bigscreen = ({ dispatch, actions, user, match, history, clientHeight, grou |
|
|
|
</div> |
|
|
|
</Card> |
|
|
|
</div> |
|
|
|
<Card title='数据在线率' tooltipContent='在线率计算:设备存活/总设备(存活判断:普通设备2h以内有实时数据,GNSS设备8h以内有实时数据)' style={{ width: "calc(50% - 8px)", height: "100%", }}> |
|
|
|
<Card title='数据在线率' tooltipContent='在线率计算:设备存活/总设备(存活判断:普通设备2h以内有实时数据,GNSS设备8h以内有实时数据)' style={{ width: "calc(50% - 8px)", height: "100%", }}> |
|
|
|
<div style={{ height: '100%', position: 'relative' }}> |
|
|
|
{/* <div > */} |
|
|
|
<Select |
|
|
@ -375,31 +388,31 @@ const Bigscreen = ({ dispatch, actions, user, match, history, clientHeight, grou |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div id='alarmRank' style={{ height: clientHeight * 0.55 - 150, position: 'relative' }}> |
|
|
|
<AutoRollComponent content={ <>{alarmData?.map((item,index)=>{ |
|
|
|
return (<div style={{ display: 'flex', marginTop: 15, alignItems: 'center' }}> |
|
|
|
<div class='rankDiv'> |
|
|
|
{index===0?<img src='/assets/images/projectGroup/first.png'></img>: |
|
|
|
index===1?<img src='/assets/images/projectGroup/second.png'></img>: |
|
|
|
index===2?<img src='/assets/images/projectGroup/third.png'></img>: |
|
|
|
index>2? <span>{index + 1}</span>:'' |
|
|
|
} |
|
|
|
</div> |
|
|
|
<div class='structDiv'>{item.name?.length > 5 ? <Tooltip content={item.name}>{item.name.substring(0, 5) + '...'}</Tooltip> : item.name}</div> |
|
|
|
<div class='barChartDiv'> |
|
|
|
<div style={{ width: '50%', display: 'flex', justifyContent: 'flex-end',position:'relative' }}> |
|
|
|
<span style={{position:'absolute',left:0,zIndex:2}}> {item.dealAlarmCount}</span> |
|
|
|
<div class='alarms' style={{ width:(biggest>0? ((item.dealAlarmCount / biggest) * 100 + '%'):0), height: '100%',zIndex:2 }}> </div> |
|
|
|
</div> |
|
|
|
<div style={{ width: '50%', display: 'flex',position:'relative' }}> |
|
|
|
<span style={{position:'absolute',right:0,zIndex:2}}> {item.alarmCount}</span> |
|
|
|
<div class='dealAlarms' style={{ width: (biggest>0? ((item.alarmCount / biggest) * 100 + '%'):0), height: '100%',zIndex:2 }}> </div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div>) |
|
|
|
})}</> } containerStyle={{ position: "relative", height: "95%", }} |
|
|
|
divHeight={"100%"} divId={"chart"}/> |
|
|
|
<AutoRollComponent content={<>{alarmData?.map((item, index) => { |
|
|
|
return (<div style={{ display: 'flex', marginTop: 15, alignItems: 'center' }}> |
|
|
|
<div class='rankDiv'> |
|
|
|
{index === 0 ? <img src='/assets/images/projectGroup/first.png'></img> : |
|
|
|
index === 1 ? <img src='/assets/images/projectGroup/second.png'></img> : |
|
|
|
index === 2 ? <img src='/assets/images/projectGroup/third.png'></img> : |
|
|
|
index > 2 ? <span>{index + 1}</span> : '' |
|
|
|
} |
|
|
|
</div> |
|
|
|
<div class='structDiv'>{item.name?.length > 5 ? <Tooltip content={item.name}>{item.name.substring(0, 5) + '...'}</Tooltip> : item.name}</div> |
|
|
|
<div class='barChartDiv'> |
|
|
|
<div style={{ width: '50%', display: 'flex', justifyContent: 'flex-end', position: 'relative' }}> |
|
|
|
<span style={{ position: 'absolute', left: 0, zIndex: 2 }}> {item.dealAlarmCount}</span> |
|
|
|
<div class='alarms' style={{ width: (biggest > 0 ? ((item.dealAlarmCount / biggest) * 100 + '%') : 0), height: '100%', zIndex: 2 }}> </div> |
|
|
|
</div> |
|
|
|
<div style={{ width: '50%', display: 'flex', position: 'relative' }}> |
|
|
|
<span style={{ position: 'absolute', right: 0, zIndex: 2 }}> {item.alarmCount}</span> |
|
|
|
<div class='dealAlarms' style={{ width: (biggest > 0 ? ((item.alarmCount / biggest) * 100 + '%') : 0), height: '100%', zIndex: 2 }}> </div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div>) |
|
|
|
})}</>} containerStyle={{ position: "relative", height: "95%", }} |
|
|
|
divHeight={"100%"} divId={"chart"} /> |
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
<div class="scale"> |
|
|
|
{xData?.map(item => { |
|
|
|
return <div >{item}</div> |
|
|
@ -407,7 +420,7 @@ divHeight={"100%"} divId={"chart"}/> |
|
|
|
</div> |
|
|
|
</div>) : ''} |
|
|
|
</Card> |
|
|
|
<Card title='中断排名' tooltipContent='中断时长:当前时间-最后一条数据时间。中断个数:结构物下中断测点个数/结构物总测点个数。' style={{ width: "calc(50% - 8px)", height: "100%", }}> |
|
|
|
<Card title='中断排名' tooltipContent='中断时长:当前时间-最后一条数据时间。中断个数:结构物下中断测点个数/结构物总测点个数。' style={{ width: "calc(50% - 8px)", height: "100%", }}> |
|
|
|
<div style={{ height: '100%', fontFamily: 'SourceHanSansCN-Regular', fontWeight: 400, fontSize: 14, }}> |
|
|
|
<div style={{ display: "flex", background: '#F6F9FF', height: 40, alignItems: 'center' }}> |
|
|
|
<div style={{ textAlign: 'center', width: '33%' }}>结构物</div> |
|
|
@ -415,33 +428,33 @@ divHeight={"100%"} divId={"chart"}/> |
|
|
|
<div style={{ textAlign: 'center', width: '33%' }}>中断个数</div> |
|
|
|
</div> |
|
|
|
<div id="interrupt" style={{ position: 'relative', height: clientHeight * 0.55 - 170 }}> |
|
|
|
<AutoRollComponent content={ <> |
|
|
|
{InterruptRank?.map((c, index) => { |
|
|
|
let title |
|
|
|
if (c.offline) { |
|
|
|
if (c.offline >= 1440 && Math.floor(c.offline / 1440)) title = Math.floor(c.offline / 1440) + "天" |
|
|
|
if ((c.offline % 1440) >= 60 && Math.floor(c.offline % 1440 / 60)) { |
|
|
|
if (title) { |
|
|
|
title = title + Math.floor(c.offline % 1440 / 60) + "时" |
|
|
|
} else { |
|
|
|
title = Math.floor(c.offline % 1440 / 60) + "时" |
|
|
|
<AutoRollComponent content={<> |
|
|
|
{InterruptRank?.map((c, index) => { |
|
|
|
let title |
|
|
|
if (c.offline) { |
|
|
|
if (c.offline >= 1440 && Math.floor(c.offline / 1440)) title = Math.floor(c.offline / 1440) + "天" |
|
|
|
if ((c.offline % 1440) >= 60 && Math.floor(c.offline % 1440 / 60)) { |
|
|
|
if (title) { |
|
|
|
title = title + Math.floor(c.offline % 1440 / 60) + "时" |
|
|
|
} else { |
|
|
|
title = Math.floor(c.offline % 1440 / 60) + "时" |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if (c.offline % 1440 % 60) { |
|
|
|
if (title) { |
|
|
|
title = title + c.offline % 1440 % 60 + "分" |
|
|
|
} else { |
|
|
|
title = c.offline % 1440 % 60 + "分" |
|
|
|
if (c.offline % 1440 % 60) { |
|
|
|
if (title) { |
|
|
|
title = title + c.offline % 1440 % 60 + "分" |
|
|
|
} else { |
|
|
|
title = c.offline % 1440 % 60 + "分" |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return <div style={{ display: "flex", background: index % 2 == 1 ? "#F6F9FF" : '', height: 40, alignItems: 'center' }}> |
|
|
|
<div style={{ textAlign: 'center', width: '33%', fontFamily: 'SourceHanSansCN-Regular', color: '#2C66F3', fontWeight: 400 }}>{c.name}</div> |
|
|
|
<div style={{ textAlign: 'center', width: '33%' }}>{title}</div> |
|
|
|
<div style={{ textAlign: 'center', width: '33%', fontFamily: 'SourceHanSansCN-Regular', color: '#F33B3B', fontWeight: 400 }}>{c.offnum + '/' + c.totnum}</div> |
|
|
|
</div> |
|
|
|
})}</> } containerStyle={{ position: "relative", height: "85%", }} |
|
|
|
divHeight={"100%"} divId={"chart"}/> |
|
|
|
return <div style={{ display: "flex", background: index % 2 == 1 ? "#F6F9FF" : '', height: 40, alignItems: 'center' }}> |
|
|
|
<div style={{ textAlign: 'center', width: '33%', fontFamily: 'SourceHanSansCN-Regular', color: '#2C66F3', fontWeight: 400 }}>{c.name}</div> |
|
|
|
<div style={{ textAlign: 'center', width: '33%' }}>{title}</div> |
|
|
|
<div style={{ textAlign: 'center', width: '33%', fontFamily: 'SourceHanSansCN-Regular', color: '#F33B3B', fontWeight: 400 }}>{c.offnum + '/' + c.totnum}</div> |
|
|
|
</div> |
|
|
|
})}</>} containerStyle={{ position: "relative", height: "85%", }} |
|
|
|
divHeight={"100%"} divId={"chart"} /> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</Card> |
|
|
|