update 风机信息
This commit is contained in:
parent
ad305f0c46
commit
6eb4102863
@ -1,6 +1,6 @@
|
|||||||
import GraphBase from "../../Common/GraphBase";
|
import GraphBase from "../../Common/GraphBase";
|
||||||
import "./index.module.scss";
|
import "./index.module.scss";
|
||||||
|
import { useSelector } from "react-redux";
|
||||||
import { ScrollBoard } from "@jiaminghi/data-view-react";
|
import { ScrollBoard } from "@jiaminghi/data-view-react";
|
||||||
|
|
||||||
function getRandomRow() {
|
function getRandomRow() {
|
||||||
@ -14,21 +14,6 @@ function getRandomRows(rows) {
|
|||||||
.map(() => getRandomRow());
|
.map(() => getRandomRow());
|
||||||
}
|
}
|
||||||
|
|
||||||
// let data = [
|
|
||||||
// [1, '1#风机', 1], // 1 正常 2 故障 0 离线
|
|
||||||
// [2, '2#风机', 1],
|
|
||||||
// [3, '3#风机', 1],
|
|
||||||
// [4, '4#风机', 0],
|
|
||||||
// [5, '5#风机', 1],
|
|
||||||
// [6, '6#风机', 1],
|
|
||||||
// [7, '7#风机', 0],
|
|
||||||
// [8, '8#风机', 1],
|
|
||||||
// [9, '9#风机', 1],
|
|
||||||
// [10, '10#风机', 1],
|
|
||||||
// ];
|
|
||||||
|
|
||||||
// let header = ['序号', '风机名称', '故障情况'];
|
|
||||||
|
|
||||||
function attachStyle(data) {
|
function attachStyle(data) {
|
||||||
return data.map((arr) => {
|
return data.map((arr) => {
|
||||||
return arr.map((item, index) => {
|
return arr.map((item, index) => {
|
||||||
@ -49,7 +34,11 @@ function attachStyle(data) {
|
|||||||
|
|
||||||
function FanInfo(props) {
|
function FanInfo(props) {
|
||||||
const rowNum = props.rows || 8;
|
const rowNum = props.rows || 8;
|
||||||
let data = getRandomRows(100);
|
// let data = getRandomRows(100);
|
||||||
|
const fanInfo = useSelector((state) => state.fanInfo.fanInfo);
|
||||||
|
const data = Object.keys(fanInfo).map((key, index) => {
|
||||||
|
return [index+1, key, fanInfo[key] == "正常" ? 1 : 0];
|
||||||
|
});
|
||||||
|
|
||||||
let config = {
|
let config = {
|
||||||
headerBGC: "rgba(4, 44, 76, 0.3)",
|
headerBGC: "rgba(4, 44, 76, 0.3)",
|
||||||
@ -62,9 +51,7 @@ function FanInfo(props) {
|
|||||||
evenRowBGC: "#042c4c",
|
evenRowBGC: "#042c4c",
|
||||||
columnWidth: [70, 96],
|
columnWidth: [70, 96],
|
||||||
rowNum,
|
rowNum,
|
||||||
// headerHeight: 40,
|
|
||||||
hoverPause: false,
|
hoverPause: false,
|
||||||
// data: replaceStyle(data, 0.7),
|
|
||||||
data: attachStyle(data),
|
data: attachStyle(data),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -2,69 +2,20 @@
|
|||||||
import { createSlice } from "@reduxjs/toolkit";
|
import { createSlice } from "@reduxjs/toolkit";
|
||||||
|
|
||||||
export const initialState = {
|
export const initialState = {
|
||||||
history: {
|
fanInfo: {
|
||||||
// 历史数据
|
测试001: "正常",
|
||||||
FLIIA1: [
|
|
||||||
// 帮我生成7个随机整数
|
|
||||||
...Array.from({ length: 7 }, () => Math.floor(Math.random() * 100)),
|
|
||||||
],
|
|
||||||
// 帮我重复上面的模式十次
|
|
||||||
FLIIA2: [
|
|
||||||
...Array.from({ length: 7 }, () => Math.floor(Math.random() * 100)),
|
|
||||||
],
|
|
||||||
FLIIA3: [
|
|
||||||
...Array.from({ length: 7 }, () => Math.floor(Math.random() * 100)),
|
|
||||||
],
|
|
||||||
FLIIA4: [
|
|
||||||
...Array.from({ length: 7 }, () => Math.floor(Math.random() * 100)),
|
|
||||||
],
|
|
||||||
FLIIA5: [
|
|
||||||
...Array.from({ length: 7 }, () => Math.floor(Math.random() * 100)),
|
|
||||||
],
|
|
||||||
FLIIA6: [
|
|
||||||
...Array.from({ length: 7 }, () => Math.floor(Math.random() * 100)),
|
|
||||||
],
|
|
||||||
FLIIA7: [
|
|
||||||
...Array.from({ length: 7 }, () => Math.floor(Math.random() * 100)),
|
|
||||||
],
|
|
||||||
FLIIA8: [
|
|
||||||
...Array.from({ length: 7 }, () => Math.floor(Math.random() * 100)),
|
|
||||||
],
|
|
||||||
FLIIB1: [
|
|
||||||
...Array.from({ length: 7 }, () => Math.floor(Math.random() * 100)),
|
|
||||||
],
|
|
||||||
FLIIB2: [
|
|
||||||
...Array.from({ length: 7 }, () => Math.floor(Math.random() * 100)),
|
|
||||||
],
|
|
||||||
},
|
},
|
||||||
|
|
||||||
runtime: [
|
|
||||||
// 实时数据
|
|
||||||
...Array.from(
|
|
||||||
{ length: 16 },
|
|
||||||
() => Math.floor(Math.random() * 100) + "m³/h"
|
|
||||||
),
|
|
||||||
],
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// export const stateNameMap = {
|
const fanInfoSlice = createSlice({
|
||||||
// lastFireChangeTime: "10分20秒",
|
name: "fanInfo",
|
||||||
// fireChangeTime: "10:23",
|
|
||||||
// fireDirection: "东火",
|
|
||||||
// };
|
|
||||||
|
|
||||||
const fanFrequenceSlice = createSlice({
|
|
||||||
name: "fanFrequence",
|
|
||||||
initialState,
|
initialState,
|
||||||
reducers: {
|
reducers: {
|
||||||
setHistory: (state, action) => {
|
setInfo: (state, action) => {
|
||||||
state.history = action.payload;
|
state.fanInfo = action.payload;
|
||||||
},
|
|
||||||
setRuntime: (state, action) => {
|
|
||||||
state.runtime = action.payload;
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
export default fanFrequenceSlice.reducer;
|
export default fanInfoSlice.reducer;
|
||||||
export const { setHistory, setRuntime } = fanFrequenceSlice.actions;
|
export const { setInfo } = fanInfoSlice.actions;
|
||||||
|
@ -6,6 +6,7 @@ import fanFrequenceReducer from "./features/fanFrequenceSlice";
|
|||||||
import combustionAirReducer from "./features/combustionAirSlice";
|
import combustionAirReducer from "./features/combustionAirSlice";
|
||||||
import gasReducer from "./features/gasSlice";
|
import gasReducer from "./features/gasSlice";
|
||||||
import temperatureReducer from "./features/temperatureSlice";
|
import temperatureReducer from "./features/temperatureSlice";
|
||||||
|
import fanInfoReducer from "./features/fanInfo";
|
||||||
|
|
||||||
export const store = configureStore({
|
export const store = configureStore({
|
||||||
reducer: {
|
reducer: {
|
||||||
@ -15,6 +16,8 @@ export const store = configureStore({
|
|||||||
feeder: feederReducer,
|
feeder: feederReducer,
|
||||||
// 火向信息
|
// 火向信息
|
||||||
fireInfo: fireReducer,
|
fireInfo: fireReducer,
|
||||||
|
// 火向信息
|
||||||
|
fanInfo: fanInfoReducer,
|
||||||
// 风机运行频率
|
// 风机运行频率
|
||||||
fanFrequence: fanFrequenceReducer,
|
fanFrequence: fanFrequenceReducer,
|
||||||
// 天然气流量
|
// 天然气流量
|
||||||
|
@ -113,6 +113,11 @@ export class WsClient {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case "FanInfo": {
|
case "FanInfo": {
|
||||||
|
// 风机信息
|
||||||
|
store.dispatch({
|
||||||
|
type: "fanInfo/setInfo",
|
||||||
|
payload: serializedData.data,
|
||||||
|
});
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
|
Loading…
Reference in New Issue
Block a user