update
This commit is contained in:
		@@ -6,7 +6,7 @@ import { useEffect, useState } from "react";
 | 
			
		||||
import { useSelector } from "react-redux";
 | 
			
		||||
 | 
			
		||||
function WindFrequence(props) {
 | 
			
		||||
  const [currLine, setCurrLine] = useState('1线')
 | 
			
		||||
  const [currLine, setCurrLine] = useState('Y61')
 | 
			
		||||
  const [showChart, setShowChart] = useState(false);
 | 
			
		||||
  const [currentLine, setCurrentLine] = useState([]);
 | 
			
		||||
  const runState = useSelector((state) => state.annealFanFrequence.runtime);
 | 
			
		||||
@@ -155,7 +155,7 @@ function WindFrequence(props) {
 | 
			
		||||
  }, [showChart]);
 | 
			
		||||
 | 
			
		||||
  function handleLineChange(line) {
 | 
			
		||||
    const lineNum = line[0];
 | 
			
		||||
    const lineNum = line[2];
 | 
			
		||||
    setCurrLine(line);
 | 
			
		||||
    setCurrentLine((old) =>
 | 
			
		||||
      dataList.filter((item) => item?.name.startsWith(`${lineNum}#`))
 | 
			
		||||
@@ -170,7 +170,7 @@ function WindFrequence(props) {
 | 
			
		||||
      switchOptions={false}
 | 
			
		||||
      switchPosition={[null, 200]} // [top, left]
 | 
			
		||||
      onSwitch={handleSwitchChange}
 | 
			
		||||
      dateOptions={["1线", "2线", "3线", "4线", "5线"]}
 | 
			
		||||
      dateOptions={["Y61", "Y62", "Y63", "Y64", "Y65"]}
 | 
			
		||||
      defaultSelect={currLine}
 | 
			
		||||
      onDateChange={handleLineChange}
 | 
			
		||||
    >
 | 
			
		||||
 
 | 
			
		||||
@@ -43,17 +43,17 @@ const SmallBox = (props) => {
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
function WindFrequence(props) {
 | 
			
		||||
  const [dataSource, setDataSource] = useState("1线");
 | 
			
		||||
  const [dataSource, setDataSource] = useState("Y61");
 | 
			
		||||
  const [currentLineTemp, setCurrentLineTemp] = useState([]);
 | 
			
		||||
  const currentTempList = useSelector((state) => state.annealTemperature?.data);
 | 
			
		||||
 | 
			
		||||
  const lines = ["Y61", "Y62", "Y63", "Y64", "Y65"];
 | 
			
		||||
  function handleSourceChange(line) {
 | 
			
		||||
    setDataSource(line);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  useEffect(() => {
 | 
			
		||||
    setCurrentLineTemp(
 | 
			
		||||
      (currentTempList && currentTempList[dataSource.replace("线", "#")]) || []
 | 
			
		||||
      (currentTempList && currentTempList[1+lines.indexOf(dataSource)+'#']) || []
 | 
			
		||||
    );
 | 
			
		||||
  }, [dataSource]);
 | 
			
		||||
 | 
			
		||||
@@ -61,7 +61,8 @@ function WindFrequence(props) {
 | 
			
		||||
    <GraphBase
 | 
			
		||||
      icon="pause"
 | 
			
		||||
      title="当前温度"
 | 
			
		||||
      dateOptions={["1线", "2线", "3线", "4线", "5线"]}
 | 
			
		||||
      dateOptions={["Y61", "Y62", "Y63", "Y64", "Y65"]}
 | 
			
		||||
      defaultSelect={dataSource}
 | 
			
		||||
      onDateChange={handleSourceChange}
 | 
			
		||||
      size={["middle", "long"]}
 | 
			
		||||
    >
 | 
			
		||||
 
 | 
			
		||||
@@ -4,6 +4,7 @@ import ReactECharts from "echarts-for-react";
 | 
			
		||||
import { useSelector } from "react-redux";
 | 
			
		||||
import { useEffect, useState } from "react";
 | 
			
		||||
import { randomInt } from "../../../utils";
 | 
			
		||||
import * as echarts from "echarts";
 | 
			
		||||
 | 
			
		||||
function FaultType(props) {
 | 
			
		||||
  const [init, setInit] = useState(true);
 | 
			
		||||
@@ -140,7 +141,7 @@ function getOptions(data, chart_type) {
 | 
			
		||||
        ...legend_common,
 | 
			
		||||
      },
 | 
			
		||||
      tooltip: {
 | 
			
		||||
        trigger: "item",
 | 
			
		||||
        trigger: "axis",
 | 
			
		||||
      },
 | 
			
		||||
      xAxis: {
 | 
			
		||||
        type: "category",
 | 
			
		||||
@@ -186,8 +187,13 @@ function getOptions(data, chart_type) {
 | 
			
		||||
      series: [
 | 
			
		||||
        {
 | 
			
		||||
          type: "bar",
 | 
			
		||||
          barWidth: 14,
 | 
			
		||||
          itemStyle: {
 | 
			
		||||
            color: color[randomInt(0, color.length - 1)],
 | 
			
		||||
            color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
 | 
			
		||||
              // i % 8 避免超过8个数据时无颜色的问题
 | 
			
		||||
              { offset: 0, color: "#5CB7FF" },
 | 
			
		||||
              { offset: 1, color: "#364BFE" },
 | 
			
		||||
            ]),
 | 
			
		||||
          },
 | 
			
		||||
          data: (dataList || []).map((item) => item.value),
 | 
			
		||||
        },
 | 
			
		||||
 
 | 
			
		||||
@@ -175,8 +175,10 @@ new XClient(
 | 
			
		||||
  }
 | 
			
		||||
);
 | 
			
		||||
 | 
			
		||||
const newUser = crypto.randomUUID();
 | 
			
		||||
console.log("websocket user:", newUser);
 | 
			
		||||
new XClient(
 | 
			
		||||
  "ws://10.70.2.2:8080/websocket/message?userId=ENERGY111",
 | 
			
		||||
  "ws://10.70.2.2:8080/websocket/message?userId=ENERGY" + newUser,
 | 
			
		||||
  // "ws://192.168.1.74:48080/websocket/message?userId=ENERGY111",
 | 
			
		||||
  "MES_DATA",
 | 
			
		||||
  (msg) => {
 | 
			
		||||
@@ -204,7 +206,7 @@ new XClient(
 | 
			
		||||
 | 
			
		||||
// 产线缺陷相关数据
 | 
			
		||||
new XClient(
 | 
			
		||||
  "ws://10.70.2.2:8080/websocket/message?userId=IS111",
 | 
			
		||||
  "ws://10.70.2.2:8080/websocket/message?userId=IS" + newUser,
 | 
			
		||||
  // "ws://192.168.0.33:48082/websocket/message?userId=IS111",
 | 
			
		||||
  "QUALITY_DATA",
 | 
			
		||||
  (msg) => {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user