Browse Source

BUG修改

dev
wenlele 2 years ago
parent
commit
23ae9981f6
  1. 146
      web/client/src/sections/problem/components/sideSheet.jsx
  2. 7
      web/client/src/sections/problem/components/tableData.jsx
  3. 30
      web/client/src/sections/problem/containers/dataAlarm.jsx

146
web/client/src/sections/problem/components/sideSheet.jsx

@ -8,7 +8,7 @@ import ReactECharts from 'echarts-for-react';
let projectScrollbar;
function SideSheets ({ dispatch, actions, close }) {
function SideSheets ({ dispatch, actions, close, alarmId }) {
const { problem } = actions;
const [clickStyle, setclickStyle] = useState();
@ -19,72 +19,75 @@ function SideSheets ({ dispatch, actions, close }) {
useEffect(() => {
dispatch(problem.getAlarmDataDetail({ alarmId: "fa7fd145-f251-3657-8176-8f8f04a92a96" })).then((res) => {
if (res?.success) {
console.log(res.payload.data);
setdataSource(res.payload.data);
projectScrollbar = new PerfectScrollbar("#Alarm", {
suppressScrollX: true,
});
}
});
dispatch(problem.getAlarmDataDetailAgg({ alarmId: "fa7fd145-f251-3657-8176-8f8f04a92a96" })).then((res) => {
if (res?.success) {
let dataSort = res.payload.data || []
console.log(dataSort);
// moment.duration(videoAfter?.diff(videoFront))._data.milliseconds;
dataSort.sort((a, b) => {
if (moment(a.hours).isBefore(b.hours)) {
return -1
} else {
return 1
}
})
console.log(dataSort);
let data = {
dataZoom: [
{
show: true,
type: 'inside',
filterMode: 'none',
xAxisIndex: [0],
},
{
show: true,
type: 'inside',
filterMode: 'none',
yAxisIndex: [0],
}
],
tooltip: {
trigger: 'axis'
},
xAxis: {
type: 'category',
name: "时间",
data: dataSort.map(v => v.hours)
},
yAxis: {
type: 'value',
name: "次数",
},
series: [
{
data: dataSort.map(v => v.count),
type: 'line',
name: '次数',
// markLine: {
// data: [{ type: 'average', name: 'Avg' }]
// }
if (alarmId) {
dispatch(problem.getAlarmDataDetail({ alarmId: alarmId })).then((res) => {
if (res?.success) {
console.log(res.payload.data);
setdataSource(res.payload.data);
projectScrollbar = new PerfectScrollbar("#Alarm", {
suppressScrollX: true,
});
}
});
dispatch(problem.getAlarmDataDetailAgg({ alarmId: alarmId })).then((res) => {
if (res?.success) {
let dataSort = res.payload.data || []
// console.log(dataSort);
// moment.duration(videoAfter?.diff(videoFront))._data.milliseconds;
dataSort.sort((a, b) => {
if (moment(a.hours).isBefore(b.hours)) {
return -1
} else {
return 1
}
]
})
// console.log(dataSort);
let data = {
dataZoom: [
{
show: true,
type: 'inside',
filterMode: 'none',
xAxisIndex: [0],
},
{
show: true,
type: 'inside',
filterMode: 'none',
yAxisIndex: [0],
}
],
tooltip: {
trigger: 'axis'
},
xAxis: {
type: 'category',
name: "时间",
data: dataSort.map(v => v.hours)
},
yAxis: {
type: 'value',
name: "次数",
},
series: [
{
data: dataSort.map(v => v.count),
type: 'line',
name: '次数',
// markLine: {
// data: [{ type: 'average', name: 'Avg' }]
// }
}
]
}
// console.log(data);
setOption(data)
// setNvrDetails(res.payload.data);
}
console.log(data);
setOption(data)
// setNvrDetails(res.payload.data);
}
});
});
}
}, []);
@ -102,7 +105,7 @@ function SideSheets ({ dispatch, actions, close }) {
rowKey: 'AlarmState',
render: (_, r, index) => {
let data = { 0: '首次产生', 1: '持续产生', 2: '等级提升', 3: '自动恢复', 4: '人工恢复' }
return data[r.AlarmState]
return data[r.AlarmState] || ''
},
}, {
title: "告警信息",
@ -114,13 +117,13 @@ function SideSheets ({ dispatch, actions, close }) {
rowKey: 'CurrentLevel',
render: (_, r, index) => {
let data = { 1: '一级', 2: '二级', 3: '三级' }
return data[r.CurrentLevel]
return data[r.CurrentLevel] || ""
},
}, {
title: "产生时间",
dataIndex: "Time",
rowKey: 'Time',
render: (_, r, index) => r.Time?moment(r.Time).format("YYYY-MM-DD HH:mm:ss"):""
render: (_, r, index) => r.Time ? moment(r.Time).format("YYYY-MM-DD HH:mm:ss") : ""
},
]
@ -152,7 +155,7 @@ function SideSheets ({ dispatch, actions, close }) {
}
}}
/>
<div style={{ display: 'flex', alignItems: 'flex-end', justifyContent: 'flex-end', marginTop: 16 }}>
{dataSource?.length > 0 ? <div style={{ display: 'flex', alignItems: 'flex-end', justifyContent: 'flex-end', marginTop: 16 }}>
<span style={{ lineHeight: "30px", fontSize: 13 }}>
{dataSource?.length || 0}条告警
</span>
@ -167,7 +170,7 @@ function SideSheets ({ dispatch, actions, close }) {
setQuery({ pageSize: pageSize, page: currentPage });
}}
/>
</div>
</div> : ""}
<ReactECharts
option={option}
notMerge={true}
@ -182,9 +185,10 @@ function SideSheets ({ dispatch, actions, close }) {
</TabPane>
<TabPane tab="工单信息" itemKey="2">
<div>开发中敬请期待</div>
</TabPane>
</Tabs>
</SideSheet>
</SideSheet >
);
}

7
web/client/src/sections/problem/components/tableData.jsx

@ -67,7 +67,7 @@ const TableData = ({ route, dispatch, actions, collectData, setSetup, exhibition
// console.log(genreData);
setGenre(genreData)
if (data && data[0]?.id) {
dispatch(problem.getAlarmDataList({ ...query, ...search, groupId: '', pepProjectId: '' })).then((res) => {
dispatch(problem.getAlarmDataList({ ...query, ...search, groupId: data.map(v => v.id).join(), pepProjectId: '' })).then((res) => {
console.log(res);
if (res.success) {
setCount(res.payload.data?.count || 0)
@ -75,13 +75,12 @@ const TableData = ({ route, dispatch, actions, collectData, setSetup, exhibition
key: v.AlarmId,
StructureName: v.StructureName,
projectName: v.pepProject?.map(r => r.projectName)?.filter(c => c),
createTime: v.StartTime ? moment(v.StartTime).format("YYYY-MM-DD HH:mm:ss") : "",
updateTime: v.EndTime ? moment(v.EndTime).format("YYYY-MM-DD HH:mm:ss") : "",
confirmTime: v.confirmedTime ? moment(v.confirmedTime).format("YYYY-MM-DD HH:mm:ss") : "",
SourceName: v.SourceName,
AlarmGroupUnit: v.AlarmGroupUnit ? genreData.find(r => r.id == v.AlarmGroupUnit)?.name : "",
Strategy: v.AlarmGroupUnit ? genreData.find(r => r.id == v.AlarmGroupUnit)?.name : "",
Strategy: v.AlarmGroupUnit ? genreData[0]?.unit?.find(r => r.id == v.AlarmGroupUnit)?.name : "",
type: v.AlarmGroupUnit ? genreData.find(r => r.id == v.AlarmGroupUnit)?.name : "",
AlarmCodeName: v.AlarmCodeName,
CurrentLevel: v.CurrentLevel,
@ -267,7 +266,7 @@ const TableData = ({ route, dispatch, actions, collectData, setSetup, exhibition
}
setCheckAll(!checkAll)
}}
style={{ width: 93, height: 24, borderRadius: '1px', border: '1px solid #0F7EFB', color: '#0F7EFB',background:"#FFFFFF", fontWeight: 400, margin: '0 10px' }}>
style={{ width: 93, height: 24, borderRadius: '1px', border: '1px solid #0F7EFB', color: '#0F7EFB', background: "#FFFFFF", fontWeight: 400, margin: '0 10px' }}>
{checkAll ? '全选' : "取消全选"}
</Button>
<Button type='primary' theme='solid' onClick={() => (setIfBulk(true), setConfirm(true))} style={{ width: 93, height: 24, borderRadius: '1px', border: '1px solid #0F7EFB', color: '#FFFFFF', fontWeight: 400, }}>批量确认</Button>

30
web/client/src/sections/problem/containers/dataAlarm.jsx

@ -37,7 +37,6 @@ const DataAlarm = ({ match, dispatch, actions, user, loading, socket }) => {
if (route) {
//
let data = columns[route]
data.splice(0, 1)
localStorage.getItem(tableType[route]) == null
? localStorage.setItem(
tableType[route],
@ -145,7 +144,7 @@ const DataAlarm = ({ match, dispatch, actions, user, loading, socket }) => {
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', '111', 'createTime', 'updateTime', 'confirm', 'confirmTime','56115'],
videoAbnormal: ['index', 'projectName', 'StructureName', 'SourceName', '19', '20', '21', '22', 'AlarmContent', '111', 'createTime', 'updateTime', 'confirm', 'confirmTime', '56115'],
useAbnormal: ['index', 'projectName', 'appName', 'url', 'type', 'alarmContent', 'createTime', 'updateTime', 'confirm', 'confirmTime'],
deviceAbnormal: ['index', 'projectName', 'StructureName', 'SourceName', '19', 'alarmContent', '21', 'AlarmContent', 'AlarmCodeName', 'createTime', 'updateTime', 'confirm', 'confirmTime'],
}
@ -211,7 +210,18 @@ const DataAlarm = ({ match, dispatch, actions, user, loading, socket }) => {
}
},
{ name: '结构物名称', value: 'StructureName' },
{ name: '告警源', value: 'SourceName' },
{
name: '告警源', value: 'SourceName', render: (_, r, index) => {
// let data = ''
// if (route == 'dataLnterrupt' || route == 'dataAbnormal') {
// data = ''
// }
// if (route == 'strategyHit') data = ''
return <>
{/* <div style={{ width: 44, lineHeight: '18px', textAlign: "center", border: '1px solid #0F7EFB', fontWeight: 400, color: '#0F7EFB', fontSize: 12 }}>{data}</div> */}
{r.SourceName}</>
}
},
{ name: '中断类型', value: 'AlarmGroupUnit' },
{ name: '告警信息', value: 'AlarmContent' },
{ name: '常见原因', value: 'AlarmCodeName' },
@ -224,7 +234,7 @@ const DataAlarm = ({ match, dispatch, actions, user, loading, socket }) => {
return data[r.CurrentLevel]
}
},
{ name: '产生次数', value: 'detailCount' },
{ name: '产生次数', value: 'detailCount', render: (_, r, index) => r.detailCount + '次' },
{ name: '确认信息', value: 'confirm', render: (_, r, index) => r.confirm },
{ name: '确认/恢复时间', value: 'confirmTime', },
{
@ -250,9 +260,9 @@ const DataAlarm = ({ match, dispatch, actions, user, loading, socket }) => {
{ name: '接入方式', value: '22' },
{ name: '应用名称', value: 'appName' },
{ name: 'URL地址', value: 'url' },
{name: '异常类型', value: 'type'},
{name: '解决方案', value: '111'},
{name: '在离线', value: '56115'},
{ name: '异常类型', value: 'type' },
{ name: '解决方案', value: '111' },
{ name: '在离线', value: '56115' },
]
@ -297,7 +307,10 @@ const DataAlarm = ({ match, dispatch, actions, user, loading, socket }) => {
}
{route ? ['dataLnterrupt', 'dataAbnormal', 'strategyHit'].includes(route) ? <>
<Button theme='borderless' disabled>已派单</Button>
<Button theme='borderless' onClick={() => (setCheckPop(true))}>查看</Button>
<Button theme='borderless' onClick={() => {
setCheckPop(true)
setAlarmId(r.key)
}}>查看</Button>
</>
: "" : ""
}
@ -415,6 +428,7 @@ const DataAlarm = ({ match, dispatch, actions, user, loading, socket }) => {
{checkPop ?
<SideSheets
alarmId={alarmId}
close={() => {
setCheckPop(false)
}}

Loading…
Cancel
Save