Browse Source

(*) 泵站跳转优化

master
liujiangyong 1 year ago
parent
commit
2aebb587f7
  1. 7
      web/client/src/sections/auth/containers/login.js
  2. 7
      web/client/src/sections/bigScreen/components/capacity.js
  3. 7
      web/client/src/sections/bigScreen/components/electrical.js
  4. 32
      web/client/src/sections/bigScreen/components/header.js
  5. 7
      web/client/src/sections/bigScreen/components/realTime.js
  6. 2
      web/client/src/sections/bigScreen/containers/systemManagement.js

7
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 = {};

7
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}</div>
<Select
{changeable && <Select
showSearch
placeholder="请选择站点"
value={strucId}
@ -694,7 +697,7 @@ const Capacity = ({ actions, dispatch, siteList, }) => {
setStrucId(v)
}}
options={siteList}
/>
/>}
</div>
</div>
{/* 进线柜 */}

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

@ -31,6 +31,8 @@ const Electrical = ({ dispatch, actions, 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;
@ -38,6 +40,7 @@ const Electrical = ({ dispatch, actions, siteList }) => {
for (let i = 0; i < siteList.length; i++) {
if (autoStructId == siteList[i].value) {
nextStructId = siteList[i].value;
setChangeable(false);
break;
}
}
@ -246,7 +249,7 @@ const Electrical = ({ dispatch, actions, 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}</div>
<Select
{changeable && <Select
showSearch
placeholder="请选择站点"
value={strucId}
@ -256,7 +259,7 @@ const Electrical = ({ dispatch, actions, siteList }) => {
setStrucId(v)
}}
options={siteList}
/>
/>}
</div>
</div>

32
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 <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>

7
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}</div>
<Select
{changeable && <Select
showSearch
placeholder="请选择站点"
value={strucId}
@ -333,7 +336,7 @@ const RealTime = ({ dispatch, actions, user, siteList, }) => {
setStrucId(v)
}}
options={siteList}
/>
/>}
</div>
</div>

2
web/client/src/sections/bigScreen/containers/systemManagement.js

@ -24,6 +24,8 @@ const SystemManagement = ({ dispatch, actions, user, history }) => {
useEffect(() => {
const tabKey = sessionStorage.getItem('tabKey');
if (tabKey) { setModule(tabKey) };
dispatch(bigScreen.axyData({ type: 'get', url: `organizations/{orgId}/structures` })).then(res => {
if (res.success) {
setSiteList(res.payload.data?.map(v => ({ value: v.id, label: v.name,iotaThingId: v.iotaThingId })) || [])

Loading…
Cancel
Save