update 天然气数据

This commit is contained in:
lb
2023-11-30 17:01:30 +08:00
parent d65fc0e3ed
commit a880f62393
4 changed files with 144 additions and 115 deletions

View File

@@ -1,47 +1,56 @@
// 风机运行频率
// 天然气流量
import { createSlice } from "@reduxjs/toolkit";
/**
* 由于接口并没有经过合理的评审,所以这里的数据结构是不确定的,需要根据实际情况进行调整
*/
export const initialState = {
history: {
gasIHistory: {
// 历史数据
GAS1: [...Array.from({ length: 7 }, () => Math.floor(Math.random() * 100))],
GAS2: [...Array.from({ length: 7 }, () => Math.floor(Math.random() * 100))],
GAS3: [...Array.from({ length: 7 }, () => Math.floor(Math.random() * 100))],
GAS4: [...Array.from({ length: 7 }, () => Math.floor(Math.random() * 100))],
GAS5: [...Array.from({ length: 7 }, () => Math.floor(Math.random() * 100))],
GAS6: [...Array.from({ length: 7 }, () => Math.floor(Math.random() * 100))],
GAS7: [...Array.from({ length: 7 }, () => Math.floor(Math.random() * 100))],
GAS8: [...Array.from({ length: 7 }, () => Math.floor(Math.random() * 100))],
// GAS1: [...Array.from({ length: 7 }, () => Math.floor(Math.random() * 100))],
GAS1: [...Array.from({ length: 7 }, () => 0)],
GAS2: [...Array.from({ length: 7 }, () => 0)],
GAS3: [...Array.from({ length: 7 }, () => 0)],
GAS4: [...Array.from({ length: 7 }, () => 0)],
GAS5: [...Array.from({ length: 7 }, () => 0)],
GAS6: [...Array.from({ length: 7 }, () => 0)],
GAS7: [...Array.from({ length: 7 }, () => 0)],
GAS8: [...Array.from({ length: 7 }, () => 0)],
},
gasIIHistory: {
GAS1: [...Array.from({ length: 7 }, () => 0)],
GAS2: [...Array.from({ length: 7 }, () => 0)],
GAS3: [...Array.from({ length: 7 }, () => 0)],
GAS4: [...Array.from({ length: 7 }, () => 0)],
},
runtime: [
gasIRuntime: [
// 实时数据
...Array.from(
{ length: 8 },
() => Math.floor(Math.random() * 100) + "m³/h"
// () => Math.floor(Math.random() * 100) + "m³/h"
() => "0m³/h"
),
],
gasIIRuntime: [
// 实时数据
...Array.from({ length: 8 }, () => "0m³/h"),
],
};
// export const stateNameMap = {
// lastFireChangeTime: "10分20秒",
// fireChangeTime: "10:23",
// fireDirection: "东火",
// };
const gasSlice = createSlice({
name: "wind",
name: "natGas",
initialState,
reducers: {
setHistory: (state, action) => {
state.history = action.payload;
setGasIHistory: (state, action) => {
state.gasIHistory = action.payload;
},
setRuntime: (state, action) => {
state.runtime = action.payload;
setGasIIHistory: (state, action) => {
state.gasIIHistory = action.payload;
},
setGasIIRuntime: (state, action) => {
state.gasIRuntime = action.payload;
},
setGasIRuntime: (state, action) => {
state.gasIIRuntime = action.payload;
},
},
});