wenlele 2 years ago
parent
commit
1237bea658
  1. 21
      web/client/src/sections/auth/containers/login.js
  2. 19
      web/client/src/sections/bigScreen/components/basis.js
  3. 16
      web/client/src/sections/bigScreen/components/capacity.js
  4. 13
      web/client/src/sections/bigScreen/components/electrical.js
  5. 15
      web/client/src/sections/bigScreen/components/realTime.js

21
web/client/src/sections/auth/containers/login.js

@ -26,11 +26,16 @@ const Login = props => {
const [codCountDown, setCodeCountDown] = useState(60)
const codCountDownRef = useRef(0)
const [form] = Form.useForm();
useEffect(() => {
useEffect(() => {
// 水环境跳转自动登录
const structId = getUrlParams(window.location.search)?.structId;
if (structId) {
sessionStorage.setItem('structId', structId);
dispatch(login({ username: 'SuperAdmin', password: '123456' }));
}
}, [])
useEffect(() => {
if (user && user.authorized) {
dispatch(push('/systemManagement'));
@ -163,3 +168,15 @@ function mapStateToProps (state) {
}
export default connect(mapStateToProps)(Login);
function getUrlParams(url) {
if (!url) return;
let arr = url.split('?');
let params = arr[1].split('&');
let obj = {};
for (let i = 0; i < params.length; i++) {
let param = params[i].split('=');
obj[param[0]] = param[1];
}
return obj;
}

19
web/client/src/sections/bigScreen/components/basis.js

@ -46,8 +46,6 @@ const Basis = ({ actions, dispatch, setshowData, siteList, siteData }) => {
useEffect(async () => {
if (siteData) {
setStrucId(siteData[0]?.id)
//获取所有泵站的集水池液位
siteData?.map(async v => {
await dispatch(bigScreen.axyData({ type: 'get', url: `structures/${v.id}/factors` })).then(async r => {
@ -125,12 +123,21 @@ const Basis = ({ actions, dispatch, setshowData, siteList, siteData }) => {
}, [siteData])
useEffect(() => {
setStrucId(siteList[0]?.value)
const autoStructId = sessionStorage.getItem('structId');
let nextStructId = siteList[0]?.value;
if (autoStructId) {
for (let i = 0; i < siteList.length; i++) {
if (autoStructId == siteList[i].value) {
nextStructId = siteList[i].value;
break;
}
}
}
setStrucId(nextStructId);
}, [siteList])
useEffect(async () => {
if (strucId) {
await dispatch(bigScreen.axyData({ type: 'get', url: `structures/${strucId}/factors` })).then(async r => {
//泵站信息
let informationId = r.payload.data?.find(v => v.name == '泵站信息')?.id
@ -155,16 +162,12 @@ const Basis = ({ actions, dispatch, setshowData, siteList, siteData }) => {
}
})
}
})
}
})
}
}, [strucId])
return <div className='super-screen-body'>
<div className='super-screen-card left'>
<Left_1 data={left1Data.current} />

16
web/client/src/sections/bigScreen/components/capacity.js

@ -21,12 +21,18 @@ const Capacity = ({ actions, dispatch, siteList, }) => {
const [electricityTrend, setElectricityTrend] = useState([]) //电流趋势
const [useTrend, setUseTrend] = useState([]) //用电趋势
useEffect(() => {
setStrucId(siteList[0]?.value)
const autoStructId = sessionStorage.getItem('structId');
let nextStructId = siteList[0]?.value;
if (autoStructId) {
for (let i = 0; i < siteList.length; i++) {
if (autoStructId == siteList[i].value) {
nextStructId = siteList[i].value;
break;
}
}
}
setStrucId(nextStructId);
}, [siteList])
useEffect(async () => {

13
web/client/src/sections/bigScreen/components/electrical.js

@ -31,9 +31,18 @@ const Electrical = ({ dispatch, actions, siteList }) => {
const [electricityTrend, setElectricityTrend] = useState([]) //电流趋势
const [useTrend, setUseTrend] = useState([]) //用电趋势
useEffect(() => {
setStrucId(siteList[0]?.value)
const autoStructId = sessionStorage.getItem('structId');
let nextStructId = siteList[0]?.value;
if (autoStructId) {
for (let i = 0; i < siteList.length; i++) {
if (autoStructId == siteList[i].value) {
nextStructId = siteList[i].value;
break;
}
}
}
setStrucId(nextStructId);
}, [siteList])
useEffect(async () => {

15
web/client/src/sections/bigScreen/components/realTime.js

@ -19,11 +19,18 @@ const RealTime = ({ dispatch, actions, user, siteList, }) => {
const [electro, setElectro] = useState({ week: 0, year: 0, day: 0 }) //用电概况
const [level, setLevel] = useState(0) //实时液位
useEffect(() => {
setStrucId(siteList[0]?.value)
const autoStructId = sessionStorage.getItem('structId');
let nextStructId = siteList[0]?.value;
if (autoStructId) {
for (let i = 0; i < siteList.length; i++) {
if (autoStructId == siteList[i].value) {
nextStructId = siteList[i].value;
break;
}
}
}
setStrucId(nextStructId);
}, [siteList])
useEffect(async () => {

Loading…
Cancel
Save