update 风机信息

This commit is contained in:
lb
2023-12-01 16:15:32 +08:00
parent ad305f0c46
commit 6eb4102863
4 changed files with 22 additions and 76 deletions

View File

@@ -1,6 +1,6 @@
import GraphBase from "../../Common/GraphBase";
import "./index.module.scss";
import { useSelector } from "react-redux";
import { ScrollBoard } from "@jiaminghi/data-view-react";
function getRandomRow() {
@@ -14,21 +14,6 @@ function getRandomRows(rows) {
.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) {
return data.map((arr) => {
return arr.map((item, index) => {
@@ -49,7 +34,11 @@ function attachStyle(data) {
function FanInfo(props) {
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 = {
headerBGC: "rgba(4, 44, 76, 0.3)",
@@ -62,9 +51,7 @@ function FanInfo(props) {
evenRowBGC: "#042c4c",
columnWidth: [70, 96],
rowNum,
// headerHeight: 40,
hoverPause: false,
// data: replaceStyle(data, 0.7),
data: attachStyle(data),
};