From 2aebb587f7f17c3f9c304258233b9cc69307a00f Mon Sep 17 00:00:00 2001 From: liujiangyong Date: Tue, 10 Oct 2023 14:46:24 +0800 Subject: [PATCH] =?UTF-8?q?(*)=20=E6=B3=B5=E7=AB=99=E8=B7=B3=E8=BD=AC?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/sections/auth/containers/login.js | 7 ++-- .../sections/bigScreen/components/capacity.js | 7 ++-- .../bigScreen/components/electrical.js | 7 ++-- .../sections/bigScreen/components/header.js | 32 +++++++++++++------ .../sections/bigScreen/components/realTime.js | 7 ++-- .../bigScreen/containers/systemManagement.js | 2 ++ 6 files changed, 43 insertions(+), 19 deletions(-) diff --git a/web/client/src/sections/auth/containers/login.js b/web/client/src/sections/auth/containers/login.js index 49ea609..c265400 100644 --- a/web/client/src/sections/auth/containers/login.js +++ b/web/client/src/sections/auth/containers/login.js @@ -29,9 +29,10 @@ const Login = props => { useEffect(() => { // 水环境跳转自动登录 - const structId = getUrlParams(window.location.search)?.structId; - if (structId) { + const { structId, tabKey } = getUrlParams(window.location.search); + if (structId && tabKey) { sessionStorage.setItem('structId', structId); + sessionStorage.setItem('tabKey', tabKey); dispatch(login({ username: 'SuperAdmin', password: '123456' })); } }, []) @@ -170,7 +171,7 @@ function mapStateToProps(state) { export default connect(mapStateToProps)(Login); function getUrlParams(url) { - if (!url) return; + if (!url) return {}; let arr = url.split('?'); let params = arr[1].split('&'); let obj = {}; diff --git a/web/client/src/sections/bigScreen/components/capacity.js b/web/client/src/sections/bigScreen/components/capacity.js index 59d7057..a91c023 100644 --- a/web/client/src/sections/bigScreen/components/capacity.js +++ b/web/client/src/sections/bigScreen/components/capacity.js @@ -21,6 +21,8 @@ const Capacity = ({ actions, dispatch, siteList, }) => { const [electricityTrend, setElectricityTrend] = useState([]) //电流趋势 const [useTrend, setUseTrend] = useState([]) //用电趋势 + const [changeable, setChangeable] = useState(true) // 泵站是否可切换 + useEffect(() => { const autoStructId = sessionStorage.getItem('structId'); let nextStructId = siteList[0]?.value; @@ -28,6 +30,7 @@ const Capacity = ({ actions, dispatch, siteList, }) => { for (let i = 0; i < siteList.length; i++) { if (autoStructId == siteList[i].value) { nextStructId = siteList[i].value; + setChangeable(false); break; } } @@ -684,7 +687,7 @@ const Capacity = ({ actions, dispatch, siteList, }) => { backgroundSize: '100% 100%', backgroundPosition: 'center', backgroundRepeat: 'no-repeat', textAlign: 'center', lineHeight: '41px', fontSize: 20, color: '#FFF', fontStyle: "italic" }}>{siteList?.filter(v => v.value == strucId)[0]?.label} - { setStrucId(v) }} options={siteList} - /> + />} diff --git a/web/client/src/sections/bigScreen/components/header.js b/web/client/src/sections/bigScreen/components/header.js index c8b9aed..d356f74 100644 --- a/web/client/src/sections/bigScreen/components/header.js +++ b/web/client/src/sections/bigScreen/components/header.js @@ -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
{ 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
setModule(v.key)}>{v.title}
})}
diff --git a/web/client/src/sections/bigScreen/components/realTime.js b/web/client/src/sections/bigScreen/components/realTime.js index 0a6af5f..42ca0cc 100644 --- a/web/client/src/sections/bigScreen/components/realTime.js +++ b/web/client/src/sections/bigScreen/components/realTime.js @@ -19,6 +19,8 @@ const RealTime = ({ dispatch, actions, user, siteList, }) => { const [electro, setElectro] = useState({ week: 0, year: 0, day: 0 }) //用电概况 const [level, setLevel] = useState(0) //实时液位 + const [changeable, setChangeable] = useState(true) // 泵站是否可切换 + useEffect(() => { const autoStructId = sessionStorage.getItem('structId'); let nextStructId = siteList[0]?.value; @@ -26,6 +28,7 @@ const RealTime = ({ dispatch, actions, user, siteList, }) => { for (let i = 0; i < siteList.length; i++) { if (autoStructId == siteList[i].value) { nextStructId = siteList[i].value; + setChangeable(false); break; } } @@ -323,7 +326,7 @@ const RealTime = ({ dispatch, actions, user, siteList, }) => { backgroundSize: '100% 100%', backgroundPosition: 'center', backgroundRepeat: 'no-repeat', textAlign: 'center', lineHeight: '41px', fontSize: 20, color: '#FFF', fontStyle: "italic" }}>{siteList?.filter(v => v.value == strucId)[0]?.label}
-