diff --git a/src/components/Common/AnnealFanRunFrequence/index.jsx b/src/components/Common/AnnealFanRunFrequence/index.jsx index fa1acb0..0c1602b 100644 --- a/src/components/Common/AnnealFanRunFrequence/index.jsx +++ b/src/components/Common/AnnealFanRunFrequence/index.jsx @@ -6,6 +6,7 @@ import { useEffect, useState } from "react"; import { useSelector } from "react-redux"; function WindFrequence(props) { + const [currLine, setCurrLine] = useState('1线') const [showChart, setShowChart] = useState(false); const [currentLine, setCurrentLine] = useState([]); const runState = useSelector((state) => state.annealFanFrequence.runtime); @@ -155,6 +156,7 @@ function WindFrequence(props) { function handleLineChange(line) { const lineNum = line[0]; + setCurrLine(line); setCurrentLine((old) => dataList.filter((item) => item?.name.startsWith(`${lineNum}#`)) ); @@ -169,6 +171,7 @@ function WindFrequence(props) { switchPosition={[null, 200]} // [top, left] onSwitch={handleSwitchChange} dateOptions={["1线", "2线", "3线", "4线", "5线"]} + defaultSelect={currLine} onDateChange={handleLineChange} >
diff --git a/src/components/Common/TemperatureBottom/index.jsx b/src/components/Common/TemperatureBottom/index.jsx index f23609b..25ff7f0 100644 --- a/src/components/Common/TemperatureBottom/index.jsx +++ b/src/components/Common/TemperatureBottom/index.jsx @@ -32,7 +32,7 @@ function TemperatureBottom(props) { }} > {Object.keys(tempBottom).map((d) => ( - + ))} ); diff --git a/src/components/Common/TemperatureTop/index.jsx b/src/components/Common/TemperatureTop/index.jsx index 6123da2..c563a60 100644 --- a/src/components/Common/TemperatureTop/index.jsx +++ b/src/components/Common/TemperatureTop/index.jsx @@ -36,7 +36,7 @@ function TemperatureTop(props) { }} > {Object.keys(tempTop).map((d) => ( - + ))} ); diff --git a/src/components/Common/TodayFaultTotal/index.jsx b/src/components/Common/TodayFaultTotal/index.jsx index 9c6603a..1635d4c 100644 --- a/src/components/Common/TodayFaultTotal/index.jsx +++ b/src/components/Common/TodayFaultTotal/index.jsx @@ -1,8 +1,8 @@ import cls from "./index.module.css"; import GraphBase from "../GraphBase"; import ReactECharts from "echarts-for-react"; -import { useSelector, useDispatch } from "react-redux"; -import { useEffect, useState } from "react"; +import { useSelector } from "react-redux"; +import { useState } from "react"; function preHandleStatisticData(data, legend) { const obj = {}; @@ -36,92 +36,8 @@ function preHandleStatisticData(data, legend) { return series; } -function FaultTotal(props) { - const [currentSelect, setCurrentSelect] = useState("日"); - const isra = useSelector((state) => state.isra); - // const dispatch = useDispatch(); - - // useEffect(() => { - // // 设置缺陷 - // dispatch({ - // type: "isra/setCheckTypeList", - // payload: [ - // "Lehrer", - // "Anwalt", - // "Professorin", - // "Professor", - // "Lehrerin", - // "Anwältin", - // ], - // }); - - // dispatch({ - // type: "isra/setDayStatistic", - // payload: [ - // // 产线1 - // { - // name: "10.1.1.1", - // sum: 500, - // data: [ - // { checkType: "Lehrer", checkNum: 100 }, - // { checkType: "Anwalt", checkNum: 200 }, - // { checkType: "Professor", checkNum: 200 }, - // ], - // }, - // // 产线2 - // { - // name: "10.1.1.2", - // sum: 730, - // data: [ - // { checkType: "Lehrer", checkNum: 200 }, - // { checkType: "Anwalt", checkNum: 130 }, - // { checkType: "Lehrerin", checkNum: 400 }, - // ], - // }, - // ], - // }); - - // dispatch({ - // type: "isra/setWeekStatistic", - // payload: [ - // // 产线1 - // { - // name: "10.1.1.1", - // sum: 500, - // data: [ - // { checkType: "Lehrerin", checkNum: 100 }, - // { checkType: "Anwalt", checkNum: 200 }, - // { checkType: "Professor", checkNum: 200 }, - // ], - // }, - // // 产线2 - // { - // name: "10.1.1.2", - // sum: 730, - // data: [ - // { checkType: "Professor", checkNum: 200 }, - // { checkType: "Anwalt", checkNum: 130 }, - // { checkType: "Lehrerin", checkNum: 400 }, - // ], - // }, - // ], - // }); - // }, []); - - const currentStatistic = - currentSelect == "日" - ? isra.dayStatistic - : currentSelect == "周" - ? isra.weekStatistic - : currentSelect == "月" - ? isra.monthStatistic - : currentSelect == "月" - ? isra.yearStatistic - : []; - - const series = preHandleStatisticData(currentStatistic, isra.checkTypeList); - - const options = { +function getOptions(series, isra, currentStatistic) { + return { color: ["#2760FF", "#8167F6", "#5B9BFF", "#99D66C", "#FFD160", "#FF8A40"], grid: { top: 42, right: 12, bottom: 20, left: 48 }, legend: { @@ -182,6 +98,25 @@ function FaultTotal(props) { trigger: "axis", }, }; +} + +function FaultTotal(props) { + const [currentSelect, setCurrentSelect] = useState("日"); + const isra = useSelector((state) => state.isra); + + const currentStatistic = + currentSelect == "日" + ? isra.dayStatistic + : currentSelect == "周" + ? isra.weekStatistic + : currentSelect == "月" + ? isra.monthStatistic + : currentSelect == "月" + ? isra.yearStatistic + : []; + + const series = preHandleStatisticData(currentStatistic, isra.checkTypeList); + const options = getOptions(series, isra, currentStatistic); function handleDateChange(v) { setCurrentSelect(v);