update energy
This commit is contained in:
		@@ -1,33 +1,46 @@
 | 
			
		||||
import cls from './index.module.scss';
 | 
			
		||||
import Container from '../../Container';
 | 
			
		||||
import TechSplitline from '../TechSplitline';
 | 
			
		||||
import EnergyCostChart from './EnergyCostChart';
 | 
			
		||||
import cls from "./index.module.scss";
 | 
			
		||||
import Container from "../../Container";
 | 
			
		||||
import TechSplitline from "../TechSplitline";
 | 
			
		||||
import EnergyCostChart from "./EnergyCostChart";
 | 
			
		||||
import { useSelector } from "react-redux";
 | 
			
		||||
 | 
			
		||||
function EnergyCost(props) {
 | 
			
		||||
	return (
 | 
			
		||||
		<Container title="能耗" icon="charger" className={cls.energyCost}>
 | 
			
		||||
			<div className={`flex flex-col`}>
 | 
			
		||||
				<div className={`${cls.cost__info} flex`}>
 | 
			
		||||
					<div
 | 
			
		||||
						className={`${cls.info__item} ${cls.hAuto} flex flex-col justify-center items-center self-stretch`}
 | 
			
		||||
					>
 | 
			
		||||
						<span>余 热 发 电</span>
 | 
			
		||||
						<span>922kWh</span>
 | 
			
		||||
					</div>
 | 
			
		||||
					<div className={cls.info__item_groups}>
 | 
			
		||||
						<div className={cls.info__item}>水 耗 量 : 32Km³</div>
 | 
			
		||||
						<div className={cls.info__item}>天 然 气 I : 83m³</div>
 | 
			
		||||
						<div className={cls.info__item}>电 耗 量 : 52kWh</div>
 | 
			
		||||
						<div className={cls.info__item}>天 然 气 II: 32m³</div>
 | 
			
		||||
					</div>
 | 
			
		||||
				</div>
 | 
			
		||||
  const energyInfo = useSelector((state) => state.energy?.info);
 | 
			
		||||
  console.log("energyInfo", energyInfo);
 | 
			
		||||
  if (energyInfo) {
 | 
			
		||||
  }
 | 
			
		||||
  return (
 | 
			
		||||
    <Container title="能耗" icon="charger" className={cls.energyCost}>
 | 
			
		||||
      <div className={`flex flex-col`}>
 | 
			
		||||
        <div className={`${cls.cost__info} flex`}>
 | 
			
		||||
          <div
 | 
			
		||||
            className={`${cls.info__item} ${cls.hAuto} flex flex-col justify-center items-center self-stretch`}
 | 
			
		||||
          >
 | 
			
		||||
            <span>余 热 发 电</span>
 | 
			
		||||
            <span>{energyInfo?.elecQty1 || 0}kWh</span>
 | 
			
		||||
          </div>
 | 
			
		||||
          <div className={cls.info__item_groups}>
 | 
			
		||||
            <div className={cls.info__item}>
 | 
			
		||||
              水 耗 量 : {energyInfo?.waterQty || 0}Km³
 | 
			
		||||
            </div>
 | 
			
		||||
            <div className={cls.info__item}>
 | 
			
		||||
              天 然 气 I : {energyInfo?.ngQty1 || 0}m³
 | 
			
		||||
            </div>
 | 
			
		||||
            <div className={cls.info__item}>
 | 
			
		||||
              电 耗 量 : {energyInfo?.elecQty2 || 0}kWh
 | 
			
		||||
            </div>
 | 
			
		||||
            <div className={cls.info__item}>
 | 
			
		||||
              天 然 气 II: {energyInfo?.ngQty2 || 0}m³
 | 
			
		||||
            </div>
 | 
			
		||||
          </div>
 | 
			
		||||
        </div>
 | 
			
		||||
 | 
			
		||||
				<TechSplitline />
 | 
			
		||||
        <TechSplitline />
 | 
			
		||||
 | 
			
		||||
				<EnergyCostChart />
 | 
			
		||||
			</div>
 | 
			
		||||
		</Container>
 | 
			
		||||
	);
 | 
			
		||||
        <EnergyCostChart />
 | 
			
		||||
      </div>
 | 
			
		||||
    </Container>
 | 
			
		||||
  );
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export default EnergyCost;
 | 
			
		||||
 
 | 
			
		||||
@@ -4,11 +4,10 @@ import { Provider } from "react-redux";
 | 
			
		||||
import { store } from "./store";
 | 
			
		||||
import App from "./App";
 | 
			
		||||
import "./index.css";
 | 
			
		||||
import { WsClient } from "./utils";
 | 
			
		||||
import "./utils";
 | 
			
		||||
 | 
			
		||||
const container = document.getElementById("root");
 | 
			
		||||
const root = createRoot(container);
 | 
			
		||||
const wsc = new WsClient();
 | 
			
		||||
 | 
			
		||||
root.render(
 | 
			
		||||
  <React.StrictMode>
 | 
			
		||||
 
 | 
			
		||||
@@ -133,14 +133,6 @@ new XClient(
 | 
			
		||||
        });
 | 
			
		||||
        break;
 | 
			
		||||
      }
 | 
			
		||||
      case "energyInfo": {
 | 
			
		||||
        // 能耗数据
 | 
			
		||||
        store.dispatch({
 | 
			
		||||
          type: "energy/setInfo",
 | 
			
		||||
          payload: serializedData.data,
 | 
			
		||||
        });
 | 
			
		||||
        break;
 | 
			
		||||
      }
 | 
			
		||||
      default: {
 | 
			
		||||
        console.log("websocket message: [unknown] --->  ", msg.data);
 | 
			
		||||
      }
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user