This commit is contained in:
lb 2023-12-18 09:51:28 +08:00
parent 98ad9f590c
commit 31e065fa5a
4 changed files with 20 additions and 11 deletions

View File

@ -6,7 +6,7 @@ import { useEffect, useState } from "react";
import { useSelector } from "react-redux"; import { useSelector } from "react-redux";
function WindFrequence(props) { function WindFrequence(props) {
const [currLine, setCurrLine] = useState('1线') const [currLine, setCurrLine] = useState('Y61')
const [showChart, setShowChart] = useState(false); const [showChart, setShowChart] = useState(false);
const [currentLine, setCurrentLine] = useState([]); const [currentLine, setCurrentLine] = useState([]);
const runState = useSelector((state) => state.annealFanFrequence.runtime); const runState = useSelector((state) => state.annealFanFrequence.runtime);
@ -155,7 +155,7 @@ function WindFrequence(props) {
}, [showChart]); }, [showChart]);
function handleLineChange(line) { function handleLineChange(line) {
const lineNum = line[0]; const lineNum = line[2];
setCurrLine(line); setCurrLine(line);
setCurrentLine((old) => setCurrentLine((old) =>
dataList.filter((item) => item?.name.startsWith(`${lineNum}#`)) dataList.filter((item) => item?.name.startsWith(`${lineNum}#`))
@ -170,7 +170,7 @@ function WindFrequence(props) {
switchOptions={false} switchOptions={false}
switchPosition={[null, 200]} // [top, left] switchPosition={[null, 200]} // [top, left]
onSwitch={handleSwitchChange} onSwitch={handleSwitchChange}
dateOptions={["1线", "2线", "3线", "4线", "5线"]} dateOptions={["Y61", "Y62", "Y63", "Y64", "Y65"]}
defaultSelect={currLine} defaultSelect={currLine}
onDateChange={handleLineChange} onDateChange={handleLineChange}
> >

View File

@ -43,17 +43,17 @@ const SmallBox = (props) => {
}; };
function WindFrequence(props) { function WindFrequence(props) {
const [dataSource, setDataSource] = useState("1线"); const [dataSource, setDataSource] = useState("Y61");
const [currentLineTemp, setCurrentLineTemp] = useState([]); const [currentLineTemp, setCurrentLineTemp] = useState([]);
const currentTempList = useSelector((state) => state.annealTemperature?.data); const currentTempList = useSelector((state) => state.annealTemperature?.data);
const lines = ["Y61", "Y62", "Y63", "Y64", "Y65"];
function handleSourceChange(line) { function handleSourceChange(line) {
setDataSource(line); setDataSource(line);
} }
useEffect(() => { useEffect(() => {
setCurrentLineTemp( setCurrentLineTemp(
(currentTempList && currentTempList[dataSource.replace("线", "#")]) || [] (currentTempList && currentTempList[1+lines.indexOf(dataSource)+'#']) || []
); );
}, [dataSource]); }, [dataSource]);
@ -61,7 +61,8 @@ function WindFrequence(props) {
<GraphBase <GraphBase
icon="pause" icon="pause"
title="当前温度" title="当前温度"
dateOptions={["1线", "2线", "3线", "4线", "5线"]} dateOptions={["Y61", "Y62", "Y63", "Y64", "Y65"]}
defaultSelect={dataSource}
onDateChange={handleSourceChange} onDateChange={handleSourceChange}
size={["middle", "long"]} size={["middle", "long"]}
> >

View File

@ -4,6 +4,7 @@ import ReactECharts from "echarts-for-react";
import { useSelector } from "react-redux"; import { useSelector } from "react-redux";
import { useEffect, useState } from "react"; import { useEffect, useState } from "react";
import { randomInt } from "../../../utils"; import { randomInt } from "../../../utils";
import * as echarts from "echarts";
function FaultType(props) { function FaultType(props) {
const [init, setInit] = useState(true); const [init, setInit] = useState(true);
@ -140,7 +141,7 @@ function getOptions(data, chart_type) {
...legend_common, ...legend_common,
}, },
tooltip: { tooltip: {
trigger: "item", trigger: "axis",
}, },
xAxis: { xAxis: {
type: "category", type: "category",
@ -186,8 +187,13 @@ function getOptions(data, chart_type) {
series: [ series: [
{ {
type: "bar", type: "bar",
barWidth: 14,
itemStyle: { 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), data: (dataList || []).map((item) => item.value),
}, },

View File

@ -175,8 +175,10 @@ new XClient(
} }
); );
const newUser = crypto.randomUUID();
console.log("websocket user:", newUser);
new XClient( 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", // "ws://192.168.1.74:48080/websocket/message?userId=ENERGY111",
"MES_DATA", "MES_DATA",
(msg) => { (msg) => {
@ -204,7 +206,7 @@ new XClient(
// 产线缺陷相关数据 // 产线缺陷相关数据
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", // "ws://192.168.0.33:48082/websocket/message?userId=IS111",
"QUALITY_DATA", "QUALITY_DATA",
(msg) => { (msg) => {