update energy

This commit is contained in:
lb 2023-12-06 16:46:44 +08:00
parent 42e5bea184
commit eadbfcb982
3 changed files with 40 additions and 36 deletions

View File

@ -1,33 +1,46 @@
import cls from './index.module.scss'; import cls from "./index.module.scss";
import Container from '../../Container'; import Container from "../../Container";
import TechSplitline from '../TechSplitline'; import TechSplitline from "../TechSplitline";
import EnergyCostChart from './EnergyCostChart'; import EnergyCostChart from "./EnergyCostChart";
import { useSelector } from "react-redux";
function EnergyCost(props) { function EnergyCost(props) {
return ( const energyInfo = useSelector((state) => state.energy?.info);
<Container title="能耗" icon="charger" className={cls.energyCost}> console.log("energyInfo", energyInfo);
<div className={`flex flex-col`}> if (energyInfo) {
<div className={`${cls.cost__info} flex`}> }
<div return (
className={`${cls.info__item} ${cls.hAuto} flex flex-col justify-center items-center self-stretch`} <Container title="能耗" icon="charger" className={cls.energyCost}>
> <div className={`flex flex-col`}>
<span> </span> <div className={`${cls.cost__info} flex`}>
<span>922kWh</span> <div
</div> className={`${cls.info__item} ${cls.hAuto} flex flex-col justify-center items-center self-stretch`}
<div className={cls.info__item_groups}> >
<div className={cls.info__item}> : 32Km³</div> <span> </span>
<div className={cls.info__item}> I : 83</div> <span>{energyInfo?.elecQty1 || 0}kWh</span>
<div className={cls.info__item}> : 52kWh</div> </div>
<div className={cls.info__item}> II: 32</div> <div className={cls.info__item_groups}>
</div> <div className={cls.info__item}>
</div> : {energyInfo?.waterQty || 0}Km³
</div>
<div className={cls.info__item}>
I : {energyInfo?.ngQty1 || 0}
</div>
<div className={cls.info__item}>
: {energyInfo?.elecQty2 || 0}kWh
</div>
<div className={cls.info__item}>
II: {energyInfo?.ngQty2 || 0}
</div>
</div>
</div>
<TechSplitline /> <TechSplitline />
<EnergyCostChart /> <EnergyCostChart />
</div> </div>
</Container> </Container>
); );
} }
export default EnergyCost; export default EnergyCost;

View File

@ -4,11 +4,10 @@ import { Provider } from "react-redux";
import { store } from "./store"; import { store } from "./store";
import App from "./App"; import App from "./App";
import "./index.css"; import "./index.css";
import { WsClient } from "./utils"; import "./utils";
const container = document.getElementById("root"); const container = document.getElementById("root");
const root = createRoot(container); const root = createRoot(container);
const wsc = new WsClient();
root.render( root.render(
<React.StrictMode> <React.StrictMode>

View File

@ -133,14 +133,6 @@ new XClient(
}); });
break; break;
} }
case "energyInfo": {
// 能耗数据
store.dispatch({
type: "energy/setInfo",
payload: serializedData.data,
});
break;
}
default: { default: {
console.log("websocket message: [unknown] ---> ", msg.data); console.log("websocket message: [unknown] ---> ", msg.data);
} }