|
|
@ -22,12 +22,10 @@ const TableData = ({ route, dispatch, actions, collectData, setSetup, exhibition |
|
|
|
switch (route) { |
|
|
|
case 'useAbnormal': |
|
|
|
dispatch(problem.getAlarmLnspectionApi({ ...search, pepProjectId: '' })).then((res) => { |
|
|
|
// console.log(res.payload.data) |
|
|
|
if (res.success) { |
|
|
|
let typeData = { element: "元素异常", apiError: "接口报错 ", timeout: "加载超时" } |
|
|
|
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: 'PMOS' } : { |
|
|
|
name: r.pepProject?.project_name, state: r.pepProject?.construction_status |
|
|
|
}))?.filter(c => c), |
|
|
@ -41,7 +39,6 @@ const TableData = ({ route, dispatch, actions, collectData, setSetup, exhibition |
|
|
|
type: v.type ? typeData[v.type] : "", |
|
|
|
confirm: v.confirm, |
|
|
|
})) |
|
|
|
// console.log(tableDatas); |
|
|
|
setCount(tableDatas?.length || 0); |
|
|
|
setTableData(tableDatas) |
|
|
|
} |
|
|
@ -58,7 +55,6 @@ const TableData = ({ route, dispatch, actions, collectData, setSetup, exhibition |
|
|
|
|
|
|
|
dispatch(problem.getAlarmVideoList({ ...search, pepProjectId: '' })).then((res) => { |
|
|
|
if (res.success) { |
|
|
|
// console.log(res); |
|
|
|
let tableDatas = res.payload.data?.map(v => ({ |
|
|
|
key: v.alarmId, |
|
|
|
StructureName: v.struc, |
|
|
@ -71,7 +67,6 @@ const TableData = ({ route, dispatch, actions, collectData, setSetup, exhibition |
|
|
|
SourceName: v.cameraName, |
|
|
|
yingshiToken: v.yingshiToken, |
|
|
|
AlarmContent: v.statusDescribe, |
|
|
|
// State: v.State, |
|
|
|
station: v.station || [], |
|
|
|
resolve: v.resolve || [], |
|
|
|
cameraChannelNo: v.cameraChannelNo, |
|
|
@ -82,7 +77,6 @@ const TableData = ({ route, dispatch, actions, collectData, setSetup, exhibition |
|
|
|
confirm: v.confirmedContent, |
|
|
|
camerOnline: v.camerOnline, |
|
|
|
})) |
|
|
|
// console.log(tableDatas); |
|
|
|
setCount(tableDatas?.length || 0); |
|
|
|
setTableData(tableDatas) |
|
|
|
} |
|
|
@ -91,25 +85,21 @@ const TableData = ({ route, dispatch, actions, collectData, setSetup, exhibition |
|
|
|
default: |
|
|
|
dispatch(problem.getAlarmDataGroup()).then((res) => { |
|
|
|
if (res.success) { |
|
|
|
// console.log(res.payload.data); |
|
|
|
let routeData = { dataLnterrupt: '数据中断', dataAbnormal: '数据异常', strategyHit: '策略命中', deviceAbnormal: '' } |
|
|
|
let data |
|
|
|
if (route == 'dataLnterrupt') data = res.payload.data?.filter(v => v.desc == '数据中断') |
|
|
|
if (route == 'dataAbnormal') data = res.payload.data?.filter(v => v.desc == '数据异常') |
|
|
|
if (route == 'strategyHit') data = res.payload.data?.filter(v => v.desc == '策略命中') |
|
|
|
if (route == 'deviceAbnormal') data = res.payload.data?.filter(v => v.desc == '掉线' || v.desc == '不活跃') |
|
|
|
// console.log(data); |
|
|
|
let genreData = [] |
|
|
|
data?.map(v => { |
|
|
|
v?.unit?.map(vv => { |
|
|
|
genreData.push({ name: vv.name, value: vv.id }) |
|
|
|
}) |
|
|
|
}) |
|
|
|
// console.log(genreData); |
|
|
|
setGenre(genreData) |
|
|
|
if (data && data[0]?.id) { |
|
|
|
dispatch(problem.getAlarmDataList({ ...query, ...search, groupId: data.map(v => v.id).join(), pepProjectId: '' })).then((res) => { |
|
|
|
console.log(res); |
|
|
|
if (res.success) { |
|
|
|
setCount(res.payload.data?.count || 0) |
|
|
|
let tableDatas = res.payload.data?.rows?.map(v => ({ |
|
|
@ -124,7 +114,7 @@ const TableData = ({ route, dispatch, actions, collectData, setSetup, exhibition |
|
|
|
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 : "", |
|
|
|
type: route == 'deviceAbnormal' ? v.DeviceStatus == 0 ? "离线" : "在线" : v.AlarmGroupUnit ? genreData.find(r => r.value == v.AlarmGroupUnit)?.name : "", |
|
|
|
type: route == 'deviceAbnormal' ? v.DeviceStatus == 0 ? "离线" : '' : v.AlarmGroupUnit ? genreData.find(r => r.value == v.AlarmGroupUnit)?.name : "", |
|
|
|
cameraKindId: v.AlarmGroupUnit ? genreData.find(r => r.value == v.AlarmGroupUnit)?.name : "", |
|
|
|
AlarmCodeName: v.AlarmCodeName, |
|
|
|
CurrentLevel: v.CurrentLevel, |
|
|
@ -135,7 +125,6 @@ const TableData = ({ route, dispatch, actions, collectData, setSetup, exhibition |
|
|
|
confirm: v.confirmedContent, |
|
|
|
station: v.StructureLongitude && v.StructureLatitude ? v.StructureLongitude + '. ' + v.StructureLatitude : "", |
|
|
|
})) |
|
|
|
// console.log(tableDatas); |
|
|
|
setTableData(tableDatas) |
|
|
|
} |
|
|
|
}) |
|
|
@ -148,7 +137,6 @@ const TableData = ({ route, dispatch, actions, collectData, setSetup, exhibition |
|
|
|
|
|
|
|
}, [query, search]) |
|
|
|
|
|
|
|
// console.log(tableData.slice(query.page * query.limit, (query.page + 1) * query.limit)); |
|
|
|
|
|
|
|
return ( |
|
|
|
<> |
|
|
@ -164,7 +152,6 @@ const TableData = ({ route, dispatch, actions, collectData, setSetup, exhibition |
|
|
|
<div style={{ display: "flex", marginBottom: 16, }}> |
|
|
|
<Form |
|
|
|
onSubmit={(values) => console.log(values)} |
|
|
|
// onValueChange={values=>console.log(values)} |
|
|
|
getFormApi={(formApi) => (api.current = formApi)} |
|
|
|
layout="horizontal" |
|
|
|
style={{ position: "relative", width: "100%", flex: 1 }} |
|
|
@ -220,9 +207,7 @@ const TableData = ({ route, dispatch, actions, collectData, setSetup, exhibition |
|
|
|
label={collectData.common.name + ':'} |
|
|
|
field={collectData.common.field} |
|
|
|
key={collectData.common.field} |
|
|
|
// defaultPickerValue={['2022-08-08 00:00'), new Date('2022-08-09 12:00')]} |
|
|
|
// initValue={[new Date('2022-08-08 00:00'), new Date()]} |
|
|
|
onChange={(v) => console.log(v)} |
|
|
|
// onChange={(v) => console.log(v)} |
|
|
|
/>) |
|
|
|
return frame |
|
|
|
})()} |
|
|
@ -245,16 +230,6 @@ const TableData = ({ route, dispatch, actions, collectData, setSetup, exhibition |
|
|
|
style={{ width: 80, height: 32, borderRadius: 3, }} |
|
|
|
onClick={() => { |
|
|
|
api.current.validate().then((v) => { |
|
|
|
// console.log(v); |
|
|
|
// console.log({ |
|
|
|
// state: v.state, |
|
|
|
// keywordTarget: v.keywordTarget, |
|
|
|
// keyword: v.keyword, |
|
|
|
// groupUnitId: v.groupUnitId, |
|
|
|
// sustainTimeStart: v.time ? moment(v.time[0]).format("YYYY-MM-DD HH:mm:ss") : "", |
|
|
|
// sustainTimeEnd: v.time ? moment(v.time[1]).format("YYYY-MM-DD HH:mm:ss") : "", |
|
|
|
// }); |
|
|
|
console.log(v); |
|
|
|
setSearch({ |
|
|
|
state: v.state, |
|
|
|
keywordTarget: v.keywordTarget, |
|
|
@ -285,7 +260,6 @@ const TableData = ({ route, dispatch, actions, collectData, setSetup, exhibition |
|
|
|
<Table |
|
|
|
columns={exhibition} |
|
|
|
dataSource={route == 'useAbnormal' || route == 'videoAbnormal' ? tableData.slice(query.page * query.limit, (query.page + 1) * query.limit) || [] : tableData} |
|
|
|
// dataSource={[{ key: '1' }]} |
|
|
|
bordered={false} |
|
|
|
empty="暂无数据" |
|
|
|
style={{}} |
|
|
@ -302,13 +276,13 @@ const TableData = ({ route, dispatch, actions, collectData, setSetup, exhibition |
|
|
|
// name: record.name, |
|
|
|
}), |
|
|
|
onSelect: (record, selected) => { |
|
|
|
console.log(`select row: ${selected}`, record); |
|
|
|
// console.log(`select row: ${selected}`, record); |
|
|
|
}, |
|
|
|
// onSelectAll: (selected, selectedRows) => { |
|
|
|
// console.log(`select all rows: ${selected}`, selectedRows); |
|
|
|
// }, |
|
|
|
onChange: (selectedRowKeys, selectedRows) => { |
|
|
|
console.log(`selectedRowKeys: ${selectedRowKeys}`, 'selectedRows: ', selectedRows); |
|
|
|
// console.log(`selectedRowKeys: ${selectedRowKeys}`, 'selectedRows: ', selectedRows); |
|
|
|
setSelected(selectedRows?.map(v => v.key)) |
|
|
|
}, |
|
|
|
}} |
|
|
@ -358,7 +332,7 @@ const TableData = ({ route, dispatch, actions, collectData, setSetup, exhibition |
|
|
|
pageSizeOpts={[10, 20, 30, 40]} |
|
|
|
onChange={(currentPage, pageSize) => { |
|
|
|
setQuery({ limit: pageSize, page: currentPage - 1 }); |
|
|
|
// page.current = currentPage - 1 |
|
|
|
|
|
|
|
}} |
|
|
|
/> |
|
|
|
</div> : ""} |
|
|
|