From 54ce19742bc21c657ae91f58fd7b2e222364e4e2 Mon Sep 17 00:00:00 2001 From: wenlele Date: Fri, 30 Sep 2022 17:20:27 +0800 Subject: [PATCH] =?UTF-8?q?=E8=87=AA=E5=8A=A8=E6=81=A2=E5=A4=8D=E5=B1=95?= =?UTF-8?q?=E7=A4=BA=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sections/problem/components/tableData.jsx | 60 ++++++++++--------- .../sections/problem/containers/dataAlarm.jsx | 19 ++++-- 2 files changed, 46 insertions(+), 33 deletions(-) diff --git a/web/client/src/sections/problem/components/tableData.jsx b/web/client/src/sections/problem/components/tableData.jsx index 030707a..1fb0a3e 100644 --- a/web/client/src/sections/problem/components/tableData.jsx +++ b/web/client/src/sections/problem/components/tableData.jsx @@ -21,31 +21,31 @@ const TableData = ({ route, dispatch, actions, collectData, setSetup, exhibition useEffect(() => { switch (route) { case 'useAbnormal': - // dispatch(problem.getAlarmLnspectionApi({})).then((res) => { - // console.log(res.payload.data) - // if (res.success) { - // let typeData = { element: "元素异常", apiError: "接口报错 ", timeout: "加载超时" } - // setCount(res.payload.data?.count || 0) - // 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: '自定义' } : { - // name: r.pepProject?.project_name, state: r.pepProject?.construction_status - // }))?.filter(c => c), - // appName: v.app?.name, - // url: v.app?.url, - // 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") : "", - // alarmContent: v.alarmContent, - // screenshot: v.screenshot, - // type: v.type ? typeData[v.type] : "", - // confirm: v.confirm, - // })) - // console.log(tableDatas); - // setTableData(tableDatas) - // } - // }) + dispatch(problem.getAlarmLnspectionApi({})).then((res) => { + console.log(res.payload.data) + if (res.success) { + let typeData = { element: "元素异常", apiError: "接口报错 ", timeout: "加载超时" } + setCount(res.payload.data?.count || 0) + 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: '自定义' } : { + name: r.pepProject?.project_name, state: r.pepProject?.construction_status + }))?.filter(c => c), + appName: v.app?.name, + url: v.app?.url, + 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") : "", + alarmContent: v.alarmContent, + screenshot: v.screenshot, + type: v.type ? typeData[v.type] : "", + confirm: v.confirm, + })) + console.log(tableDatas); + setTableData(tableDatas) + } + }) break; case 'videoAbnormal': dispatch(problem.getAlarmVideoList({})).then((res) => { @@ -57,9 +57,9 @@ const TableData = ({ route, dispatch, actions, collectData, setSetup, exhibition // 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.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") : "", + 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, // AlarmGroupUnit: v.AlarmGroupUnit ? genreData.find(r => r.value == v.AlarmGroupUnit)?.name : "", // Strategy: v.AlarmGroupUnit ? genreData.find(r => r.value == v.AlarmGroupUnit)?.name : "", @@ -70,10 +70,12 @@ const TableData = ({ route, dispatch, actions, collectData, setSetup, exhibition // AlarmContent: v.AlarmContent, // State: v.State, // alarmType: v.alarmType, - // confirm: v.confirmedContent, + platform: v.platform, + confirm: v.confirmedContent, camerOnline: v.camerOnline, })) console.log(tableDatas); + setCount(tableDatas?.length || 0); setTableData(tableDatas) } }) diff --git a/web/client/src/sections/problem/containers/dataAlarm.jsx b/web/client/src/sections/problem/containers/dataAlarm.jsx index e4aa8be..33dc851 100644 --- a/web/client/src/sections/problem/containers/dataAlarm.jsx +++ b/web/client/src/sections/problem/containers/dataAlarm.jsx @@ -12,6 +12,7 @@ import moment from "moment"; import '../style.less' import { request } from 'screenfull'; import { useRef } from 'react'; +import { render } from 'less'; const DataAlarm = ({ match, dispatch, actions, user, loading, socket }) => { let route = match.url.substring(match.url.lastIndexOf("/") + 1, match.url.length) @@ -150,7 +151,7 @@ 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', '22', 'AlarmContent', '111', 'createTime', 'updateTime', 'confirm', 'confirmTime', 'camerOnline'], + videoAbnormal: ['index', 'projectName', 'StructureName', 'SourceName', '19', '20', '21', 'platform', 'AlarmContent', '111', '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'], } @@ -227,7 +228,11 @@ 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) => r.confirm ? r.confirm : "未确认" }, + { + name: '确认信息', sort: 20, value: 'confirm', render: (_, r, index) => { + return r.State == 3 ? '无' : r.State == 4 ? r.confirm : '未确认' + } + }, { name: '确认/恢复时间', sort: 21, value: 'confirmTime', render: (_, r, index) => r.confirmTime ? r.confirmTime : "无" }, { name: '持续时间', sort: 19.5, value: 'sustainTime', render: (_, r, index) => { @@ -257,7 +262,12 @@ const DataAlarm = ({ match, dispatch, actions, user, loading, socket }) => { { name: '位置信息', sort: 11, value: '19' }, { name: '设备类型', sort: 6, value: '20' }, { name: '设备厂家', sort: 10, value: '21' }, - { name: '接入方式', sort: 9, value: '22' }, + { + name: '接入方式', sort: 9, value: 'platform', render: (_, r, index) => { + let accessType = { yingshi: "萤石云", nvr: "NVR", ipc: "IPC", cascade: "级联" } + return accessType[r.platform] || '无' + } + }, { name: '应用名称', sort: 2, value: 'appName' }, { name: 'URL地址', sort: 16, value: 'url' }, { name: '异常类型', sort: 6, value: 'type' }, @@ -456,7 +466,8 @@ const DataAlarm = ({ match, dispatch, actions, user, loading, socket }) => { /> : "" } - :) + : + ) } function mapStateToProps (state) {