|
|
@ -1,12 +1,28 @@ |
|
|
|
import React from 'react'; |
|
|
|
import React, { useState, useEffect } from 'react'; |
|
|
|
import { connect } from 'react-redux'; |
|
|
|
import { Spin, Card, Modal, TreeSelect, message } from 'antd'; |
|
|
|
import ProForm, { ProFormText, ModalForm, ProFormSwitch, ProFormTreeSelect } from '@ant-design/pro-form'; |
|
|
|
import Title from 'antd/lib/skeleton/Title'; |
|
|
|
import Weather from './public/weather'; |
|
|
|
|
|
|
|
const Header = ({ dispatch, actions, user, module, setModule, history }) => { |
|
|
|
|
|
|
|
const [tabs, setTabs] = useState([ |
|
|
|
{ title: '基础信息', key: 'basis' }, |
|
|
|
{ title: '能耗监测', key: 'capacity' }, |
|
|
|
{ title: '电排远控', key: 'electrical' }, |
|
|
|
{ title: '实时监测', key: 'realTime' }, |
|
|
|
{ title: '视频监控', key: 'video' }, |
|
|
|
]) |
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
const tabKey = sessionStorage.getItem('tabKey'); |
|
|
|
if (tabKey) { |
|
|
|
setTabs([ |
|
|
|
{ title: '能耗监测', key: 'capacity' }, |
|
|
|
{ title: '电排远控', key: 'electrical' }, |
|
|
|
{ title: '实时监测', key: 'realTime' }, |
|
|
|
{ title: '视频监控', key: 'video' }, |
|
|
|
]) |
|
|
|
}; |
|
|
|
}, []) |
|
|
|
|
|
|
|
return <div style={{ width: '100%', height: 160 }}> |
|
|
|
<div style={{ |
|
|
@ -43,18 +59,14 @@ const Header = ({ dispatch, actions, user, module, setModule, history }) => { |
|
|
|
display: 'flex', |
|
|
|
alignItems: 'flex-end', justifyContent: 'space-around', |
|
|
|
}}> |
|
|
|
{[{ title: '基础信息', key: 'basis' }, |
|
|
|
{ title: '能耗监测', key: 'capacity' }, |
|
|
|
{ title: '电排远控', key: 'electrical' }, |
|
|
|
{ title: '实时监测', key: 'realTime' }, |
|
|
|
{ title: '视频监控', key: 'video' },].map(v => { |
|
|
|
{tabs.map(v => { |
|
|
|
return <div key={v.key} style={{ |
|
|
|
width: 100, height: 30, lineHeight: '30px', |
|
|
|
backgroundImage: `url(/assets/images/monitor/${module == v.key ? 'pitch-on' : 'choseNone'}.png)`, |
|
|
|
backgroundSize: '100% 100%', |
|
|
|
backgroundPosition: '100% 100%', |
|
|
|
backgroundRepeat: 'no-repeat', |
|
|
|
color: 'white',cursor: "pointer" |
|
|
|
color: 'white', cursor: "pointer" |
|
|
|
}} onClick={() => setModule(v.key)}>{v.title}</div> |
|
|
|
})} |
|
|
|
</div> |
|
|
|