|
|
@ -14,6 +14,7 @@ const DataAlarm = ({ match, dispatch, actions, user, loading, socket }) => { |
|
|
|
const [collect, setCollect] = useState([]) //搜索结构 |
|
|
|
const [setup, setSetup] = useState(false); //表格设置是否显现 |
|
|
|
const [tableSetup, setTableSetup] = useState([]); //单一表格设置信息 |
|
|
|
const [exhibition, setExhibition] = useState([]); //单一表格展现信息 |
|
|
|
|
|
|
|
const tableType = { dataLnterrupt: 'dataLnterrupt', dataAbnormal: 'dataAbnormal', strategyHit: 'strategyHit', videoAbnormal: 'videoAbnormal', useAbnormal: 'useAbnormal', deviceAbnormal: 'deviceAbnormal' } |
|
|
|
|
|
|
@ -22,10 +23,25 @@ const DataAlarm = ({ match, dispatch, actions, user, loading, socket }) => { |
|
|
|
setRoute(match.url.substring(match.url.lastIndexOf("/") + 1, match.url.length)) |
|
|
|
console.log(match.url) |
|
|
|
console.log(tableType); |
|
|
|
|
|
|
|
|
|
|
|
}, []) |
|
|
|
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
|
|
|
|
if (route) { |
|
|
|
//初始化表格显示设置 |
|
|
|
let data = columns[route] |
|
|
|
data.splice(0, 1) |
|
|
|
if (tableType[route] == 'dataAbnormal') data.splice(6, 0, '6') |
|
|
|
localStorage.getItem(tableType[route]) == null |
|
|
|
? localStorage.setItem( |
|
|
|
tableType[route], |
|
|
|
JSON.stringify(data) |
|
|
|
) |
|
|
|
: ""; |
|
|
|
} |
|
|
|
attribute(tableType[route], route); |
|
|
|
}, [route]) |
|
|
|
|
|
|
@ -146,7 +162,7 @@ const DataAlarm = ({ match, dispatch, actions, user, loading, socket }) => { |
|
|
|
const columns = { |
|
|
|
dataLnterrupt: ['0', '1', '2', '3', '4', '5', '6', '7', '8',], |
|
|
|
dataAbnormal: ['0', '1', '2', '3', '15', '5', '6', '7', '8'], |
|
|
|
strategyHit: ['0', '1', '2', '3', '17', '5', '10', '11', '7', '8'], |
|
|
|
strategyHit: ['0', '1', '2', '3', '17', '5', '10', '11', '8'], |
|
|
|
videoAbnormal: ['0', '1', '2', '3', '21', '20', '5', '7', '8'], |
|
|
|
useAbnormal: ['0', '1', '23', '24', '15', '25', '7', '8'], |
|
|
|
deviceAbnormal: ['0', '1', '2', '3', '15', '19', '5', '7', '8'], |
|
|
@ -183,17 +199,38 @@ const DataAlarm = ({ match, dispatch, actions, user, loading, socket }) => { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const attribute = (tableType, route) => { |
|
|
|
let arr = localStorage.getItem(tableType) |
|
|
|
? JSON.parse(localStorage.getItem(tableType)) |
|
|
|
const attribute = (name, route) => { |
|
|
|
let arr = localStorage.getItem(name) |
|
|
|
? JSON.parse(localStorage.getItem(name)) |
|
|
|
: []; |
|
|
|
// if (route) { |
|
|
|
// console.log(tableList[route]); |
|
|
|
// console.log([...[1,2,3],...[2,3]]); |
|
|
|
// let setup = tableList[route].map(v => columnAll.find(vv => v == vv.value)) |
|
|
|
// console.log(setup); |
|
|
|
// setTableSetup([{ list: setup }]) |
|
|
|
// } |
|
|
|
console.log(arr); |
|
|
|
if (route) { |
|
|
|
let setup = tableList[route].map(v => columnAll.find(vv => v == vv.value)) |
|
|
|
|
|
|
|
let data = ['0'] |
|
|
|
if (tableType[route] == 'dataAbnormal') { |
|
|
|
data = ['0', '6'] |
|
|
|
data.splice(1, 0, ...arr) |
|
|
|
} else { |
|
|
|
data.splice(1, 0, ...arr) |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
console.log(data) |
|
|
|
|
|
|
|
let TableDisplay = data.map(v => { |
|
|
|
let datas = columnAll.find(vv => v == vv.value) |
|
|
|
if (datas) { |
|
|
|
return { title: datas.name, dataIndex: datas.value, rowKey: datas.value } |
|
|
|
} |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
console.log(TableDisplay); |
|
|
|
console.log(setup); |
|
|
|
setExhibition(TableDisplay) |
|
|
|
setTableSetup([{ list: setup }]) |
|
|
|
} |
|
|
|
|
|
|
|
// for (let i = 0; i < arr.length; i++) { |
|
|
|
// let colum = column.filter((item) => { |
|
|
@ -219,24 +256,25 @@ const DataAlarm = ({ match, dispatch, actions, user, loading, socket }) => { |
|
|
|
} |
|
|
|
} |
|
|
|
return ( |
|
|
|
<div> |
|
|
|
<div style={{minWidth:1000}}> |
|
|
|
{/* 滞留提醒 */} |
|
|
|
<div> |
|
|
|
{abnormalLenght > 0 ? <div style={{ height: 30, fontSize: 12, display: 'flex' }}><IconAlertCircle /><div>当前滞留5个工单即将超时,请尽快处理!</div></div> : ""} |
|
|
|
</div> |
|
|
|
<Statistics /> |
|
|
|
{/* <Statistics /> |
|
|
|
<TableData |
|
|
|
route={route} |
|
|
|
collectData={collectData} |
|
|
|
setSetup={setSetup} |
|
|
|
/> |
|
|
|
exhibition={exhibition} |
|
|
|
/> */} |
|
|
|
{setup ? ( |
|
|
|
<Setup |
|
|
|
tableType={tableType[route] || []} |
|
|
|
tableList={tableSetup} |
|
|
|
close={() => { |
|
|
|
setSetup(false); |
|
|
|
attribute(tableType[route]); |
|
|
|
attribute(tableType[route], route); |
|
|
|
// setcameraSetup(false); |
|
|
|
}} |
|
|
|
/> |
|
|
|