From 1e6759dc27095f62c9a84b4439a299a80c30fb24 Mon Sep 17 00:00:00 2001 From: wenlele Date: Sat, 8 Oct 2022 18:11:24 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=86=E9=A2=91=E6=95=B0=E6=8D=AE=E8=B0=83?= =?UTF-8?q?=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/sections/problem/actions/problem.jsx | 14 ++- .../problem/components/inspection.jsx | 2 +- .../sections/problem/components/tableData.jsx | 80 ++++++++++------ .../sections/problem/containers/dataAlarm.jsx | 95 ++++++++++++------- 4 files changed, 128 insertions(+), 63 deletions(-) diff --git a/web/client/src/sections/problem/actions/problem.jsx b/web/client/src/sections/problem/actions/problem.jsx index d1007ff..680078d 100644 --- a/web/client/src/sections/problem/actions/problem.jsx +++ b/web/client/src/sections/problem/actions/problem.jsx @@ -146,4 +146,16 @@ export function getAlarmVideoDeviceKind () { //查询视频设备类型 msg: { option: '查询视频设备类型' }, reducer: { name: '' } }); -} \ No newline at end of file +} + +// export function putAlarmdataConfirm (data) { //确认数据告警 +// return dispatch => basicAction({ +// type: 'put', +// dispatch: dispatch, +// data, +// actionType: 'PUT-AIARM-DATA-CONFIRM', +// url: `${ApiTable.putAlarmdataConfirm}`, +// msg: { option: '确认数据告警' }, +// reducer: { name: '' } +// }); +// } diff --git a/web/client/src/sections/problem/components/inspection.jsx b/web/client/src/sections/problem/components/inspection.jsx index acb1929..c99bf08 100644 --- a/web/client/src/sections/problem/components/inspection.jsx +++ b/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(() => { diff --git a/web/client/src/sections/problem/components/tableData.jsx b/web/client/src/sections/problem/components/tableData.jsx index 1fb0a3e..4bce85b 100644 --- a/web/client/src/sections/problem/components/tableData.jsx +++ b/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( - - {[{ name: "告警源", value: "source" }, { name: "项目", value: "pepProject" }, { name: "结构物", value: "struc" },].map(vv => { - return {vv.name} - })} - - - ) + if (route == 'useAbnormal') { + frame.push() + } else { + frame.push( + + {[{ name: "告警源", value: "source" }, { name: "项目", value: "pepProject" }, { name: "结构物", value: "struc" },].map(vv => { + return {vv.name} + })} + + + ) + } + } else { frame.push( 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 > 勾选{selected.length}条问题 : r.State == 3 ? : - : "" + } - {route ? ['dataLnterrupt', 'dataAbnormal', 'strategyHit'].includes(route) ? <> + {route && ['dataLnterrupt', 'dataAbnormal', 'strategyHit'].includes(route) ? <> - : "" : "" + : route == 'videoAbnormal' ? <> + + + : "" } } @@ -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'?
{/* 滞留提醒 */}
@@ -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 }) => { /> : "" }
- : + // : ) }