import GraphBase from "../../Common/GraphBase"; import "./index.module.scss"; import { useSelector } from "react-redux"; import { ScrollBoard } from "@jiaminghi/data-view-react"; function attachStyle(data) { return data.map((arr) => { return arr.map((item, index) => { if (index == arr.length - 1) { return `
${item == 1 ? "运行" : item == 0 ? "故障" : "未运行"}
`; } return `${item}`; }); }); } function FanInfo(props) { const rowNum = props.rows || 8; // 默认使用风机信息,可以使用 source 来调整该组件使用 annealFanInfo 的数据 const fanInfo = useSelector((state) => state[props.source ?? "fanInfo"].data); const data = Object.keys(fanInfo).map((key, index) => { return [ index + 1, key, fanInfo[key] == "运行" ? 1 : fanInfo[key] == "故障" ? 0 : 2, ]; }); const dataRight = [...data.slice(rowNum), ...data.slice(0, rowNum)]; let config = { headerBGC: "rgba(4, 44, 76, 0.3)", header: [ '序号', '风机名称', '故障情况', ], oddRowBGC: "#042444", evenRowBGC: "#042c4c", // columnWidth: data.length > 12 ? [50, 136] : [88, 256], columnWidth: [50, 136], rowNum, hoverPause: true, data: attachStyle(data), }; return (
12 ? "20px" : 0, height: "100%", position: "relative", }} >
12 ? "280px" : "100%", height: "100%", }} />
{/* {data.length > 12 && ( <> */}
{/* )} */}
); } export default FanInfo;