update 天然气流量

This commit is contained in:
lb
2023-12-01 09:31:44 +08:00
parent a880f62393
commit d1d47cf5ac
6 changed files with 61 additions and 56 deletions

View File

@@ -5,8 +5,8 @@ import { useSelector, useDispatch } from "react-redux";
function GasChart(props) {
const { dataSource } = props;
const hisState = useSelector((state) => state.combustionAir.runtime);
const dataName = dataSource == "gas-i" ? "hisGas1" : "hisGas2";
const hisState = useSelector((state) => state.natGas.history);
const dataName = dataSource == "gas-i" ? "gasIHistory" : "gasIIHistory";
const seriesData = hisState?.[dataName]
? Object.keys(hisState?.[dataName])

View File

@@ -1,5 +1,5 @@
import cls from "./index.module.css";
import { useEffect, useState } from "react";
import { useSelector } from "react-redux";
function getData(type) {
let data = [];
@@ -30,14 +30,16 @@ function getData(type) {
}
function GridList(props) {
// const { runState } = useContext(SocketContext);
const runState = null;
const runState = useSelector((state) => state.natGas.runtime);
const key = props.dataSource == "gas-i" ? "gasFlowArr" : "furnaceGasFlowArr";
const key = props.dataSource == "gas-i" ? "gasIRuntime" : "gasIIRuntime";
let dataList = getData(props.dataSource);
dataList = runState?.[key]
? dataList.map((v, i) => ({ ...v, value: runState[key][i] ?? "/" }))
? dataList.map((v, i) => ({
...v,
value: (runState[key][i] || 0) + "m³/h",
}))
: dataList;
return (