Browse Source

视频数据调试

dev
wenlele 2 years ago
parent
commit
1e6759dc27
  1. 14
      web/client/src/sections/problem/actions/problem.jsx
  2. 2
      web/client/src/sections/problem/components/inspection.jsx
  3. 80
      web/client/src/sections/problem/components/tableData.jsx
  4. 95
      web/client/src/sections/problem/containers/dataAlarm.jsx

14
web/client/src/sections/problem/actions/problem.jsx

@ -146,4 +146,16 @@ export function getAlarmVideoDeviceKind () { //查询视频设备类型
msg: { option: '查询视频设备类型' },
reducer: { name: '' }
});
}
}
// export function putAlarmdataConfirm (data) { //
// return dispatch => basicAction({
// type: 'put',
// dispatch: dispatch,
// data,
// actionType: 'PUT-AIARM-DATA-CONFIRM',
// url: `${ApiTable.putAlarmdataConfirm}`,
// msg: { option: '' },
// reducer: { name: '' }
// });
// }

2
web/client/src/sections/problem/components/inspection.jsx

@ -25,7 +25,7 @@ const Inspection = ({ dispatch, actions, user, route, statistic }) => {
const api = useRef();
const unfoldApi = useRef(false);
// console.log(actions);
// console.log(pictureData);
useEffect(() => {

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

@ -16,12 +16,12 @@ const TableData = ({ route, dispatch, actions, collectData, setSetup, exhibition
const [search, setSearch] = useState({}) //
const [checkAll, setCheckAll] = useState(true) //
const api = useRef();
let title = { dataLnterrupt: "数据中断详情", dataAbnormal: "数据异常详情", strategyHit: "策略命中详情", ideoAbnormal: "视频异常详情", useAbnormal: "应用异常详情", deviceAbnormal: "设备异常详情" }
let title = { dataLnterrupt: "数据中断详情", dataAbnormal: "数据异常详情", strategyHit: "策略命中详情", videoAbnormal: "视频异常详情", useAbnormal: "应用异常详情", deviceAbnormal: "设备异常详情" }
useEffect(() => {
switch (route) {
case 'useAbnormal':
dispatch(problem.getAlarmLnspectionApi({})).then((res) => {
dispatch(problem.getAlarmLnspectionApi({ ...search, pepProjectId: '' })).then((res) => {
console.log(res.payload.data)
if (res.success) {
let typeData = { element: "元素异常", apiError: "接口报错 ", timeout: "加载超时" }
@ -29,7 +29,7 @@ const TableData = ({ route, dispatch, actions, collectData, setSetup, exhibition
let tableDatas = res.payload.data?.rows.map(v => ({
key: v.id,
// serialNumber: v.serialNumber,
projectName: v.app?.projectCorrelations?.map(r => (r.name ? { name: r.name, state: '自定义' } : {
projectName: v.app?.projectCorrelations?.map(r => (r.name ? { name: r.name, state: 'PMOS' } : {
name: r.pepProject?.project_name, state: r.pepProject?.construction_status
}))?.filter(c => c),
appName: v.app?.name,
@ -42,7 +42,7 @@ const TableData = ({ route, dispatch, actions, collectData, setSetup, exhibition
type: v.type ? typeData[v.type] : "",
confirm: v.confirm,
}))
console.log(tableDatas);
// console.log(tableDatas);
setTableData(tableDatas)
}
})
@ -53,23 +53,28 @@ const TableData = ({ route, dispatch, actions, collectData, setSetup, exhibition
console.log(res);
let tableDatas = res.payload.data?.map(v => ({
key: v.alarmId,
// StructureName: v.StructureName,
StructureName: v.struc,
// projectName: v.pomsProject?.map(r => (r.name ? { name: r.name, state: 'PMOS' } : {
// name: r.pepProject?.projectName, state: r.pepProject?.constructionStatus
// }))?.filter(c => c),
createTime: v.createTime ? moment(v.createTime).format("YYYY-MM-DD HH:mm:ss") : "",
updateTime: v.updateTime ? moment(v.updateTime).format("YYYY-MM-DD HH:mm:ss") : "",
confirmTime: v.confirmTime ? moment(v.confirmTime).format("YYYY-MM-DD HH:mm:ss") : "",
// SourceName: v.SourceName,
createTime: v.createTime ? moment(v.createTime).format("YYYY-MM-DD HH:mm:ss") : "",
updateTime: v.updateTime ? moment(v.updateTime).format("YYYY-MM-DD HH:mm:ss") : "",
confirmTime: v.confirmTime ? moment(v.confirmTime).format("YYYY-MM-DD HH:mm:ss") : "",
SourceName: v.cameraName,
// AlarmGroupUnit: v.AlarmGroupUnit ? genreData.find(r => r.value == v.AlarmGroupUnit)?.name : "",
// Strategy: v.AlarmGroupUnit ? genreData.find(r => r.value == v.AlarmGroupUnit)?.name : "",
// type: v.AlarmGroupUnit ? genreData.find(r => r.value == v.AlarmGroupUnit)?.name : "",
// AlarmCodeName: v.AlarmCodeName,
// CurrentLevel: v.CurrentLevel,
// detailCount: v.detailCount,
// AlarmContent: v.AlarmContent,
AlarmContent: v.statusDescribe,
// State: v.State,
// alarmType: v.alarmType,
station: v.station,
resolve: v.resolve,
cameraChannelNo: v.cameraChannelNo,
cameraSerialNo: v.cameraSerialNo,
cameraKindId: v.cameraKindId,
venderName: v.venderName,
platform: v.platform,
confirm: v.confirmedContent,
camerOnline: v.camerOnline,
@ -116,7 +121,7 @@ const TableData = ({ route, dispatch, actions, collectData, setSetup, exhibition
name: r.pepProject?.projectName, state: r.pepProject?.constructionStatus
}))?.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") : "",
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.value == v.AlarmGroupUnit)?.name : "",
@ -143,7 +148,7 @@ const TableData = ({ route, dispatch, actions, collectData, setSetup, exhibition
}, [query, search])
// console.log(query);
// console.log(tableData.slice(query.page * query.limit, (query.page + 1) * query.limit));
return (
<>
@ -168,14 +173,25 @@ const TableData = ({ route, dispatch, actions, collectData, setSetup, exhibition
let frame = []
collectData[route]?.map((v, index) => {
if (index == 0) {
frame.push(<Form.InputGroup key={v.field} label={v.name + ':'} labelPosition="left" style={{ width: 203, marginRight: 16, marginBottom: 16 }}>
<Form.Select style={{ width: 88 }} field='keywordTarget' initValue='source' rules={[{ required: true, message: '请选择筛选类型' }]} showClear>
{[{ name: "告警源", value: "source" }, { name: "项目", value: "pepProject" }, { name: "结构物", value: "struc" },].map(vv => {
return <Form.Select.Option value={vv.value} key={vv.value}>{vv.name}</Form.Select.Option>
})}
</Form.Select>
<Form.Input field='keyword' maxLength="16" placeholder="关键字搜索" style={{ width: 115 }} />
</Form.InputGroup>)
if (route == 'useAbnormal') {
frame.push(<Form.Input
label={v.name + ':'}
labelPosition="left"
field={v.field}
placeholder="项目或应用关键字"
showClear
style={{ width: 115, marginRight: 16, marginBottom: 16 }} />)
} else {
frame.push(<Form.InputGroup key={v.field} label={v.name + ':'} labelPosition="left" style={{ width: 203, marginRight: 16, marginBottom: 16 }}>
<Form.Select style={{ width: 88 }} field='keywordTarget' initValue='source' rules={[{ required: true, message: '请选择筛选类型' }]} showClear>
{[{ name: "告警源", value: "source" }, { name: "项目", value: "pepProject" }, { name: "结构物", value: "struc" },].map(vv => {
return <Form.Select.Option value={vv.value} key={vv.value}>{vv.name}</Form.Select.Option>
})}
</Form.Select>
<Form.Input field='keyword' maxLength="16" placeholder="关键字搜索" style={{ width: 115 }} />
</Form.InputGroup>)
}
} else {
frame.push(<Form.Select
label={v.name + ':'}
@ -238,12 +254,14 @@ const TableData = ({ route, dispatch, actions, collectData, setSetup, exhibition
// sustainTimeStart: v.time ? moment(v.time[0]).format("YYYY-MM-DD HH:mm:ss") : "",
// sustainTimeEnd: v.time ? moment(v.time[1]).format("YYYY-MM-DD HH:mm:ss") : "",
// });
console.log(v.time);
console.log(v);
setSearch({
state: v.state,
keywordTarget: v.keywordTarget,
keyword: v.keyword,
groupUnitId: v.groupUnitId,
errType: v.errType,
confirmState: v.confirmState,
sustainTimeStart: v.time && v.time.length > 0 ? moment(v.time[0]).format("YYYY-MM-DD HH:mm:ss") : "",
sustainTimeEnd: v.time && v.time.length > 0 ? moment(v.time[1]).format("YYYY-MM-DD HH:mm:ss") : "",
});
@ -264,7 +282,7 @@ const TableData = ({ route, dispatch, actions, collectData, setSetup, exhibition
>
<Table
columns={exhibition}
dataSource={tableData}
dataSource={route == 'useAbnormal' ? tableData.slice(query.page * query.limit, (query.page + 1) * query.limit) || [] : tableData}
// dataSource={[{ key: '1' }]}
bordered={false}
empty="暂无数据"
@ -305,9 +323,15 @@ const TableData = ({ route, dispatch, actions, collectData, setSetup, exhibition
<div style={{ display: 'inline-block', lineHeight: '30px', fontSize: 13 }}>勾选<span style={{ fontWeight: 400, color: '#0F7EFB', margin: '0 6px' }}>{selected.length}</span>问题</div>
<Button onClick={() => {
if (checkAll) {
setSelected(tableData?.map(v => {
if (!(v.State > 2)) {
return v.key
setSelected((route == 'useAbnormal' ? tableData.slice(query.page * query.limit, (query.page + 1) * query.limit) || [] : tableData)?.map(v => {
if (['videoAbnormal', 'useAbnormal'].includes(route)) {
if (!v.confirmTime) {
return v.key
}
} else {
if (!(v.State > 2)) {
return v.key
}
}
})?.filter(v => v))
} else {
@ -322,11 +346,11 @@ const TableData = ({ route, dispatch, actions, collectData, setSetup, exhibition
</div>
{count > 0 ? <div style={{ display: 'flex', }}>
<span style={{ lineHeight: "30px", fontSize: 13 }}>
{count}个问题
{route == 'useAbnormal' ? tableData.length : count}个问题
</span>
<Pagination
className="22"
total={count}
total={route == 'useAbnormal' ? tableData.length : count}
showSizeChanger
currentPage={(query?.page || 0) + 1}
pageSizeOpts={[10, 20, 30, 40]}

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

@ -57,6 +57,7 @@ const DataAlarm = ({ match, dispatch, actions, user, loading, socket }) => {
attribute(tableType[route], route);
}, [])
// console.log(selected);
//
const collectData = {
@ -109,19 +110,19 @@ const DataAlarm = ({ match, dispatch, actions, user, loading, socket }) => {
{ name: '历史', value: 'histroy' }]
}],
useAbnormal: [ // (useAbnormal)
{ name: '搜索', field: 'errType' },
{ name: '搜索', field: 'keyword' },
{
name: '异常类型', field: '2',
name: '异常类型', field: 'errType',
data: [
{ name: '接口报错', value: 'apiError ' },
{ name: '加载超时', value: 'timeout' },
{ name: '元素异常', value: 'element' }]
},
{
name: '异常状态', field: '3',
name: '异常状态', field: 'confirmState',
data: [
{ name: '当前', value: '11' },
{ name: '历史', value: '22' }]
{ name: '当前', value: 'unconfirmed' },
{ name: '历史', value: 'confirmd' }]
}],
deviceAbnormal: [ // (deviceAbnormal)
{ name: '搜索', field: '1' },
@ -151,18 +152,18 @@ const DataAlarm = ({ match, dispatch, actions, user, loading, socket }) => {
dataLnterrupt: ['index', 'projectName', 'StructureName', 'SourceName', 'AlarmGroupUnit', 'AlarmCodeName', 'sustainTime', 'createTime', 'AlarmContent', 'CurrentLevel', 'updateTime', 'detailCount', 'confirm', 'confirmTime',],
dataAbnormal: ['index', 'projectName', 'StructureName', 'SourceName', 'type', 'alarmType', 'createTime', 'sustainTime', 'AlarmContent', 'CurrentLevel', 'updateTime', 'detailCount', 'confirm', 'confirmTime'],
strategyHit: ['index', 'projectName', 'StructureName', 'SourceName', 'Strategy', 'State', 'createTime', 'sustainTime', 'AlarmContent', 'CurrentLevel', 'updateTime', 'detailCount', 'confirm', 'confirmTime'],
videoAbnormal: ['index', 'projectName', 'StructureName', 'SourceName', '19', '20', '21', 'platform', 'AlarmContent', '111', 'createTime', 'updateTime', 'confirm', 'confirmTime', 'camerOnline'],
videoAbnormal: ['index', 'projectName', 'StructureName', 'SourceName', 'station', 'cameraKindId', 'venderName', 'cameraSerialNo', 'cameraChannelNo', 'platform', 'AlarmContent', 'resolve', 'createTime', 'updateTime', 'confirm', 'confirmTime', 'camerOnline'],
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'],
deviceAbnormal: ['index', 'projectName', 'StructureName', 'SourceName', 'station', 'alarmContent', 'venderName', 'AlarmContent', 'AlarmCodeName', 'createTime', 'updateTime', 'confirm', 'confirmTime'],
}
//
const columns = {
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'],
videoAbnormal: ['projectName', 'StructureName', 'SourceName', 'venderName', 'cameraKindId', 'AlarmContent', 'createTime', 'updateTime'],
useAbnormal: ['appName', 'projectName', 'url', 'type', 'alarmContent', 'createTime', 'updateTime'],
deviceAbnormal: ['projectName', 'StructureName', 'SourceName', 'alarmContent', '19', 'AlarmContent', 'createTime', 'updateTime'],
deviceAbnormal: ['projectName', 'StructureName', 'SourceName', 'alarmContent', 'station', 'AlarmContent', 'createTime', 'updateTime'],
}
@ -198,7 +199,15 @@ const DataAlarm = ({ match, dispatch, actions, user, loading, socket }) => {
</>
}
},
{ name: '结构物名称', sort: 4, value: 'StructureName' },
{
name: '结构物名称', sort: 4, value: 'StructureName', render: (_, r, index) => {
if (route == 'videoAbnormal') {
return r.StructureName?.map((v, index) => <div key={v.name + v.id} style={{ lineHeight: "22px" }}>{v.name}</div>)
} else {
return r.StructureName
}
}
},
{
name: '告警源', sort: 2, value: 'SourceName', render: (_, r, index) => {
let data = ''
@ -206,17 +215,17 @@ const DataAlarm = ({ match, dispatch, actions, user, loading, socket }) => {
data = '传感器'
}
if (route == 'strategyHit') data = '测点'
return r.SourceName ? <div style={{ width: 136, display: 'flex', justifyContent: 'space-between' }}>
return r.SourceName ? <div style={{ width: data ? 136 : 84, display: 'flex', justifyContent: 'space-between' }}>
<div style={{ display: "inline-block", width: 84, lineHeight: "20px" }}>{r.SourceName}</div>
<div style={{ display: "inline-block", width: 44, height: 18, lineHeight: '18px', textAlign: "center", border: '1px solid #0F7EFB', fontWeight: 400, color: '#0F7EFB', fontSize: 12 }}>{data}</div>
{data ? <div style={{ display: "inline-block", width: 44, height: 18, lineHeight: '18px', textAlign: "center", border: '1px solid #0F7EFB', fontWeight: 400, color: '#0F7EFB', fontSize: 12 }}>{data}</div> : ""}
</div> : ""
}
},
{ name: '中断类型', sort: 6, value: 'AlarmGroupUnit' },
{ name: '告警信息', sort: 5, value: 'AlarmContent' },
{ name: '常见原因', sort: 7, value: 'AlarmCodeName' },
{ name: '产生时间', sort: 22, value: 'createTime' },
{ name: '更新时间', sort: 23, value: 'updateTime' },
{ name: '产生时间', sort: 22, value: 'createTime', render: (_, r, index) => r.createTime || '无' },
{ name: '更新时间', sort: 23, value: 'updateTime', render: (_, r, index) => r.updateTime || '无' },
{ name: '服务器地址', sort: 12, value: '9' },
{
name: '告警等级', sort: 13, value: 'CurrentLevel', render: (_, r, index) => {
@ -230,13 +239,13 @@ const DataAlarm = ({ match, dispatch, actions, user, loading, socket }) => {
{ name: '产生次数', sort: 19, value: 'detailCount', render: (_, r, index) => r.detailCount + '次' },
{
name: '确认信息', sort: 20, value: 'confirm', render: (_, r, index) => {
return r.State == 3 ? '无' : r.State == 4 ? r.confirm : '未确认'
return r.State == 3 ? '无' : r.State == 4 ? r.confirm : r.confirm || '未确认'
}
},
{ name: '确认/恢复时间', sort: 21, value: 'confirmTime', render: (_, r, index) => r.confirmTime ? r.confirmTime : "无" },
{
name: '持续时间', sort: 19.5, value: 'sustainTime', render: (_, r, index) => {
console.log(r.updateTime);
// console.log(r.updateTime);
let time = moment(r.updateTime).diff(moment(r.createTime), 'seconds')
// console.log(time);
return time < 60 ? '< 1分钟' : time > 3600 ? Math.floor(time / 3600) + '小时' + Math.floor((time - Math.floor(time / 3600) * 3600) / 60) + '分钟' : Math.floor((time - Math.floor(time / 3600) * 3600) / 60) + '分钟'
@ -259,9 +268,15 @@ const DataAlarm = ({ match, dispatch, actions, user, loading, socket }) => {
return '当前'
}
},
{ name: '位置信息', sort: 11, value: '19' },
{ name: '设备类型', sort: 6, value: '20' },
{ name: '设备厂家', sort: 10, value: '21' },
{ name: '位置信息', sort: 11, value: 'station', render: (_, r, index) => r.station?.map(v => <div key={v.resolve + v.id} style={{ lineHeight: "22px" }}>{v.position}</div>) },
{
name: '设备类型', sort: 6, value: 'cameraKindId', render: (_, r, index) => {
}
},
{ name: '设备厂家', sort: 10, value: 'venderName', render: (_, r, index) => r.platform ? '未知' : r.venderName },
{ name: '通道号', sort: 10.1, value: 'cameraChannelNo' },
{ name: '系列号', sort: 10.2, value: 'cameraSerialNo' },
{
name: '接入方式', sort: 9, value: 'platform', render: (_, r, index) => {
let accessType = { yingshi: "萤石云", nvr: "NVR", ipc: "IPC", cascade: "级联" }
@ -271,28 +286,34 @@ const DataAlarm = ({ match, dispatch, actions, user, loading, socket }) => {
{ name: '应用名称', sort: 2, value: 'appName' },
{ name: 'URL地址', sort: 16, value: 'url' },
{ name: '异常类型', sort: 6, value: 'type' },
{ name: '解决方案', sort: 17, value: '111' },
{ name: '解决方案', sort: 17, value: 'resolve', render: (_, r, index) => r.resolve?.map(v => <div key={v.resolve + v.id} style={{ lineHeight: "22px" }}>{v.resolve}</div>) },
{ name: '在离线', sort: 18, value: 'camerOnline' },
{
name: '操作', sort: 25, value: 'text', render: (_, r, index) => {
return <div style={{ width: 195 }}>
{r.State || r.State == 0 ? r.State >= 0 && r.State < 3 ?
{r.State && r.State >= 0 && r.State < 3 || route && ['videoAbnormal', 'useAbnormal'].includes(route) && !r.confirmTime ?
<Button theme='borderless' style={{ width: 65 }} onClick={() => {
setConfirm(true)
setSelected([r.key])
}}>确认</Button>
: r.State == 3 ?
<Button theme='borderless' style={{ width: 65 }} disabled>自动恢复</Button> :
<Button theme='borderless' style={{ width: 65 }} disabled>已确认</Button> : ""
<Button theme='borderless' style={{ width: 65 }} disabled>已确认</Button>
}
{route ? ['dataLnterrupt', 'dataAbnormal', 'strategyHit'].includes(route) ? <>
{route && ['dataLnterrupt', 'dataAbnormal', 'strategyHit'].includes(route) ? <>
<Button theme='borderless' style={{ width: 65 }} disabled>已派单</Button>
<Button theme='borderless' style={{ width: 65 }} onClick={() => {
setCheckPop(true)
setAlarmId(r.key)
}}>查看</Button>
</>
: "" : ""
: route == 'videoAbnormal' ? <>
<Button theme='borderless' style={{ width: 65 }} disabled>已派单</Button>
<Button theme='borderless' style={{ width: 65 }} onClick={() => {
// setCheckPop(true)
// setAlarmId(r.key)
}}>播放</Button>
</> : ""
}
</div>
}
@ -352,7 +373,7 @@ const DataAlarm = ({ match, dispatch, actions, user, loading, socket }) => {
return (
route=='dataLnterrupt'|| route=='dataAbnormal'|| route=='strategyHit'?
// route=='dataLnterrupt'|| route=='dataAbnormal'|| route=='strategyHit'?
<div style={{ minWidth: 1000 }}>
{/* 滞留提醒 */}
<div>
@ -412,15 +433,23 @@ const DataAlarm = ({ match, dispatch, actions, user, loading, socket }) => {
onOk={() => {
if (route == 'useAbnormal') {
dispatch(problem.postApiConfirm({ appAlarmId: selected, confirm: content })).then(res => {
if (res.success) {
setConfirm(false)
setQuery({ limit: query.limit, page: query.page })
}
TextAreaApi.current.validate().then((v) => {
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)
TextAreaApi.current.validate().then((v) => {
dispatch(problem.postApiConfirm({ appAlarmId: selected, confirm: content })).then(res => {
if (res.success) {
setConfirm(false)
setQuery({ limit: query.limit, page: query.page })
}
})
})
} else {
TextAreaApi.current.validate().then((v) => {
dispatch(problem.putAlarmdataConfirm({ alarmId: selected, content: content })).then(res => {
@ -466,7 +495,7 @@ const DataAlarm = ({ match, dispatch, actions, user, loading, socket }) => {
/> : ""
}
</div>
:<Set />
// :<Set />
)
}

Loading…
Cancel
Save