update 退火-风机信息

This commit is contained in:
lb 2023-12-11 16:04:46 +08:00
parent 85ed13d8f5
commit cb0de3b5d0
6 changed files with 56 additions and 21 deletions

View File

@ -23,7 +23,8 @@ function attachStyle(data) {
function FanInfo(props) {
const rowNum = props.rows || 8;
const fanInfo = useSelector((state) => state.fanInfo.fanInfo);
// 使使 source 使 annealFanInfo
const fanInfo = useSelector((state) => state[props.source ?? "fanInfo"].data);
const data = Object.keys(fanInfo).map((key, index) => {
return [

View File

@ -18,7 +18,7 @@ export default function index() {
transition={{ type: 'tween' }}
>
<div style={{ flex: 1 }}>
<FanInfo longBg={true} rows={24} />
<FanInfo longBg={true} rows={24} source="annealFanInfo" />
</div>
</motion.div>
);

View File

@ -0,0 +1,23 @@
// 风机信息
import { createSlice } from "@reduxjs/toolkit";
export const initialState = {
data: {
正常数据: "运行",
故障数据: "故障",
其他数据: "其他",
},
};
const annealFanInfoSlice = createSlice({
name: "annealFanInfo",
initialState,
reducers: {
setInfo: (state, action) => {
state.data = action.payload;
},
},
});
export default annealFanInfoSlice.reducer;
export const { setInfo } = annealFanInfoSlice.actions;

View File

@ -2,8 +2,8 @@
import { createSlice } from "@reduxjs/toolkit";
export const initialState = {
fanInfo: {
测试001: "正常",
data: {
测试001: "运行",
},
};
@ -12,7 +12,7 @@ const fanInfoSlice = createSlice({
initialState,
reducers: {
setInfo: (state, action) => {
state.fanInfo = action.payload.fanInfo;
state.data = action.payload;
},
},
});

View File

@ -10,6 +10,7 @@ import annealTemperatureReducer from "./features/annealTemperatureSlice";
import fanInfoReducer from "./features/fanInfo";
import energySlice from "./features/EnergySlice";
import annealFanFrequenceReducer from "./features/annealFanFrequenceSlice";
import annealFanInfoReducer from "./features/annealFanInfoSlice";
export const store = configureStore({
reducer: {
@ -21,6 +22,8 @@ export const store = configureStore({
fireInfo: fireReducer,
// 风机信息
fanInfo: fanInfoReducer,
// 风机信息
annealFanInfo: annealFanInfoReducer,
// 风机运行频率
fanFrequence: fanFrequenceReducer,
// 退火-风机运行频率

View File

@ -94,14 +94,6 @@ new XClient(
// 风机运行频率 历史 暂无
break;
}
case "AnnealFanFrequencyInfo": {
// 退火页面,风机运行频率 暂时只有实时数据
store.dispatch({
type: "annealFanFrequence/setRuntime",
payload: serializedData.data.AnnealFanFrequencyInfo,
});
break;
}
case "TopTempInfo": {
// 碹顶温度列表
store.dispatch({
@ -118,14 +110,6 @@ new XClient(
});
break;
}
case "AnnealTempInfo": {
// 退火监测温度列表
store.dispatch({
type: "annealTemperature/setTemp",
payload: serializedData.data,
});
break;
}
case "FeederInfo": {
// 投料机信息
store.dispatch({
@ -146,10 +130,34 @@ new XClient(
// 风机信息
store.dispatch({
type: "fanInfo/setInfo",
payload: serializedData.data.fanInfo,
});
break;
}
case "AnnealFanFrequencyInfo": {
// 退火-风机运行频率
store.dispatch({
type: "annealFanFrequence/setRuntime",
payload: serializedData.data.AnnealFanFrequencyInfo,
});
break;
}
case "AnnealTempInfo": {
// 退火-温度列表
store.dispatch({
type: "annealTemperature/setTemp",
payload: serializedData.data,
});
break;
}
case "AnnealFanInfo": {
// 退火-风机故障信息
store.dispatch({
type: "annealFanInfo/setInfo",
payload: serializedData.data.annealFanInfo,
});
break;
}
default: {
console.log("websocket message: [unknown] ---> ", msg.data);
}