From a44f76a4a8a79e825c2ac03e4884de395b1232b5 Mon Sep 17 00:00:00 2001 From: wenlele Date: Tue, 10 Jan 2023 16:55:45 +0800 Subject: [PATCH] =?UTF-8?q?key=E5=80=BC=E7=9A=84=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/sections/problem/components/tableData.jsx | 12 ++++++------ .../src/sections/problem/containers/dataAlarm.jsx | 14 +++++++------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/web/client/src/sections/problem/components/tableData.jsx b/web/client/src/sections/problem/components/tableData.jsx index f6f2fb8..eacbfd6 100644 --- a/web/client/src/sections/problem/components/tableData.jsx +++ b/web/client/src/sections/problem/components/tableData.jsx @@ -31,7 +31,7 @@ const TableData = ({ route, dispatch, actions, collectData, setSetup, exhibition if (res.success) { let typeData = { element: "元素异常", apiError: "接口报错 ", timeout: "加载超时" } let tableDatas = res.payload.data?.rows.map(v => ({ - key: v.id, + id: v.id, projectName: v.app?.projectCorrelations?.map(r => (r.name ? { id: r.id, name: r.name, state: 'PMOS' } : { id: r.id, name: r.pepProject?.projectName, state: r.pepProject?.constructionStatus }))?.filter(c => c), @@ -55,7 +55,7 @@ const TableData = ({ route, dispatch, actions, collectData, setSetup, exhibition dispatch(problem.getAlarmVideoList({ ...search.current, pepProjectId: pepProjectId })).then((res) => { if (res.success) { let tableDatas = res.payload.data?.map(v => ({ - key: v.alarmId, + id: v.alarmId, StructureName: v.struc, projectName: v.pomsProject?.map(r => (r.name ? { id: r.id, name: r.name, state: 'PMOS' } : { id: r.id, name: r.pepProject?.projectName, state: r.pepProject?.constructionStatus @@ -88,7 +88,7 @@ const TableData = ({ route, dispatch, actions, collectData, setSetup, exhibition if (res.success) { setCount(res.payload.data?.count || 0) let tableDatas = res.payload.data?.rows?.map(v => ({ - key: v.AlarmId, + id: v.AlarmId, StructureName: v.StructureName, projectName: v.pomsProject?.map(r => (r.name ? { id: r.id, name: r.name, state: 'PMOS' } : { id: r.id, name: r.pepProject?.projectName, state: r.pepProject?.constructionStatus @@ -417,7 +417,7 @@ const TableData = ({ route, dispatch, actions, collectData, setSetup, exhibition // }, onChange: (selectedRowKeys, selectedRows) => { // console.log(`selectedRowKeys: ${selectedRowKeys}`, 'selectedRows: ', selectedRows); - setSelected(selectedRows?.map(v => v.key)) + setSelected(selectedRows?.map(v => v.id)) }, }} /> @@ -438,11 +438,11 @@ const TableData = ({ route, dispatch, actions, collectData, setSetup, exhibition setSelected((route == 'useAbnormal' || route == 'videoAbnormal' ? 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 + return v.id } } else { if (!(v.State > 2)) { - return v.key + return v.id } } })?.filter(v => v)) diff --git a/web/client/src/sections/problem/containers/dataAlarm.jsx b/web/client/src/sections/problem/containers/dataAlarm.jsx index 27ef6be..dbf8214 100644 --- a/web/client/src/sections/problem/containers/dataAlarm.jsx +++ b/web/client/src/sections/problem/containers/dataAlarm.jsx @@ -312,7 +312,7 @@ const DataAlarm = (props) => { {r.State < 3 || route && ['videoAbnormal', 'useAbnormal'].includes(route) && !r.confirmTime ? : r.State == 3 || r.autoRestore || r.confirmAuto ? : @@ -322,7 +322,7 @@ const DataAlarm = (props) => { {route == 'deviceAbnormal' ? "" : } : route == 'videoAbnormal' ? <> @@ -390,14 +390,14 @@ const DataAlarm = (props) => { const getAlarmConfirmItems = () => { let confirmItems = []; selected.map(s => { - let alarmInfo = tableData.find(td => td.key == s); + let alarmInfo = tableData.find(td => td.id == s); let source = route == 'useAbnormal' ? alarmInfo.appName : alarmInfo.SourceName; let type = route == 'useAbnormal' ? alarmInfo.type : route == 'videoAbnormal' ? alarmInfo.AlarmContent : alarmInfo.AlarmGroupUnit; let item = { pepUserId: user.pomsUserInfo.pepUserId, projectCorrelationIds: alarmInfo?.projectName?.map(p => p.id), alarmInfo: { - id: alarmInfo.key, + id: alarmInfo.id, source: source,//告警源 type: type,//异常类型 } @@ -488,7 +488,7 @@ const DataAlarm = (props) => { setConfirm(false) setSelected([]) let data = tableData?.map(v => { - if (selected.find(vv => vv == v.key)) { + if (selected.find(vv => vv == v.id)) { return { ...v, confirm: content, confirmTime: moment().format("YYYY-MM-DD HH:mm:ss"), State: 4 } } else { return { ...v } @@ -506,7 +506,7 @@ const DataAlarm = (props) => { if (res.success) { setConfirm(false) let data = tableData?.map(v => { - if (selected.find(vv => vv == v.key)) { + if (selected.find(vv => vv == v.id)) { return { ...v, confirm: '告警确认:' + content, confirmTime: moment().format("YYYY-MM-DD HH:mm:ss"), State: 4 } } else { return { ...v } @@ -536,7 +536,7 @@ const DataAlarm = (props) => { {route == 'videoAbnormal' ? (() => { let data if (selected.length == 1) { - data = tableData.find(v => v.key == selected[0]) + data = tableData.find(v => v.id == selected[0]) } return data ?
当前告警源-{data?.SourceName},在项目{data?.projectName?.map((v, index) => {