From 31e065fa5a109f7dddfc7c9ae47dd962a8549fab Mon Sep 17 00:00:00 2001 From: lb Date: Mon, 18 Dec 2023 09:51:28 +0800 Subject: [PATCH] update --- src/components/Common/AnnealFanRunFrequence/index.jsx | 6 +++--- src/components/Common/CurrentTemp/index.jsx | 9 +++++---- src/components/Common/TodayFaultType/index.jsx | 10 ++++++++-- src/utils/index.ts | 6 ++++-- 4 files changed, 20 insertions(+), 11 deletions(-) diff --git a/src/components/Common/AnnealFanRunFrequence/index.jsx b/src/components/Common/AnnealFanRunFrequence/index.jsx index 0c1602b..ea0670a 100644 --- a/src/components/Common/AnnealFanRunFrequence/index.jsx +++ b/src/components/Common/AnnealFanRunFrequence/index.jsx @@ -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} > diff --git a/src/components/Common/CurrentTemp/index.jsx b/src/components/Common/CurrentTemp/index.jsx index a2b0ddb..a66b237 100644 --- a/src/components/Common/CurrentTemp/index.jsx +++ b/src/components/Common/CurrentTemp/index.jsx @@ -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) { diff --git a/src/components/Common/TodayFaultType/index.jsx b/src/components/Common/TodayFaultType/index.jsx index 81c378e..d048303 100644 --- a/src/components/Common/TodayFaultType/index.jsx +++ b/src/components/Common/TodayFaultType/index.jsx @@ -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), }, diff --git a/src/utils/index.ts b/src/utils/index.ts index 824d016..66bf2ef 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -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) => {