Browse Source

水利加载性能优化

master
liujiangyong 1 year ago
parent
commit
33d9a7c96f
  1. 26
      super-screen/client/src/sections/water-prevention/containers/homePage.js

26
super-screen/client/src/sections/water-prevention/containers/homePage.js

@ -46,15 +46,26 @@ function homePage(props) {
const currentContainer = SCREEN_COMPONENTS[tab];
useEffect(() => {
getData();
getWaterData();
}, [])
const getData = () => {
// 水务
dispatch(waterLogin({ username: "123456", password: "123456", pcode: 'fce4afe2-5b6a-408a-ab18-a2afa7fa027c' })).then(loginRes => {
// 获取水务数据
const getWaterData = async () => {
const waterToken = sessionStorage.getItem('waterToken')
let token = waterToken;
if (!token) {
try {
const loginRes = await dispatch(waterLogin({ username: "123456", password: "123456", pcode: 'fce4afe2-5b6a-408a-ab18-a2afa7fa027c' }))
if (loginRes.success) {
const { token } = loginRes.payload.data;
sessionStorage.setItem('waterUser', JSON.stringify(loginRes.payload.data));
sessionStorage.setItem('waterToken', loginRes.payload.data.token);
token = loginRes.payload.data.token;
} else {
return;
}
} catch (error) {
return;
}
}
// 水位趋势
dispatch(getWaterLevelTrend({ orgId: 84, keyword: '', token })).then(trendRes => {
let fifterData = []
@ -130,9 +141,6 @@ function homePage(props) {
}
})
}
})
}
const getPumpStatusData = async (structId) => {
return await dispatch(getPumpStatus(structId));

Loading…
Cancel
Save