This commit is contained in:
lb
2023-12-14 13:57:49 +08:00
parent e4a2af8458
commit c3511e1bfe
4 changed files with 28 additions and 90 deletions

View File

@@ -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);