import React, { useEffect, useState, useRef } 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 moment from 'moment' import CardTitle from './public/cardTitle' import SimpleBar from 'simplebar-react'; import Left_1 from './basis/left_1'; import Right_1 from './basis/right_1'; import Right_2 from './basis/right_2'; import { POWER_STATIONS } from './shuizhan_detail'; import './basis.less' const Basis = ({ actions, dispatch, setshowData, siteList, siteData, waterLevelSix, waterPumpStateAll }) => { const { bigScreen } = actions const [strucId, setStrucId] = useState() //站点ID const [information, setInformation] = useState({}) const [pumpInformation, setPumpInformation] = useState({}) const [pumpNumber, setPumpNumber] = useState(0) useEffect(() => { dispatch(bigScreen.pumpInformation({})).then(res => { if (res.success) { setPumpInformation(res.payload.data || []) } }) }, []) useEffect(() => { if (pumpInformation && strucId) { setInformation(Object.values(pumpInformation)?.find(v => v.structId == strucId) || {}) } }, [pumpInformation, strucId]) useEffect(() => { if (waterPumpStateAll?.length) { let num = 0 waterPumpStateAll?.forEach(v => { num += v.data.length || 0 }) setPumpNumber(num) } }, [waterPumpStateAll]) useEffect(async () => { if (siteData) { //水泵状态 dispatch(bigScreen.getWaterPumpStateAll({ key: 'waterPumpStateAll', methodType: 'get', })) } }, [siteData]) useEffect(() => { 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; } if (i === siteList.length - 1) { alert('泵站系统暂未接入此泵站'); } } } setStrucId(nextStructId); }, [siteList]) useEffect(() => { if (strucId) { //泵站水位数据 dispatch(bigScreen.getWaterLevelSix({ key: 'waterLevelSix', methodType: 'hget', field: 'struc' + strucId })) } }, [strucId]) return
站点
编号
{waterPumpStateAll?.map(v =>
{v.name}
{v.data?.map((s, i) => ) }
)}
泵站数量:{siteList?.length || 0}
提升泵数量:{pumpNumber || 0}
} function mapStateToProps (state) { const { auth, global, waterLevelSix, waterPumpStateAll } = state; return { user: auth.user, clientHeight: global.clientHeight, actions: global.actions, waterLevelSix: waterLevelSix?.data || [], waterPumpStateAll: waterPumpStateAll?.data || [], }; } export default connect(mapStateToProps)(Basis);