改变链接位置,改成在每个页面链接

This commit is contained in:
朱菊兰 2025-03-06 08:27:31 +08:00
parent 45c8563892
commit 40791bc619
57 changed files with 657 additions and 394 deletions

View File

@ -81,7 +81,7 @@
"workbox-webpack-plugin": "^6.4.1"
},
"scripts": {
"start": "node scripts/start.js",
"start": "node --max-old-space-size=4096 scripts/start.js",
"build": "node scripts/build.js",
"test": "node scripts/test.js"
},

View File

@ -185,7 +185,7 @@ function MybabylonJS({ modelPath }: MybabylonJSProps) {
currentMeshesRef.current.push(...LOD0MESH2.meshes);
// ...为新加载的模型设置交互逻辑
LOD0MESH1.meshes.map((mesh) => {
LOD0MESH1.meshes.forEach((mesh) => {
mesh.isPickable = true;
mesh.actionManager = new BABYLON.ActionManager(scene);
if (modelPath.slice(-1) === "1") {
@ -227,7 +227,7 @@ function MybabylonJS({ modelPath }: MybabylonJSProps) {
setSelectedMeshId(MeshNameId);
};
});
LOD0MESH2.meshes.map((mesh) => {
LOD0MESH2.meshes.forEach((mesh) => {
mesh.isPickable = true;
mesh.actionManager = new BABYLON.ActionManager(scene);
if (modelPath.slice(-1) === "1") {

View File

@ -12,6 +12,15 @@ import AlarmTipGreen from "./../page/assets/icon/g.png";
import AlarmTipYellow from "./../page/assets/icon/y.png";
import AlarmTipRed from "./../page/assets/icon/r.png";
import {selectLine1Before} from "../store/LinePageSlice";
import {selectLine1After} from "../store/LinePageSlice";
import {selectLine2Before} from "../store/LinePageSlice";
import {selectLine2After} from "../store/LinePageSlice";
import {selectLine3Before} from "../store/LinePageSlice";
import {selectLine3After} from "../store/LinePageSlice";
import {selectLine4Before} from "../store/LinePageSlice";
import {selectLine4After} from "../store/LinePageSlice";
import {selectLine5Before} from "../store/LinePageSlice";
import {selectLine5After} from "../store/LinePageSlice";
const lineNameNo = ["一","二","三","四","五"]
const myStyle = {
@ -40,7 +49,6 @@ interface EqMsg {
}
function MybabylonJS({ modelPath }: MybabylonJSProps) {
const [eqList, setEqList] = useState<EqListType>({});
const allData = useAppSelector(selectLine1Before) as any; // 使用`any`来绕过类型检查
const canvasRef = useRef(null);
const resetRef = useRef<(() => void) | null>(null);
const [selectedMeshName, setSelectedMeshName] = useState<string | null>(null);
@ -52,6 +60,23 @@ function MybabylonJS({ modelPath }: MybabylonJSProps) {
});
const [showInfo, setShowInfo] = useState(true);
const selectorMap: Record<string, (state: any) => any> = {
"Line1-1": selectLine1Before,
"Line1-2": selectLine1After,
"Line2-1": selectLine2Before,
"Line2-2": selectLine2After,
"Line3-1": selectLine3Before,
"Line3-2": selectLine3After,
"Line4-1": selectLine4Before,
"Line4-2": selectLine4After,
"Line5-1": selectLine5Before,
"Line5-2": selectLine5After
};
const selectedSelector = selectorMap[modelPath];
const allData = useAppSelector(selectedSelector);
// const allData = useAppSelector(selectLine1Before) as any;
// 使用 useRef 来存储当前加载的模型引用
const currentMeshesRef = useRef<Array<BABYLON.AbstractMesh>>([]);
useEffect(() => {
@ -183,7 +208,7 @@ function MybabylonJS({ modelPath }: MybabylonJSProps) {
// ...为新加载的模型设置交互逻辑
LOD0MESH.meshes.map((mesh) => {
LOD0MESH.meshes.forEach((mesh) => {
mesh.isPickable = true;
mesh.actionManager = new BABYLON.ActionManager(scene);
if (modelPath.slice(-1) === "1") {

View File

@ -1,4 +1,4 @@
import * as echarts from "echarts";
export default function getOptions(tempData: any) {
if (Object.keys(tempData).length === 0) {
return null;

View File

@ -5,7 +5,6 @@ import { deepClone } from "./util/utils";
import { co } from "./util";
import classnames from "classnames";
import "./index.css";
import { current } from "@reduxjs/toolkit";
interface ScrollBoardProps {
config?: object;
onClick?: () => void;

View File

@ -1,6 +1,4 @@
import React from "react";
import "./style/standard.css"
import intl from "react-intl-universal";
function ErrorPage() {

View File

@ -3,7 +3,6 @@ import TitleBox from "../Component/TitleBox";
import getOptions from "../../Component/BarLineChart/chart.config";
import {useAppSelector} from "./../../../store/hooks"
import { selectAllLine } from "./../../../store/LeaderPageSlice";
import { Fragment } from "react/jsx-runtime";
function LeftDown() {
const data = useAppSelector(selectAllLine);
interface Detail {

View File

@ -29,7 +29,7 @@ function CenterDown() {
{ name: "周", ename: "week" },
{ name: "月", ename: "month" },
];
const [activeName, setActiveName] = useState<string>(nameList[1].ename);
const [activeName] = useState<string>(nameList[1].ename);
// const handleButtonChange = (activeName: string) => {
// setActiveName(activeName);
// };
@ -52,7 +52,7 @@ function CenterDown() {
// @ts-ignore
sumAlarm = data.alarms.length
// @ts-ignore
data.alarms.map((item,index) => {
data.alarms.forEach((item,index) => {
let arrInner = []
arrInner.push(
index+1,
@ -70,11 +70,11 @@ function CenterDown() {
// @ts-ignore
let keys = Object.keys(data.todayProductionRates)
// @ts-ignore
data.todayProductionRates[keys[0]].map((item,index)=>{
data.todayProductionRates[keys[0]].forEach((item,index)=>{
// @ts-ignore
dataSource.day.xData.push(dayjs(item.recTime).format("HH:mm"))
})
keys.map((item,index)=>{
keys.forEach((item,index)=>{
let obj = {
name: "",
type: "line",
@ -85,7 +85,7 @@ function CenterDown() {
// @ts-ignore
obj.name = data.todayProductionRates[item][0].lineName
// @ts-ignore
data.todayProductionRates[item].map((subItem,index)=>{
data.todayProductionRates[item].forEach((subItem,index)=>{
// @ts-ignore
obj.data.push(subItem.passRate)
})
@ -100,11 +100,11 @@ function CenterDown() {
// @ts-ignore
let keys = Object.keys(data.weekProductionRates)
// @ts-ignore
data.weekProductionRates[keys[0]].map((item,index)=>{
data.weekProductionRates[keys[0]].forEach((item,index)=>{
// @ts-ignore
dataSource.week.xData.push(dayjs(item.recTime).format("HH:mm"))
})
keys.map((item,index)=>{
keys.forEach((item,index)=>{
let obj = {
name: "",
type: "line",
@ -115,7 +115,7 @@ function CenterDown() {
// @ts-ignore
obj.name = data.weekProductionRates[item][0].lineName
// @ts-ignore
data.weekProductionRates[item].map((subItem,index)=>{
data.weekProductionRates[item].forEach((subItem,index)=>{
// @ts-ignore
obj.data.push(subItem.passRate)
})
@ -130,11 +130,11 @@ function CenterDown() {
// @ts-ignore
let keys = Object.keys(data.monthProductionRates)
// @ts-ignore
data.monthProductionRates[keys[0]].map((item,index)=>{
data.monthProductionRates[keys[0]].forEach((item,index)=>{
// @ts-ignore
dataSource.month.xData.push(dayjs(item.recTime).format("HH:mm"))
})
keys.map((item,index)=>{
keys.forEach((item,index)=>{
let obj = {
name: "",
type: "line",
@ -145,7 +145,7 @@ function CenterDown() {
// @ts-ignore
obj.name = data.monthProductionRates[item][0].lineName
// @ts-ignore
data.monthProductionRates[item].map((subItem,index)=>{
data.monthProductionRates[item].forEach((subItem,index)=>{
// @ts-ignore
obj.data.push(subItem.passRate)
})
@ -192,7 +192,7 @@ function CenterDown() {
{<ReactECharts option={options} style={{ height: "100%" }} />}
</div>
)}
{chartData.xData.length==0 && (
{chartData.xData.length===0 && (
<p
style={{
color: "#cccf",

View File

@ -77,7 +77,7 @@ function LeftDown() {
// @ts-ignore
if (data.todayProductionScraps && data.todayProductionScraps.length > 0) {
// @ts-ignore
data.todayProductionScraps.map((item,index)=>{
data.todayProductionScraps.forEach((item,index)=>{
let arrInner = [];
arrInner.push(index+1,item.sectionName,item.scrapNum || 0);
arr1.push(arrInner);
@ -90,7 +90,7 @@ function LeftDown() {
// @ts-ignore
if (data.weekProductionScraps && data.weekProductionScraps.length > 0) {
// @ts-ignore
data.weekProductionScraps.map((item,index)=>{
data.weekProductionScraps.forEach((item,index)=>{
let arrInner = [];
arrInner.push(index+1,item.sectionName,item.scrapNum || 0);
arr2.push(arrInner);
@ -103,7 +103,7 @@ function LeftDown() {
// @ts-ignore
if (data.monthProductionScraps && data.monthProductionScraps.length > 0) {
// @ts-ignore
data.monthProductionScraps.map((item,index)=>{
data.monthProductionScraps.forEach((item,index)=>{
let arrInner = [];
arrInner.push(index+1,item.sectionName,item.scrapNum || 0);
arr3.push(arrInner);

View File

@ -37,7 +37,7 @@ function LeftUp() {
let sum: number[] = [];
// 生成obj
// @ts-ignore
data.scrapBars.map((item,index) => {
data.scrapBars.forEach((item,index) => {
let obj = {
data: [],
type: "bar",
@ -67,7 +67,7 @@ function LeftUp() {
for(let i = 0;i < dataSource.day.series.length;i++){
let itemSeries = dataSource.day.series[i]
// @ts-ignore
data.todayAllProductionScraps[item].map((itemInner,indexInner)=>{
data.todayAllProductionScraps[item].forEach((itemInner,indexInner)=>{
// @ts-ignore
if (itemInner.sectionName.indexOf(itemSeries.name)!==-1) {
// @ts-ignore
@ -105,7 +105,7 @@ function LeftUp() {
let sum: number[] = [];
// 生成obj
// @ts-ignore
data.scrapBars.map((item,index) => {
data.scrapBars.forEach((item,index) => {
let obj = {
data: [],
type: "bar",
@ -135,7 +135,7 @@ function LeftUp() {
for(let i = 0;i < dataSource.week.series.length;i++){
let itemSeries = dataSource.week.series[i]
// @ts-ignore
data.weekAllProductionScraps[item].map((itemInner,indexInner)=>{
data.weekAllProductionScraps[item].forEach((itemInner,indexInner)=>{
// @ts-ignore
if (itemInner.sectionName.indexOf(itemSeries.name)!==-1) {
// @ts-ignore
@ -173,7 +173,7 @@ function LeftUp() {
let sum: number[] = [];
// 生成obj
// @ts-ignore
data.scrapBars.map((item,index) => {
data.scrapBars.forEach((item,index) => {
let obj = {
data: [],
type: "bar",
@ -203,7 +203,7 @@ function LeftUp() {
for(let i = 0;i < dataSource.month.series.length;i++){
let itemSeries = dataSource.month.series[i]
// @ts-ignore
data.monthAllProductionScraps[item].map((itemInner,indexInner)=>{
data.monthAllProductionScraps[item].forEach((itemInner,indexInner)=>{
// @ts-ignore
if (itemInner.sectionName.indexOf(itemSeries.name)!==-1) {
// @ts-ignore

View File

@ -81,7 +81,7 @@ function RightDown() {
// @ts-ignore
if (data.todayProductionDets && data.todayProductionDets.length > 0) {
// @ts-ignore
data.todayProductionDets.map((item,index)=>{
data.todayProductionDets.forEach((item,index)=>{
let arrInner = [];
arrInner.push(dayjs(item.recTime).format("HH:mm"),item.inputNum,item.outputNum);
arr1.push(arrInner);
@ -97,7 +97,7 @@ function RightDown() {
// @ts-ignore
if (data.weekProductionDets && data.weekProductionDets.length > 0) {
// @ts-ignore
data.weekProductionDets.map((item,index)=>{
data.weekProductionDets.forEach((item,index)=>{
let arrInner = [];
arrInner.push(dayjs(item.recTime).format("YYYY/MM/DD"),item.inputNum,item.outputNum);
arr2.push(arrInner);
@ -113,7 +113,7 @@ function RightDown() {
// @ts-ignore
if (data.monthProductionDets && data.monthProductionDets.length > 0) {
// @ts-ignore
data.monthProductionDets.map((item,index)=>{
data.monthProductionDets.forEach((item,index)=>{
let arrInner = [];
arrInner.push(dayjs(item.recTime).format("YYYY/MM/DD"),item.inputNum,item.outputNum);
arr3.push(arrInner);

View File

@ -19,7 +19,7 @@ function RightUp() {
// @ts-ignore
if (data.sectionDet && data.sectionDet.length > 0) {
// @ts-ignore
data.sectionDet.map((item, index) => {
data.sectionDet.forEach((item, index) => {
let arrInner = []
arrInner.push(index + 1, item.lineName, item.inputNum, item.outputNum)
arr.push(arrInner)

View File

@ -5,7 +5,31 @@ import Right from "./Right";
import Center from "./Center";
import {useEffect} from 'react';
import {useNavigate} from "react-router-dom";
import { useDispatch } from 'react-redux';
import { UpdateLine1Before } from "../../store/LinePageSlice";
function LinePage() {
const dispatch = useDispatch();
// const myUrl = "192.168.8.22"
const myUrl = window.location.host;
useEffect(() => {
let websocket1_1 = new WebSocket("ws://" + myUrl + "/websocket/message?userId=1-1-" + Date.now());
// @ts-ignore
websocket1_1.onmessage = function (event) {
let msgData = event.data
try {
msgData = JSON.parse(event.data);
} catch (error) {
console.log("websocket: [unable to msgData] : ", event.data);
}
if (!Object.prototype.toString.call(msgData).includes('Object')) return;
dispatch(UpdateLine1Before(msgData));
}
// 清理函数
return () => {
websocket1_1.close();
};
}, [dispatch]);
const navigate = useNavigate();
useEffect(() => {
const handleKeyDown = (event:any) => {

View File

@ -29,7 +29,7 @@ function CenterDown() {
{ name: "周", ename: "week" },
{ name: "月", ename: "month" },
];
const [activeName, setActiveName] = useState<string>(nameList[1].ename);
const [activeName] = useState<string>(nameList[1].ename);
// const handleButtonChange = (activeName: string) => {
// setActiveName(activeName);
// };
@ -52,7 +52,7 @@ function CenterDown() {
// @ts-ignore
sumAlarm = data.alarms.length
// @ts-ignore
data.alarms.map((item,index) => {
data.alarms.forEach((item,index) => {
let arrInner = []
arrInner.push(
index+1,
@ -70,11 +70,11 @@ function CenterDown() {
// @ts-ignore
let keys = Object.keys(data.todayProductionRates)
// @ts-ignore
data.todayProductionRates[keys[0]].map((item,index)=>{
data.todayProductionRates[keys[0]].forEach((item,index)=>{
// @ts-ignore
dataSource.day.xData.push(dayjs(item.recTime).format("HH:mm"))
})
keys.map((item,index)=>{
keys.forEach((item,index)=>{
let obj = {
name: "",
type: "line",
@ -85,7 +85,7 @@ function CenterDown() {
// @ts-ignore
obj.name = data.todayProductionRates[item][0].lineName
// @ts-ignore
data.todayProductionRates[item].map((subItem,index)=>{
data.todayProductionRates[item].forEach((subItem,index)=>{
// @ts-ignore
obj.data.push(subItem.passRate)
})
@ -100,11 +100,11 @@ function CenterDown() {
// @ts-ignore
let keys = Object.keys(data.weekProductionRates)
// @ts-ignore
data.weekProductionRates[keys[0]].map((item,index)=>{
data.weekProductionRates[keys[0]].forEach((item,index)=>{
// @ts-ignore
dataSource.week.xData.push(dayjs(item.recTime).format("HH:mm"))
})
keys.map((item,index)=>{
keys.forEach((item,index)=>{
let obj = {
name: "",
type: "line",
@ -115,7 +115,7 @@ function CenterDown() {
// @ts-ignore
obj.name = data.weekProductionRates[item][0].lineName
// @ts-ignore
data.weekProductionRates[item].map((subItem,index)=>{
data.weekProductionRates[item].forEach((subItem,index)=>{
// @ts-ignore
obj.data.push(subItem.passRate)
})
@ -130,11 +130,11 @@ function CenterDown() {
// @ts-ignore
let keys = Object.keys(data.monthProductionRates)
// @ts-ignore
data.monthProductionRates[keys[0]].map((item,index)=>{
data.monthProductionRates[keys[0]].forEach((item,index)=>{
// @ts-ignore
dataSource.month.xData.push(dayjs(item.recTime).format("HH:mm"))
})
keys.map((item,index)=>{
keys.forEach((item,index)=>{
let obj = {
name: "",
type: "line",
@ -145,7 +145,7 @@ function CenterDown() {
// @ts-ignore
obj.name = data.monthProductionRates[item][0].lineName
// @ts-ignore
data.monthProductionRates[item].map((subItem,index)=>{
data.monthProductionRates[item].forEach((subItem,index)=>{
// @ts-ignore
obj.data.push(subItem.passRate)
})
@ -192,7 +192,7 @@ function CenterDown() {
{<ReactECharts option={options} style={{ height: "100%" }} />}
</div>
)}
{chartData.xData.length==0 && (
{chartData.xData.length===0 && (
<p
style={{
color: "#cccf",

View File

@ -77,7 +77,7 @@ function LeftDown() {
// @ts-ignore
if (data.todayProductionScraps && data.todayProductionScraps.length > 0) {
// @ts-ignore
data.todayProductionScraps.map((item,index)=>{
data.todayProductionScraps.forEach((item,index)=>{
let arrInner = [];
arrInner.push(index+1,item.sectionName,item.scrapNum || 0);
arr1.push(arrInner);
@ -90,7 +90,7 @@ function LeftDown() {
// @ts-ignore
if (data.weekProductionScraps && data.weekProductionScraps.length > 0) {
// @ts-ignore
data.weekProductionScraps.map((item,index)=>{
data.weekProductionScraps.forEach((item,index)=>{
let arrInner = [];
arrInner.push(index+1,item.sectionName,item.scrapNum || 0);
arr2.push(arrInner);
@ -103,7 +103,7 @@ function LeftDown() {
// @ts-ignore
if (data.monthProductionScraps && data.monthProductionScraps.length > 0) {
// @ts-ignore
data.monthProductionScraps.map((item,index)=>{
data.monthProductionScraps.forEach((item,index)=>{
let arrInner = [];
arrInner.push(index+1,item.sectionName,item.scrapNum || 0);
arr3.push(arrInner);

View File

@ -37,7 +37,7 @@ function LeftUp() {
let sum: number[] = [];
// 生成obj
// @ts-ignore
data.scrapBars.map((item,index) => {
data.scrapBars.forEach((item,index) => {
let obj = {
data: [],
type: "bar",
@ -67,7 +67,7 @@ function LeftUp() {
for(let i = 0;i < dataSource.day.series.length;i++){
let itemSeries = dataSource.day.series[i]
// @ts-ignore
data.todayAllProductionScraps[item].map((itemInner,indexInner)=>{
data.todayAllProductionScraps[item].forEach((itemInner,indexInner)=>{
// @ts-ignore
if (itemInner.sectionName.indexOf(itemSeries.name)!==-1) {
// @ts-ignore
@ -105,7 +105,7 @@ function LeftUp() {
let sum: number[] = [];
// 生成obj
// @ts-ignore
data.scrapBars.map((item,index) => {
data.scrapBars.forEach((item,index) => {
let obj = {
data: [],
type: "bar",
@ -135,7 +135,7 @@ function LeftUp() {
for(let i = 0;i < dataSource.week.series.length;i++){
let itemSeries = dataSource.week.series[i]
// @ts-ignore
data.weekAllProductionScraps[item].map((itemInner,indexInner)=>{
data.weekAllProductionScraps[item].forEach((itemInner,indexInner)=>{
// @ts-ignore
if (itemInner.sectionName.indexOf(itemSeries.name)!==-1) {
// @ts-ignore
@ -173,7 +173,7 @@ function LeftUp() {
let sum: number[] = [];
// 生成obj
// @ts-ignore
data.scrapBars.map((item,index) => {
data.scrapBars.forEach((item,index) => {
let obj = {
data: [],
type: "bar",
@ -203,7 +203,7 @@ function LeftUp() {
for(let i = 0;i < dataSource.month.series.length;i++){
let itemSeries = dataSource.month.series[i]
// @ts-ignore
data.monthAllProductionScraps[item].map((itemInner,indexInner)=>{
data.monthAllProductionScraps[item].forEach((itemInner,indexInner)=>{
// @ts-ignore
if (itemInner.sectionName.indexOf(itemSeries.name)!==-1) {
// @ts-ignore

View File

@ -81,7 +81,7 @@ function RightDown() {
// @ts-ignore
if (data.todayProductionDets && data.todayProductionDets.length > 0) {
// @ts-ignore
data.todayProductionDets.map((item,index)=>{
data.todayProductionDets.forEach((item,index)=>{
let arrInner = [];
arrInner.push(dayjs(item.recTime).format("HH:mm"),item.inputNum,item.outputNum);
arr1.push(arrInner);
@ -97,7 +97,7 @@ function RightDown() {
// @ts-ignore
if (data.weekProductionDets && data.weekProductionDets.length > 0) {
// @ts-ignore
data.weekProductionDets.map((item,index)=>{
data.weekProductionDets.forEach((item,index)=>{
let arrInner = [];
arrInner.push(dayjs(item.recTime).format("YYYY/MM/DD"),item.inputNum,item.outputNum);
arr2.push(arrInner);
@ -113,7 +113,7 @@ function RightDown() {
// @ts-ignore
if (data.monthProductionDets && data.monthProductionDets.length > 0) {
// @ts-ignore
data.monthProductionDets.map((item,index)=>{
data.monthProductionDets.forEach((item,index)=>{
let arrInner = [];
arrInner.push(dayjs(item.recTime).format("YYYY/MM/DD"),item.inputNum,item.outputNum);
arr3.push(arrInner);

View File

@ -19,7 +19,7 @@ function RightUp() {
// @ts-ignore
if (data.sectionDet && data.sectionDet.length > 0) {
// @ts-ignore
data.sectionDet.map((item, index) => {
data.sectionDet.forEach((item, index) => {
let arrInner = []
arrInner.push(index + 1, item.lineName, item.inputNum, item.outputNum)
arr.push(arrInner)

View File

@ -5,7 +5,31 @@ import Right from "./Right";
import Center from "./Center";
import {useEffect} from 'react';
import {useNavigate} from "react-router-dom";
import { useDispatch } from 'react-redux';
import { UpdateLine1After } from "../../store/LinePageSlice";
function LinePage() {
const dispatch = useDispatch();
// const myUrl = "192.168.8.22"
const myUrl = window.location.host;
useEffect(() => {
let websocket1_2 = new WebSocket("ws://" + myUrl + "/websocket/message?userId=1-2-" + Date.now());
// @ts-ignore
websocket1_2.onmessage = function (event) {
let msgData = event.data
try {
msgData = JSON.parse(event.data);
} catch (error) {
console.log("websocket: [unable to msgData] : ", event.data);
}
if (!Object.prototype.toString.call(msgData).includes('Object')) return;
dispatch(UpdateLine1After(msgData));
}
// 清理函数
return () => {
websocket1_2.close();
};
}, [dispatch]);
const navigate = useNavigate();
useEffect(() => {
const handleKeyDown = (event:any) => {

View File

@ -29,7 +29,7 @@ function CenterDown() {
{ name: "周", ename: "week" },
{ name: "月", ename: "month" },
];
const [activeName, setActiveName] = useState<string>(nameList[1].ename);
const [activeName] = useState<string>(nameList[1].ename);
// const handleButtonChange = (activeName: string) => {
// setActiveName(activeName);
// };
@ -52,7 +52,7 @@ function CenterDown() {
// @ts-ignore
sumAlarm = data.alarms.length
// @ts-ignore
data.alarms.map((item,index) => {
data.alarms.forEach((item,index) => {
let arrInner = []
arrInner.push(
index+1,
@ -70,11 +70,11 @@ function CenterDown() {
// @ts-ignore
let keys = Object.keys(data.todayProductionRates)
// @ts-ignore
data.todayProductionRates[keys[0]].map((item,index)=>{
data.todayProductionRates[keys[0]].forEach((item,index)=>{
// @ts-ignore
dataSource.day.xData.push(dayjs(item.recTime).format("HH:mm"))
})
keys.map((item,index)=>{
keys.forEach((item,index)=>{
let obj = {
name: "",
type: "line",
@ -85,7 +85,7 @@ function CenterDown() {
// @ts-ignore
obj.name = data.todayProductionRates[item][0].lineName
// @ts-ignore
data.todayProductionRates[item].map((subItem,index)=>{
data.todayProductionRates[item].forEach((subItem,index)=>{
// @ts-ignore
obj.data.push(subItem.passRate)
})
@ -100,11 +100,11 @@ function CenterDown() {
// @ts-ignore
let keys = Object.keys(data.weekProductionRates)
// @ts-ignore
data.weekProductionRates[keys[0]].map((item,index)=>{
data.weekProductionRates[keys[0]].forEach((item,index)=>{
// @ts-ignore
dataSource.week.xData.push(dayjs(item.recTime).format("HH:mm"))
})
keys.map((item,index)=>{
keys.forEach((item,index)=>{
let obj = {
name: "",
type: "line",
@ -115,7 +115,7 @@ function CenterDown() {
// @ts-ignore
obj.name = data.weekProductionRates[item][0].lineName
// @ts-ignore
data.weekProductionRates[item].map((subItem,index)=>{
data.weekProductionRates[item].forEach((subItem,index)=>{
// @ts-ignore
obj.data.push(subItem.passRate)
})
@ -130,11 +130,11 @@ function CenterDown() {
// @ts-ignore
let keys = Object.keys(data.monthProductionRates)
// @ts-ignore
data.monthProductionRates[keys[0]].map((item,index)=>{
data.monthProductionRates[keys[0]].forEach((item,index)=>{
// @ts-ignore
dataSource.month.xData.push(dayjs(item.recTime).format("HH:mm"))
})
keys.map((item,index)=>{
keys.forEach((item,index)=>{
let obj = {
name: "",
type: "line",
@ -145,7 +145,7 @@ function CenterDown() {
// @ts-ignore
obj.name = data.monthProductionRates[item][0].lineName
// @ts-ignore
data.monthProductionRates[item].map((subItem,index)=>{
data.monthProductionRates[item].forEach((subItem,index)=>{
// @ts-ignore
obj.data.push(subItem.passRate)
})
@ -192,7 +192,7 @@ function CenterDown() {
{<ReactECharts option={options} style={{ height: "100%" }} />}
</div>
)}
{chartData.xData.length==0 && (
{chartData.xData.length===0 && (
<p
style={{
color: "#cccf",

View File

@ -77,7 +77,7 @@ function LeftDown() {
// @ts-ignore
if (data.todayProductionScraps && data.todayProductionScraps.length > 0) {
// @ts-ignore
data.todayProductionScraps.map((item,index)=>{
data.todayProductionScraps.forEach((item,index)=>{
let arrInner = [];
arrInner.push(index+1,item.sectionName,item.scrapNum || 0);
arr1.push(arrInner);
@ -90,7 +90,7 @@ function LeftDown() {
// @ts-ignore
if (data.weekProductionScraps && data.weekProductionScraps.length > 0) {
// @ts-ignore
data.weekProductionScraps.map((item,index)=>{
data.weekProductionScraps.forEach((item,index)=>{
let arrInner = [];
arrInner.push(index+1,item.sectionName,item.scrapNum || 0);
arr2.push(arrInner);
@ -103,7 +103,7 @@ function LeftDown() {
// @ts-ignore
if (data.monthProductionScraps && data.monthProductionScraps.length > 0) {
// @ts-ignore
data.monthProductionScraps.map((item,index)=>{
data.monthProductionScraps.forEach((item,index)=>{
let arrInner = [];
arrInner.push(index+1,item.sectionName,item.scrapNum || 0);
arr3.push(arrInner);

View File

@ -37,7 +37,7 @@ function LeftUp() {
let sum: number[] = [];
// 生成obj
// @ts-ignore
data.scrapBars.map((item,index) => {
data.scrapBars.forEach((item,index) => {
let obj = {
data: [],
type: "bar",
@ -67,7 +67,7 @@ function LeftUp() {
for(let i = 0;i < dataSource.day.series.length;i++){
let itemSeries = dataSource.day.series[i]
// @ts-ignore
data.todayAllProductionScraps[item].map((itemInner,indexInner)=>{
data.todayAllProductionScraps[item].forEach((itemInner,indexInner)=>{
// @ts-ignore
if (itemInner.sectionName.indexOf(itemSeries.name)!==-1) {
// @ts-ignore
@ -105,7 +105,7 @@ function LeftUp() {
let sum: number[] = [];
// 生成obj
// @ts-ignore
data.scrapBars.map((item,index) => {
data.scrapBars.forEach((item,index) => {
let obj = {
data: [],
type: "bar",
@ -135,7 +135,7 @@ function LeftUp() {
for(let i = 0;i < dataSource.week.series.length;i++){
let itemSeries = dataSource.week.series[i]
// @ts-ignore
data.weekAllProductionScraps[item].map((itemInner,indexInner)=>{
data.weekAllProductionScraps[item].forEach((itemInner,indexInner)=>{
// @ts-ignore
if (itemInner.sectionName.indexOf(itemSeries.name)!==-1) {
// @ts-ignore
@ -173,7 +173,7 @@ function LeftUp() {
let sum: number[] = [];
// 生成obj
// @ts-ignore
data.scrapBars.map((item,index) => {
data.scrapBars.forEach((item,index) => {
let obj = {
data: [],
type: "bar",
@ -203,7 +203,7 @@ function LeftUp() {
for(let i = 0;i < dataSource.month.series.length;i++){
let itemSeries = dataSource.month.series[i]
// @ts-ignore
data.monthAllProductionScraps[item].map((itemInner,indexInner)=>{
data.monthAllProductionScraps[item].forEach((itemInner,indexInner)=>{
// @ts-ignore
if (itemInner.sectionName.indexOf(itemSeries.name)!==-1) {
// @ts-ignore

View File

@ -81,7 +81,7 @@ function RightDown() {
// @ts-ignore
if (data.todayProductionDets && data.todayProductionDets.length > 0) {
// @ts-ignore
data.todayProductionDets.map((item,index)=>{
data.todayProductionDets.forEach((item,index)=>{
let arrInner = [];
arrInner.push(dayjs(item.recTime).format("HH:mm"),item.inputNum,item.outputNum);
arr1.push(arrInner);
@ -97,7 +97,7 @@ function RightDown() {
// @ts-ignore
if (data.weekProductionDets && data.weekProductionDets.length > 0) {
// @ts-ignore
data.weekProductionDets.map((item,index)=>{
data.weekProductionDets.forEach((item,index)=>{
let arrInner = [];
arrInner.push(dayjs(item.recTime).format("YYYY/MM/DD"),item.inputNum,item.outputNum);
arr2.push(arrInner);
@ -113,7 +113,7 @@ function RightDown() {
// @ts-ignore
if (data.monthProductionDets && data.monthProductionDets.length > 0) {
// @ts-ignore
data.monthProductionDets.map((item,index)=>{
data.monthProductionDets.forEach((item,index)=>{
let arrInner = [];
arrInner.push(dayjs(item.recTime).format("YYYY/MM/DD"),item.inputNum,item.outputNum);
arr3.push(arrInner);

View File

@ -19,7 +19,7 @@ function RightUp() {
// @ts-ignore
if (data.sectionDet && data.sectionDet.length > 0) {
// @ts-ignore
data.sectionDet.map((item, index) => {
data.sectionDet.forEach((item, index) => {
let arrInner = []
arrInner.push(index + 1, item.lineName, item.inputNum, item.outputNum)
arr.push(arrInner)

View File

@ -5,7 +5,31 @@ import Right from "./Right";
import Center from "./Center";
import {useEffect} from 'react';
import {useNavigate} from "react-router-dom";
import { useDispatch } from 'react-redux';
import { UpdateLine2Before } from "../../store/LinePageSlice";
function LinePage() {
const dispatch = useDispatch();
// const myUrl = "192.168.8.22"
const myUrl = window.location.host;
useEffect(() => {
let websocket2_1 = new WebSocket("ws://" + myUrl + "/websocket/message?userId=2-1-" + Date.now());
// @ts-ignore
websocket2_1.onmessage = function (event) {
let msgData = event.data
try {
msgData = JSON.parse(event.data);
} catch (error) {
console.log("websocket: [unable to msgData] : ", event.data);
}
if (!Object.prototype.toString.call(msgData).includes('Object')) return;
dispatch(UpdateLine2Before(msgData));
}
// 清理函数
return () => {
websocket2_1.close();
};
}, [dispatch]);
const navigate = useNavigate();
useEffect(() => {
const handleKeyDown = (event:any) => {

View File

@ -29,7 +29,7 @@ function CenterDown() {
{ name: "周", ename: "week" },
{ name: "月", ename: "month" },
];
const [activeName, setActiveName] = useState<string>(nameList[1].ename);
const [activeName] = useState<string>(nameList[1].ename);
// const handleButtonChange = (activeName: string) => {
// setActiveName(activeName);
// };
@ -52,7 +52,7 @@ function CenterDown() {
// @ts-ignore
sumAlarm = data.alarms.length
// @ts-ignore
data.alarms.map((item,index) => {
data.alarms.forEach((item,index) => {
let arrInner = []
arrInner.push(
index+1,
@ -70,11 +70,11 @@ function CenterDown() {
// @ts-ignore
let keys = Object.keys(data.todayProductionRates)
// @ts-ignore
data.todayProductionRates[keys[0]].map((item,index)=>{
data.todayProductionRates[keys[0]].forEach((item,index)=>{
// @ts-ignore
dataSource.day.xData.push(dayjs(item.recTime).format("HH:mm"))
})
keys.map((item,index)=>{
keys.forEach((item,index)=>{
let obj = {
name: "",
type: "line",
@ -85,7 +85,7 @@ function CenterDown() {
// @ts-ignore
obj.name = data.todayProductionRates[item][0].lineName
// @ts-ignore
data.todayProductionRates[item].map((subItem,index)=>{
data.todayProductionRates[item].forEach((subItem,index)=>{
// @ts-ignore
obj.data.push(subItem.passRate)
})
@ -100,11 +100,11 @@ function CenterDown() {
// @ts-ignore
let keys = Object.keys(data.weekProductionRates)
// @ts-ignore
data.weekProductionRates[keys[0]].map((item,index)=>{
data.weekProductionRates[keys[0]].forEach((item,index)=>{
// @ts-ignore
dataSource.week.xData.push(dayjs(item.recTime).format("HH:mm"))
})
keys.map((item,index)=>{
keys.forEach((item,index)=>{
let obj = {
name: "",
type: "line",
@ -115,7 +115,7 @@ function CenterDown() {
// @ts-ignore
obj.name = data.weekProductionRates[item][0].lineName
// @ts-ignore
data.weekProductionRates[item].map((subItem,index)=>{
data.weekProductionRates[item].forEach((subItem,index)=>{
// @ts-ignore
obj.data.push(subItem.passRate)
})
@ -130,11 +130,11 @@ function CenterDown() {
// @ts-ignore
let keys = Object.keys(data.monthProductionRates)
// @ts-ignore
data.monthProductionRates[keys[0]].map((item,index)=>{
data.monthProductionRates[keys[0]].forEach((item,index)=>{
// @ts-ignore
dataSource.month.xData.push(dayjs(item.recTime).format("HH:mm"))
})
keys.map((item,index)=>{
keys.forEach((item,index)=>{
let obj = {
name: "",
type: "line",
@ -145,7 +145,7 @@ function CenterDown() {
// @ts-ignore
obj.name = data.monthProductionRates[item][0].lineName
// @ts-ignore
data.monthProductionRates[item].map((subItem,index)=>{
data.monthProductionRates[item].forEach((subItem,index)=>{
// @ts-ignore
obj.data.push(subItem.passRate)
})
@ -192,7 +192,7 @@ function CenterDown() {
{<ReactECharts option={options} style={{ height: "100%" }} />}
</div>
)}
{chartData.xData.length==0 && (
{chartData.xData.length===0 && (
<p
style={{
color: "#cccf",

View File

@ -77,7 +77,7 @@ function LeftDown() {
// @ts-ignore
if (data.todayProductionScraps && data.todayProductionScraps.length > 0) {
// @ts-ignore
data.todayProductionScraps.map((item,index)=>{
data.todayProductionScraps.forEach((item,index)=>{
let arrInner = [];
arrInner.push(index+1,item.sectionName,item.scrapNum || 0);
arr1.push(arrInner);
@ -90,7 +90,7 @@ function LeftDown() {
// @ts-ignore
if (data.weekProductionScraps && data.weekProductionScraps.length > 0) {
// @ts-ignore
data.weekProductionScraps.map((item,index)=>{
data.weekProductionScraps.forEach((item,index)=>{
let arrInner = [];
arrInner.push(index+1,item.sectionName,item.scrapNum || 0);
arr2.push(arrInner);
@ -103,7 +103,7 @@ function LeftDown() {
// @ts-ignore
if (data.monthProductionScraps && data.monthProductionScraps.length > 0) {
// @ts-ignore
data.monthProductionScraps.map((item,index)=>{
data.monthProductionScraps.forEach((item,index)=>{
let arrInner = [];
arrInner.push(index+1,item.sectionName,item.scrapNum || 0);
arr3.push(arrInner);

View File

@ -37,7 +37,7 @@ function LeftUp() {
let sum: number[] = [];
// 生成obj
// @ts-ignore
data.scrapBars.map((item,index) => {
data.scrapBars.forEach((item,index) => {
let obj = {
data: [],
type: "bar",
@ -67,7 +67,7 @@ function LeftUp() {
for(let i = 0;i < dataSource.day.series.length;i++){
let itemSeries = dataSource.day.series[i]
// @ts-ignore
data.todayAllProductionScraps[item].map((itemInner,indexInner)=>{
data.todayAllProductionScraps[item].forEach((itemInner,indexInner)=>{
// @ts-ignore
if (itemInner.sectionName.indexOf(itemSeries.name)!==-1) {
// @ts-ignore
@ -105,7 +105,7 @@ function LeftUp() {
let sum: number[] = [];
// 生成obj
// @ts-ignore
data.scrapBars.map((item,index) => {
data.scrapBars.forEach((item,index) => {
let obj = {
data: [],
type: "bar",
@ -135,7 +135,7 @@ function LeftUp() {
for(let i = 0;i < dataSource.week.series.length;i++){
let itemSeries = dataSource.week.series[i]
// @ts-ignore
data.weekAllProductionScraps[item].map((itemInner,indexInner)=>{
data.weekAllProductionScraps[item].forEach((itemInner,indexInner)=>{
// @ts-ignore
if (itemInner.sectionName.indexOf(itemSeries.name)!==-1) {
// @ts-ignore
@ -173,7 +173,7 @@ function LeftUp() {
let sum: number[] = [];
// 生成obj
// @ts-ignore
data.scrapBars.map((item,index) => {
data.scrapBars.forEach((item,index) => {
let obj = {
data: [],
type: "bar",
@ -203,7 +203,7 @@ function LeftUp() {
for(let i = 0;i < dataSource.month.series.length;i++){
let itemSeries = dataSource.month.series[i]
// @ts-ignore
data.monthAllProductionScraps[item].map((itemInner,indexInner)=>{
data.monthAllProductionScraps[item].forEach((itemInner,indexInner)=>{
// @ts-ignore
if (itemInner.sectionName.indexOf(itemSeries.name)!==-1) {
// @ts-ignore

View File

@ -81,7 +81,7 @@ function RightDown() {
// @ts-ignore
if (data.todayProductionDets && data.todayProductionDets.length > 0) {
// @ts-ignore
data.todayProductionDets.map((item,index)=>{
data.todayProductionDets.forEach((item,index)=>{
let arrInner = [];
arrInner.push(dayjs(item.recTime).format("HH:mm"),item.inputNum,item.outputNum);
arr1.push(arrInner);
@ -97,7 +97,7 @@ function RightDown() {
// @ts-ignore
if (data.weekProductionDets && data.weekProductionDets.length > 0) {
// @ts-ignore
data.weekProductionDets.map((item,index)=>{
data.weekProductionDets.forEach((item,index)=>{
let arrInner = [];
arrInner.push(dayjs(item.recTime).format("YYYY/MM/DD"),item.inputNum,item.outputNum);
arr2.push(arrInner);
@ -113,7 +113,7 @@ function RightDown() {
// @ts-ignore
if (data.monthProductionDets && data.monthProductionDets.length > 0) {
// @ts-ignore
data.monthProductionDets.map((item,index)=>{
data.monthProductionDets.forEach((item,index)=>{
let arrInner = [];
arrInner.push(dayjs(item.recTime).format("YYYY/MM/DD"),item.inputNum,item.outputNum);
arr3.push(arrInner);

View File

@ -19,7 +19,7 @@ function RightUp() {
// @ts-ignore
if (data.sectionDet && data.sectionDet.length > 0) {
// @ts-ignore
data.sectionDet.map((item, index) => {
data.sectionDet.forEach((item, index) => {
let arrInner = []
arrInner.push(index + 1, item.lineName, item.inputNum, item.outputNum)
arr.push(arrInner)

View File

@ -5,7 +5,31 @@ import Right from "./Right";
import Center from "./Center";
import {useEffect} from 'react';
import {useNavigate} from "react-router-dom";
import { useDispatch } from 'react-redux';
import { UpdateLine2After } from "../../store/LinePageSlice";
function LinePage() {
const dispatch = useDispatch();
// const myUrl = "192.168.8.22"
const myUrl = window.location.host;
useEffect(() => {
let websocket2_2 = new WebSocket("ws://" + myUrl + "/websocket/message?userId=2-2-" + Date.now());
// @ts-ignore
websocket2_2.onmessage = function (event) {
let msgData = event.data
try {
msgData = JSON.parse(event.data);
} catch (error) {
console.log("websocket: [unable to msgData] : ", event.data);
}
if (!Object.prototype.toString.call(msgData).includes('Object')) return;
dispatch(UpdateLine2After(msgData));
}
// 清理函数
return () => {
websocket2_2.close();
};
}, [dispatch]);
const navigate = useNavigate();
useEffect(() => {
const handleKeyDown = (event:any) => {

View File

@ -29,7 +29,7 @@ function CenterDown() {
{ name: "周", ename: "week" },
{ name: "月", ename: "month" },
];
const [activeName, setActiveName] = useState<string>(nameList[1].ename);
const [activeName] = useState<string>(nameList[1].ename);
// const handleButtonChange = (activeName: string) => {
// setActiveName(activeName);
// };
@ -52,7 +52,7 @@ function CenterDown() {
// @ts-ignore
sumAlarm = data.alarms.length
// @ts-ignore
data.alarms.map((item,index) => {
data.alarms.forEach((item,index) => {
let arrInner = []
arrInner.push(
index+1,
@ -70,11 +70,11 @@ function CenterDown() {
// @ts-ignore
let keys = Object.keys(data.todayProductionRates)
// @ts-ignore
data.todayProductionRates[keys[0]].map((item,index)=>{
data.todayProductionRates[keys[0]].forEach((item,index)=>{
// @ts-ignore
dataSource.day.xData.push(dayjs(item.recTime).format("HH:mm"))
})
keys.map((item,index)=>{
keys.forEach((item,index)=>{
let obj = {
name: "",
type: "line",
@ -85,7 +85,7 @@ function CenterDown() {
// @ts-ignore
obj.name = data.todayProductionRates[item][0].lineName
// @ts-ignore
data.todayProductionRates[item].map((subItem,index)=>{
data.todayProductionRates[item].forEach((subItem,index)=>{
// @ts-ignore
obj.data.push(subItem.passRate)
})
@ -100,11 +100,11 @@ function CenterDown() {
// @ts-ignore
let keys = Object.keys(data.weekProductionRates)
// @ts-ignore
data.weekProductionRates[keys[0]].map((item,index)=>{
data.weekProductionRates[keys[0]].forEach((item,index)=>{
// @ts-ignore
dataSource.week.xData.push(dayjs(item.recTime).format("HH:mm"))
})
keys.map((item,index)=>{
keys.forEach((item,index)=>{
let obj = {
name: "",
type: "line",
@ -115,7 +115,7 @@ function CenterDown() {
// @ts-ignore
obj.name = data.weekProductionRates[item][0].lineName
// @ts-ignore
data.weekProductionRates[item].map((subItem,index)=>{
data.weekProductionRates[item].forEach((subItem,index)=>{
// @ts-ignore
obj.data.push(subItem.passRate)
})
@ -130,11 +130,11 @@ function CenterDown() {
// @ts-ignore
let keys = Object.keys(data.monthProductionRates)
// @ts-ignore
data.monthProductionRates[keys[0]].map((item,index)=>{
data.monthProductionRates[keys[0]].forEach((item,index)=>{
// @ts-ignore
dataSource.month.xData.push(dayjs(item.recTime).format("HH:mm"))
})
keys.map((item,index)=>{
keys.forEach((item,index)=>{
let obj = {
name: "",
type: "line",
@ -145,7 +145,7 @@ function CenterDown() {
// @ts-ignore
obj.name = data.monthProductionRates[item][0].lineName
// @ts-ignore
data.monthProductionRates[item].map((subItem,index)=>{
data.monthProductionRates[item].forEach((subItem,index)=>{
// @ts-ignore
obj.data.push(subItem.passRate)
})
@ -192,7 +192,7 @@ function CenterDown() {
{<ReactECharts option={options} style={{ height: "100%" }} />}
</div>
)}
{chartData.xData.length==0 && (
{chartData.xData.length===0 && (
<p
style={{
color: "#cccf",

View File

@ -77,7 +77,7 @@ function LeftDown() {
// @ts-ignore
if (data.todayProductionScraps && data.todayProductionScraps.length > 0) {
// @ts-ignore
data.todayProductionScraps.map((item,index)=>{
data.todayProductionScraps.forEach((item,index)=>{
let arrInner = [];
arrInner.push(index+1,item.sectionName,item.scrapNum || 0);
arr1.push(arrInner);
@ -90,7 +90,7 @@ function LeftDown() {
// @ts-ignore
if (data.weekProductionScraps && data.weekProductionScraps.length > 0) {
// @ts-ignore
data.weekProductionScraps.map((item,index)=>{
data.weekProductionScraps.forEach((item,index)=>{
let arrInner = [];
arrInner.push(index+1,item.sectionName,item.scrapNum || 0);
arr2.push(arrInner);
@ -103,7 +103,7 @@ function LeftDown() {
// @ts-ignore
if (data.monthProductionScraps && data.monthProductionScraps.length > 0) {
// @ts-ignore
data.monthProductionScraps.map((item,index)=>{
data.monthProductionScraps.forEach((item,index)=>{
let arrInner = [];
arrInner.push(index+1,item.sectionName,item.scrapNum || 0);
arr3.push(arrInner);

View File

@ -37,7 +37,7 @@ function LeftUp() {
let sum: number[] = [];
// 生成obj
// @ts-ignore
data.scrapBars.map((item,index) => {
data.scrapBars.forEach((item,index) => {
let obj = {
data: [],
type: "bar",
@ -67,7 +67,7 @@ function LeftUp() {
for(let i = 0;i < dataSource.day.series.length;i++){
let itemSeries = dataSource.day.series[i]
// @ts-ignore
data.todayAllProductionScraps[item].map((itemInner,indexInner)=>{
data.todayAllProductionScraps[item].forEach((itemInner,indexInner)=>{
// @ts-ignore
if (itemInner.sectionName.indexOf(itemSeries.name)!==-1) {
// @ts-ignore
@ -105,7 +105,7 @@ function LeftUp() {
let sum: number[] = [];
// 生成obj
// @ts-ignore
data.scrapBars.map((item,index) => {
data.scrapBars.forEach((item,index) => {
let obj = {
data: [],
type: "bar",
@ -135,7 +135,7 @@ function LeftUp() {
for(let i = 0;i < dataSource.week.series.length;i++){
let itemSeries = dataSource.week.series[i]
// @ts-ignore
data.weekAllProductionScraps[item].map((itemInner,indexInner)=>{
data.weekAllProductionScraps[item].forEach((itemInner,indexInner)=>{
// @ts-ignore
if (itemInner.sectionName.indexOf(itemSeries.name)!==-1) {
// @ts-ignore
@ -173,7 +173,7 @@ function LeftUp() {
let sum: number[] = [];
// 生成obj
// @ts-ignore
data.scrapBars.map((item,index) => {
data.scrapBars.forEach((item,index) => {
let obj = {
data: [],
type: "bar",
@ -203,7 +203,7 @@ function LeftUp() {
for(let i = 0;i < dataSource.month.series.length;i++){
let itemSeries = dataSource.month.series[i]
// @ts-ignore
data.monthAllProductionScraps[item].map((itemInner,indexInner)=>{
data.monthAllProductionScraps[item].forEach((itemInner,indexInner)=>{
// @ts-ignore
if (itemInner.sectionName.indexOf(itemSeries.name)!==-1) {
// @ts-ignore

View File

@ -80,7 +80,7 @@ function RightDown() {
// @ts-ignore
if (data.todayProductionDets && data.todayProductionDets.length > 0) {
// @ts-ignore
data.todayProductionDets.map((item,index)=>{
data.todayProductionDets.forEach((item,index)=>{
let arrInner = [];
arrInner.push(dayjs(item.recTime).format("HH:mm"),item.inputNum,item.outputNum);
arr1.push(arrInner);
@ -96,7 +96,7 @@ function RightDown() {
// @ts-ignore
if (data.weekProductionDets && data.weekProductionDets.length > 0) {
// @ts-ignore
data.weekProductionDets.map((item,index)=>{
data.weekProductionDets.forEach((item,index)=>{
let arrInner = [];
arrInner.push(dayjs(item.recTime).format("YYYY/MM/DD"),item.inputNum,item.outputNum);
arr2.push(arrInner);
@ -112,7 +112,7 @@ function RightDown() {
// @ts-ignore
if (data.monthProductionDets && data.monthProductionDets.length > 0) {
// @ts-ignore
data.monthProductionDets.map((item,index)=>{
data.monthProductionDets.forEach((item,index)=>{
let arrInner = [];
arrInner.push(dayjs(item.recTime).format("YYYY/MM/DD"),item.inputNum,item.outputNum);
arr3.push(arrInner);

View File

@ -19,7 +19,7 @@ function RightUp() {
// @ts-ignore
if (data.sectionDet && data.sectionDet.length > 0) {
// @ts-ignore
data.sectionDet.map((item, index) => {
data.sectionDet.forEach((item, index) => {
let arrInner = []
arrInner.push(index + 1, item.lineName, item.inputNum, item.outputNum)
arr.push(arrInner)

View File

@ -5,7 +5,31 @@ import Right from "./Right";
import Center from "./Center";
import {useEffect} from 'react';
import {useNavigate} from "react-router-dom";
import { useDispatch } from 'react-redux';
import { UpdateLine3Before } from "../../store/LinePageSlice";
function LinePage() {
const dispatch = useDispatch();
// const myUrl = "192.168.8.22"
const myUrl = window.location.host;
useEffect(() => {
let websocket3_1 = new WebSocket("ws://" + myUrl + "/websocket/message?userId=3-1-" + Date.now());
// @ts-ignore
websocket3_1.onmessage = function (event) {
let msgData = event.data
try {
msgData = JSON.parse(event.data);
} catch (error) {
console.log("websocket: [unable to msgData] : ", event.data);
}
if (!Object.prototype.toString.call(msgData).includes('Object')) return;
dispatch(UpdateLine3Before(msgData));
}
// 清理函数
return () => {
websocket3_1.close();
};
}, [dispatch]);
const navigate = useNavigate();
useEffect(() => {
const handleKeyDown = (event:any) => {

View File

@ -29,7 +29,7 @@ function CenterDown() {
{ name: "周", ename: "week" },
{ name: "月", ename: "month" },
];
const [activeName, setActiveName] = useState<string>(nameList[1].ename);
const [activeName] = useState<string>(nameList[1].ename);
// const handleButtonChange = (activeName: string) => {
// setActiveName(activeName);
// };
@ -52,7 +52,7 @@ function CenterDown() {
// @ts-ignore
sumAlarm = data.alarms.length
// @ts-ignore
data.alarms.map((item,index) => {
data.alarms.forEach((item,index) => {
let arrInner = []
arrInner.push(
index+1,
@ -70,11 +70,11 @@ function CenterDown() {
// @ts-ignore
let keys = Object.keys(data.todayProductionRates)
// @ts-ignore
data.todayProductionRates[keys[0]].map((item,index)=>{
data.todayProductionRates[keys[0]].forEach((item,index)=>{
// @ts-ignore
dataSource.day.xData.push(dayjs(item.recTime).format("HH:mm"))
})
keys.map((item,index)=>{
keys.forEach((item,index)=>{
let obj = {
name: "",
type: "line",
@ -85,7 +85,7 @@ function CenterDown() {
// @ts-ignore
obj.name = data.todayProductionRates[item][0].lineName
// @ts-ignore
data.todayProductionRates[item].map((subItem,index)=>{
data.todayProductionRates[item].forEach((subItem,index)=>{
// @ts-ignore
obj.data.push(subItem.passRate)
})
@ -100,11 +100,11 @@ function CenterDown() {
// @ts-ignore
let keys = Object.keys(data.weekProductionRates)
// @ts-ignore
data.weekProductionRates[keys[0]].map((item,index)=>{
data.weekProductionRates[keys[0]].forEach((item,index)=>{
// @ts-ignore
dataSource.week.xData.push(dayjs(item.recTime).format("HH:mm"))
})
keys.map((item,index)=>{
keys.forEach((item,index)=>{
let obj = {
name: "",
type: "line",
@ -115,7 +115,7 @@ function CenterDown() {
// @ts-ignore
obj.name = data.weekProductionRates[item][0].lineName
// @ts-ignore
data.weekProductionRates[item].map((subItem,index)=>{
data.weekProductionRates[item].forEach((subItem,index)=>{
// @ts-ignore
obj.data.push(subItem.passRate)
})
@ -130,11 +130,11 @@ function CenterDown() {
// @ts-ignore
let keys = Object.keys(data.monthProductionRates)
// @ts-ignore
data.monthProductionRates[keys[0]].map((item,index)=>{
data.monthProductionRates[keys[0]].forEach((item,index)=>{
// @ts-ignore
dataSource.month.xData.push(dayjs(item.recTime).format("HH:mm"))
})
keys.map((item,index)=>{
keys.forEach((item,index)=>{
let obj = {
name: "",
type: "line",
@ -145,7 +145,7 @@ function CenterDown() {
// @ts-ignore
obj.name = data.monthProductionRates[item][0].lineName
// @ts-ignore
data.monthProductionRates[item].map((subItem,index)=>{
data.monthProductionRates[item].forEach((subItem,index)=>{
// @ts-ignore
obj.data.push(subItem.passRate)
})
@ -192,7 +192,7 @@ function CenterDown() {
{<ReactECharts option={options} style={{ height: "100%" }} />}
</div>
)}
{chartData.xData.length==0 && (
{chartData.xData.length===0 && (
<p
style={{
color: "#cccf",

View File

@ -77,7 +77,7 @@ function LeftDown() {
// @ts-ignore
if (data.todayProductionScraps && data.todayProductionScraps.length > 0) {
// @ts-ignore
data.todayProductionScraps.map((item,index)=>{
data.todayProductionScraps.forEach((item,index)=>{
let arrInner = [];
arrInner.push(index+1,item.sectionName,item.scrapNum || 0);
arr1.push(arrInner);
@ -90,7 +90,7 @@ function LeftDown() {
// @ts-ignore
if (data.weekProductionScraps && data.weekProductionScraps.length > 0) {
// @ts-ignore
data.weekProductionScraps.map((item,index)=>{
data.weekProductionScraps.forEach((item,index)=>{
let arrInner = [];
arrInner.push(index+1,item.sectionName,item.scrapNum || 0);
arr2.push(arrInner);
@ -103,7 +103,7 @@ function LeftDown() {
// @ts-ignore
if (data.monthProductionScraps && data.monthProductionScraps.length > 0) {
// @ts-ignore
data.monthProductionScraps.map((item,index)=>{
data.monthProductionScraps.forEach((item,index)=>{
let arrInner = [];
arrInner.push(index+1,item.sectionName,item.scrapNum || 0);
arr3.push(arrInner);

View File

@ -37,7 +37,7 @@ function LeftUp() {
let sum: number[] = [];
// 生成obj
// @ts-ignore
data.scrapBars.map((item,index) => {
data.scrapBars.forEach((item,index) => {
let obj = {
data: [],
type: "bar",
@ -67,7 +67,7 @@ function LeftUp() {
for(let i = 0;i < dataSource.day.series.length;i++){
let itemSeries = dataSource.day.series[i]
// @ts-ignore
data.todayAllProductionScraps[item].map((itemInner,indexInner)=>{
data.todayAllProductionScraps[item].forEach((itemInner,indexInner)=>{
// @ts-ignore
if (itemInner.sectionName.indexOf(itemSeries.name)!==-1) {
// @ts-ignore
@ -105,7 +105,7 @@ function LeftUp() {
let sum: number[] = [];
// 生成obj
// @ts-ignore
data.scrapBars.map((item,index) => {
data.scrapBars.forEach((item,index) => {
let obj = {
data: [],
type: "bar",
@ -135,7 +135,7 @@ function LeftUp() {
for(let i = 0;i < dataSource.week.series.length;i++){
let itemSeries = dataSource.week.series[i]
// @ts-ignore
data.weekAllProductionScraps[item].map((itemInner,indexInner)=>{
data.weekAllProductionScraps[item].forEach((itemInner,indexInner)=>{
// @ts-ignore
if (itemInner.sectionName.indexOf(itemSeries.name)!==-1) {
// @ts-ignore
@ -173,7 +173,7 @@ function LeftUp() {
let sum: number[] = [];
// 生成obj
// @ts-ignore
data.scrapBars.map((item,index) => {
data.scrapBars.forEach((item,index) => {
let obj = {
data: [],
type: "bar",
@ -203,7 +203,7 @@ function LeftUp() {
for(let i = 0;i < dataSource.month.series.length;i++){
let itemSeries = dataSource.month.series[i]
// @ts-ignore
data.monthAllProductionScraps[item].map((itemInner,indexInner)=>{
data.monthAllProductionScraps[item].forEach((itemInner,indexInner)=>{
// @ts-ignore
if (itemInner.sectionName.indexOf(itemSeries.name)!==-1) {
// @ts-ignore

View File

@ -81,7 +81,7 @@ function RightDown() {
// @ts-ignore
if (data.todayProductionDets && data.todayProductionDets.length > 0) {
// @ts-ignore
data.todayProductionDets.map((item,index)=>{
data.todayProductionDets.forEach((item,index)=>{
let arrInner = [];
arrInner.push(dayjs(item.recTime).format("HH:mm"),item.inputNum,item.outputNum);
arr1.push(arrInner);
@ -97,7 +97,7 @@ function RightDown() {
// @ts-ignore
if (data.weekProductionDets && data.weekProductionDets.length > 0) {
// @ts-ignore
data.weekProductionDets.map((item,index)=>{
data.weekProductionDets.forEach((item,index)=>{
let arrInner = [];
arrInner.push(dayjs(item.recTime).format("YYYY/MM/DD"),item.inputNum,item.outputNum);
arr2.push(arrInner);
@ -113,7 +113,7 @@ function RightDown() {
// @ts-ignore
if (data.monthProductionDets && data.monthProductionDets.length > 0) {
// @ts-ignore
data.monthProductionDets.map((item,index)=>{
data.monthProductionDets.forEach((item,index)=>{
let arrInner = [];
arrInner.push(dayjs(item.recTime).format("YYYY/MM/DD"),item.inputNum,item.outputNum);
arr3.push(arrInner);

View File

@ -19,7 +19,7 @@ function RightUp() {
// @ts-ignore
if (data.sectionDet && data.sectionDet.length > 0) {
// @ts-ignore
data.sectionDet.map((item, index) => {
data.sectionDet.forEach((item, index) => {
let arrInner = []
arrInner.push(index + 1, item.lineName, item.inputNum, item.outputNum)
arr.push(arrInner)

View File

@ -5,7 +5,31 @@ import Right from "./Right";
import Center from "./Center";
import {useEffect} from 'react';
import {useNavigate} from "react-router-dom";
import { useDispatch } from 'react-redux';
import { UpdateLine3After } from "../../store/LinePageSlice";
function LinePage() {
const dispatch = useDispatch();
// const myUrl = "192.168.8.22"
const myUrl = window.location.host;
useEffect(() => {
let websocket3_2 = new WebSocket("ws://" + myUrl + "/websocket/message?userId=3-2-" + Date.now());
// @ts-ignore
websocket3_2.onmessage = function (event) {
let msgData = event.data
try {
msgData = JSON.parse(event.data);
} catch (error) {
console.log("websocket: [unable to msgData] : ", event.data);
}
if (!Object.prototype.toString.call(msgData).includes('Object')) return;
dispatch(UpdateLine3After(msgData));
}
// 清理函数
return () => {
websocket3_2.close();
};
}, [dispatch]);
const navigate = useNavigate();
useEffect(() => {
const handleKeyDown = (event:any) => {

View File

@ -29,7 +29,7 @@ function CenterDown() {
{ name: "周", ename: "week" },
{ name: "月", ename: "month" },
];
const [activeName, setActiveName] = useState<string>(nameList[1].ename);
const [activeName] = useState<string>(nameList[1].ename);
// const handleButtonChange = (activeName: string) => {
// setActiveName(activeName);
// };
@ -52,7 +52,7 @@ function CenterDown() {
// @ts-ignore
sumAlarm = data.alarms.length
// @ts-ignore
data.alarms.map((item,index) => {
data.alarms.forEach((item,index) => {
let arrInner = []
arrInner.push(
index+1,
@ -70,11 +70,11 @@ function CenterDown() {
// @ts-ignore
let keys = Object.keys(data.todayProductionRates)
// @ts-ignore
data.todayProductionRates[keys[0]].map((item,index)=>{
data.todayProductionRates[keys[0]].forEach((item,index)=>{
// @ts-ignore
dataSource.day.xData.push(dayjs(item.recTime).format("HH:mm"))
})
keys.map((item,index)=>{
keys.forEach((item,index)=>{
let obj = {
name: "",
type: "line",
@ -85,7 +85,7 @@ function CenterDown() {
// @ts-ignore
obj.name = data.todayProductionRates[item][0].lineName
// @ts-ignore
data.todayProductionRates[item].map((subItem,index)=>{
data.todayProductionRates[item].forEach((subItem,index)=>{
// @ts-ignore
obj.data.push(subItem.passRate)
})
@ -100,11 +100,11 @@ function CenterDown() {
// @ts-ignore
let keys = Object.keys(data.weekProductionRates)
// @ts-ignore
data.weekProductionRates[keys[0]].map((item,index)=>{
data.weekProductionRates[keys[0]].forEach((item,index)=>{
// @ts-ignore
dataSource.week.xData.push(dayjs(item.recTime).format("HH:mm"))
})
keys.map((item,index)=>{
keys.forEach((item,index)=>{
let obj = {
name: "",
type: "line",
@ -115,7 +115,7 @@ function CenterDown() {
// @ts-ignore
obj.name = data.weekProductionRates[item][0].lineName
// @ts-ignore
data.weekProductionRates[item].map((subItem,index)=>{
data.weekProductionRates[item].forEach((subItem,index)=>{
// @ts-ignore
obj.data.push(subItem.passRate)
})
@ -130,11 +130,11 @@ function CenterDown() {
// @ts-ignore
let keys = Object.keys(data.monthProductionRates)
// @ts-ignore
data.monthProductionRates[keys[0]].map((item,index)=>{
data.monthProductionRates[keys[0]].forEach((item,index)=>{
// @ts-ignore
dataSource.month.xData.push(dayjs(item.recTime).format("HH:mm"))
})
keys.map((item,index)=>{
keys.forEach((item,index)=>{
let obj = {
name: "",
type: "line",
@ -145,7 +145,7 @@ function CenterDown() {
// @ts-ignore
obj.name = data.monthProductionRates[item][0].lineName
// @ts-ignore
data.monthProductionRates[item].map((subItem,index)=>{
data.monthProductionRates[item].forEach((subItem,index)=>{
// @ts-ignore
obj.data.push(subItem.passRate)
})
@ -192,7 +192,7 @@ function CenterDown() {
{<ReactECharts option={options} style={{ height: "100%" }} />}
</div>
)}
{chartData.xData.length==0 && (
{chartData.xData.length===0 && (
<p
style={{
color: "#cccf",

View File

@ -77,7 +77,7 @@ function LeftDown() {
// @ts-ignore
if (data.todayProductionScraps && data.todayProductionScraps.length > 0) {
// @ts-ignore
data.todayProductionScraps.map((item,index)=>{
data.todayProductionScraps.forEach((item,index)=>{
let arrInner = [];
arrInner.push(index+1,item.sectionName,item.scrapNum || 0);
arr1.push(arrInner);
@ -90,7 +90,7 @@ function LeftDown() {
// @ts-ignore
if (data.weekProductionScraps && data.weekProductionScraps.length > 0) {
// @ts-ignore
data.weekProductionScraps.map((item,index)=>{
data.weekProductionScraps.forEach((item,index)=>{
let arrInner = [];
arrInner.push(index+1,item.sectionName,item.scrapNum || 0);
arr2.push(arrInner);
@ -103,7 +103,7 @@ function LeftDown() {
// @ts-ignore
if (data.monthProductionScraps && data.monthProductionScraps.length > 0) {
// @ts-ignore
data.monthProductionScraps.map((item,index)=>{
data.monthProductionScraps.forEach((item,index)=>{
let arrInner = [];
arrInner.push(index+1,item.sectionName,item.scrapNum || 0);
arr3.push(arrInner);

View File

@ -37,7 +37,7 @@ function LeftUp() {
let sum: number[] = [];
// 生成obj
// @ts-ignore
data.scrapBars.map((item,index) => {
data.scrapBars.forEach((item,index) => {
let obj = {
data: [],
type: "bar",
@ -67,7 +67,7 @@ function LeftUp() {
for(let i = 0;i < dataSource.day.series.length;i++){
let itemSeries = dataSource.day.series[i]
// @ts-ignore
data.todayAllProductionScraps[item].map((itemInner,indexInner)=>{
data.todayAllProductionScraps[item].forEach((itemInner,indexInner)=>{
// @ts-ignore
if (itemInner.sectionName.indexOf(itemSeries.name)!==-1) {
// @ts-ignore
@ -105,7 +105,7 @@ function LeftUp() {
let sum: number[] = [];
// 生成obj
// @ts-ignore
data.scrapBars.map((item,index) => {
data.scrapBars.forEach((item,index) => {
let obj = {
data: [],
type: "bar",
@ -135,7 +135,7 @@ function LeftUp() {
for(let i = 0;i < dataSource.week.series.length;i++){
let itemSeries = dataSource.week.series[i]
// @ts-ignore
data.weekAllProductionScraps[item].map((itemInner,indexInner)=>{
data.weekAllProductionScraps[item].forEach((itemInner,indexInner)=>{
// @ts-ignore
if (itemInner.sectionName.indexOf(itemSeries.name)!==-1) {
// @ts-ignore
@ -173,7 +173,7 @@ function LeftUp() {
let sum: number[] = [];
// 生成obj
// @ts-ignore
data.scrapBars.map((item,index) => {
data.scrapBars.forEach((item,index) => {
let obj = {
data: [],
type: "bar",
@ -203,7 +203,7 @@ function LeftUp() {
for(let i = 0;i < dataSource.month.series.length;i++){
let itemSeries = dataSource.month.series[i]
// @ts-ignore
data.monthAllProductionScraps[item].map((itemInner,indexInner)=>{
data.monthAllProductionScraps[item].forEach((itemInner,indexInner)=>{
// @ts-ignore
if (itemInner.sectionName.indexOf(itemSeries.name)!==-1) {
// @ts-ignore

View File

@ -81,7 +81,7 @@ function RightDown() {
// @ts-ignore
if (data.todayProductionDets && data.todayProductionDets.length > 0) {
// @ts-ignore
data.todayProductionDets.map((item,index)=>{
data.todayProductionDets.forEach((item,index)=>{
let arrInner = [];
arrInner.push(dayjs(item.recTime).format("HH:mm"),item.inputNum,item.outputNum);
arr1.push(arrInner);
@ -97,7 +97,7 @@ function RightDown() {
// @ts-ignore
if (data.weekProductionDets && data.weekProductionDets.length > 0) {
// @ts-ignore
data.weekProductionDets.map((item,index)=>{
data.weekProductionDets.forEach((item,index)=>{
let arrInner = [];
arrInner.push(dayjs(item.recTime).format("YYYY/MM/DD"),item.inputNum,item.outputNum);
arr2.push(arrInner);
@ -113,7 +113,7 @@ function RightDown() {
// @ts-ignore
if (data.monthProductionDets && data.monthProductionDets.length > 0) {
// @ts-ignore
data.monthProductionDets.map((item,index)=>{
data.monthProductionDets.forEach((item,index)=>{
let arrInner = [];
arrInner.push(dayjs(item.recTime).format("YYYY/MM/DD"),item.inputNum,item.outputNum);
arr3.push(arrInner);

View File

@ -19,7 +19,7 @@ function RightUp() {
// @ts-ignore
if (data.sectionDet && data.sectionDet.length > 0) {
// @ts-ignore
data.sectionDet.map((item, index) => {
data.sectionDet.forEach((item, index) => {
let arrInner = []
arrInner.push(index + 1, item.lineName, item.inputNum, item.outputNum)
arr.push(arrInner)

View File

@ -5,7 +5,31 @@ import Right from "./Right";
import Center from "./Center";
import {useEffect} from 'react';
import {useNavigate} from "react-router-dom";
import { useDispatch } from 'react-redux';
import { UpdateLine4Before } from "../../store/LinePageSlice";
function LinePage() {
const dispatch = useDispatch();
// const myUrl = "192.168.8.22"
const myUrl = window.location.host;
useEffect(() => {
let websocket4_1 = new WebSocket("ws://" + myUrl + "/websocket/message?userId=4-1-" + Date.now());
// @ts-ignore
websocket4_1.onmessage = function (event) {
let msgData = event.data
try {
msgData = JSON.parse(event.data);
} catch (error) {
console.log("websocket: [unable to msgData] : ", event.data);
}
if (!Object.prototype.toString.call(msgData).includes('Object')) return;
dispatch(UpdateLine4Before(msgData));
}
// 清理函数
return () => {
websocket4_1.close();
};
}, [dispatch]);
const navigate = useNavigate();
useEffect(() => {
const handleKeyDown = (event:any) => {

View File

@ -29,7 +29,7 @@ function CenterDown() {
{ name: "周", ename: "week" },
{ name: "月", ename: "month" },
];
const [activeName, setActiveName] = useState<string>(nameList[1].ename);
const [activeName] = useState<string>(nameList[1].ename);
// const handleButtonChange = (activeName: string) => {
// setActiveName(activeName);
// };
@ -52,7 +52,7 @@ function CenterDown() {
// @ts-ignore
sumAlarm = data.alarms.length
// @ts-ignore
data.alarms.map((item,index) => {
data.alarms.forEach((item,index) => {
let arrInner = []
arrInner.push(
index+1,
@ -70,11 +70,11 @@ function CenterDown() {
// @ts-ignore
let keys = Object.keys(data.todayProductionRates)
// @ts-ignore
data.todayProductionRates[keys[0]].map((item,index)=>{
data.todayProductionRates[keys[0]].forEach((item,index)=>{
// @ts-ignore
dataSource.day.xData.push(dayjs(item.recTime).format("HH:mm"))
})
keys.map((item,index)=>{
keys.forEach((item,index)=>{
let obj = {
name: "",
type: "line",
@ -85,7 +85,7 @@ function CenterDown() {
// @ts-ignore
obj.name = data.todayProductionRates[item][0].lineName
// @ts-ignore
data.todayProductionRates[item].map((subItem,index)=>{
data.todayProductionRates[item].forEach((subItem,index)=>{
// @ts-ignore
obj.data.push(subItem.passRate)
})
@ -100,11 +100,11 @@ function CenterDown() {
// @ts-ignore
let keys = Object.keys(data.weekProductionRates)
// @ts-ignore
data.weekProductionRates[keys[0]].map((item,index)=>{
data.weekProductionRates[keys[0]].forEach((item,index)=>{
// @ts-ignore
dataSource.week.xData.push(dayjs(item.recTime).format("HH:mm"))
})
keys.map((item,index)=>{
keys.forEach((item,index)=>{
let obj = {
name: "",
type: "line",
@ -115,7 +115,7 @@ function CenterDown() {
// @ts-ignore
obj.name = data.weekProductionRates[item][0].lineName
// @ts-ignore
data.weekProductionRates[item].map((subItem,index)=>{
data.weekProductionRates[item].forEach((subItem,index)=>{
// @ts-ignore
obj.data.push(subItem.passRate)
})
@ -130,11 +130,11 @@ function CenterDown() {
// @ts-ignore
let keys = Object.keys(data.monthProductionRates)
// @ts-ignore
data.monthProductionRates[keys[0]].map((item,index)=>{
data.monthProductionRates[keys[0]].forEach((item,index)=>{
// @ts-ignore
dataSource.month.xData.push(dayjs(item.recTime).format("HH:mm"))
})
keys.map((item,index)=>{
keys.forEach((item,index)=>{
let obj = {
name: "",
type: "line",
@ -145,7 +145,7 @@ function CenterDown() {
// @ts-ignore
obj.name = data.monthProductionRates[item][0].lineName
// @ts-ignore
data.monthProductionRates[item].map((subItem,index)=>{
data.monthProductionRates[item].forEach((subItem,index)=>{
// @ts-ignore
obj.data.push(subItem.passRate)
})
@ -192,7 +192,7 @@ function CenterDown() {
{<ReactECharts option={options} style={{ height: "100%" }} />}
</div>
)}
{chartData.xData.length==0 && (
{chartData.xData.length===0 && (
<p
style={{
color: "#cccf",

View File

@ -77,7 +77,7 @@ function LeftDown() {
// @ts-ignore
if (data.todayProductionScraps && data.todayProductionScraps.length > 0) {
// @ts-ignore
data.todayProductionScraps.map((item,index)=>{
data.todayProductionScraps.forEach((item,index)=>{
let arrInner = [];
arrInner.push(index+1,item.sectionName,item.scrapNum || 0);
arr1.push(arrInner);
@ -90,7 +90,7 @@ function LeftDown() {
// @ts-ignore
if (data.weekProductionScraps && data.weekProductionScraps.length > 0) {
// @ts-ignore
data.weekProductionScraps.map((item,index)=>{
data.weekProductionScraps.forEach((item,index)=>{
let arrInner = [];
arrInner.push(index+1,item.sectionName,item.scrapNum || 0);
arr2.push(arrInner);
@ -103,7 +103,7 @@ function LeftDown() {
// @ts-ignore
if (data.monthProductionScraps && data.monthProductionScraps.length > 0) {
// @ts-ignore
data.monthProductionScraps.map((item,index)=>{
data.monthProductionScraps.forEach((item,index)=>{
let arrInner = [];
arrInner.push(index+1,item.sectionName,item.scrapNum || 0);
arr3.push(arrInner);

View File

@ -37,7 +37,7 @@ function LeftUp() {
let sum: number[] = [];
// 生成obj
// @ts-ignore
data.scrapBars.map((item,index) => {
data.scrapBars.forEach((item,index) => {
let obj = {
data: [],
type: "bar",
@ -67,7 +67,7 @@ function LeftUp() {
for(let i = 0;i < dataSource.day.series.length;i++){
let itemSeries = dataSource.day.series[i]
// @ts-ignore
data.todayAllProductionScraps[item].map((itemInner,indexInner)=>{
data.todayAllProductionScraps[item].forEach((itemInner,indexInner)=>{
// @ts-ignore
if (itemInner.sectionName.indexOf(itemSeries.name)!==-1) {
// @ts-ignore
@ -105,7 +105,7 @@ function LeftUp() {
let sum: number[] = [];
// 生成obj
// @ts-ignore
data.scrapBars.map((item,index) => {
data.scrapBars.forEach((item,index) => {
let obj = {
data: [],
type: "bar",
@ -135,7 +135,7 @@ function LeftUp() {
for(let i = 0;i < dataSource.week.series.length;i++){
let itemSeries = dataSource.week.series[i]
// @ts-ignore
data.weekAllProductionScraps[item].map((itemInner,indexInner)=>{
data.weekAllProductionScraps[item].forEach((itemInner,indexInner)=>{
// @ts-ignore
if (itemInner.sectionName.indexOf(itemSeries.name)!==-1) {
// @ts-ignore
@ -173,7 +173,7 @@ function LeftUp() {
let sum: number[] = [];
// 生成obj
// @ts-ignore
data.scrapBars.map((item,index) => {
data.scrapBars.forEach((item,index) => {
let obj = {
data: [],
type: "bar",
@ -203,7 +203,7 @@ function LeftUp() {
for(let i = 0;i < dataSource.month.series.length;i++){
let itemSeries = dataSource.month.series[i]
// @ts-ignore
data.monthAllProductionScraps[item].map((itemInner,indexInner)=>{
data.monthAllProductionScraps[item].forEach((itemInner,indexInner)=>{
// @ts-ignore
if (itemInner.sectionName.indexOf(itemSeries.name)!==-1) {
// @ts-ignore

View File

@ -5,7 +5,31 @@ import Right from "./Right";
import Center from "./Center";
import {useEffect} from 'react';
import {useNavigate} from "react-router-dom";
import { useDispatch } from 'react-redux';
import { UpdateLine4After } from "../../store/LinePageSlice";
function LinePage() {
const dispatch = useDispatch();
// const myUrl = "192.168.8.22"
const myUrl = window.location.host;
useEffect(() => {
let websocket4_2 = new WebSocket("ws://" + myUrl + "/websocket/message?userId=4-2-" + Date.now());
// @ts-ignore
websocket4_2.onmessage = function (event) {
let msgData = event.data
try {
msgData = JSON.parse(event.data);
} catch (error) {
console.log("websocket: [unable to msgData] : ", event.data);
}
if (!Object.prototype.toString.call(msgData).includes('Object')) return;
dispatch(UpdateLine4After(msgData));
}
// 清理函数
return () => {
websocket4_2.close();
};
}, [dispatch]);
const navigate = useNavigate();
useEffect(() => {
const handleKeyDown = (event:any) => {

View File

@ -5,7 +5,31 @@ import Right from "./Right";
import Center from "./Center";
import {useEffect} from 'react';
import {useNavigate} from "react-router-dom";
import { useDispatch } from 'react-redux';
import { UpdateLine5Before } from "../../store/LinePageSlice";
function LinePage() {
const dispatch = useDispatch();
// const myUrl = "192.168.8.22"
const myUrl = window.location.host;
useEffect(() => {
let websocket5_1 = new WebSocket("ws://" + myUrl + "/websocket/message?userId=5-1-" + Date.now());
// @ts-ignore
websocket5_1.onmessage = function (event) {
let msgData = event.data
try {
msgData = JSON.parse(event.data);
} catch (error) {
console.log("websocket: [unable to msgData] : ", event.data);
}
if (!Object.prototype.toString.call(msgData).includes('Object')) return;
dispatch(UpdateLine5Before(msgData));
}
// 清理函数
return () => {
websocket5_1.close();
};
}, [dispatch]);
const navigate = useNavigate();
useEffect(() => {
const handleKeyDown = (event:any) => {

View File

@ -192,7 +192,7 @@ function CenterDown() {
{<ReactECharts option={options} style={{ height: "100%" }} />}
</div>
)}
{chartData.xData.length==0 && (
{chartData.xData.length===0 && (
<p
style={{
color: "#cccf",

View File

@ -5,7 +5,31 @@ import Right from "./Right";
import Center from "./Center";
import {useEffect} from 'react';
import {useNavigate} from "react-router-dom";
import { useDispatch } from 'react-redux';
import { UpdateLine5After } from "../../store/LinePageSlice";
function LinePage() {
const dispatch = useDispatch();
// const myUrl = "192.168.8.22"
const myUrl = window.location.host;
useEffect(() => {
let websocket5_2 = new WebSocket("ws://" + myUrl + "/websocket/message?userId=5-2-" + Date.now());
// @ts-ignore
websocket5_2.onmessage = function (event) {
let msgData = event.data
try {
msgData = JSON.parse(event.data);
} catch (error) {
console.log("websocket: [unable to msgData] : ", event.data);
}
if (!Object.prototype.toString.call(msgData).includes('Object')) return;
dispatch(UpdateLine5After(msgData));
}
// 清理函数
return () => {
websocket5_2.close();
};
}, [dispatch]);
const navigate = useNavigate();
useEffect(() => {
const handleKeyDown = (event:any) => {

View File

@ -1,50 +1,52 @@
import {useState} from "react";
// import {useState} from "react";
import {useAppDispatch} from "./hooks";
import axios from "axios";
// import axios from "axios";
import {
UpdateLine1Before,
UpdateLine1After,
UpdateLine2Before,
UpdateLine2After,
UpdateLine3Before,
UpdateLine3After,
UpdateLine4Before,
UpdateLine4After,
UpdateLine5Before,
UpdateLine5After
} from "./LinePageSlice"
// import {
// UpdateLine1Before,
// UpdateLine1After,
// UpdateLine2Before,
// UpdateLine2After,
// UpdateLine3Before,
// UpdateLine3After,
// UpdateLine4Before,
// UpdateLine4After,
// UpdateLine5Before,
// UpdateLine5After
// } from "./LinePageSlice"
import { UpdateAllLine } from "./LeaderPageSlice"
function UpdateData() {
const [myUrl, setUrl] = useState('')
axios.get('/wsconfig.json')
.then((r) => {
setUrl(r.data.url)
})
// const [myUrl, setUrl] = useState('')
// axios.get('/wsconfig.json')
// .then((r) => {
// setUrl(r.data.url)
// })
// const myUrl = "192.168.8.22"
const myUrl = window.location.host;
let websocketAllLine = null;
let websocket1_1 = null;
let websocket1_2 = null;
let websocket2_1 = null;
let websocket2_2 = null;
let websocket3_1 = null;
let websocket3_2 = null;
let websocket4_1 = null;
let websocket4_2 = null;
let websocket5_1 = null;
let websocket5_2 = null;
// let websocket1_1 = null;
// let websocket1_2 = null;
// let websocket2_1 = null;
// let websocket2_2 = null;
// let websocket3_1 = null;
// let websocket3_2 = null;
// let websocket4_1 = null;
// let websocket4_2 = null;
// let websocket5_1 = null;
// let websocket5_2 = null;
const dispatch = useAppDispatch();
if ('WebSocket' in window) {
websocketAllLine = new WebSocket("ws://" + myUrl + "/websocket/message?userId=all");
websocket1_1 = new WebSocket("ws://" + myUrl + "/websocket/message?userId=1-1-" + Date.now());
websocket1_2 = new WebSocket("ws://" + myUrl + "/websocket/message?userId=1-2-" + Date.now());
websocket2_1 = new WebSocket("ws://" + myUrl + "/websocket/message?userId=2-1-" + Date.now());
websocket2_2 = new WebSocket("ws://" + myUrl + "/websocket/message?userId=2-2-" + Date.now());
websocket3_1 = new WebSocket("ws://" + myUrl + "/websocket/message?userId=3-1-" + Date.now());
websocket3_2 = new WebSocket("ws://" + myUrl + "/websocket/message?userId=3-2-" + Date.now());
websocket4_1 = new WebSocket("ws://" + myUrl + "/websocket/message?userId=4-1-" + Date.now());
websocket4_2 = new WebSocket("ws://" + myUrl + "/websocket/message?userId=4-2-" + Date.now());
websocket5_1 = new WebSocket("ws://" + myUrl + "/websocket/message?userId=5-1-" + Date.now());
websocket5_2 = new WebSocket("ws://" + myUrl + "/websocket/message?userId=5-2-" + Date.now());
// websocket1_1 = new WebSocket("ws://" + myUrl + "/websocket/message?userId=1-1-" + Date.now());
// websocket1_2 = new WebSocket("ws://" + myUrl + "/websocket/message?userId=1-2-" + Date.now());
// websocket2_1 = new WebSocket("ws://" + myUrl + "/websocket/message?userId=2-1-" + Date.now());
// websocket2_2 = new WebSocket("ws://" + myUrl + "/websocket/message?userId=2-2-" + Date.now());
// websocket3_1 = new WebSocket("ws://" + myUrl + "/websocket/message?userId=3-1-" + Date.now());
// websocket3_2 = new WebSocket("ws://" + myUrl + "/websocket/message?userId=3-2-" + Date.now());
// websocket4_1 = new WebSocket("ws://" + myUrl + "/websocket/message?userId=4-1-" + Date.now());
// websocket4_2 = new WebSocket("ws://" + myUrl + "/websocket/message?userId=4-2-" + Date.now());
// websocket5_1 = new WebSocket("ws://" + myUrl + "/websocket/message?userId=5-1-" + Date.now());
// websocket5_2 = new WebSocket("ws://" + myUrl + "/websocket/message?userId=5-2-" + Date.now());
//连接成功建立的回调方法
} else {
alert('Not support websocket');
@ -53,46 +55,46 @@ function UpdateData() {
websocketAllLine.onopen = function (event) {
console.log("websocketAllLine-open");
}
// // @ts-ignore
// websocket1_1.onopen = function (event) {
// console.log("websocket1_1-open");
// }
// @ts-ignore
websocket1_1.onopen = function (event) {
console.log("websocket1_1-open");
}
// @ts-ignore
websocket1_2.onopen = function (event) {
console.log("websocket1_2-open");
}
// @ts-ignore
websocket2_1.onopen = function (event) {
console.log("websocket2_1-open");
}
// @ts-ignore
websocket2_2.onopen = function (event) {
console.log("websocket2_2-open");
}
// @ts-ignore
websocket3_1.onopen = function (event) {
console.log("websocket3_1-open");
}
// @ts-ignore
websocket3_2.onopen = function (event) {
console.log("websocket3_2-open");
}
// @ts-ignore
websocket4_1.onopen = function (event) {
console.log("websocket4_1-open");
}
// @ts-ignore
websocket4_2.onopen = function (event) {
console.log("websocket4_2-open");
}
// @ts-ignore
websocket5_1.onopen = function (event) {
console.log("websocket5_1-open");
}
// @ts-ignore
websocket5_2.onopen = function (event) {
console.log("websocket5_2-open");
}
// websocket1_2.onopen = function (event) {
// console.log("websocket1_2-open");
// }
// // @ts-ignore
// websocket2_1.onopen = function (event) {
// console.log("websocket2_1-open");
// }
// // @ts-ignore
// websocket2_2.onopen = function (event) {
// console.log("websocket2_2-open");
// }
// // @ts-ignore
// websocket3_1.onopen = function (event) {
// console.log("websocket3_1-open");
// }
// // @ts-ignore
// websocket3_2.onopen = function (event) {
// console.log("websocket3_2-open");
// }
// // @ts-ignore
// websocket4_1.onopen = function (event) {
// console.log("websocket4_1-open");
// }
// // @ts-ignore
// websocket4_2.onopen = function (event) {
// console.log("websocket4_2-open");
// }
// // @ts-ignore
// websocket5_1.onopen = function (event) {
// console.log("websocket5_1-open");
// }
// // @ts-ignore
// websocket5_2.onopen = function (event) {
// console.log("websocket5_2-open");
// }
//接收到消息的回调方法
// @ts-ignore
websocketAllLine.onmessage = function (event) {
@ -105,116 +107,116 @@ function UpdateData() {
if (!Object.prototype.toString.call(msgData).includes('Object')) return;
dispatch(UpdateAllLine(msgData));
}
// // @ts-ignore
// websocket1_1.onmessage = function (event) {
// let msgData = event.data
// try {
// msgData = JSON.parse(event.data);
// } catch (error) {
// console.log("websocket: [unable to msgData] : ", event.data);
// }
// if (!Object.prototype.toString.call(msgData).includes('Object')) return;
// dispatch(UpdateLine1Before(msgData));
// }
// @ts-ignore
websocket1_1.onmessage = function (event) {
let msgData = event.data
try {
msgData = JSON.parse(event.data);
} catch (error) {
console.log("websocket: [unable to msgData] : ", event.data);
}
if (!Object.prototype.toString.call(msgData).includes('Object')) return;
dispatch(UpdateLine1Before(msgData));
}
// @ts-ignore
websocket1_2.onmessage = function (event) {
let msgData = event.data
try {
msgData = JSON.parse(event.data);
} catch (error) {
console.log("websocket: [unable to msgData] : ", event.data);
}
if (!Object.prototype.toString.call(msgData).includes('Object')) return;
dispatch(UpdateLine1After(msgData));
}
// @ts-ignore
websocket2_1.onmessage = function (event) {
let msgData = event.data
try {
msgData = JSON.parse(event.data);
} catch (error) {
console.log("websocket: [unable to msgData] : ", event.data);
}
if (!Object.prototype.toString.call(msgData).includes('Object')) return;
dispatch(UpdateLine2Before(msgData));
}
// @ts-ignore
websocket2_2.onmessage = function (event) {
let msgData = event.data
try {
msgData = JSON.parse(event.data);
} catch (error) {
console.log("websocket: [unable to msgData] : ", event.data);
}
if (!Object.prototype.toString.call(msgData).includes('Object')) return;
dispatch(UpdateLine2After(msgData));
}
// @ts-ignore
websocket3_1.onmessage = function (event) {
let msgData = event.data
try {
msgData = JSON.parse(event.data);
} catch (error) {
console.log("websocket: [unable to msgData] : ", event.data);
}
if (!Object.prototype.toString.call(msgData).includes('Object')) return;
dispatch(UpdateLine3Before(msgData));
}
// @ts-ignore
websocket3_2.onmessage = function (event) {
let msgData = event.data
try {
msgData = JSON.parse(event.data);
} catch (error) {
console.log("websocket: [unable to msgData] : ", event.data);
}
if (!Object.prototype.toString.call(msgData).includes('Object')) return;
dispatch(UpdateLine3After(msgData));
}
// @ts-ignore
websocket4_1.onmessage = function (event) {
let msgData = event.data
try {
msgData = JSON.parse(event.data);
} catch (error) {
console.log("websocket: [unable to msgData] : ", event.data);
}
if (!Object.prototype.toString.call(msgData).includes('Object')) return;
dispatch(UpdateLine4Before(msgData));
}
// @ts-ignore
websocket4_2.onmessage = function (event) {
let msgData = event.data
try {
msgData = JSON.parse(event.data);
} catch (error) {
console.log("websocket: [unable to msgData] : ", event.data);
}
if (!Object.prototype.toString.call(msgData).includes('Object')) return;
dispatch(UpdateLine4After(msgData));
}
// @ts-ignore
websocket5_1.onmessage = function (event) {
let msgData = event.data
try {
msgData = JSON.parse(event.data);
} catch (error) {
console.log("websocket: [unable to msgData] : ", event.data);
}
if (!Object.prototype.toString.call(msgData).includes('Object')) return;
dispatch(UpdateLine5Before(msgData));
}
// @ts-ignore
websocket5_2.onmessage = function (event) {
let msgData = event.data
try {
msgData = JSON.parse(event.data);
} catch (error) {
console.log("websocket: [unable to msgData] : ", event.data);
}
if (!Object.prototype.toString.call(msgData).includes('Object')) return;
dispatch(UpdateLine5After(msgData));
}
// websocket1_2.onmessage = function (event) {
// let msgData = event.data
// try {
// msgData = JSON.parse(event.data);
// } catch (error) {
// console.log("websocket: [unable to msgData] : ", event.data);
// }
// if (!Object.prototype.toString.call(msgData).includes('Object')) return;
// dispatch(UpdateLine1After(msgData));
// }
// // @ts-ignore
// websocket2_1.onmessage = function (event) {
// let msgData = event.data
// try {
// msgData = JSON.parse(event.data);
// } catch (error) {
// console.log("websocket: [unable to msgData] : ", event.data);
// }
// if (!Object.prototype.toString.call(msgData).includes('Object')) return;
// dispatch(UpdateLine2Before(msgData));
// }
// // @ts-ignore
// websocket2_2.onmessage = function (event) {
// let msgData = event.data
// try {
// msgData = JSON.parse(event.data);
// } catch (error) {
// console.log("websocket: [unable to msgData] : ", event.data);
// }
// if (!Object.prototype.toString.call(msgData).includes('Object')) return;
// dispatch(UpdateLine2After(msgData));
// }
// // @ts-ignore
// websocket3_1.onmessage = function (event) {
// let msgData = event.data
// try {
// msgData = JSON.parse(event.data);
// } catch (error) {
// console.log("websocket: [unable to msgData] : ", event.data);
// }
// if (!Object.prototype.toString.call(msgData).includes('Object')) return;
// dispatch(UpdateLine3Before(msgData));
// }
// // @ts-ignore
// websocket3_2.onmessage = function (event) {
// let msgData = event.data
// try {
// msgData = JSON.parse(event.data);
// } catch (error) {
// console.log("websocket: [unable to msgData] : ", event.data);
// }
// if (!Object.prototype.toString.call(msgData).includes('Object')) return;
// dispatch(UpdateLine3After(msgData));
// }
// // @ts-ignore
// websocket4_1.onmessage = function (event) {
// let msgData = event.data
// try {
// msgData = JSON.parse(event.data);
// } catch (error) {
// console.log("websocket: [unable to msgData] : ", event.data);
// }
// if (!Object.prototype.toString.call(msgData).includes('Object')) return;
// dispatch(UpdateLine4Before(msgData));
// }
// // @ts-ignore
// websocket4_2.onmessage = function (event) {
// let msgData = event.data
// try {
// msgData = JSON.parse(event.data);
// } catch (error) {
// console.log("websocket: [unable to msgData] : ", event.data);
// }
// if (!Object.prototype.toString.call(msgData).includes('Object')) return;
// dispatch(UpdateLine4After(msgData));
// }
// // @ts-ignore
// websocket5_1.onmessage = function (event) {
// let msgData = event.data
// try {
// msgData = JSON.parse(event.data);
// } catch (error) {
// console.log("websocket: [unable to msgData] : ", event.data);
// }
// if (!Object.prototype.toString.call(msgData).includes('Object')) return;
// dispatch(UpdateLine5Before(msgData));
// }
// // @ts-ignore
// websocket5_2.onmessage = function (event) {
// let msgData = event.data
// try {
// msgData = JSON.parse(event.data);
// } catch (error) {
// console.log("websocket: [unable to msgData] : ", event.data);
// }
// if (!Object.prototype.toString.call(msgData).includes('Object')) return;
// dispatch(UpdateLine5After(msgData));
// }
return null;
}