update 退火-风机信息
This commit is contained in:
parent
85ed13d8f5
commit
cb0de3b5d0
@ -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 [
|
||||
|
@ -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>
|
||||
);
|
||||
|
23
src/store/features/annealFanInfoSlice.js
Normal file
23
src/store/features/annealFanInfoSlice.js
Normal 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;
|
@ -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;
|
||||
},
|
||||
},
|
||||
});
|
||||
|
@ -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,
|
||||
// 退火-风机运行频率
|
||||
|
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user