connect KilnInfo

This commit is contained in:
lb
2023-11-30 16:07:41 +08:00
parent bc03a717bb
commit af531456f4
3 changed files with 70 additions and 49 deletions

View File

@@ -6,30 +6,30 @@ import { stateNameMap } from "../../../store/features/kilnSlice";
export default function Kiln() {
const kilnInfo = useSelector((state) => state.kiln);
const dispatch = useDispatch();
// const dispatch = useDispatch();
const infos = Object.keys(kilnInfo).map((key) => ({
label: stateNameMap[key],
value: kilnInfo[key],
}));
useEffect(() => {
setInterval(() => {
dispatch({
type: "kiln/setKilnInfo",
payload: {
kilnPressure: Math.ceil(Math.random() * 100) + "Pa",
waterTemp: Math.ceil(Math.random() * 100) + "℃",
waterFlow: Math.ceil(Math.random() * 100) + "m³/h",
waterPressure: Math.ceil(Math.random() * 100) + "Pa",
combustionAirPressure: Math.ceil(Math.random() * 100) + "Pa",
topTemp: Math.ceil(Math.random() * 100) + "℃",
compressedAirPressure: Math.ceil(Math.random() * 100) + "Pa",
meltTemp: Math.ceil(Math.random() * 100) + "℃",
},
});
}, 30000);
}, [dispatch]);
// useEffect(() => {
// setInterval(() => {
// dispatch({
// type: "kiln/setKilnInfo",
// payload: {
// kilnPressure: Math.ceil(Math.random() * 100) + "Pa",
// waterTemp: Math.ceil(Math.random() * 100) + "℃",
// waterFlow: Math.ceil(Math.random() * 100) + "m³/h",
// waterPressure: Math.ceil(Math.random() * 100) + "Pa",
// combustionAirPressure: Math.ceil(Math.random() * 100) + "Pa",
// topTemp: Math.ceil(Math.random() * 100) + "℃",
// compressedAirPressure: Math.ceil(Math.random() * 100) + "Pa",
// meltTemp: Math.ceil(Math.random() * 100) + "℃",
// },
// });
// }, 30000);
// }, [dispatch]);
// const infos = [
// { label: "窑炉压力", value: ctx?.runState?.kilnPressure || "0Pa" },