Browse Source

key值的修改

dev
wenlele 2 years ago
parent
commit
a44f76a4a8
  1. 12
      web/client/src/sections/problem/components/tableData.jsx
  2. 14
      web/client/src/sections/problem/containers/dataAlarm.jsx

12
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))

14
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 ?
<Button theme='borderless' style={{ width: 65 }} onClick={() => {
setConfirm(true)
setSelected([r.key])
setSelected([r.id])
}}>确认</Button>
: r.State == 3 || r.autoRestore || r.confirmAuto ?
<Button theme='borderless' style={{ width: 65 }} disabled>自动恢复</Button> :
@ -322,7 +322,7 @@ const DataAlarm = (props) => {
<Button theme='borderless' style={{ width: 65 }} disabled>已派单</Button>
{route == 'deviceAbnormal' ? "" : <Button theme='borderless' style={{ width: 65 }} onClick={() => {
setCheckPop(true)
setAlarmId(r.key)
setAlarmId(r.id)
}}>查看</Button>}
</>
: 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 ? <div style={{ width: 450, marginLeft: 80, background: '#FFF6E9', fontWeight: 400, color: '#FE9812', fontSize: 13 }}>
当前告警源-{data?.SourceName}在项目{data?.projectName?.map((v, index) => {

Loading…
Cancel
Save