|
|
@ -1,7 +1,7 @@ |
|
|
|
import React, { useEffect, useState } from 'react' |
|
|
|
import { connect } from 'react-redux' |
|
|
|
import { IconAlertCircle } from '@douyinfe/semi-icons' |
|
|
|
import { Button, Form, Modal, Skeleton, Pagination, TextArea } from "@douyinfe/semi-ui"; |
|
|
|
import { Button, Form, Modal, Skeleton, Pagination, TextArea, Tooltip } from "@douyinfe/semi-ui"; |
|
|
|
import Statistics from '../components/statistics' |
|
|
|
import TableData from '../components/tableData' |
|
|
|
import SideSheets from '../components/sideSheet' |
|
|
@ -28,6 +28,7 @@ const DataAlarm = ({ match, dispatch, actions, user, loading, socket }) => { |
|
|
|
const [genre, setGenre] = useState([]) //搜索类型 |
|
|
|
const [checkPop, setCheckPop] = useState(false) //查看弹框是否显现 |
|
|
|
const [alarmId, setAlarmId] = useState(false) //查看alarmId |
|
|
|
const [query, setQuery] = useState({ limit: 10, page: 0 }) //分页 |
|
|
|
|
|
|
|
const tableType = { dataLnterrupt: 'dataLnterrupt', dataAbnormal: 'dataAbnormal', strategyHit: 'strategyHit', videoAbnormal: 'videoAbnormal', useAbnormal: 'useAbnormal', deviceAbnormal: 'deviceAbnormal' } |
|
|
|
const statistic = { dataLnterrupt: '数据中断统计', dataAbnormal: '数据异常统计', strategyHit: '策略命中统计', videoAbnormal: '视频异常统计', useAbnormal: '应用异常统计', deviceAbnormal: '设备异常统计' } |
|
|
@ -48,7 +49,6 @@ const DataAlarm = ({ match, dispatch, actions, user, loading, socket }) => { |
|
|
|
//初始化表格显示设置 |
|
|
|
let data = columns[route] |
|
|
|
data.splice(0, 1) |
|
|
|
if (tableType[route] == 'dataAbnormal') data.splice(6, 0, '6') |
|
|
|
localStorage.getItem(tableType[route]) == null |
|
|
|
? localStorage.setItem( |
|
|
|
tableType[route], |
|
|
@ -65,38 +65,38 @@ const DataAlarm = ({ match, dispatch, actions, user, loading, socket }) => { |
|
|
|
dataLnterrupt: [ //数据中断(dataLnterrupt) |
|
|
|
{ name: '搜索', field: '1' }, |
|
|
|
{ |
|
|
|
name: '中断类型', field: '2', |
|
|
|
name: '中断类型', field: 'groupUnitId', |
|
|
|
data: genre |
|
|
|
}, |
|
|
|
{ |
|
|
|
name: '中断状态', field: '3', |
|
|
|
name: '中断状态', field: 'state', |
|
|
|
data: [ |
|
|
|
{ name: '当前', value: '11' }, |
|
|
|
{ name: '历史', value: '22' }] |
|
|
|
{ name: '当前', value: 'new' }, |
|
|
|
{ name: '历史', value: 'histroy' }] |
|
|
|
}], |
|
|
|
dataAbnormal: [ //数据异常(dataAbnormal) |
|
|
|
{ name: '搜索', field: '1' }, |
|
|
|
{ |
|
|
|
name: '异常类型', field: '2', |
|
|
|
name: '异常类型', field: 'groupUnitId', |
|
|
|
data: genre |
|
|
|
}, |
|
|
|
{ |
|
|
|
name: '异常状态', field: '3', |
|
|
|
name: '异常状态', field: 'state', |
|
|
|
data: [ |
|
|
|
{ name: '当前', value: '11' }, |
|
|
|
{ name: '历史', value: '22' }] |
|
|
|
{ name: '当前', value: 'new' }, |
|
|
|
{ name: '历史', value: 'histroy' }] |
|
|
|
}], |
|
|
|
strategyHit: [ // 策略命中(strategyHit) |
|
|
|
{ name: '搜索', field: '1' }, |
|
|
|
{ |
|
|
|
name: '策略类型', field: '2', |
|
|
|
name: '策略类型', field: 'groupUnitId', |
|
|
|
data: genre |
|
|
|
}, |
|
|
|
{ |
|
|
|
name: '命中状态', field: '3', |
|
|
|
name: '命中状态', field: 'state', |
|
|
|
data: [ |
|
|
|
{ name: '当前', value: '11' }, |
|
|
|
{ name: '历史', value: '22' }] |
|
|
|
{ name: '当前', value: 'new' }, |
|
|
|
{ name: '历史', value: 'histroy' }] |
|
|
|
}], |
|
|
|
videoAbnormal: [ // 视频异常(videoAbnormal) |
|
|
|
{ name: '搜索', field: '1' }, |
|
|
@ -131,14 +131,14 @@ const DataAlarm = ({ match, dispatch, actions, user, loading, socket }) => { |
|
|
|
deviceAbnormal: [ // 设备告警(deviceAbnormal) |
|
|
|
{ name: '搜索', field: '1' }, |
|
|
|
{ |
|
|
|
name: '设备类型', field: '2', |
|
|
|
name: '设备类型', field: 'groupUnitId', |
|
|
|
data: genre |
|
|
|
}, |
|
|
|
{ |
|
|
|
name: '异常状态', field: '3', |
|
|
|
name: '异常状态', field: 'state', |
|
|
|
data: [ |
|
|
|
{ name: '当前', value: '11' }, |
|
|
|
{ name: '历史', value: '22' }] |
|
|
|
{ name: '当前', value: 'new' }, |
|
|
|
{ name: '历史', value: 'histroy' }] |
|
|
|
}, |
|
|
|
{ |
|
|
|
name: '异常类型', field: '4', |
|
|
@ -147,27 +147,27 @@ const DataAlarm = ({ match, dispatch, actions, user, loading, socket }) => { |
|
|
|
}], |
|
|
|
common: { |
|
|
|
name: '持续时间', |
|
|
|
field: '5' |
|
|
|
field: 'time' |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
//表格设置信息 |
|
|
|
const tableList = { |
|
|
|
dataLnterrupt: ['index', 'projectName', '2', '3', '4', '6', '9', 'createTime', '5', '10', 'updateTime', '11', 'confirm', 'confirmTime', '14'], |
|
|
|
dataAbnormal: ['index', 'projectName', '2', '3', '4', 'alarmContent', '16', '9', 'createTime', '5', '10', 'updateTime', '11', 'confirm', 'confirmTime'], |
|
|
|
strategyHit: ['index', 'projectName', '2', '3', '17', '18', 'createTime', '5', '10', 'updateTime', '11', 'confirm', 'confirmTime'], |
|
|
|
videoAbnormal: ['index', 'projectName', '2', '3', '19', '20', '21', '22', '5', '6', 'createTime', 'updateTime', 'confirm', 'confirmTime'], |
|
|
|
dataLnterrupt: ['index', 'projectName', 'StructureName', 'SourceName', 'AlarmGroupUnit', 'AlarmCodeName', 'createTime', 'AlarmContent', 'CurrentLevel', 'updateTime', 'detailCount', 'confirm', 'confirmTime',], |
|
|
|
dataAbnormal: ['index', 'projectName', 'StructureName', 'SourceName', 'type', 'alarmType', 'createTime', 'AlarmContent', 'CurrentLevel', 'updateTime', 'detailCount', 'confirm', 'confirmTime'], |
|
|
|
strategyHit: ['index', 'projectName', 'StructureName', 'SourceName', 'Strategy', 'State', 'createTime', 'AlarmContent', 'CurrentLevel', 'updateTime', 'detailCount', 'confirm', 'confirmTime'], |
|
|
|
videoAbnormal: ['index', 'projectName', 'StructureName', 'SourceName', '19', '20', '21', '22', 'AlarmContent', 'AlarmCodeName', 'createTime', 'updateTime', 'confirm', 'confirmTime'], |
|
|
|
useAbnormal: ['index', 'projectName', 'appName', 'url', 'type', 'alarmContent', 'createTime', 'updateTime', 'confirm', 'confirmTime'], |
|
|
|
deviceAbnormal: ['index', 'projectName', '2', '3', '19', 'alarmContent', '21', '5', '6', 'createTime', 'updateTime', 'confirm', 'confirmTime'], |
|
|
|
deviceAbnormal: ['index', 'projectName', 'StructureName', 'SourceName', '19', 'alarmContent', '21', 'AlarmContent', 'AlarmCodeName', 'createTime', 'updateTime', 'confirm', 'confirmTime'], |
|
|
|
} |
|
|
|
//表格默认配置信息 |
|
|
|
const columns = { |
|
|
|
dataLnterrupt: ['projectName', '2', '3', '4', '5', '6', 'createTime', 'updateTime',], |
|
|
|
dataAbnormal: ['projectName', '2', '3', 'alarmContent', '5', '6', 'createTime', 'updateTime'], |
|
|
|
strategyHit: ['projectName', '2', '3', '17', '5', '10', '11', 'updateTime'], |
|
|
|
videoAbnormal: ['projectName', '2', '3', '21', '20', '5', 'createTime', 'updateTime'], |
|
|
|
dataLnterrupt: ['projectName', 'StructureName', 'SourceName', 'AlarmGroupUnit', 'AlarmContent', 'AlarmCodeName', 'createTime', 'updateTime',], |
|
|
|
dataAbnormal: ['projectName', 'StructureName', 'SourceName', 'AlarmContent', 'AlarmCodeName', 'createTime', 'updateTime'], |
|
|
|
strategyHit: ['projectName', 'StructureName', 'SourceName', 'Strategy', 'AlarmContent', 'CurrentLevel', 'detailCount', 'updateTime'], |
|
|
|
videoAbnormal: ['projectName', 'StructureName', 'SourceName', '21', '20', 'AlarmContent', 'createTime', 'updateTime'], |
|
|
|
useAbnormal: ['appName', 'projectName', 'url', 'type', 'alarmContent', 'createTime', 'updateTime'], |
|
|
|
deviceAbnormal: ['projectName', '2', '3', 'alarmContent', '19', '5', 'createTime', 'updateTime'], |
|
|
|
deviceAbnormal: ['projectName', 'StructureName', 'SourceName', 'alarmContent', '19', 'AlarmContent', 'createTime', 'updateTime'], |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -183,7 +183,7 @@ const DataAlarm = ({ match, dispatch, actions, user, loading, socket }) => { |
|
|
|
{ |
|
|
|
name: '项目名称', value: 'projectName', render: (_, r, index) => { |
|
|
|
return <> |
|
|
|
{r.projectName.map((v, index) => { |
|
|
|
{r.projectName?.map((v, index) => { |
|
|
|
let width |
|
|
|
let name = v |
|
|
|
switch (r.projectName?.length) { |
|
|
@ -201,24 +201,43 @@ const DataAlarm = ({ match, dispatch, actions, user, loading, socket }) => { |
|
|
|
{index > 0 ? <span style={{ width: 1, height: 12, border: '1px solid #DCDEE0', margin: '3px 8px', display: 'inline-block', }}></span> : ""} |
|
|
|
{OutHidden({ width, name })} |
|
|
|
</div>) |
|
|
|
|
|
|
|
})} |
|
|
|
{r.projectName?.length > 3 ? |
|
|
|
<Tooltip |
|
|
|
trigger="click" |
|
|
|
// style={{ lineHeight: 2 }} |
|
|
|
content={ |
|
|
|
<div style={{ display: 'flex', flexWrap: 'wrap' }}> |
|
|
|
{r.projectName?.map(vv => { |
|
|
|
return <div key={vv}> |
|
|
|
{vv}<span style={{ color: '#FFFFFF' }}>、</span> |
|
|
|
</div> |
|
|
|
})} |
|
|
|
</div>}> |
|
|
|
<span style={{ fontSize: 14, color: '#005ABD', marginLeft: 8, cursor: "pointer", }}> |
|
|
|
{'+' + (r.projectName?.length - 3)} |
|
|
|
</span> |
|
|
|
</Tooltip> : ""} |
|
|
|
</> |
|
|
|
} |
|
|
|
}, |
|
|
|
{ name: '结构物名称', value: '2' }, |
|
|
|
{ name: '告警源', value: '3' }, |
|
|
|
{ name: '中断类型', value: '4' }, |
|
|
|
{ name: '告警信息', value: '5' }, |
|
|
|
{ name: '常见原因', value: '6' }, |
|
|
|
{ name: '结构物名称', value: 'StructureName' }, |
|
|
|
{ name: '告警源', value: 'SourceName' }, |
|
|
|
{ name: '中断类型', value: 'AlarmGroupUnit' }, |
|
|
|
{ name: '告警信息', value: 'AlarmContent' }, |
|
|
|
{ name: '常见原因', value: 'AlarmCodeName' }, |
|
|
|
{ name: '产生时间', value: 'createTime' }, |
|
|
|
{ name: '更新时间', value: 'updateTime' }, |
|
|
|
{ name: '服务器地址', value: '9' }, |
|
|
|
{ name: '告警等级', value: '10' }, |
|
|
|
{ name: '产生次数', value: '11' }, |
|
|
|
{ |
|
|
|
name: '告警等级', value: 'CurrentLevel', render: (_, r, index) => { |
|
|
|
let data = { 1: '一级', 2: '二级', 3: '三级' } |
|
|
|
return data[r.CurrentLevel] |
|
|
|
} |
|
|
|
}, |
|
|
|
{ name: '产生次数', value: 'detailCount' }, |
|
|
|
{ name: '确认信息', value: 'confirm', render: (_, r, index) => r.confirm }, |
|
|
|
{ name: '确认/恢复时间', value: 'confirmTime', }, |
|
|
|
{ name: '项目阶段', value: '14' }, |
|
|
|
{ |
|
|
|
name: '异常信息', value: 'alarmContent', render: (_, r, index) => { |
|
|
|
return <>{r.alarmContent} |
|
|
@ -226,9 +245,16 @@ const DataAlarm = ({ match, dispatch, actions, user, loading, socket }) => { |
|
|
|
</> |
|
|
|
} |
|
|
|
}, |
|
|
|
{ name: '异常原因', value: '16' }, |
|
|
|
{ name: '策略类型', value: '17' }, |
|
|
|
{ name: '命中状态', value: '18' }, |
|
|
|
{ name: '异常原因', value: 'alarmType' }, |
|
|
|
{ name: '策略类型', value: 'Strategy' }, |
|
|
|
{ |
|
|
|
name: '命中状态', value: 'State', render: (_, r, index) => { |
|
|
|
if (r.State == 3 || r.State == 4) { |
|
|
|
return '历史' |
|
|
|
} |
|
|
|
return '当前' |
|
|
|
} |
|
|
|
}, |
|
|
|
{ name: '位置信息', value: '19' }, |
|
|
|
{ name: '设备类型', value: '20' }, |
|
|
|
{ name: '设备厂家', value: '21' }, |
|
|
@ -236,10 +262,7 @@ const DataAlarm = ({ match, dispatch, actions, user, loading, socket }) => { |
|
|
|
{ name: '应用名称', value: 'appName' }, |
|
|
|
{ name: 'URL地址', value: 'url' }, |
|
|
|
{ |
|
|
|
name: '异常类型', value: 'type', render: (_, r, index) => { |
|
|
|
let data = { element: '元素异常', apiError: '接口报错', timeout: '加载超时' } |
|
|
|
return data[r.type] |
|
|
|
} |
|
|
|
name: '异常类型', value: 'type' |
|
|
|
}, |
|
|
|
] |
|
|
|
|
|
|
@ -254,38 +277,43 @@ const DataAlarm = ({ match, dispatch, actions, user, loading, socket }) => { |
|
|
|
let setup = tableList[route].map(v => columnAll.find(vv => v == vv.value)) |
|
|
|
|
|
|
|
let data = [] |
|
|
|
if (tableType[route] == 'dataAbnormal') { |
|
|
|
data = ['6'] |
|
|
|
data.splice(1, 0, ...arr) |
|
|
|
} else { |
|
|
|
data.splice(1, 0, ...arr) |
|
|
|
} |
|
|
|
// if (tableType[route] == 'dataAbnormal') { |
|
|
|
// data = ['AlarmCodeName'] |
|
|
|
// data.splice(1, 0, ...arr) |
|
|
|
// } else { |
|
|
|
data.splice(1, 0, ...arr) |
|
|
|
// } |
|
|
|
|
|
|
|
|
|
|
|
// console.log(data) |
|
|
|
console.log(data) |
|
|
|
// let TableDisplay = [] |
|
|
|
|
|
|
|
let TableDisplay = data.map(v => { |
|
|
|
let datas = columnAll.find(vv => v == vv.value) |
|
|
|
let TableDisplay = data?.map(v => { |
|
|
|
let datas = columnAll?.find(vv => v == vv.value) |
|
|
|
if (datas) { |
|
|
|
return { title: datas.name, dataIndex: datas.value, rowKey: datas.value, render: datas.render } |
|
|
|
} |
|
|
|
|
|
|
|
}) |
|
|
|
console.log(TableDisplay); |
|
|
|
|
|
|
|
TableDisplay.push({ |
|
|
|
title: '操作', |
|
|
|
dataIndex: 'text', |
|
|
|
rowKey: 'text', |
|
|
|
render: (_, r) => { |
|
|
|
return <> |
|
|
|
return <div style={{ width: 190 }}> |
|
|
|
{r.confirmTime ? <Button theme='borderless' disabled>已确认</Button> : |
|
|
|
<Button theme='borderless' onClick={() => (setConfirm(true), setSelected([r.id]))}>确认</Button> |
|
|
|
} |
|
|
|
{route ? ['dataLnterrupt', 'dataAbnormal', 'strategyHit'].includes(route) ? |
|
|
|
{<Button theme='borderless' disabled>已派单</Button>} |
|
|
|
{route ? ['dataLnterrupt', 'dataAbnormal', 'strategyHit'].includes(route) ? <> |
|
|
|
<Button theme='borderless' disabled>已派单</Button> |
|
|
|
<Button theme='borderless' onClick={() => (setCheckPop(true))}>查看</Button> |
|
|
|
</> |
|
|
|
: "" : "" |
|
|
|
} |
|
|
|
</> |
|
|
|
</div> |
|
|
|
} |
|
|
|
}) |
|
|
|
// console.log(TableDisplay); |
|
|
@ -371,8 +399,24 @@ const DataAlarm = ({ match, dispatch, actions, user, loading, socket }) => { |
|
|
|
width={600} |
|
|
|
onCancel={() => setConfirm(false)} |
|
|
|
onOk={() => { |
|
|
|
dispatch(problem.postApiConfirm({ appAlarmId: selected, confirm: content })) |
|
|
|
setConfirm(false) |
|
|
|
if (route == 'useAbnormal') { |
|
|
|
dispatch(problem.postApiConfirm({ appAlarmId: selected, confirm: content })).then(res => { |
|
|
|
if (res.success) { |
|
|
|
setConfirm(false) |
|
|
|
setQuery({ limit: query.limit, page: query.page }) |
|
|
|
} |
|
|
|
|
|
|
|
}) |
|
|
|
} else if (route == 'videoAbnormal') { |
|
|
|
setConfirm(false) |
|
|
|
} else { |
|
|
|
dispatch(problem.putAlarmdataConfirm({ alarmId: selected, content: content })).then(res => { |
|
|
|
if (res.success) { |
|
|
|
setConfirm(false) |
|
|
|
setQuery({ limit: query.limit, page: query.page }) |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
}} |
|
|
|
> |
|
|
|
<div style={{ display: 'flex', paddingLeft: 20 }}> |
|
|
|