From 1e6759dc27095f62c9a84b4439a299a80c30fb24 Mon Sep 17 00:00:00 2001 From: wenlele Date: Sat, 8 Oct 2022 18:11:24 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E8=A7=86=E9=A2=91=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E8=B0=83=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 }) => { /> : "" }
- : + // : ) } From 944e43902b0ccf6c4a780be9649342c71cfcfd55 Mon Sep 17 00:00:00 2001 From: wenlele Date: Sat, 8 Oct 2022 21:27:30 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E8=A7=86=E9=A2=91=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E4=B8=8E=E6=92=AD=E6=94=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sections/problem/components/tableData.jsx | 6 +-- .../sections/problem/containers/dataAlarm.jsx | 46 +++++++++++++++++-- 2 files changed, 45 insertions(+), 7 deletions(-) diff --git a/web/client/src/sections/problem/components/tableData.jsx b/web/client/src/sections/problem/components/tableData.jsx index 4bce85b..5a70c70 100644 --- a/web/client/src/sections/problem/components/tableData.jsx +++ b/web/client/src/sections/problem/components/tableData.jsx @@ -54,9 +54,9 @@ const TableData = ({ route, dispatch, actions, collectData, setSetup, exhibition let tableDatas = res.payload.data?.map(v => ({ key: v.alarmId, 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), + 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") : "", diff --git a/web/client/src/sections/problem/containers/dataAlarm.jsx b/web/client/src/sections/problem/containers/dataAlarm.jsx index ce4e403..f4d8bbd 100644 --- a/web/client/src/sections/problem/containers/dataAlarm.jsx +++ b/web/client/src/sections/problem/containers/dataAlarm.jsx @@ -34,6 +34,8 @@ const DataAlarm = ({ match, dispatch, actions, user, loading, socket }) => { const [alarmId, setAlarmId] = useState(false) //查看alarmId const [query, setQuery] = useState({ limit: 10, page: 0 }) //分页 const [tableData, setTableData] = useState([]) //表格数据 + const [videoModal, setVideoModal] = useState(false) //视频播放弹框 + const [videoData, setVideoData] = useState({}) //视频播放参数 @@ -180,7 +182,7 @@ const DataAlarm = ({ match, dispatch, actions, user, loading, socket }) => { name: '项目名称', sort: 3, value: 'projectName', render: (_, r, index) => { return <> {r.projectName?.map((v, index) => { - return v.name ?
+ return v.name ?
{OutHidden({ number: 7, name: v.name @@ -195,7 +197,6 @@ const DataAlarm = ({ match, dispatch, actions, user, loading, socket }) => {
: "" }) } - } }, @@ -310,8 +311,8 @@ const DataAlarm = ({ match, dispatch, actions, user, loading, socket }) => { : route == 'videoAbnormal' ? <> : "" } @@ -486,6 +487,43 @@ const DataAlarm = ({ match, dispatch, actions, user, loading, socket }) => {
: ""} + {videoModal ? setVideoModal(false)} + onOk={() => { + + + }} + > +
+ +
+ +
: ""} + {checkPop ? Date: Sun, 9 Oct 2022 09:08:58 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E6=92=AD=E6=94=BE=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/sections/problem/actions/problem.jsx | 22 +++++----- .../sections/problem/components/sideSheet.jsx | 14 +++---- .../sections/problem/containers/dataAlarm.jsx | 41 +++++++++++-------- web/client/src/utils/webapi.js | 2 +- 4 files changed, 42 insertions(+), 37 deletions(-) diff --git a/web/client/src/sections/problem/actions/problem.jsx b/web/client/src/sections/problem/actions/problem.jsx index 680078d..5004b48 100644 --- a/web/client/src/sections/problem/actions/problem.jsx +++ b/web/client/src/sections/problem/actions/problem.jsx @@ -148,14 +148,14 @@ export function getAlarmVideoDeviceKind () { //查询视频设备类型 }); } -// export function putAlarmdataConfirm (data) { //确认数据告警 -// return dispatch => basicAction({ -// type: 'put', -// dispatch: dispatch, -// data, -// actionType: 'PUT-AIARM-DATA-CONFIRM', -// url: `${ApiTable.putAlarmdataConfirm}`, -// msg: { option: '确认数据告警' }, -// reducer: { name: '' } -// }); -// } +export function putAlarmVideoConfirm (data) { //确认视频告警 + return dispatch => basicAction({ + type: 'put', + dispatch: dispatch, + data, + actionType: 'PUT-AIARM-VIDEO-CONFIRM', + url: `${ApiTable.putAlarmVideoConfirm}`, + msg: { option: '确认视频告警' }, + reducer: { name: '' } + }); +} diff --git a/web/client/src/sections/problem/components/sideSheet.jsx b/web/client/src/sections/problem/components/sideSheet.jsx index 94ff7fd..a8b119b 100644 --- a/web/client/src/sections/problem/components/sideSheet.jsx +++ b/web/client/src/sections/problem/components/sideSheet.jsx @@ -13,7 +13,7 @@ function SideSheets ({ dispatch, actions, close, alarmId }) { const { problem } = actions; const [clickStyle, setclickStyle] = useState(); - const [query, setQuery] = useState({ page: 1, pageSize: 10 }); + const [query, setQuery] = useState({ page: 0, pageSize: 10 }); const [dataSource, setdataSource] = useState([]); const [option, setOption] = useState({}); @@ -21,7 +21,7 @@ function SideSheets ({ dispatch, actions, close, alarmId }) { useEffect(() => { if (alarmId) { - dispatch(problem.getAlarmDataDetail({ alarmId: alarmId })).then((res) => { + dispatch(problem.getAlarmDataDetail({ alarmId: alarmId, ...query })).then((res) => { if (res?.success) { console.log(res.payload.data); setdataSource(res.payload.data); @@ -103,7 +103,7 @@ function SideSheets ({ dispatch, actions, close, alarmId }) { }); } - }, []); + }, [query]); useEffect(() => { @@ -163,7 +163,7 @@ function SideSheets ({ dispatch, actions, close, alarmId }) {
- +
告警详情 @@ -171,7 +171,7 @@ function SideSheets ({ dispatch, actions, close, alarmId }) {
{ console.log(currentPage, pageSize); - setQuery({ pageSize: pageSize, page: currentPage }); + setQuery({ pageSize: pageSize, page: currentPage - 1 }); }} /> : ""} diff --git a/web/client/src/sections/problem/containers/dataAlarm.jsx b/web/client/src/sections/problem/containers/dataAlarm.jsx index f4d8bbd..e47cf20 100644 --- a/web/client/src/sections/problem/containers/dataAlarm.jsx +++ b/web/client/src/sections/problem/containers/dataAlarm.jsx @@ -227,7 +227,7 @@ const DataAlarm = ({ match, dispatch, actions, user, loading, socket }) => { { name: '常见原因', sort: 7, value: 'AlarmCodeName' }, { 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: 12, value: '9' }, { name: '告警等级', sort: 13, value: 'CurrentLevel', render: (_, r, index) => { let data = { 1: '一级', 2: '二级', 3: '三级' } @@ -444,7 +444,7 @@ const DataAlarm = ({ match, dispatch, actions, user, loading, socket }) => { }) } else if (route == 'videoAbnormal') { TextAreaApi.current.validate().then((v) => { - dispatch(problem.postApiConfirm({ appAlarmId: selected, confirm: content })).then(res => { + dispatch(problem.putAlarmVideoConfirm({ alarmId: selected, content: content })).then(res => { if (res.success) { setConfirm(false) setQuery({ limit: query.limit, page: query.page }) @@ -490,30 +490,35 @@ const DataAlarm = ({ match, dispatch, actions, user, loading, socket }) => { {videoModal ? setVideoModal(false)} onOk={() => { }} > -
+