diff --git a/public/wsconfig.json b/public/wsconfig.json index b190853..a95d606 100644 --- a/public/wsconfig.json +++ b/public/wsconfig.json @@ -1,3 +1,3 @@ { - "url": "192.168.1.40:48080" + "url": "192.168.1.35:48080" } \ No newline at end of file diff --git a/src/App.tsx b/src/App.tsx index 07787da..d1b44ae 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -14,7 +14,16 @@ import { selectGlassStatus } from "./store/ProductionMonitoringEntity"; import TestPage from "./page/TestPage"; import LDPage from "./page/LDPage"; import LinePage from "./page/LinePage"; -import LinePage1_1 from "./page/LinePage1_1"; +import LinePage1_1 from "./page/LinePage1-1"; +import LinePage1_2 from "./page/LinePage1-2"; +import LinePage2_1 from "./page/LinePage2-1"; +import LinePage2_2 from "./page/LinePage2-2"; +import LinePage3_1 from "./page/LinePage3-1"; +import LinePage3_2 from "./page/LinePage3-2"; +import LinePage4_1 from "./page/LinePage4-1"; +import LinePage4_2 from "./page/LinePage4-2"; +import LinePage5_1 from "./page/LinePage5-1"; +import LinePage5_2 from "./page/LinePage5-2"; // const LOCALES_LIST = [ // { @@ -49,11 +58,11 @@ function App() { setCurrentLocale(Locale); const router = createHashRouter([ - { - path: "/:LineID?", - element: , - errorElement: , - }, + // { + // path: "/:LineID?", + // element: , + // errorElement: , + // }, ///////////////////////////////////////////////////////////////////////////// { path: "/TP/:LineID?", @@ -71,13 +80,57 @@ function App() { // element: , // errorElement: , // }, - /////////////////////////////////////////////////////////////// + ////////////////////////////从这开始/////////////////////////////////// { path: "/LP/1-1", element: , errorElement: , }, - + { + path: "/LP/1-2", + element: , + errorElement: , + }, + { + path: "/LP/2-1", + element: , + errorElement: , + }, + { + path: "/LP/2-2", + element: , + errorElement: , + }, + { + path: "/LP/3-1", + element: , + errorElement: , + }, + { + path: "/LP/3-2", + element: , + errorElement: , + }, + { + path: "/LP/4-1", + element: , + errorElement: , + }, + { + path: "/LP/4-2", + element: , + errorElement: , + }, + { + path: "/LP/5-1", + element: , + errorElement: , + }, + { + path: "/LP/5-2", + element: , + errorElement: , + }, ]); useEffect(() => { const timerId = setInterval(() => { diff --git a/src/page/Component/LineChart/chart.config.ts b/src/page/Component/LineChart/chart.config.ts index 38cd3a0..5452b3c 100644 --- a/src/page/Component/LineChart/chart.config.ts +++ b/src/page/Component/LineChart/chart.config.ts @@ -5,7 +5,7 @@ export default function getOptions(chartData: any) { const colors = ["#1A99FF", "#FFB70C", "#C69DFF", "#50F4E3", "#E02094"]; return { color: colors, - grid: { top: 38, right: 12, bottom: 26, left: 48 }, + grid: { top: 38, right: 12, bottom: 5, left: 15, containLabel: true }, legend: { show: true, top: 10, diff --git a/src/page/LinePage1_1/Center/CenterDown.tsx b/src/page/LinePage1-1/Center/CenterDown.tsx similarity index 99% rename from src/page/LinePage1_1/Center/CenterDown.tsx rename to src/page/LinePage1-1/Center/CenterDown.tsx index f7b2fff..46c5c72 100644 --- a/src/page/LinePage1_1/Center/CenterDown.tsx +++ b/src/page/LinePage1-1/Center/CenterDown.tsx @@ -4,7 +4,6 @@ import ScrollBoard from "./../../Component/ScrollBoard"; import SwitchButton from "../Component/SwitchButton"; import { useState } from "react"; import getOptions from "../../Component/LineChart/chart.config"; -import { useParams } from "react-router-dom"; import {useAppSelector} from "./../../../store/hooks" import {selectLine1Before} from "./../../../store/LinePageSlice" import moment from "moment"; diff --git a/src/page/LinePage1_1/Center/CenterUp.tsx b/src/page/LinePage1-1/Center/CenterUp.tsx similarity index 64% rename from src/page/LinePage1_1/Center/CenterUp.tsx rename to src/page/LinePage1-1/Center/CenterUp.tsx index ad8d3c0..4ae6d57 100644 --- a/src/page/LinePage1_1/Center/CenterUp.tsx +++ b/src/page/LinePage1-1/Center/CenterUp.tsx @@ -1,8 +1,6 @@ import LinePageBabylon from "../../../babylonjs/LinePageBabylon"; -import { useParams } from "react-router-dom"; function CenterUp() { - const { LineID } = useParams(); - const lineID = LineID?.toString() || "1-1"; + const lineID = "1-1" return (
diff --git a/src/page/LinePage1_1/Center/index.tsx b/src/page/LinePage1-1/Center/index.tsx similarity index 100% rename from src/page/LinePage1_1/Center/index.tsx rename to src/page/LinePage1-1/Center/index.tsx diff --git a/src/page/LinePage1_1/Component/SwitchButton/index.css b/src/page/LinePage1-1/Component/SwitchButton/index.css similarity index 100% rename from src/page/LinePage1_1/Component/SwitchButton/index.css rename to src/page/LinePage1-1/Component/SwitchButton/index.css diff --git a/src/page/LinePage1_1/Component/SwitchButton/index.tsx b/src/page/LinePage1-1/Component/SwitchButton/index.tsx similarity index 100% rename from src/page/LinePage1_1/Component/SwitchButton/index.tsx rename to src/page/LinePage1-1/Component/SwitchButton/index.tsx diff --git a/src/page/LinePage1_1/Component/TitleBox/index.css b/src/page/LinePage1-1/Component/TitleBox/index.css similarity index 100% rename from src/page/LinePage1_1/Component/TitleBox/index.css rename to src/page/LinePage1-1/Component/TitleBox/index.css diff --git a/src/page/LinePage1_1/Component/TitleBox/index.tsx b/src/page/LinePage1-1/Component/TitleBox/index.tsx similarity index 100% rename from src/page/LinePage1_1/Component/TitleBox/index.tsx rename to src/page/LinePage1-1/Component/TitleBox/index.tsx diff --git a/src/page/LinePage1_1/Left/LeftDown.tsx b/src/page/LinePage1-1/Left/LeftDown.tsx similarity index 100% rename from src/page/LinePage1_1/Left/LeftDown.tsx rename to src/page/LinePage1-1/Left/LeftDown.tsx diff --git a/src/page/LinePage1_1/Left/LeftUp.tsx b/src/page/LinePage1-1/Left/LeftUp.tsx similarity index 99% rename from src/page/LinePage1_1/Left/LeftUp.tsx rename to src/page/LinePage1-1/Left/LeftUp.tsx index a53c437..1abff2a 100644 --- a/src/page/LinePage1_1/Left/LeftUp.tsx +++ b/src/page/LinePage1-1/Left/LeftUp.tsx @@ -7,7 +7,7 @@ import {useAppSelector} from "./../../../store/hooks" import {selectLine1Before} from "./../../../store/LinePageSlice" function LeftUp() { const data = useAppSelector(selectLine1Before); - console.log('页面数据:',data) + console.log('页面数据1-1:',data) // 假数据 const dataSource = { day: { diff --git a/src/page/LinePage1_1/Left/index.tsx b/src/page/LinePage1-1/Left/index.tsx similarity index 100% rename from src/page/LinePage1_1/Left/index.tsx rename to src/page/LinePage1-1/Left/index.tsx diff --git a/src/page/LinePage1_1/Right/RightDown.tsx b/src/page/LinePage1-1/Right/RightDown.tsx similarity index 100% rename from src/page/LinePage1_1/Right/RightDown.tsx rename to src/page/LinePage1-1/Right/RightDown.tsx diff --git a/src/page/LinePage1_1/Right/RightUp.tsx b/src/page/LinePage1-1/Right/RightUp.tsx similarity index 100% rename from src/page/LinePage1_1/Right/RightUp.tsx rename to src/page/LinePage1-1/Right/RightUp.tsx diff --git a/src/page/LinePage1_1/Right/index.tsx b/src/page/LinePage1-1/Right/index.tsx similarity index 100% rename from src/page/LinePage1_1/Right/index.tsx rename to src/page/LinePage1-1/Right/index.tsx diff --git a/src/page/LinePage1_1/TopP.tsx b/src/page/LinePage1-1/TopP.tsx similarity index 100% rename from src/page/LinePage1_1/TopP.tsx rename to src/page/LinePage1-1/TopP.tsx diff --git a/src/page/LinePage1_1/assets/icon/alarm.png b/src/page/LinePage1-1/assets/icon/alarm.png similarity index 100% rename from src/page/LinePage1_1/assets/icon/alarm.png rename to src/page/LinePage1-1/assets/icon/alarm.png diff --git a/src/page/LinePage1_1/assets/icon/defect.png b/src/page/LinePage1-1/assets/icon/defect.png similarity index 100% rename from src/page/LinePage1_1/assets/icon/defect.png rename to src/page/LinePage1-1/assets/icon/defect.png diff --git a/src/page/LinePage1_1/assets/icon/finished.png b/src/page/LinePage1-1/assets/icon/finished.png similarity index 100% rename from src/page/LinePage1_1/assets/icon/finished.png rename to src/page/LinePage1-1/assets/icon/finished.png diff --git a/src/page/LinePage1_1/assets/icon/g.png b/src/page/LinePage1-1/assets/icon/g.png similarity index 100% rename from src/page/LinePage1_1/assets/icon/g.png rename to src/page/LinePage1-1/assets/icon/g.png diff --git a/src/page/LinePage1_1/assets/icon/inputAndOutput.png b/src/page/LinePage1-1/assets/icon/inputAndOutput.png similarity index 100% rename from src/page/LinePage1_1/assets/icon/inputAndOutput.png rename to src/page/LinePage1-1/assets/icon/inputAndOutput.png diff --git a/src/page/LinePage1_1/assets/icon/num.png b/src/page/LinePage1-1/assets/icon/num.png similarity index 100% rename from src/page/LinePage1_1/assets/icon/num.png rename to src/page/LinePage1-1/assets/icon/num.png diff --git a/src/page/LinePage1_1/assets/icon/r.png b/src/page/LinePage1-1/assets/icon/r.png similarity index 100% rename from src/page/LinePage1_1/assets/icon/r.png rename to src/page/LinePage1-1/assets/icon/r.png diff --git a/src/page/LinePage1_1/assets/icon/record.png b/src/page/LinePage1-1/assets/icon/record.png similarity index 100% rename from src/page/LinePage1_1/assets/icon/record.png rename to src/page/LinePage1-1/assets/icon/record.png diff --git a/src/page/LinePage1_1/assets/icon/y.png b/src/page/LinePage1-1/assets/icon/y.png similarity index 100% rename from src/page/LinePage1_1/assets/icon/y.png rename to src/page/LinePage1-1/assets/icon/y.png diff --git a/src/page/LinePage1_1/index.css b/src/page/LinePage1-1/index.css similarity index 100% rename from src/page/LinePage1_1/index.css rename to src/page/LinePage1-1/index.css diff --git a/src/page/LinePage1_1/index.tsx b/src/page/LinePage1-1/index.tsx similarity index 100% rename from src/page/LinePage1_1/index.tsx rename to src/page/LinePage1-1/index.tsx diff --git a/src/page/LinePage1-2/Center/CenterDown.tsx b/src/page/LinePage1-2/Center/CenterDown.tsx new file mode 100644 index 0000000..2d0eae2 --- /dev/null +++ b/src/page/LinePage1-2/Center/CenterDown.tsx @@ -0,0 +1,214 @@ +import ReactECharts from "echarts-for-react"; +import TitleBox from "../Component/TitleBox"; +import ScrollBoard from "./../../Component/ScrollBoard"; +import SwitchButton from "../Component/SwitchButton"; +import { useState } from "react"; +import getOptions from "../../Component/LineChart/chart.config"; +import {useAppSelector} from "./../../../store/hooks" +import {selectLine1After} from "./../../../store/LinePageSlice" +import moment from "moment"; +function CenterDown() { + const data = useAppSelector(selectLine1After); + // 假数据 + const dataSource = { + day: { + xData:[], + series: [] as { name: string; type: string; symbol: string; symbolSize: number; data: never[]; }[], + }, + week: { + xData:[], + series: [] as { name: string; type: string; symbol: string; symbolSize: number; data: never[]; }[], + }, + month: { + xData:[], + series: [] as { name: string; type: string; symbol: string; symbolSize: number; data: never[]; }[], + }, + }; + const nameList = [ + { name: "天", ename: "day" }, + { name: "周", ename: "week" }, + { name: "月", ename: "month" }, + ]; + const [activeName, setActiveName] = useState(nameList[0].ename); + const handleButtonChange = (activeName: string) => { + setActiveName(activeName); + }; + const config = { + header: ["序号", "报警时间", "报警设备", "报警内容"], + headerHeight: 36, + rowNum: 6, + align: ["center", "left", "left", "left"], + headerBGC: "rgba(79, 114, 136, 0.3)", + oddRowBGC: "rgba(79, 114, 136, 0.3)", + evenRowBGC: "rgba(76, 97, 123, 0.1)", + columnWidth: [80, 137, 137, 137], + data: [] + }; + // 报警数据 + let arr:any = [] + let sumAlarm = 0 + // @ts-ignore + if (data.alarms && data.alarms.length > 0) { + // @ts-ignore + sumAlarm = data.alarms.length + // @ts-ignore + data.alarms.map((item,index) => { + let arrInner = [] + arrInner.push( + index+1, + moment(item.recTime).format("YYYY/MM/DD HH:mm"), + item.name, + item.status === '故障'?"故障":"离线", + ); + arr.push(arrInner) + }); + } + config.data = arr + // 产线成品率 + // @ts-ignore + if (data.todayProductionRates && Object.keys(data.todayProductionRates).length > 0) { + // @ts-ignore + let keys = Object.keys(data.todayProductionRates) + // @ts-ignore + data.todayProductionRates[keys[0]].map((item,index)=>{ + // @ts-ignore + dataSource.day.xData.push(moment(item.recTime).format("HH:mm")) + }) + keys.map((item,index)=>{ + let obj = { + name: "", + type: "line", + symbol: "circle", + symbolSize: 4, + data:[] + } + // @ts-ignore + obj.name = data.todayProductionRates[item][0].lineName + // @ts-ignore + data.todayProductionRates[item].map((subItem,index)=>{ + // @ts-ignore + obj.data.push(subItem.passRate) + }) + dataSource.day.series.push(obj) + }) + }else{ + dataSource.day.xData = [] + dataSource.day.series = [] + } + // @ts-ignore + if (data.weekProductionRates && Object.keys(data.weekProductionRates).length > 0) { + // @ts-ignore + let keys = Object.keys(data.weekProductionRates) + // @ts-ignore + data.weekProductionRates[keys[0]].map((item,index)=>{ + // @ts-ignore + dataSource.week.xData.push(moment(item.recTime).format("HH:mm")) + }) + keys.map((item,index)=>{ + let obj = { + name: "", + type: "line", + symbol: "circle", + symbolSize: 4, + data:[] + } + // @ts-ignore + obj.name = data.weekProductionRates[item][0].lineName + // @ts-ignore + data.weekProductionRates[item].map((subItem,index)=>{ + // @ts-ignore + obj.data.push(subItem.passRate) + }) + dataSource.week.series.push(obj) + }) + }else{ + dataSource.week.xData = [] + dataSource.week.series = [] + } + // @ts-ignore + if (data.monthProductionRates && Object.keys(data.monthProductionRates).length > 0) { + // @ts-ignore + let keys = Object.keys(data.monthProductionRates) + // @ts-ignore + data.monthProductionRates[keys[0]].map((item,index)=>{ + // @ts-ignore + dataSource.month.xData.push(moment(item.recTime).format("HH:mm")) + }) + keys.map((item,index)=>{ + let obj = { + name: "", + type: "line", + symbol: "circle", + symbolSize: 4, + data:[] + } + // @ts-ignore + obj.name = data.monthProductionRates[item][0].lineName + // @ts-ignore + data.monthProductionRates[item].map((subItem,index)=>{ + // @ts-ignore + obj.data.push(subItem.passRate) + }) + dataSource.month.series.push(obj) + }) + }else{ + dataSource.month.xData = [] + dataSource.month.series = [] + } + let chartData = (dataSource as { [key: string]: any })[activeName]; + console.log('???????????',chartData) + const options = getOptions(chartData); + return ( +
+
+ + — 报警总数 — +
{sumAlarm}
+
+ {arr.length>0?:(

+ 暂无数据 +

)} +
+
+ {/* 产线成品率 */} +
+ +
+ +
+ {chartData.xData.length>0 && ( +
+ {} +
+ )} + {chartData.xData.length==0 && ( +

+ 暂无数据 +

+ )} +
+
+ ); +} +export default CenterDown; diff --git a/src/page/LinePage1-2/Center/CenterUp.tsx b/src/page/LinePage1-2/Center/CenterUp.tsx new file mode 100644 index 0000000..5ddf6e2 --- /dev/null +++ b/src/page/LinePage1-2/Center/CenterUp.tsx @@ -0,0 +1,10 @@ +import LinePageBabylon from "../../../babylonjs/LinePageBabylon"; +function CenterUp() { + const lineID = "1-2"; + return ( +
+ +
+ ); +} +export default CenterUp; diff --git a/src/page/LinePage1-2/Center/index.tsx b/src/page/LinePage1-2/Center/index.tsx new file mode 100644 index 0000000..14d5036 --- /dev/null +++ b/src/page/LinePage1-2/Center/index.tsx @@ -0,0 +1,12 @@ +import CenterDown from "./CenterDown"; +import CenterUp from "./CenterUp"; + +function Center() { + return ( +
+ + +
+ ); +} +export default Center; diff --git a/src/page/LinePage1-2/Component/SwitchButton/index.css b/src/page/LinePage1-2/Component/SwitchButton/index.css new file mode 100644 index 0000000..604d81a --- /dev/null +++ b/src/page/LinePage1-2/Component/SwitchButton/index.css @@ -0,0 +1,19 @@ +.switch-button { + height: 33px; +} +.switch-button button { + color: #fff; + font-size: 18px; + padding: 4px 10px; + background-color: rgba(49, 135, 140, 0.3); + cursor: pointer; +} +.switch-button button:first-child { + border-radius: 5px 0 0 5px; +} +.switch-button button:last-child { + border-radius: 0 5px 5px 0; +} +.switch-button button.active { + background-color: rgba(86, 244, 231, 0.7); +} diff --git a/src/page/LinePage1-2/Component/SwitchButton/index.tsx b/src/page/LinePage1-2/Component/SwitchButton/index.tsx new file mode 100644 index 0000000..9209c06 --- /dev/null +++ b/src/page/LinePage1-2/Component/SwitchButton/index.tsx @@ -0,0 +1,65 @@ +import { useEffect, useState } from "react"; +import "./index.css"; +interface Name { + name: string; + ename: string; +} +interface nameListProps { + nameList: Name[]; + onChange: (value: string) => void; +} +function createActiveNameUpdater(nameList: any, activeName: string) { + let activeIndex = nameList.findIndex((obj: any) => obj.name === activeName); + + return function updateActiveName() { + activeIndex = (activeIndex + 1) % nameList.length; + return nameList[activeIndex].ename; + }; +} +function SwitchButton(props: nameListProps) { + const [activeName, setActiveName] = useState(props.nameList[0].ename); + const [timerId, setTimerId] = useState(null); + let updateActiveName = createActiveNameUpdater(props.nameList, activeName); + useEffect(() => { + const timer = setInterval(() => { + let active = updateActiveName(); + setActiveName(active); + props.onChange(active); + }, 60000); + setTimerId(timer); + return () => { + if (timerId !== null) { + clearInterval(timerId); + } + }; + }, [props.nameList.length]); + const btnClick = (ename: string) => { + if (timerId !== null) { + clearInterval(timerId); + } + setActiveName(ename); + props.onChange(ename); // 通知父组件 + const newTimer = setInterval(() => { + let active = updateActiveName(); + setActiveName(active); + props.onChange(active); + }, 60000); + setTimerId(newTimer); + }; + return ( +
+ {props.nameList.map((item, index) => { + return ( + + ); + })} +
+ ); +} +export default SwitchButton; diff --git a/src/page/LinePage1-2/Component/TitleBox/index.css b/src/page/LinePage1-2/Component/TitleBox/index.css new file mode 100644 index 0000000..3ae06db --- /dev/null +++ b/src/page/LinePage1-2/Component/TitleBox/index.css @@ -0,0 +1,13 @@ +.title_box { + font-size: 24px; + color: #52fff1; + padding: 10px 0 0 15px; +} +.title_box img { + width: 33px; + height: 33px; + vertical-align: bottom; + margin-right: 3px; + position: relative; + top: 3px; +} diff --git a/src/page/LinePage1-2/Component/TitleBox/index.tsx b/src/page/LinePage1-2/Component/TitleBox/index.tsx new file mode 100644 index 0000000..dd43a66 --- /dev/null +++ b/src/page/LinePage1-2/Component/TitleBox/index.tsx @@ -0,0 +1,53 @@ +import Defect from "./../../assets/icon/defect.png"; +import Alarm from "./../../assets/icon/alarm.png"; +import Finished from "./../../assets/icon/finished.png"; +import InputAndOutput from "./../../assets/icon/inputAndOutput.png"; +import Num from "./../../assets/icon/num.png"; +import Record from "./../../assets/icon/record.png"; +import "./index.css"; +interface titleProps { + title: string; +} +function TitleBox(props: titleProps) { + const filteredTitles = () => { + switch (props.title) { + case "left_up": + return { + img: Defect, + title: "产线报废汇总", + }; + case "left_down": + return { + img: Record, + title: "当前产线报废情况", + }; + case "center_down_left": + return { + img: Alarm, + title: "异常报警", + }; + case "center_down_right": + return { + img: Finished, + title: "产线成品率", + }; + case "right_up": + return { + img: Num, + title: "各产线总投入和产出", + }; + default: + return { + img: InputAndOutput, + title: "当前产线投入和产出", + }; + } + }; + return ( +
+ title + {filteredTitles().title} +
+ ); +} +export default TitleBox; diff --git a/src/page/LinePage1-2/Left/LeftDown.tsx b/src/page/LinePage1-2/Left/LeftDown.tsx new file mode 100644 index 0000000..9100416 --- /dev/null +++ b/src/page/LinePage1-2/Left/LeftDown.tsx @@ -0,0 +1,245 @@ +import ReactECharts from "echarts-for-react"; +import TitleBox from "../Component/TitleBox"; +import SwitchButton from "../Component/SwitchButton"; +import ScrollBoard from "./../../Component/ScrollBoard"; +import { useState } from "react"; +import getOptions from "../../Component/BarChart/chart.config"; +import {useAppSelector} from "./../../../store/hooks" +import {selectLine1After} from "./../../../store/LinePageSlice" +function LeftDown() { + const data = useAppSelector(selectLine1After); + // console.log('页面数据:',data) + const nameList = [ + { name: "表单", ename: "table" }, + { name: "柱状", ename: "chart" }, + ]; + const [activeName, setActiveName] = useState(nameList[0].ename); + const handleButtonChange = (activeName: string) => { + setActiveName(activeName); + }; + const configDay = { + header: ["序号", "工序类型", "报废数量"], + headerHeight: 30, + rowNum: 4, + align: ["center", "left", "left"], + headerBGC: "rgba(79, 114, 136, 0.3)", + oddRowBGC: "rgba(79, 114, 136, 0.3)", + evenRowBGC: "rgba(76, 97, 123, 0.1)", + columnWidth: [73, 117, 190], + data: [ + ["1", "磨边后", 224], + ["2", "包装1", 322], + ["3", "包装2", 66], + ], + }; + const configWeek = { + header: ["序号", "工序类型", "报废数量"], + headerHeight: 30, + rowNum: 4, + align: ["center", "left", "left"], + headerBGC: "rgba(79, 114, 136, 0.3)", + oddRowBGC: "rgba(79, 114, 136, 0.3)", + evenRowBGC: "rgba(76, 97, 123, 0.1)", + columnWidth: [73, 117, 190], + data: [ + ["1", "磨边后", 1119], + ["2", "包装1", 1798], + ["3", "包装2", 435], + ], + }; + const configMonth = { + header: ["序号", "工序类型", "报废数量"], + headerHeight: 30, + rowNum: 4, + align: ["center", "left", "left"], + headerBGC: "rgba(79, 114, 136, 0.3)", + oddRowBGC: "rgba(79, 114, 136, 0.3)", + evenRowBGC: "rgba(76, 97, 123, 0.1)", + columnWidth: [73, 117, 190], + data: [ + ["1", "磨边后", 5004], + ["2", "包装1", 9122], + ["3", "包装2", 1924], + ], + }; + const color1 = ["#9DD5FF", "#1295FF"]; + const color2 = ["#85F6E9", "#2EC6B4"]; + // @ts-ignore + let xData: string[] = data.scrapBars + let dataProps1: number[] = []; + let dataProps2: number[] = []; + let dataProps3: number[] = []; + let arr1: any = []; + let arr2: any = []; + let arr3: any = []; + // @ts-ignore + if (data.todayProductionScraps && data.todayProductionScraps.length > 0) { + // @ts-ignore + data.todayProductionScraps.map((item,index)=>{ + let arrInner = []; + arrInner.push(index+1,item.sectionName,item.scrapNum); + arr1.push(arrInner); + dataProps1.push(item.scrapNum); + }) + }else{ + dataProps1 = [] + } + // @ts-ignore + if (data.weekProductionScraps && data.weekProductionScraps.length > 0) { + // @ts-ignore + data.weekProductionScraps.map((item,index)=>{ + let arrInner = []; + arrInner.push(index+1,item.sectionName,item.scrapNum); + arr2.push(arrInner); + dataProps2.push(item.scrapNum); + }) + }else{ + dataProps2 = [] + } + // @ts-ignore + if (data.monthProductionScraps && data.monthProductionScraps.length > 0) { + // @ts-ignore + data.monthProductionScraps.map((item,index)=>{ + let arrInner = []; + arrInner.push(index+1,item.sectionName,item.scrapNum); + arr3.push(arrInner); + dataProps3.push(item.scrapNum); + }) + }else{ + dataProps3 = [] + } + configDay.data = arr1; + configWeek.data = arr2; + configMonth.data = arr3; + const options1 = getOptions(dataProps1,xData, color1); + const options2 = getOptions(dataProps2,xData, color2); + const options3 = getOptions(dataProps3,xData, color1); + return ( +
+ +
+ +
+
+
+
+ 当天 +
+
+
+ {activeName === "table" ? ( + arr1.length > 0 ? :(

+ 暂无数据 +

) + ) : dataProps1.length>0 ? ( + + ) : ( +

+ 暂无数据 +

+ )} +
+
+
+ 本周 +
+
+
+ {activeName === "table" ? ( + arr2.length > 0 ? :(

+ 暂无数据 +

) + ) : dataProps2.length>0 ? ( + + ) : ( +

+ 暂无数据 +

+ )} +
+
+
+ 本月 +
+
+
+ {activeName === "table" ? ( + arr3.length > 0 ? :(

+ 暂无数据 +

) + ) : dataProps3.length>0 ? ( + + ) : ( +

+ 暂无数据 +

+ )} +
+
+
+ ); +} +export default LeftDown; diff --git a/src/page/LinePage1-2/Left/LeftUp.tsx b/src/page/LinePage1-2/Left/LeftUp.tsx new file mode 100644 index 0000000..ac007f7 --- /dev/null +++ b/src/page/LinePage1-2/Left/LeftUp.tsx @@ -0,0 +1,229 @@ +import ReactECharts from "echarts-for-react"; +import TitleBox from "../Component/TitleBox"; +import SwitchButton from "../Component/SwitchButton"; +import getOptions from "../../Component/SummaryBarChart/chart.config"; +import { useState } from "react"; +import {useAppSelector} from "./../../../store/hooks" +import {selectLine1After} from "./../../../store/LinePageSlice" +function LeftUp() { + const data = useAppSelector(selectLine1After); + console.log('页面数据1-1:',data) + // 假数据 + const dataSource = { + day: { + xData: [], + series: [] as { data: number[]; type: string; stack: string; name: any; barWidth?: number; label: { show: boolean; position: string; color: string;formatter?:any }; }[], + }, + week: { + xData: [], + series: [] as { data: number[]; type: string; stack: string; name: any; barWidth?: number; label: { show: boolean; position: string; color: string;formatter?:any }; }[], + }, + month: { + xData: [], + series: [] as { data: number[]; type: string; stack: string; name: any; barWidth?: number; label: { show: boolean; position: string; color: string;formatter?:any }; }[], + }, + }; + const nameList = [ + { name: "天", ename: "day" }, + { name: "周", ename: "week" }, + { name: "月", ename: "month" }, + ]; + const [activeName, setActiveName] = useState(nameList[0].ename); + let chartData = (dataSource as { [key: string]: any })[activeName]; + const handleButtonChange = (activeName: string) => { + setActiveName(activeName); + }; + // @ts-ignore + if (data.todayAllProductionScraps && Object.keys(data.todayAllProductionScraps).length > 0) { + let sum: number[] = []; + // 生成obj + // @ts-ignore + data.scrapBars.map((item,index) => { + let obj = { + data: [], + type: "bar", + stack: "a", + name: item, + barWidth: 14, + label: { + show: true, + position: "right", + color: "inherit", + }, + } + dataSource.day.series.push(obj) + }) + // @ts-ignore + dataSource.day.xData = Object.keys(data.todayAllProductionScraps) + dataSource.day.xData.map((item,index)=>{ + let sumIner = 0 + // @ts-ignore + data.todayAllProductionScraps[item].map((itemInner,indexInner)=>{ + sumIner += itemInner.scrapNum + dataSource.day.series.map((itemSeries,indexSeries)=>{ + // @ts-ignore + if (itemSeries.name === itemInner.sectionName) { + // @ts-ignore + itemSeries.data.push(itemInner.scrapNum) + } + }) + }) + sum.push(sumIner) + }) + dataSource.day.series.push({ + data: sum, + type: "bar", + stack: "a", + name: "", + label: { + show: true, + position: "top", + color: "#fff", + formatter: function (params: any) { + return sum[params.dataIndex]; + }, + }, + }) + }else{ + dataSource.day.xData = [] + dataSource.day.series = [] + } + // @ts-ignore + if (data.weekAllProductionScraps && Object.keys(data.weekAllProductionScraps).length > 0) { + let sum: number[] = []; + // 生成obj + // @ts-ignore + data.scrapBars.map((item,index) => { + let obj = { + data: [], + type: "bar", + stack: "a", + name: item, + barWidth: 14, + label: { + show: true, + position: "right", + color: "inherit", + }, + } + dataSource.week.series.push(obj) + }) + // @ts-ignore + dataSource.week.xData = Object.keys(data.weekAllProductionScraps) + dataSource.week.xData.map((item,index)=>{ + let sumIner = 0 + // @ts-ignore + data.weekAllProductionScraps[item].map((itemInner,indexInner)=>{ + sumIner += itemInner.scrapNum + dataSource.week.series.map((itemSeries,indexSeries)=>{ + // @ts-ignore + if (itemSeries.name === itemInner.sectionName) { + // @ts-ignore + itemSeries.data.push(itemInner.scrapNum) + } + }) + }) + sum.push(sumIner) + }) + dataSource.week.series.push({ + data: sum, + type: "bar", + stack: "a", + name: "", + label: { + show: true, + position: "top", + color: "#fff", + formatter: function (params: any) { + return sum[params.dataIndex]; + }, + }, + }) + }else{ + dataSource.week.xData = [] + dataSource.week.series = [] + } + // @ts-ignore + if (data.monthAllProductionScraps && Object.keys(data.monthAllProductionScraps).length > 0) { + let sum: number[] = []; + // 生成obj + // @ts-ignore + data.scrapBars.map((item,index) => { + let obj = { + data: [], + type: "bar", + stack: "a", + name: item, + barWidth: 14, + label: { + show: true, + position: "right", + color: "inherit", + }, + } + dataSource.month.series.push(obj) + }) + // @ts-ignore + dataSource.month.xData = Object.keys(data.monthAllProductionScraps) + dataSource.month.xData.map((item,index)=>{ + let sumIner = 0 + // @ts-ignore + data.monthAllProductionScraps[item].map((itemInner,indexInner)=>{ + sumIner += itemInner.scrapNum + dataSource.month.series.map((itemSeries,indexSeries)=>{ + // @ts-ignore + if (itemSeries.name === itemInner.sectionName) { + // @ts-ignore + itemSeries.data.push(itemInner.scrapNum) + } + }) + }) + sum.push(sumIner) + }) + dataSource.month.series.push({ + data: sum, + type: "bar", + stack: "a", + name: "", + label: { + show: true, + position: "top", + color: "#fff", + formatter: function (params: any) { + return sum[params.dataIndex]; + }, + }, + }) + }else{ + dataSource.month.xData = [] + dataSource.month.series = [] + } + const options = getOptions(chartData); + return ( +
+ +
+ +
+ {// @ts-ignore + dataSource[activeName].xData.length>0 ? ( +
+ {} +
+ ):( +

+ 暂无数据 +

+ )} +
+ ); +} +export default LeftUp; diff --git a/src/page/LinePage1-2/Left/index.tsx b/src/page/LinePage1-2/Left/index.tsx new file mode 100644 index 0000000..6524b82 --- /dev/null +++ b/src/page/LinePage1-2/Left/index.tsx @@ -0,0 +1,11 @@ +import LeftUp from "./LeftUp"; +import LeftDown from "./LeftDown"; +function Left() { + return ( +
+ + +
+ ); +} +export default Left; diff --git a/src/page/LinePage1-2/Right/RightDown.tsx b/src/page/LinePage1-2/Right/RightDown.tsx new file mode 100644 index 0000000..d2c51c8 --- /dev/null +++ b/src/page/LinePage1-2/Right/RightDown.tsx @@ -0,0 +1,273 @@ +import ReactECharts from "echarts-for-react"; +import TitleBox from "../Component/TitleBox"; +import SwitchButton from "../Component/SwitchButton"; +import ScrollBoard from "./../../Component/ScrollBoard"; +import { useState } from "react"; +import getOptions from "../../Component/LineChartRight/chart.config"; +import {useAppSelector} from "./../../../store/hooks" +import {selectLine1After} from "./../../../store/LinePageSlice" +import moment from "moment"; +function RightDown() { + const data = useAppSelector(selectLine1After); + // console.log('页面数据:',data) + // 假数据 + let tempData = [ + { + type: "day", + data: { + time: [] as string[], + input: [] as number[], + output: [] as number[], + }, + }, + { + type: "week", + data: { + time: [] as string[], + input: [] as number[], + output: [] as number[], + }, + }, + { + type: "month", + data: { + time: [] as string[], + input: [] as number[], + output: [] as number[], + }, + }, + ]; + const nameList = [ + { name: "表单", ename: "table" }, + { name: "折线", ename: "chart" }, + ]; + const [activeName, setActiveName] = useState(nameList[0].ename); + const handleButtonChange = (activeName: string) => { + setActiveName(activeName); + }; + const configDay = { + header: ["时间", "投入数量", "产出数量"], + headerHeight: 30, + rowNum: 5, + headerBGC: "rgba(79, 114, 136, 0.3)", + oddRowBGC: "rgba(79, 114, 136, 0.3)", + evenRowBGC: "rgba(76, 97, 123, 0.1)", + columnWidth: [120, 130, 130], + data: [], + }; + const configWeek = { + header: ["时间", "投入数量", "产出数量"], + headerHeight: 30, + rowNum: 5, + headerBGC: "rgba(79, 114, 136, 0.3)", + oddRowBGC: "rgba(79, 114, 136, 0.3)", + evenRowBGC: "rgba(76, 97, 123, 0.1)", + columnWidth: [120, 130, 130], + data: [], + }; + const configMonth = { + header: ["时间", "投入数量", "产出数量"], + headerHeight: 30, + rowNum: 5, + headerBGC: "rgba(79, 114, 136, 0.3)", + oddRowBGC: "rgba(79, 114, 136, 0.3)", + evenRowBGC: "rgba(76, 97, 123, 0.1)", + columnWidth: [120, 130, 130], + data: [], + }; + let arr1: any = []; + let arr2: any = []; + let arr3: any = []; + // @ts-ignore + if (data.todayProductionDets && data.todayProductionDets.length > 0) { + // @ts-ignore + data.todayProductionDets.map((item,index)=>{ + let arrInner = []; + arrInner.push(moment(item.recTime).format("HH:mm"),item.inputNum,item.outputNum); + arr1.push(arrInner); + tempData[0].data.time.push(moment(item.recTime).format("HH:mm")); + tempData[0].data.input.push(item.inputNum); + tempData[0].data.output.push(item.outputNum); + }) + }else{ + tempData[0].data.time = [] + tempData[0].data.input = [] + tempData[0].data.output = [] + } + // @ts-ignore + if (data.weekProductionDets && data.weekProductionDets.length > 0) { + // @ts-ignore + data.weekProductionDets.map((item,index)=>{ + let arrInner = []; + arrInner.push(moment(item.recTime).format("YYYY/MM/DD"),item.inputNum,item.outputNum); + arr2.push(arrInner); + tempData[1].data.time.push(moment(item.recTime).format("HH:mm")); + tempData[1].data.input.push(item.inputNum); + tempData[1].data.output.push(item.outputNum); + }) + }else{ + tempData[1].data.time = [] + tempData[1].data.input = [] + tempData[1].data.output = [] + } + // @ts-ignore + if (data.monthProductionDets && data.monthProductionDets.length > 0) { + // @ts-ignore + data.monthProductionDets.map((item,index)=>{ + let arrInner = []; + arrInner.push(moment(item.recTime).format("YYYY/MM/DD"),item.inputNum,item.outputNum); + arr3.push(arrInner); + tempData[2].data.time.push(moment(item.recTime).format("HH:mm")); + tempData[2].data.input.push(item.inputNum); + tempData[2].data.output.push(item.outputNum); + }) + }else{ + tempData[2].data.time = [] + tempData[2].data.input = [] + tempData[2].data.output = [] + } + configDay.data = arr1; + configWeek.data = arr2; + configMonth.data = arr3; + + const chartData1 = tempData[0].data; + const chartData2 = tempData[1].data; + const chartData3 = tempData[2].data; + const options1 = getOptions(chartData1); + const options2 = getOptions(chartData2); + const options3 = getOptions(chartData3); + return ( +
+ +
+ +
+
+
+
+ 当天 +
+
+
+ {activeName === "table" ? ( + arr1.length>0?:( +

+ 暂无数据 +

+ ) + ) : tempData[0].data.time.length>0 ? ( + + ) : ( +

+ 暂无数据 +

+ )} +
+
+
+ 本周 +
+
+
+ {activeName === "table" ? ( + arr2.length>0?:( +

+ 暂无数据 +

+ ) + ) : tempData[1].data.time.length>0 ? ( + + ) : ( +

+ 暂无数据 +

+ )} +
+
+
+ 本月 +
+
+
+ {activeName === "table" ? ( + arr3.length>0?:( +

+ 暂无数据 +

+ ) + ) : tempData[2].data.time.length>0 ? ( + + ) : ( +

+ 暂无数据 +

+ )} +
+
+
+ ); +} +export default RightDown; diff --git a/src/page/LinePage1-2/Right/RightUp.tsx b/src/page/LinePage1-2/Right/RightUp.tsx new file mode 100644 index 0000000..c01c7be --- /dev/null +++ b/src/page/LinePage1-2/Right/RightUp.tsx @@ -0,0 +1,52 @@ +import TitleBox from "../Component/TitleBox"; +import ScrollBoard from "./../../Component/ScrollBoard"; +import {useAppSelector} from "./../../../store/hooks" +import {selectLine1After} from "./../../../store/LinePageSlice" +function RightUp() { + const data = useAppSelector(selectLine1After); + const config = { + header: ["序号", "产线", "上片数据量", "成品下片数量"], + headerHeight: 32, + rowNum: 5, + align: ["center", "left", "left", "left"], + headerBGC: "rgba(79, 114, 136, 0.3)", + oddRowBGC: "rgba(79, 114, 136, 0.3)", + evenRowBGC: "rgba(76, 97, 123, 0.1)", + columnWidth: [70, 90, 106, 114], + data: [], + }; + let arr:any = [] + // @ts-ignore + if (data.sumProductionDets && data.sumProductionDets.length > 0) { + // @ts-ignore + data.sumProductionDets.map((item, index) => { + let arrInner = [] + arrInner.push(index + 1, item.lineName, item.inputNum, item.outputNum) + arr.push(arrInner) + }) + } + config.data = arr + return ( +
+ +
+ {arr.length>0?:(

+ 暂无数据 +

)} +
+
+ ); +} +export default RightUp; diff --git a/src/page/LinePage1-2/Right/index.tsx b/src/page/LinePage1-2/Right/index.tsx new file mode 100644 index 0000000..53c802a --- /dev/null +++ b/src/page/LinePage1-2/Right/index.tsx @@ -0,0 +1,12 @@ +import RightDown from "./RightDown"; +import RightUp from "./RightUp"; + +function Right() { + return ( +
+ + +
+ ); +} +export default Right; diff --git a/src/page/LinePage1-2/TopP.tsx b/src/page/LinePage1-2/TopP.tsx new file mode 100644 index 0000000..e7c7a64 --- /dev/null +++ b/src/page/LinePage1-2/TopP.tsx @@ -0,0 +1,14 @@ +import '../../lanhuapp/common.css'; +import "./index.css"; + +function TopP() { + return ( +
+
+
+
+
+ ); +} + +export default TopP; \ No newline at end of file diff --git a/src/page/LinePage1-2/assets/icon/alarm.png b/src/page/LinePage1-2/assets/icon/alarm.png new file mode 100644 index 0000000..eb335f3 Binary files /dev/null and b/src/page/LinePage1-2/assets/icon/alarm.png differ diff --git a/src/page/LinePage1-2/assets/icon/defect.png b/src/page/LinePage1-2/assets/icon/defect.png new file mode 100644 index 0000000..76ed17c Binary files /dev/null and b/src/page/LinePage1-2/assets/icon/defect.png differ diff --git a/src/page/LinePage1-2/assets/icon/finished.png b/src/page/LinePage1-2/assets/icon/finished.png new file mode 100644 index 0000000..99b411b Binary files /dev/null and b/src/page/LinePage1-2/assets/icon/finished.png differ diff --git a/src/page/LinePage1-2/assets/icon/g.png b/src/page/LinePage1-2/assets/icon/g.png new file mode 100644 index 0000000..bf1b107 Binary files /dev/null and b/src/page/LinePage1-2/assets/icon/g.png differ diff --git a/src/page/LinePage1-2/assets/icon/inputAndOutput.png b/src/page/LinePage1-2/assets/icon/inputAndOutput.png new file mode 100644 index 0000000..113ed13 Binary files /dev/null and b/src/page/LinePage1-2/assets/icon/inputAndOutput.png differ diff --git a/src/page/LinePage1-2/assets/icon/num.png b/src/page/LinePage1-2/assets/icon/num.png new file mode 100644 index 0000000..e77c409 Binary files /dev/null and b/src/page/LinePage1-2/assets/icon/num.png differ diff --git a/src/page/LinePage1-2/assets/icon/r.png b/src/page/LinePage1-2/assets/icon/r.png new file mode 100644 index 0000000..d11591e Binary files /dev/null and b/src/page/LinePage1-2/assets/icon/r.png differ diff --git a/src/page/LinePage1-2/assets/icon/record.png b/src/page/LinePage1-2/assets/icon/record.png new file mode 100644 index 0000000..4622f01 Binary files /dev/null and b/src/page/LinePage1-2/assets/icon/record.png differ diff --git a/src/page/LinePage1-2/assets/icon/y.png b/src/page/LinePage1-2/assets/icon/y.png new file mode 100644 index 0000000..72c796a Binary files /dev/null and b/src/page/LinePage1-2/assets/icon/y.png differ diff --git a/src/page/LinePage1-2/index.css b/src/page/LinePage1-2/index.css new file mode 100644 index 0000000..1a28491 --- /dev/null +++ b/src/page/LinePage1-2/index.css @@ -0,0 +1,264 @@ +/* 顶部 */ +.block_top { + width: 1920px; + height: 94px; + background: url(/public/svg/topback.svg) 100% no-repeat; + background-size: 100% 100%; + opacity: 1; + display: flex; + justify-content: center; +} + +.block_top_title { + width: 651px; + height: 77px; + background: url(/public/png/topTiltle.png) 100% no-repeat; + background-size: 100% 100%; + margin-top: 18px; +} +/* 中部 */ +.block_bottom { + width: 1920px; + height: 966px; + padding-top: 20px; +} + +.group_left { + width: 402px; + height: 966px; + margin: 0 0 0 24px; +} + +.group_center { + width: 1041px; + height: 966px; + margin: 0 0 0 15px; +} + +.group_right { + width: 401px; + height: 966px; + margin-left: 15px; +} + +.left_up { + width: 402px; + height: 332px; + background: url(../../../public/png/rect/lp_left_up.png) no-repeat; + background-size: 100% 100%; + background-position: 0 0; + position: relative; +} +.left_down { + width: 402px; + height: 599px; + background: url(../../../public/png/rect/lp_left_down.png) no-repeat; + background-size: 100% 100%; + background-position: 0 0; + margin-top: 14px; + position: relative; +} +.center_up { + width: 1041px; + height: 562px; + background: url(../../../public/png/rect/lp_center_up.png) no-repeat; + background-size: 100% 100%; + background-position: 0 0; + position: relative; +} +.center_down { + width: 1041px; + height: 368px; + margin-top: 17px; +} +.center_down_inner { + width: 513px; + height: 366px; + background: url(../../../public/png/rect/lp_center_down.png) no-repeat; + background-size: 100% 100%; + background-position: 0 0; + position: relative; +} +.center_down .left-box { + margin-right: 15px; + position: relative; +} +.center_down .left-box .alarm_num_title { + position: absolute; + left: 220px; + top: 22px; + font-size: 13px; + letter-spacing: 3px; + color: #fff; +} +.center_down .left-box .alarm_num { + color: #52fff1; + font-size: 40px; + text-align: center; + font-family: PingFangSC, PingFang SC; +} +.center_down .right_box .chart_box { + width: 100%; + height: 310px; + margin-top: 10px; +} +.right_up { + width: 401px; + height: 257px; + background: url(../../../public/png/rect/lp_right_up.png) no-repeat; + background-size: 100% 100%; + background-position: 0 0; +} +.right_down { + width: 401px; + height: 673px; + background: url(../../../public/png/rect/lp_right_down.png) no-repeat; + background-size: 100% 100%; + background-position: 0 0; + margin-top: 14px; + position: relative; +} +.left_up_switch { + position: absolute; + right: 10px; + top: 12px; +} +.left_up_chart { + height: 275px; + margin-top: 10px; +} +/* 左侧 */ +.left_down_title { + height: 18px; + justify-content: center; + margin-bottom: 4px; +} +.left_down_box1 { + width: 56px; + height: 13px; + background: url(/public/png/leftbar.png) 100% no-repeat; + background-size: 100% 100%; + margin-top: 2px; +} +.left_down_box2 { + width: 56px; + height: 13px; + background: url(/public/png/rightbar.png) 100% no-repeat; + background-size: 100% 100%; + margin: 2px 0 0 0px; +} +.left_down_text { + /*width: 40px;*/ + height: 18px; + overflow-wrap: break-word; + color: rgba(1, 207, 204, 1); + font-size: 18px; + letter-spacing: 5px; + font-family: PingFangSC-Regular; + white-space: nowrap; + line-height: 18px; + margin-left: 18px; + margin-right: 16px; + text-align: center; +} +.left_down_content { + height: 160px; + /* padding-bottom: 5px; */ +} +.right_down_content { + height: 185px; + /* padding-bottom: 5px; */ +} +/* 滚动表格部分 */ +.dv-scroll-board .header .header-item, +.dv-scroll-board .rows .ceil { + border-right: 1px solid #0d1728; +} +.dv-scroll-board .header .header-item:last-child, +.dv-scroll-board .rows .ceil:last-child { + border-right: none; + border: none; +} +/* chart图部分 */ +.luoyang-chart-tooltip { + background: #0a2b4f77 !important; + border: none !important; + backdrop-filter: blur(12px); +} + +.luoyang-chart-tooltip * { + color: #fff !important; +} +/* 三维页面部分 */ +.center_up .model_name { + position: absolute; + left: 0px; + top: 0px; + z-index: 1000; +} +.center_up .model_info { + position: absolute; + left: 100px; + bottom: 0px; + z-index: 1000; + width: 841px; + height: 62px; + background: url(/public/png/lp/line_part.png) 100% no-repeat; + background-size: 100% 100%; +} +.center_up .model_info .reset_btn { + position: absolute; + top: 20px; + left: 40px; + width: 140px; + height: 40px; + cursor: pointer; +} +.center_up .model_info .title { + display: inline-block; + width: 361px; + text-align: center; + font-size: 32px; + color: #fff; + letter-spacing: 5px; + position: absolute; + left: 241px; + bottom: 10px; +} +.center_up .eq_detail_info { + position: absolute; + right: 0px; + bottom: 0px; + z-index: 1002; + width: 240px; + height: 110px; + background: url(/public/png/lp/eq_msg_detail.png) 100% no-repeat; + background-size: 100% 100%; + color: #fff; + padding: 15px 0 0 15px; +} +.center_up .eq_detail_info .left_name { + display: inline-block; + width: 95px; + height: 28px; + text-align: right; + font-size: 18px; +} +.center_up .eq_detail_info .right_value { + display: inline-block; + height: 28px; + font-size: 18px; +} +.center_up .eq_info { + position: absolute; + z-index: 1002; + background: url(/public/png/lp/eq_msg_always.png) 100% no-repeat; + background-size: 100% 100%; + color: #fff; + padding: 10px 15px; +} +.center_up .eq_info .eq_info_inner { + height: 24px; + font-size: 17px; + white-space: nowrap; +} diff --git a/src/page/LinePage1-2/index.tsx b/src/page/LinePage1-2/index.tsx new file mode 100644 index 0000000..daf9389 --- /dev/null +++ b/src/page/LinePage1-2/index.tsx @@ -0,0 +1,18 @@ +import React from "react"; +import TopP from "./TopP"; +import Left from "./Left"; +import Right from "./Right"; +import Center from "./Center"; +function LinePage() { + return ( + + +
+ +
+ +
+
+ ); +} +export default LinePage; diff --git a/src/page/LinePage2-1/Center/CenterDown.tsx b/src/page/LinePage2-1/Center/CenterDown.tsx new file mode 100644 index 0000000..d47c712 --- /dev/null +++ b/src/page/LinePage2-1/Center/CenterDown.tsx @@ -0,0 +1,214 @@ +import ReactECharts from "echarts-for-react"; +import TitleBox from "../Component/TitleBox"; +import ScrollBoard from "./../../Component/ScrollBoard"; +import SwitchButton from "../Component/SwitchButton"; +import { useState } from "react"; +import getOptions from "../../Component/LineChart/chart.config"; +import {useAppSelector} from "./../../../store/hooks" +import {selectLine2Before} from "./../../../store/LinePageSlice" +import moment from "moment"; +function CenterDown() { + const data = useAppSelector(selectLine2Before); + // 假数据 + const dataSource = { + day: { + xData:[], + series: [] as { name: string; type: string; symbol: string; symbolSize: number; data: never[]; }[], + }, + week: { + xData:[], + series: [] as { name: string; type: string; symbol: string; symbolSize: number; data: never[]; }[], + }, + month: { + xData:[], + series: [] as { name: string; type: string; symbol: string; symbolSize: number; data: never[]; }[], + }, + }; + const nameList = [ + { name: "天", ename: "day" }, + { name: "周", ename: "week" }, + { name: "月", ename: "month" }, + ]; + const [activeName, setActiveName] = useState(nameList[0].ename); + const handleButtonChange = (activeName: string) => { + setActiveName(activeName); + }; + const config = { + header: ["序号", "报警时间", "报警设备", "报警内容"], + headerHeight: 36, + rowNum: 6, + align: ["center", "left", "left", "left"], + headerBGC: "rgba(79, 114, 136, 0.3)", + oddRowBGC: "rgba(79, 114, 136, 0.3)", + evenRowBGC: "rgba(76, 97, 123, 0.1)", + columnWidth: [80, 137, 137, 137], + data: [] + }; + // 报警数据 + let arr:any = [] + let sumAlarm = 0 + // @ts-ignore + if (data.alarms && data.alarms.length > 0) { + // @ts-ignore + sumAlarm = data.alarms.length + // @ts-ignore + data.alarms.map((item,index) => { + let arrInner = [] + arrInner.push( + index+1, + moment(item.recTime).format("YYYY/MM/DD HH:mm"), + item.name, + item.status === '故障'?"故障":"离线", + ); + arr.push(arrInner) + }); + } + config.data = arr + // 产线成品率 + // @ts-ignore + if (data.todayProductionRates && Object.keys(data.todayProductionRates).length > 0) { + // @ts-ignore + let keys = Object.keys(data.todayProductionRates) + // @ts-ignore + data.todayProductionRates[keys[0]].map((item,index)=>{ + // @ts-ignore + dataSource.day.xData.push(moment(item.recTime).format("HH:mm")) + }) + keys.map((item,index)=>{ + let obj = { + name: "", + type: "line", + symbol: "circle", + symbolSize: 4, + data:[] + } + // @ts-ignore + obj.name = data.todayProductionRates[item][0].lineName + // @ts-ignore + data.todayProductionRates[item].map((subItem,index)=>{ + // @ts-ignore + obj.data.push(subItem.passRate) + }) + dataSource.day.series.push(obj) + }) + }else{ + dataSource.day.xData = [] + dataSource.day.series = [] + } + // @ts-ignore + if (data.weekProductionRates && Object.keys(data.weekProductionRates).length > 0) { + // @ts-ignore + let keys = Object.keys(data.weekProductionRates) + // @ts-ignore + data.weekProductionRates[keys[0]].map((item,index)=>{ + // @ts-ignore + dataSource.week.xData.push(moment(item.recTime).format("HH:mm")) + }) + keys.map((item,index)=>{ + let obj = { + name: "", + type: "line", + symbol: "circle", + symbolSize: 4, + data:[] + } + // @ts-ignore + obj.name = data.weekProductionRates[item][0].lineName + // @ts-ignore + data.weekProductionRates[item].map((subItem,index)=>{ + // @ts-ignore + obj.data.push(subItem.passRate) + }) + dataSource.week.series.push(obj) + }) + }else{ + dataSource.week.xData = [] + dataSource.week.series = [] + } + // @ts-ignore + if (data.monthProductionRates && Object.keys(data.monthProductionRates).length > 0) { + // @ts-ignore + let keys = Object.keys(data.monthProductionRates) + // @ts-ignore + data.monthProductionRates[keys[0]].map((item,index)=>{ + // @ts-ignore + dataSource.month.xData.push(moment(item.recTime).format("HH:mm")) + }) + keys.map((item,index)=>{ + let obj = { + name: "", + type: "line", + symbol: "circle", + symbolSize: 4, + data:[] + } + // @ts-ignore + obj.name = data.monthProductionRates[item][0].lineName + // @ts-ignore + data.monthProductionRates[item].map((subItem,index)=>{ + // @ts-ignore + obj.data.push(subItem.passRate) + }) + dataSource.month.series.push(obj) + }) + }else{ + dataSource.month.xData = [] + dataSource.month.series = [] + } + let chartData = (dataSource as { [key: string]: any })[activeName]; + console.log('???????????',chartData) + const options = getOptions(chartData); + return ( +
+
+ + — 报警总数 — +
{sumAlarm}
+
+ {arr.length>0?:(

+ 暂无数据 +

)} +
+
+ {/* 产线成品率 */} +
+ +
+ +
+ {chartData.xData.length>0 && ( +
+ {} +
+ )} + {chartData.xData.length==0 && ( +

+ 暂无数据 +

+ )} +
+
+ ); +} +export default CenterDown; diff --git a/src/page/LinePage2-1/Center/CenterUp.tsx b/src/page/LinePage2-1/Center/CenterUp.tsx new file mode 100644 index 0000000..4fe5cdd --- /dev/null +++ b/src/page/LinePage2-1/Center/CenterUp.tsx @@ -0,0 +1,10 @@ +import LinePageBabylon from "../../../babylonjs/LinePageBabylon"; +function CenterUp() { + const lineID = "2-1" + return ( +
+ +
+ ); +} +export default CenterUp; diff --git a/src/page/LinePage2-1/Center/index.tsx b/src/page/LinePage2-1/Center/index.tsx new file mode 100644 index 0000000..14d5036 --- /dev/null +++ b/src/page/LinePage2-1/Center/index.tsx @@ -0,0 +1,12 @@ +import CenterDown from "./CenterDown"; +import CenterUp from "./CenterUp"; + +function Center() { + return ( +
+ + +
+ ); +} +export default Center; diff --git a/src/page/LinePage2-1/Component/SwitchButton/index.css b/src/page/LinePage2-1/Component/SwitchButton/index.css new file mode 100644 index 0000000..604d81a --- /dev/null +++ b/src/page/LinePage2-1/Component/SwitchButton/index.css @@ -0,0 +1,19 @@ +.switch-button { + height: 33px; +} +.switch-button button { + color: #fff; + font-size: 18px; + padding: 4px 10px; + background-color: rgba(49, 135, 140, 0.3); + cursor: pointer; +} +.switch-button button:first-child { + border-radius: 5px 0 0 5px; +} +.switch-button button:last-child { + border-radius: 0 5px 5px 0; +} +.switch-button button.active { + background-color: rgba(86, 244, 231, 0.7); +} diff --git a/src/page/LinePage2-1/Component/SwitchButton/index.tsx b/src/page/LinePage2-1/Component/SwitchButton/index.tsx new file mode 100644 index 0000000..9209c06 --- /dev/null +++ b/src/page/LinePage2-1/Component/SwitchButton/index.tsx @@ -0,0 +1,65 @@ +import { useEffect, useState } from "react"; +import "./index.css"; +interface Name { + name: string; + ename: string; +} +interface nameListProps { + nameList: Name[]; + onChange: (value: string) => void; +} +function createActiveNameUpdater(nameList: any, activeName: string) { + let activeIndex = nameList.findIndex((obj: any) => obj.name === activeName); + + return function updateActiveName() { + activeIndex = (activeIndex + 1) % nameList.length; + return nameList[activeIndex].ename; + }; +} +function SwitchButton(props: nameListProps) { + const [activeName, setActiveName] = useState(props.nameList[0].ename); + const [timerId, setTimerId] = useState(null); + let updateActiveName = createActiveNameUpdater(props.nameList, activeName); + useEffect(() => { + const timer = setInterval(() => { + let active = updateActiveName(); + setActiveName(active); + props.onChange(active); + }, 60000); + setTimerId(timer); + return () => { + if (timerId !== null) { + clearInterval(timerId); + } + }; + }, [props.nameList.length]); + const btnClick = (ename: string) => { + if (timerId !== null) { + clearInterval(timerId); + } + setActiveName(ename); + props.onChange(ename); // 通知父组件 + const newTimer = setInterval(() => { + let active = updateActiveName(); + setActiveName(active); + props.onChange(active); + }, 60000); + setTimerId(newTimer); + }; + return ( +
+ {props.nameList.map((item, index) => { + return ( + + ); + })} +
+ ); +} +export default SwitchButton; diff --git a/src/page/LinePage2-1/Component/TitleBox/index.css b/src/page/LinePage2-1/Component/TitleBox/index.css new file mode 100644 index 0000000..3ae06db --- /dev/null +++ b/src/page/LinePage2-1/Component/TitleBox/index.css @@ -0,0 +1,13 @@ +.title_box { + font-size: 24px; + color: #52fff1; + padding: 10px 0 0 15px; +} +.title_box img { + width: 33px; + height: 33px; + vertical-align: bottom; + margin-right: 3px; + position: relative; + top: 3px; +} diff --git a/src/page/LinePage2-1/Component/TitleBox/index.tsx b/src/page/LinePage2-1/Component/TitleBox/index.tsx new file mode 100644 index 0000000..dd43a66 --- /dev/null +++ b/src/page/LinePage2-1/Component/TitleBox/index.tsx @@ -0,0 +1,53 @@ +import Defect from "./../../assets/icon/defect.png"; +import Alarm from "./../../assets/icon/alarm.png"; +import Finished from "./../../assets/icon/finished.png"; +import InputAndOutput from "./../../assets/icon/inputAndOutput.png"; +import Num from "./../../assets/icon/num.png"; +import Record from "./../../assets/icon/record.png"; +import "./index.css"; +interface titleProps { + title: string; +} +function TitleBox(props: titleProps) { + const filteredTitles = () => { + switch (props.title) { + case "left_up": + return { + img: Defect, + title: "产线报废汇总", + }; + case "left_down": + return { + img: Record, + title: "当前产线报废情况", + }; + case "center_down_left": + return { + img: Alarm, + title: "异常报警", + }; + case "center_down_right": + return { + img: Finished, + title: "产线成品率", + }; + case "right_up": + return { + img: Num, + title: "各产线总投入和产出", + }; + default: + return { + img: InputAndOutput, + title: "当前产线投入和产出", + }; + } + }; + return ( +
+ title + {filteredTitles().title} +
+ ); +} +export default TitleBox; diff --git a/src/page/LinePage2-1/Left/LeftDown.tsx b/src/page/LinePage2-1/Left/LeftDown.tsx new file mode 100644 index 0000000..f829d78 --- /dev/null +++ b/src/page/LinePage2-1/Left/LeftDown.tsx @@ -0,0 +1,245 @@ +import ReactECharts from "echarts-for-react"; +import TitleBox from "../Component/TitleBox"; +import SwitchButton from "../Component/SwitchButton"; +import ScrollBoard from "./../../Component/ScrollBoard"; +import { useState } from "react"; +import getOptions from "../../Component/BarChart/chart.config"; +import {useAppSelector} from "./../../../store/hooks" +import {selectLine2Before} from "./../../../store/LinePageSlice" +function LeftDown() { + const data = useAppSelector(selectLine2Before); + // console.log('页面数据:',data) + const nameList = [ + { name: "表单", ename: "table" }, + { name: "柱状", ename: "chart" }, + ]; + const [activeName, setActiveName] = useState(nameList[0].ename); + const handleButtonChange = (activeName: string) => { + setActiveName(activeName); + }; + const configDay = { + header: ["序号", "工序类型", "报废数量"], + headerHeight: 30, + rowNum: 4, + align: ["center", "left", "left"], + headerBGC: "rgba(79, 114, 136, 0.3)", + oddRowBGC: "rgba(79, 114, 136, 0.3)", + evenRowBGC: "rgba(76, 97, 123, 0.1)", + columnWidth: [73, 117, 190], + data: [ + ["1", "磨边后", 224], + ["2", "包装1", 322], + ["3", "包装2", 66], + ], + }; + const configWeek = { + header: ["序号", "工序类型", "报废数量"], + headerHeight: 30, + rowNum: 4, + align: ["center", "left", "left"], + headerBGC: "rgba(79, 114, 136, 0.3)", + oddRowBGC: "rgba(79, 114, 136, 0.3)", + evenRowBGC: "rgba(76, 97, 123, 0.1)", + columnWidth: [73, 117, 190], + data: [ + ["1", "磨边后", 1119], + ["2", "包装1", 1798], + ["3", "包装2", 435], + ], + }; + const configMonth = { + header: ["序号", "工序类型", "报废数量"], + headerHeight: 30, + rowNum: 4, + align: ["center", "left", "left"], + headerBGC: "rgba(79, 114, 136, 0.3)", + oddRowBGC: "rgba(79, 114, 136, 0.3)", + evenRowBGC: "rgba(76, 97, 123, 0.1)", + columnWidth: [73, 117, 190], + data: [ + ["1", "磨边后", 5004], + ["2", "包装1", 9122], + ["3", "包装2", 1924], + ], + }; + const color1 = ["#9DD5FF", "#1295FF"]; + const color2 = ["#85F6E9", "#2EC6B4"]; + // @ts-ignore + let xData: string[] = data.scrapBars + let dataProps1: number[] = []; + let dataProps2: number[] = []; + let dataProps3: number[] = []; + let arr1: any = []; + let arr2: any = []; + let arr3: any = []; + // @ts-ignore + if (data.todayProductionScraps && data.todayProductionScraps.length > 0) { + // @ts-ignore + data.todayProductionScraps.map((item,index)=>{ + let arrInner = []; + arrInner.push(index+1,item.sectionName,item.scrapNum); + arr1.push(arrInner); + dataProps1.push(item.scrapNum); + }) + }else{ + dataProps1 = [] + } + // @ts-ignore + if (data.weekProductionScraps && data.weekProductionScraps.length > 0) { + // @ts-ignore + data.weekProductionScraps.map((item,index)=>{ + let arrInner = []; + arrInner.push(index+1,item.sectionName,item.scrapNum); + arr2.push(arrInner); + dataProps2.push(item.scrapNum); + }) + }else{ + dataProps2 = [] + } + // @ts-ignore + if (data.monthProductionScraps && data.monthProductionScraps.length > 0) { + // @ts-ignore + data.monthProductionScraps.map((item,index)=>{ + let arrInner = []; + arrInner.push(index+1,item.sectionName,item.scrapNum); + arr3.push(arrInner); + dataProps3.push(item.scrapNum); + }) + }else{ + dataProps3 = [] + } + configDay.data = arr1; + configWeek.data = arr2; + configMonth.data = arr3; + const options1 = getOptions(dataProps1,xData, color1); + const options2 = getOptions(dataProps2,xData, color2); + const options3 = getOptions(dataProps3,xData, color1); + return ( +
+ +
+ +
+
+
+
+ 当天 +
+
+
+ {activeName === "table" ? ( + arr1.length > 0 ? :(

+ 暂无数据 +

) + ) : dataProps1.length>0 ? ( + + ) : ( +

+ 暂无数据 +

+ )} +
+
+
+ 本周 +
+
+
+ {activeName === "table" ? ( + arr2.length > 0 ? :(

+ 暂无数据 +

) + ) : dataProps2.length>0 ? ( + + ) : ( +

+ 暂无数据 +

+ )} +
+
+
+ 本月 +
+
+
+ {activeName === "table" ? ( + arr3.length > 0 ? :(

+ 暂无数据 +

) + ) : dataProps3.length>0 ? ( + + ) : ( +

+ 暂无数据 +

+ )} +
+
+
+ ); +} +export default LeftDown; diff --git a/src/page/LinePage2-1/Left/LeftUp.tsx b/src/page/LinePage2-1/Left/LeftUp.tsx new file mode 100644 index 0000000..19a3904 --- /dev/null +++ b/src/page/LinePage2-1/Left/LeftUp.tsx @@ -0,0 +1,228 @@ +import ReactECharts from "echarts-for-react"; +import TitleBox from "../Component/TitleBox"; +import SwitchButton from "../Component/SwitchButton"; +import getOptions from "../../Component/SummaryBarChart/chart.config"; +import { useState } from "react"; +import {useAppSelector} from "./../../../store/hooks" +import {selectLine2Before} from "./../../../store/LinePageSlice" +function LeftUp() { + const data = useAppSelector(selectLine2Before); + // 假数据 + const dataSource = { + day: { + xData: [], + series: [] as { data: number[]; type: string; stack: string; name: any; barWidth?: number; label: { show: boolean; position: string; color: string;formatter?:any }; }[], + }, + week: { + xData: [], + series: [] as { data: number[]; type: string; stack: string; name: any; barWidth?: number; label: { show: boolean; position: string; color: string;formatter?:any }; }[], + }, + month: { + xData: [], + series: [] as { data: number[]; type: string; stack: string; name: any; barWidth?: number; label: { show: boolean; position: string; color: string;formatter?:any }; }[], + }, + }; + const nameList = [ + { name: "天", ename: "day" }, + { name: "周", ename: "week" }, + { name: "月", ename: "month" }, + ]; + const [activeName, setActiveName] = useState(nameList[0].ename); + let chartData = (dataSource as { [key: string]: any })[activeName]; + const handleButtonChange = (activeName: string) => { + setActiveName(activeName); + }; + // @ts-ignore + if (data.todayAllProductionScraps && Object.keys(data.todayAllProductionScraps).length > 0) { + let sum: number[] = []; + // 生成obj + // @ts-ignore + data.scrapBars.map((item,index) => { + let obj = { + data: [], + type: "bar", + stack: "a", + name: item, + barWidth: 14, + label: { + show: true, + position: "right", + color: "inherit", + }, + } + dataSource.day.series.push(obj) + }) + // @ts-ignore + dataSource.day.xData = Object.keys(data.todayAllProductionScraps) + dataSource.day.xData.map((item,index)=>{ + let sumIner = 0 + // @ts-ignore + data.todayAllProductionScraps[item].map((itemInner,indexInner)=>{ + sumIner += itemInner.scrapNum + dataSource.day.series.map((itemSeries,indexSeries)=>{ + // @ts-ignore + if (itemSeries.name === itemInner.sectionName) { + // @ts-ignore + itemSeries.data.push(itemInner.scrapNum) + } + }) + }) + sum.push(sumIner) + }) + dataSource.day.series.push({ + data: sum, + type: "bar", + stack: "a", + name: "", + label: { + show: true, + position: "top", + color: "#fff", + formatter: function (params: any) { + return sum[params.dataIndex]; + }, + }, + }) + }else{ + dataSource.day.xData = [] + dataSource.day.series = [] + } + // @ts-ignore + if (data.weekAllProductionScraps && Object.keys(data.weekAllProductionScraps).length > 0) { + let sum: number[] = []; + // 生成obj + // @ts-ignore + data.scrapBars.map((item,index) => { + let obj = { + data: [], + type: "bar", + stack: "a", + name: item, + barWidth: 14, + label: { + show: true, + position: "right", + color: "inherit", + }, + } + dataSource.week.series.push(obj) + }) + // @ts-ignore + dataSource.week.xData = Object.keys(data.weekAllProductionScraps) + dataSource.week.xData.map((item,index)=>{ + let sumIner = 0 + // @ts-ignore + data.weekAllProductionScraps[item].map((itemInner,indexInner)=>{ + sumIner += itemInner.scrapNum + dataSource.week.series.map((itemSeries,indexSeries)=>{ + // @ts-ignore + if (itemSeries.name === itemInner.sectionName) { + // @ts-ignore + itemSeries.data.push(itemInner.scrapNum) + } + }) + }) + sum.push(sumIner) + }) + dataSource.week.series.push({ + data: sum, + type: "bar", + stack: "a", + name: "", + label: { + show: true, + position: "top", + color: "#fff", + formatter: function (params: any) { + return sum[params.dataIndex]; + }, + }, + }) + }else{ + dataSource.week.xData = [] + dataSource.week.series = [] + } + // @ts-ignore + if (data.monthAllProductionScraps && Object.keys(data.monthAllProductionScraps).length > 0) { + let sum: number[] = []; + // 生成obj + // @ts-ignore + data.scrapBars.map((item,index) => { + let obj = { + data: [], + type: "bar", + stack: "a", + name: item, + barWidth: 14, + label: { + show: true, + position: "right", + color: "inherit", + }, + } + dataSource.month.series.push(obj) + }) + // @ts-ignore + dataSource.month.xData = Object.keys(data.monthAllProductionScraps) + dataSource.month.xData.map((item,index)=>{ + let sumIner = 0 + // @ts-ignore + data.monthAllProductionScraps[item].map((itemInner,indexInner)=>{ + sumIner += itemInner.scrapNum + dataSource.month.series.map((itemSeries,indexSeries)=>{ + // @ts-ignore + if (itemSeries.name === itemInner.sectionName) { + // @ts-ignore + itemSeries.data.push(itemInner.scrapNum) + } + }) + }) + sum.push(sumIner) + }) + dataSource.month.series.push({ + data: sum, + type: "bar", + stack: "a", + name: "", + label: { + show: true, + position: "top", + color: "#fff", + formatter: function (params: any) { + return sum[params.dataIndex]; + }, + }, + }) + }else{ + dataSource.month.xData = [] + dataSource.month.series = [] + } + const options = getOptions(chartData); + return ( +
+ +
+ +
+ {// @ts-ignore + dataSource[activeName].xData.length>0 ? ( +
+ {} +
+ ):( +

+ 暂无数据 +

+ )} +
+ ); +} +export default LeftUp; diff --git a/src/page/LinePage2-1/Left/index.tsx b/src/page/LinePage2-1/Left/index.tsx new file mode 100644 index 0000000..6524b82 --- /dev/null +++ b/src/page/LinePage2-1/Left/index.tsx @@ -0,0 +1,11 @@ +import LeftUp from "./LeftUp"; +import LeftDown from "./LeftDown"; +function Left() { + return ( +
+ + +
+ ); +} +export default Left; diff --git a/src/page/LinePage2-1/Right/RightDown.tsx b/src/page/LinePage2-1/Right/RightDown.tsx new file mode 100644 index 0000000..c46ef93 --- /dev/null +++ b/src/page/LinePage2-1/Right/RightDown.tsx @@ -0,0 +1,273 @@ +import ReactECharts from "echarts-for-react"; +import TitleBox from "../Component/TitleBox"; +import SwitchButton from "../Component/SwitchButton"; +import ScrollBoard from "./../../Component/ScrollBoard"; +import { useState } from "react"; +import getOptions from "../../Component/LineChartRight/chart.config"; +import {useAppSelector} from "./../../../store/hooks" +import {selectLine2Before} from "./../../../store/LinePageSlice" +import moment from "moment"; +function RightDown() { + const data = useAppSelector(selectLine2Before); + // console.log('页面数据:',data) + // 假数据 + let tempData = [ + { + type: "day", + data: { + time: [] as string[], + input: [] as number[], + output: [] as number[], + }, + }, + { + type: "week", + data: { + time: [] as string[], + input: [] as number[], + output: [] as number[], + }, + }, + { + type: "month", + data: { + time: [] as string[], + input: [] as number[], + output: [] as number[], + }, + }, + ]; + const nameList = [ + { name: "表单", ename: "table" }, + { name: "折线", ename: "chart" }, + ]; + const [activeName, setActiveName] = useState(nameList[0].ename); + const handleButtonChange = (activeName: string) => { + setActiveName(activeName); + }; + const configDay = { + header: ["时间", "投入数量", "产出数量"], + headerHeight: 30, + rowNum: 5, + headerBGC: "rgba(79, 114, 136, 0.3)", + oddRowBGC: "rgba(79, 114, 136, 0.3)", + evenRowBGC: "rgba(76, 97, 123, 0.1)", + columnWidth: [120, 130, 130], + data: [], + }; + const configWeek = { + header: ["时间", "投入数量", "产出数量"], + headerHeight: 30, + rowNum: 5, + headerBGC: "rgba(79, 114, 136, 0.3)", + oddRowBGC: "rgba(79, 114, 136, 0.3)", + evenRowBGC: "rgba(76, 97, 123, 0.1)", + columnWidth: [120, 130, 130], + data: [], + }; + const configMonth = { + header: ["时间", "投入数量", "产出数量"], + headerHeight: 30, + rowNum: 5, + headerBGC: "rgba(79, 114, 136, 0.3)", + oddRowBGC: "rgba(79, 114, 136, 0.3)", + evenRowBGC: "rgba(76, 97, 123, 0.1)", + columnWidth: [120, 130, 130], + data: [], + }; + let arr1: any = []; + let arr2: any = []; + let arr3: any = []; + // @ts-ignore + if (data.todayProductionDets && data.todayProductionDets.length > 0) { + // @ts-ignore + data.todayProductionDets.map((item,index)=>{ + let arrInner = []; + arrInner.push(moment(item.recTime).format("HH:mm"),item.inputNum,item.outputNum); + arr1.push(arrInner); + tempData[0].data.time.push(moment(item.recTime).format("HH:mm")); + tempData[0].data.input.push(item.inputNum); + tempData[0].data.output.push(item.outputNum); + }) + }else{ + tempData[0].data.time = [] + tempData[0].data.input = [] + tempData[0].data.output = [] + } + // @ts-ignore + if (data.weekProductionDets && data.weekProductionDets.length > 0) { + // @ts-ignore + data.weekProductionDets.map((item,index)=>{ + let arrInner = []; + arrInner.push(moment(item.recTime).format("YYYY/MM/DD"),item.inputNum,item.outputNum); + arr2.push(arrInner); + tempData[1].data.time.push(moment(item.recTime).format("HH:mm")); + tempData[1].data.input.push(item.inputNum); + tempData[1].data.output.push(item.outputNum); + }) + }else{ + tempData[1].data.time = [] + tempData[1].data.input = [] + tempData[1].data.output = [] + } + // @ts-ignore + if (data.monthProductionDets && data.monthProductionDets.length > 0) { + // @ts-ignore + data.monthProductionDets.map((item,index)=>{ + let arrInner = []; + arrInner.push(moment(item.recTime).format("YYYY/MM/DD"),item.inputNum,item.outputNum); + arr3.push(arrInner); + tempData[2].data.time.push(moment(item.recTime).format("HH:mm")); + tempData[2].data.input.push(item.inputNum); + tempData[2].data.output.push(item.outputNum); + }) + }else{ + tempData[2].data.time = [] + tempData[2].data.input = [] + tempData[2].data.output = [] + } + configDay.data = arr1; + configWeek.data = arr2; + configMonth.data = arr3; + + const chartData1 = tempData[0].data; + const chartData2 = tempData[1].data; + const chartData3 = tempData[2].data; + const options1 = getOptions(chartData1); + const options2 = getOptions(chartData2); + const options3 = getOptions(chartData3); + return ( +
+ +
+ +
+
+
+
+ 当天 +
+
+
+ {activeName === "table" ? ( + arr1.length>0?:( +

+ 暂无数据 +

+ ) + ) : tempData[0].data.time.length>0 ? ( + + ) : ( +

+ 暂无数据 +

+ )} +
+
+
+ 本周 +
+
+
+ {activeName === "table" ? ( + arr2.length>0?:( +

+ 暂无数据 +

+ ) + ) : tempData[1].data.time.length>0 ? ( + + ) : ( +

+ 暂无数据 +

+ )} +
+
+
+ 本月 +
+
+
+ {activeName === "table" ? ( + arr3.length>0?:( +

+ 暂无数据 +

+ ) + ) : tempData[2].data.time.length>0 ? ( + + ) : ( +

+ 暂无数据 +

+ )} +
+
+
+ ); +} +export default RightDown; diff --git a/src/page/LinePage2-1/Right/RightUp.tsx b/src/page/LinePage2-1/Right/RightUp.tsx new file mode 100644 index 0000000..d3c4b67 --- /dev/null +++ b/src/page/LinePage2-1/Right/RightUp.tsx @@ -0,0 +1,52 @@ +import TitleBox from "../Component/TitleBox"; +import ScrollBoard from "./../../Component/ScrollBoard"; +import {useAppSelector} from "./../../../store/hooks" +import {selectLine2Before} from "./../../../store/LinePageSlice" +function RightUp() { + const data = useAppSelector(selectLine2Before); + const config = { + header: ["序号", "产线", "上片数据量", "成品下片数量"], + headerHeight: 32, + rowNum: 5, + align: ["center", "left", "left", "left"], + headerBGC: "rgba(79, 114, 136, 0.3)", + oddRowBGC: "rgba(79, 114, 136, 0.3)", + evenRowBGC: "rgba(76, 97, 123, 0.1)", + columnWidth: [70, 90, 106, 114], + data: [], + }; + let arr:any = [] + // @ts-ignore + if (data.sumProductionDets && data.sumProductionDets.length > 0) { + // @ts-ignore + data.sumProductionDets.map((item, index) => { + let arrInner = [] + arrInner.push(index + 1, item.lineName, item.inputNum, item.outputNum) + arr.push(arrInner) + }) + } + config.data = arr + return ( +
+ +
+ {arr.length>0?:(

+ 暂无数据 +

)} +
+
+ ); +} +export default RightUp; diff --git a/src/page/LinePage2-1/Right/index.tsx b/src/page/LinePage2-1/Right/index.tsx new file mode 100644 index 0000000..53c802a --- /dev/null +++ b/src/page/LinePage2-1/Right/index.tsx @@ -0,0 +1,12 @@ +import RightDown from "./RightDown"; +import RightUp from "./RightUp"; + +function Right() { + return ( +
+ + +
+ ); +} +export default Right; diff --git a/src/page/LinePage2-1/TopP.tsx b/src/page/LinePage2-1/TopP.tsx new file mode 100644 index 0000000..e7c7a64 --- /dev/null +++ b/src/page/LinePage2-1/TopP.tsx @@ -0,0 +1,14 @@ +import '../../lanhuapp/common.css'; +import "./index.css"; + +function TopP() { + return ( +
+
+
+
+
+ ); +} + +export default TopP; \ No newline at end of file diff --git a/src/page/LinePage2-1/assets/icon/alarm.png b/src/page/LinePage2-1/assets/icon/alarm.png new file mode 100644 index 0000000..eb335f3 Binary files /dev/null and b/src/page/LinePage2-1/assets/icon/alarm.png differ diff --git a/src/page/LinePage2-1/assets/icon/defect.png b/src/page/LinePage2-1/assets/icon/defect.png new file mode 100644 index 0000000..76ed17c Binary files /dev/null and b/src/page/LinePage2-1/assets/icon/defect.png differ diff --git a/src/page/LinePage2-1/assets/icon/finished.png b/src/page/LinePage2-1/assets/icon/finished.png new file mode 100644 index 0000000..99b411b Binary files /dev/null and b/src/page/LinePage2-1/assets/icon/finished.png differ diff --git a/src/page/LinePage2-1/assets/icon/g.png b/src/page/LinePage2-1/assets/icon/g.png new file mode 100644 index 0000000..bf1b107 Binary files /dev/null and b/src/page/LinePage2-1/assets/icon/g.png differ diff --git a/src/page/LinePage2-1/assets/icon/inputAndOutput.png b/src/page/LinePage2-1/assets/icon/inputAndOutput.png new file mode 100644 index 0000000..113ed13 Binary files /dev/null and b/src/page/LinePage2-1/assets/icon/inputAndOutput.png differ diff --git a/src/page/LinePage2-1/assets/icon/num.png b/src/page/LinePage2-1/assets/icon/num.png new file mode 100644 index 0000000..e77c409 Binary files /dev/null and b/src/page/LinePage2-1/assets/icon/num.png differ diff --git a/src/page/LinePage2-1/assets/icon/r.png b/src/page/LinePage2-1/assets/icon/r.png new file mode 100644 index 0000000..d11591e Binary files /dev/null and b/src/page/LinePage2-1/assets/icon/r.png differ diff --git a/src/page/LinePage2-1/assets/icon/record.png b/src/page/LinePage2-1/assets/icon/record.png new file mode 100644 index 0000000..4622f01 Binary files /dev/null and b/src/page/LinePage2-1/assets/icon/record.png differ diff --git a/src/page/LinePage2-1/assets/icon/y.png b/src/page/LinePage2-1/assets/icon/y.png new file mode 100644 index 0000000..72c796a Binary files /dev/null and b/src/page/LinePage2-1/assets/icon/y.png differ diff --git a/src/page/LinePage2-1/index.css b/src/page/LinePage2-1/index.css new file mode 100644 index 0000000..1a28491 --- /dev/null +++ b/src/page/LinePage2-1/index.css @@ -0,0 +1,264 @@ +/* 顶部 */ +.block_top { + width: 1920px; + height: 94px; + background: url(/public/svg/topback.svg) 100% no-repeat; + background-size: 100% 100%; + opacity: 1; + display: flex; + justify-content: center; +} + +.block_top_title { + width: 651px; + height: 77px; + background: url(/public/png/topTiltle.png) 100% no-repeat; + background-size: 100% 100%; + margin-top: 18px; +} +/* 中部 */ +.block_bottom { + width: 1920px; + height: 966px; + padding-top: 20px; +} + +.group_left { + width: 402px; + height: 966px; + margin: 0 0 0 24px; +} + +.group_center { + width: 1041px; + height: 966px; + margin: 0 0 0 15px; +} + +.group_right { + width: 401px; + height: 966px; + margin-left: 15px; +} + +.left_up { + width: 402px; + height: 332px; + background: url(../../../public/png/rect/lp_left_up.png) no-repeat; + background-size: 100% 100%; + background-position: 0 0; + position: relative; +} +.left_down { + width: 402px; + height: 599px; + background: url(../../../public/png/rect/lp_left_down.png) no-repeat; + background-size: 100% 100%; + background-position: 0 0; + margin-top: 14px; + position: relative; +} +.center_up { + width: 1041px; + height: 562px; + background: url(../../../public/png/rect/lp_center_up.png) no-repeat; + background-size: 100% 100%; + background-position: 0 0; + position: relative; +} +.center_down { + width: 1041px; + height: 368px; + margin-top: 17px; +} +.center_down_inner { + width: 513px; + height: 366px; + background: url(../../../public/png/rect/lp_center_down.png) no-repeat; + background-size: 100% 100%; + background-position: 0 0; + position: relative; +} +.center_down .left-box { + margin-right: 15px; + position: relative; +} +.center_down .left-box .alarm_num_title { + position: absolute; + left: 220px; + top: 22px; + font-size: 13px; + letter-spacing: 3px; + color: #fff; +} +.center_down .left-box .alarm_num { + color: #52fff1; + font-size: 40px; + text-align: center; + font-family: PingFangSC, PingFang SC; +} +.center_down .right_box .chart_box { + width: 100%; + height: 310px; + margin-top: 10px; +} +.right_up { + width: 401px; + height: 257px; + background: url(../../../public/png/rect/lp_right_up.png) no-repeat; + background-size: 100% 100%; + background-position: 0 0; +} +.right_down { + width: 401px; + height: 673px; + background: url(../../../public/png/rect/lp_right_down.png) no-repeat; + background-size: 100% 100%; + background-position: 0 0; + margin-top: 14px; + position: relative; +} +.left_up_switch { + position: absolute; + right: 10px; + top: 12px; +} +.left_up_chart { + height: 275px; + margin-top: 10px; +} +/* 左侧 */ +.left_down_title { + height: 18px; + justify-content: center; + margin-bottom: 4px; +} +.left_down_box1 { + width: 56px; + height: 13px; + background: url(/public/png/leftbar.png) 100% no-repeat; + background-size: 100% 100%; + margin-top: 2px; +} +.left_down_box2 { + width: 56px; + height: 13px; + background: url(/public/png/rightbar.png) 100% no-repeat; + background-size: 100% 100%; + margin: 2px 0 0 0px; +} +.left_down_text { + /*width: 40px;*/ + height: 18px; + overflow-wrap: break-word; + color: rgba(1, 207, 204, 1); + font-size: 18px; + letter-spacing: 5px; + font-family: PingFangSC-Regular; + white-space: nowrap; + line-height: 18px; + margin-left: 18px; + margin-right: 16px; + text-align: center; +} +.left_down_content { + height: 160px; + /* padding-bottom: 5px; */ +} +.right_down_content { + height: 185px; + /* padding-bottom: 5px; */ +} +/* 滚动表格部分 */ +.dv-scroll-board .header .header-item, +.dv-scroll-board .rows .ceil { + border-right: 1px solid #0d1728; +} +.dv-scroll-board .header .header-item:last-child, +.dv-scroll-board .rows .ceil:last-child { + border-right: none; + border: none; +} +/* chart图部分 */ +.luoyang-chart-tooltip { + background: #0a2b4f77 !important; + border: none !important; + backdrop-filter: blur(12px); +} + +.luoyang-chart-tooltip * { + color: #fff !important; +} +/* 三维页面部分 */ +.center_up .model_name { + position: absolute; + left: 0px; + top: 0px; + z-index: 1000; +} +.center_up .model_info { + position: absolute; + left: 100px; + bottom: 0px; + z-index: 1000; + width: 841px; + height: 62px; + background: url(/public/png/lp/line_part.png) 100% no-repeat; + background-size: 100% 100%; +} +.center_up .model_info .reset_btn { + position: absolute; + top: 20px; + left: 40px; + width: 140px; + height: 40px; + cursor: pointer; +} +.center_up .model_info .title { + display: inline-block; + width: 361px; + text-align: center; + font-size: 32px; + color: #fff; + letter-spacing: 5px; + position: absolute; + left: 241px; + bottom: 10px; +} +.center_up .eq_detail_info { + position: absolute; + right: 0px; + bottom: 0px; + z-index: 1002; + width: 240px; + height: 110px; + background: url(/public/png/lp/eq_msg_detail.png) 100% no-repeat; + background-size: 100% 100%; + color: #fff; + padding: 15px 0 0 15px; +} +.center_up .eq_detail_info .left_name { + display: inline-block; + width: 95px; + height: 28px; + text-align: right; + font-size: 18px; +} +.center_up .eq_detail_info .right_value { + display: inline-block; + height: 28px; + font-size: 18px; +} +.center_up .eq_info { + position: absolute; + z-index: 1002; + background: url(/public/png/lp/eq_msg_always.png) 100% no-repeat; + background-size: 100% 100%; + color: #fff; + padding: 10px 15px; +} +.center_up .eq_info .eq_info_inner { + height: 24px; + font-size: 17px; + white-space: nowrap; +} diff --git a/src/page/LinePage2-1/index.tsx b/src/page/LinePage2-1/index.tsx new file mode 100644 index 0000000..daf9389 --- /dev/null +++ b/src/page/LinePage2-1/index.tsx @@ -0,0 +1,18 @@ +import React from "react"; +import TopP from "./TopP"; +import Left from "./Left"; +import Right from "./Right"; +import Center from "./Center"; +function LinePage() { + return ( + + +
+ +
+ +
+
+ ); +} +export default LinePage; diff --git a/src/page/LinePage2-2/Center/CenterDown.tsx b/src/page/LinePage2-2/Center/CenterDown.tsx new file mode 100644 index 0000000..cf9c180 --- /dev/null +++ b/src/page/LinePage2-2/Center/CenterDown.tsx @@ -0,0 +1,214 @@ +import ReactECharts from "echarts-for-react"; +import TitleBox from "../Component/TitleBox"; +import ScrollBoard from "./../../Component/ScrollBoard"; +import SwitchButton from "../Component/SwitchButton"; +import { useState } from "react"; +import getOptions from "../../Component/LineChart/chart.config"; +import {useAppSelector} from "./../../../store/hooks" +import {selectLine2After} from "./../../../store/LinePageSlice" +import moment from "moment"; +function CenterDown() { + const data = useAppSelector(selectLine2After); + // 假数据 + const dataSource = { + day: { + xData:[], + series: [] as { name: string; type: string; symbol: string; symbolSize: number; data: never[]; }[], + }, + week: { + xData:[], + series: [] as { name: string; type: string; symbol: string; symbolSize: number; data: never[]; }[], + }, + month: { + xData:[], + series: [] as { name: string; type: string; symbol: string; symbolSize: number; data: never[]; }[], + }, + }; + const nameList = [ + { name: "天", ename: "day" }, + { name: "周", ename: "week" }, + { name: "月", ename: "month" }, + ]; + const [activeName, setActiveName] = useState(nameList[0].ename); + const handleButtonChange = (activeName: string) => { + setActiveName(activeName); + }; + const config = { + header: ["序号", "报警时间", "报警设备", "报警内容"], + headerHeight: 36, + rowNum: 6, + align: ["center", "left", "left", "left"], + headerBGC: "rgba(79, 114, 136, 0.3)", + oddRowBGC: "rgba(79, 114, 136, 0.3)", + evenRowBGC: "rgba(76, 97, 123, 0.1)", + columnWidth: [80, 137, 137, 137], + data: [] + }; + // 报警数据 + let arr:any = [] + let sumAlarm = 0 + // @ts-ignore + if (data.alarms && data.alarms.length > 0) { + // @ts-ignore + sumAlarm = data.alarms.length + // @ts-ignore + data.alarms.map((item,index) => { + let arrInner = [] + arrInner.push( + index+1, + moment(item.recTime).format("YYYY/MM/DD HH:mm"), + item.name, + item.status === '故障'?"故障":"离线", + ); + arr.push(arrInner) + }); + } + config.data = arr + // 产线成品率 + // @ts-ignore + if (data.todayProductionRates && Object.keys(data.todayProductionRates).length > 0) { + // @ts-ignore + let keys = Object.keys(data.todayProductionRates) + // @ts-ignore + data.todayProductionRates[keys[0]].map((item,index)=>{ + // @ts-ignore + dataSource.day.xData.push(moment(item.recTime).format("HH:mm")) + }) + keys.map((item,index)=>{ + let obj = { + name: "", + type: "line", + symbol: "circle", + symbolSize: 4, + data:[] + } + // @ts-ignore + obj.name = data.todayProductionRates[item][0].lineName + // @ts-ignore + data.todayProductionRates[item].map((subItem,index)=>{ + // @ts-ignore + obj.data.push(subItem.passRate) + }) + dataSource.day.series.push(obj) + }) + }else{ + dataSource.day.xData = [] + dataSource.day.series = [] + } + // @ts-ignore + if (data.weekProductionRates && Object.keys(data.weekProductionRates).length > 0) { + // @ts-ignore + let keys = Object.keys(data.weekProductionRates) + // @ts-ignore + data.weekProductionRates[keys[0]].map((item,index)=>{ + // @ts-ignore + dataSource.week.xData.push(moment(item.recTime).format("HH:mm")) + }) + keys.map((item,index)=>{ + let obj = { + name: "", + type: "line", + symbol: "circle", + symbolSize: 4, + data:[] + } + // @ts-ignore + obj.name = data.weekProductionRates[item][0].lineName + // @ts-ignore + data.weekProductionRates[item].map((subItem,index)=>{ + // @ts-ignore + obj.data.push(subItem.passRate) + }) + dataSource.week.series.push(obj) + }) + }else{ + dataSource.week.xData = [] + dataSource.week.series = [] + } + // @ts-ignore + if (data.monthProductionRates && Object.keys(data.monthProductionRates).length > 0) { + // @ts-ignore + let keys = Object.keys(data.monthProductionRates) + // @ts-ignore + data.monthProductionRates[keys[0]].map((item,index)=>{ + // @ts-ignore + dataSource.month.xData.push(moment(item.recTime).format("HH:mm")) + }) + keys.map((item,index)=>{ + let obj = { + name: "", + type: "line", + symbol: "circle", + symbolSize: 4, + data:[] + } + // @ts-ignore + obj.name = data.monthProductionRates[item][0].lineName + // @ts-ignore + data.monthProductionRates[item].map((subItem,index)=>{ + // @ts-ignore + obj.data.push(subItem.passRate) + }) + dataSource.month.series.push(obj) + }) + }else{ + dataSource.month.xData = [] + dataSource.month.series = [] + } + let chartData = (dataSource as { [key: string]: any })[activeName]; + console.log('???????????',chartData) + const options = getOptions(chartData); + return ( +
+
+ + — 报警总数 — +
{sumAlarm}
+
+ {arr.length>0?:(

+ 暂无数据 +

)} +
+
+ {/* 产线成品率 */} +
+ +
+ +
+ {chartData.xData.length>0 && ( +
+ {} +
+ )} + {chartData.xData.length==0 && ( +

+ 暂无数据 +

+ )} +
+
+ ); +} +export default CenterDown; diff --git a/src/page/LinePage2-2/Center/CenterUp.tsx b/src/page/LinePage2-2/Center/CenterUp.tsx new file mode 100644 index 0000000..2dd19f2 --- /dev/null +++ b/src/page/LinePage2-2/Center/CenterUp.tsx @@ -0,0 +1,10 @@ +import LinePageBabylon from "../../../babylonjs/LinePageBabylon"; +function CenterUp() { + const lineID = "2-2"; + return ( +
+ +
+ ); +} +export default CenterUp; diff --git a/src/page/LinePage2-2/Center/index.tsx b/src/page/LinePage2-2/Center/index.tsx new file mode 100644 index 0000000..14d5036 --- /dev/null +++ b/src/page/LinePage2-2/Center/index.tsx @@ -0,0 +1,12 @@ +import CenterDown from "./CenterDown"; +import CenterUp from "./CenterUp"; + +function Center() { + return ( +
+ + +
+ ); +} +export default Center; diff --git a/src/page/LinePage2-2/Component/SwitchButton/index.css b/src/page/LinePage2-2/Component/SwitchButton/index.css new file mode 100644 index 0000000..604d81a --- /dev/null +++ b/src/page/LinePage2-2/Component/SwitchButton/index.css @@ -0,0 +1,19 @@ +.switch-button { + height: 33px; +} +.switch-button button { + color: #fff; + font-size: 18px; + padding: 4px 10px; + background-color: rgba(49, 135, 140, 0.3); + cursor: pointer; +} +.switch-button button:first-child { + border-radius: 5px 0 0 5px; +} +.switch-button button:last-child { + border-radius: 0 5px 5px 0; +} +.switch-button button.active { + background-color: rgba(86, 244, 231, 0.7); +} diff --git a/src/page/LinePage2-2/Component/SwitchButton/index.tsx b/src/page/LinePage2-2/Component/SwitchButton/index.tsx new file mode 100644 index 0000000..9209c06 --- /dev/null +++ b/src/page/LinePage2-2/Component/SwitchButton/index.tsx @@ -0,0 +1,65 @@ +import { useEffect, useState } from "react"; +import "./index.css"; +interface Name { + name: string; + ename: string; +} +interface nameListProps { + nameList: Name[]; + onChange: (value: string) => void; +} +function createActiveNameUpdater(nameList: any, activeName: string) { + let activeIndex = nameList.findIndex((obj: any) => obj.name === activeName); + + return function updateActiveName() { + activeIndex = (activeIndex + 1) % nameList.length; + return nameList[activeIndex].ename; + }; +} +function SwitchButton(props: nameListProps) { + const [activeName, setActiveName] = useState(props.nameList[0].ename); + const [timerId, setTimerId] = useState(null); + let updateActiveName = createActiveNameUpdater(props.nameList, activeName); + useEffect(() => { + const timer = setInterval(() => { + let active = updateActiveName(); + setActiveName(active); + props.onChange(active); + }, 60000); + setTimerId(timer); + return () => { + if (timerId !== null) { + clearInterval(timerId); + } + }; + }, [props.nameList.length]); + const btnClick = (ename: string) => { + if (timerId !== null) { + clearInterval(timerId); + } + setActiveName(ename); + props.onChange(ename); // 通知父组件 + const newTimer = setInterval(() => { + let active = updateActiveName(); + setActiveName(active); + props.onChange(active); + }, 60000); + setTimerId(newTimer); + }; + return ( +
+ {props.nameList.map((item, index) => { + return ( + + ); + })} +
+ ); +} +export default SwitchButton; diff --git a/src/page/LinePage2-2/Component/TitleBox/index.css b/src/page/LinePage2-2/Component/TitleBox/index.css new file mode 100644 index 0000000..3ae06db --- /dev/null +++ b/src/page/LinePage2-2/Component/TitleBox/index.css @@ -0,0 +1,13 @@ +.title_box { + font-size: 24px; + color: #52fff1; + padding: 10px 0 0 15px; +} +.title_box img { + width: 33px; + height: 33px; + vertical-align: bottom; + margin-right: 3px; + position: relative; + top: 3px; +} diff --git a/src/page/LinePage2-2/Component/TitleBox/index.tsx b/src/page/LinePage2-2/Component/TitleBox/index.tsx new file mode 100644 index 0000000..dd43a66 --- /dev/null +++ b/src/page/LinePage2-2/Component/TitleBox/index.tsx @@ -0,0 +1,53 @@ +import Defect from "./../../assets/icon/defect.png"; +import Alarm from "./../../assets/icon/alarm.png"; +import Finished from "./../../assets/icon/finished.png"; +import InputAndOutput from "./../../assets/icon/inputAndOutput.png"; +import Num from "./../../assets/icon/num.png"; +import Record from "./../../assets/icon/record.png"; +import "./index.css"; +interface titleProps { + title: string; +} +function TitleBox(props: titleProps) { + const filteredTitles = () => { + switch (props.title) { + case "left_up": + return { + img: Defect, + title: "产线报废汇总", + }; + case "left_down": + return { + img: Record, + title: "当前产线报废情况", + }; + case "center_down_left": + return { + img: Alarm, + title: "异常报警", + }; + case "center_down_right": + return { + img: Finished, + title: "产线成品率", + }; + case "right_up": + return { + img: Num, + title: "各产线总投入和产出", + }; + default: + return { + img: InputAndOutput, + title: "当前产线投入和产出", + }; + } + }; + return ( +
+ title + {filteredTitles().title} +
+ ); +} +export default TitleBox; diff --git a/src/page/LinePage2-2/Left/LeftDown.tsx b/src/page/LinePage2-2/Left/LeftDown.tsx new file mode 100644 index 0000000..e7e83d8 --- /dev/null +++ b/src/page/LinePage2-2/Left/LeftDown.tsx @@ -0,0 +1,245 @@ +import ReactECharts from "echarts-for-react"; +import TitleBox from "../Component/TitleBox"; +import SwitchButton from "../Component/SwitchButton"; +import ScrollBoard from "./../../Component/ScrollBoard"; +import { useState } from "react"; +import getOptions from "../../Component/BarChart/chart.config"; +import {useAppSelector} from "./../../../store/hooks" +import {selectLine2After} from "./../../../store/LinePageSlice" +function LeftDown() { + const data = useAppSelector(selectLine2After); + // console.log('页面数据:',data) + const nameList = [ + { name: "表单", ename: "table" }, + { name: "柱状", ename: "chart" }, + ]; + const [activeName, setActiveName] = useState(nameList[0].ename); + const handleButtonChange = (activeName: string) => { + setActiveName(activeName); + }; + const configDay = { + header: ["序号", "工序类型", "报废数量"], + headerHeight: 30, + rowNum: 4, + align: ["center", "left", "left"], + headerBGC: "rgba(79, 114, 136, 0.3)", + oddRowBGC: "rgba(79, 114, 136, 0.3)", + evenRowBGC: "rgba(76, 97, 123, 0.1)", + columnWidth: [73, 117, 190], + data: [ + ["1", "磨边后", 224], + ["2", "包装1", 322], + ["3", "包装2", 66], + ], + }; + const configWeek = { + header: ["序号", "工序类型", "报废数量"], + headerHeight: 30, + rowNum: 4, + align: ["center", "left", "left"], + headerBGC: "rgba(79, 114, 136, 0.3)", + oddRowBGC: "rgba(79, 114, 136, 0.3)", + evenRowBGC: "rgba(76, 97, 123, 0.1)", + columnWidth: [73, 117, 190], + data: [ + ["1", "磨边后", 1119], + ["2", "包装1", 1798], + ["3", "包装2", 435], + ], + }; + const configMonth = { + header: ["序号", "工序类型", "报废数量"], + headerHeight: 30, + rowNum: 4, + align: ["center", "left", "left"], + headerBGC: "rgba(79, 114, 136, 0.3)", + oddRowBGC: "rgba(79, 114, 136, 0.3)", + evenRowBGC: "rgba(76, 97, 123, 0.1)", + columnWidth: [73, 117, 190], + data: [ + ["1", "磨边后", 5004], + ["2", "包装1", 9122], + ["3", "包装2", 1924], + ], + }; + const color1 = ["#9DD5FF", "#1295FF"]; + const color2 = ["#85F6E9", "#2EC6B4"]; + // @ts-ignore + let xData: string[] = data.scrapBars + let dataProps1: number[] = []; + let dataProps2: number[] = []; + let dataProps3: number[] = []; + let arr1: any = []; + let arr2: any = []; + let arr3: any = []; + // @ts-ignore + if (data.todayProductionScraps && data.todayProductionScraps.length > 0) { + // @ts-ignore + data.todayProductionScraps.map((item,index)=>{ + let arrInner = []; + arrInner.push(index+1,item.sectionName,item.scrapNum); + arr1.push(arrInner); + dataProps1.push(item.scrapNum); + }) + }else{ + dataProps1 = [] + } + // @ts-ignore + if (data.weekProductionScraps && data.weekProductionScraps.length > 0) { + // @ts-ignore + data.weekProductionScraps.map((item,index)=>{ + let arrInner = []; + arrInner.push(index+1,item.sectionName,item.scrapNum); + arr2.push(arrInner); + dataProps2.push(item.scrapNum); + }) + }else{ + dataProps2 = [] + } + // @ts-ignore + if (data.monthProductionScraps && data.monthProductionScraps.length > 0) { + // @ts-ignore + data.monthProductionScraps.map((item,index)=>{ + let arrInner = []; + arrInner.push(index+1,item.sectionName,item.scrapNum); + arr3.push(arrInner); + dataProps3.push(item.scrapNum); + }) + }else{ + dataProps3 = [] + } + configDay.data = arr1; + configWeek.data = arr2; + configMonth.data = arr3; + const options1 = getOptions(dataProps1,xData, color1); + const options2 = getOptions(dataProps2,xData, color2); + const options3 = getOptions(dataProps3,xData, color1); + return ( +
+ +
+ +
+
+
+
+ 当天 +
+
+
+ {activeName === "table" ? ( + arr1.length > 0 ? :(

+ 暂无数据 +

) + ) : dataProps1.length>0 ? ( + + ) : ( +

+ 暂无数据 +

+ )} +
+
+
+ 本周 +
+
+
+ {activeName === "table" ? ( + arr2.length > 0 ? :(

+ 暂无数据 +

) + ) : dataProps2.length>0 ? ( + + ) : ( +

+ 暂无数据 +

+ )} +
+
+
+ 本月 +
+
+
+ {activeName === "table" ? ( + arr3.length > 0 ? :(

+ 暂无数据 +

) + ) : dataProps3.length>0 ? ( + + ) : ( +

+ 暂无数据 +

+ )} +
+
+
+ ); +} +export default LeftDown; diff --git a/src/page/LinePage2-2/Left/LeftUp.tsx b/src/page/LinePage2-2/Left/LeftUp.tsx new file mode 100644 index 0000000..e172b49 --- /dev/null +++ b/src/page/LinePage2-2/Left/LeftUp.tsx @@ -0,0 +1,228 @@ +import ReactECharts from "echarts-for-react"; +import TitleBox from "../Component/TitleBox"; +import SwitchButton from "../Component/SwitchButton"; +import getOptions from "../../Component/SummaryBarChart/chart.config"; +import { useState } from "react"; +import {useAppSelector} from "./../../../store/hooks" +import {selectLine2After} from "./../../../store/LinePageSlice" +function LeftUp() { + const data = useAppSelector(selectLine2After); + // 假数据 + const dataSource = { + day: { + xData: [], + series: [] as { data: number[]; type: string; stack: string; name: any; barWidth?: number; label: { show: boolean; position: string; color: string;formatter?:any }; }[], + }, + week: { + xData: [], + series: [] as { data: number[]; type: string; stack: string; name: any; barWidth?: number; label: { show: boolean; position: string; color: string;formatter?:any }; }[], + }, + month: { + xData: [], + series: [] as { data: number[]; type: string; stack: string; name: any; barWidth?: number; label: { show: boolean; position: string; color: string;formatter?:any }; }[], + }, + }; + const nameList = [ + { name: "天", ename: "day" }, + { name: "周", ename: "week" }, + { name: "月", ename: "month" }, + ]; + const [activeName, setActiveName] = useState(nameList[0].ename); + let chartData = (dataSource as { [key: string]: any })[activeName]; + const handleButtonChange = (activeName: string) => { + setActiveName(activeName); + }; + // @ts-ignore + if (data.todayAllProductionScraps && Object.keys(data.todayAllProductionScraps).length > 0) { + let sum: number[] = []; + // 生成obj + // @ts-ignore + data.scrapBars.map((item,index) => { + let obj = { + data: [], + type: "bar", + stack: "a", + name: item, + barWidth: 14, + label: { + show: true, + position: "right", + color: "inherit", + }, + } + dataSource.day.series.push(obj) + }) + // @ts-ignore + dataSource.day.xData = Object.keys(data.todayAllProductionScraps) + dataSource.day.xData.map((item,index)=>{ + let sumIner = 0 + // @ts-ignore + data.todayAllProductionScraps[item].map((itemInner,indexInner)=>{ + sumIner += itemInner.scrapNum + dataSource.day.series.map((itemSeries,indexSeries)=>{ + // @ts-ignore + if (itemSeries.name === itemInner.sectionName) { + // @ts-ignore + itemSeries.data.push(itemInner.scrapNum) + } + }) + }) + sum.push(sumIner) + }) + dataSource.day.series.push({ + data: sum, + type: "bar", + stack: "a", + name: "", + label: { + show: true, + position: "top", + color: "#fff", + formatter: function (params: any) { + return sum[params.dataIndex]; + }, + }, + }) + }else{ + dataSource.day.xData = [] + dataSource.day.series = [] + } + // @ts-ignore + if (data.weekAllProductionScraps && Object.keys(data.weekAllProductionScraps).length > 0) { + let sum: number[] = []; + // 生成obj + // @ts-ignore + data.scrapBars.map((item,index) => { + let obj = { + data: [], + type: "bar", + stack: "a", + name: item, + barWidth: 14, + label: { + show: true, + position: "right", + color: "inherit", + }, + } + dataSource.week.series.push(obj) + }) + // @ts-ignore + dataSource.week.xData = Object.keys(data.weekAllProductionScraps) + dataSource.week.xData.map((item,index)=>{ + let sumIner = 0 + // @ts-ignore + data.weekAllProductionScraps[item].map((itemInner,indexInner)=>{ + sumIner += itemInner.scrapNum + dataSource.week.series.map((itemSeries,indexSeries)=>{ + // @ts-ignore + if (itemSeries.name === itemInner.sectionName) { + // @ts-ignore + itemSeries.data.push(itemInner.scrapNum) + } + }) + }) + sum.push(sumIner) + }) + dataSource.week.series.push({ + data: sum, + type: "bar", + stack: "a", + name: "", + label: { + show: true, + position: "top", + color: "#fff", + formatter: function (params: any) { + return sum[params.dataIndex]; + }, + }, + }) + }else{ + dataSource.week.xData = [] + dataSource.week.series = [] + } + // @ts-ignore + if (data.monthAllProductionScraps && Object.keys(data.monthAllProductionScraps).length > 0) { + let sum: number[] = []; + // 生成obj + // @ts-ignore + data.scrapBars.map((item,index) => { + let obj = { + data: [], + type: "bar", + stack: "a", + name: item, + barWidth: 14, + label: { + show: true, + position: "right", + color: "inherit", + }, + } + dataSource.month.series.push(obj) + }) + // @ts-ignore + dataSource.month.xData = Object.keys(data.monthAllProductionScraps) + dataSource.month.xData.map((item,index)=>{ + let sumIner = 0 + // @ts-ignore + data.monthAllProductionScraps[item].map((itemInner,indexInner)=>{ + sumIner += itemInner.scrapNum + dataSource.month.series.map((itemSeries,indexSeries)=>{ + // @ts-ignore + if (itemSeries.name === itemInner.sectionName) { + // @ts-ignore + itemSeries.data.push(itemInner.scrapNum) + } + }) + }) + sum.push(sumIner) + }) + dataSource.month.series.push({ + data: sum, + type: "bar", + stack: "a", + name: "", + label: { + show: true, + position: "top", + color: "#fff", + formatter: function (params: any) { + return sum[params.dataIndex]; + }, + }, + }) + }else{ + dataSource.month.xData = [] + dataSource.month.series = [] + } + const options = getOptions(chartData); + return ( +
+ +
+ +
+ {// @ts-ignore + dataSource[activeName].xData.length>0 ? ( +
+ {} +
+ ):( +

+ 暂无数据 +

+ )} +
+ ); +} +export default LeftUp; diff --git a/src/page/LinePage2-2/Left/index.tsx b/src/page/LinePage2-2/Left/index.tsx new file mode 100644 index 0000000..6524b82 --- /dev/null +++ b/src/page/LinePage2-2/Left/index.tsx @@ -0,0 +1,11 @@ +import LeftUp from "./LeftUp"; +import LeftDown from "./LeftDown"; +function Left() { + return ( +
+ + +
+ ); +} +export default Left; diff --git a/src/page/LinePage2-2/Right/RightDown.tsx b/src/page/LinePage2-2/Right/RightDown.tsx new file mode 100644 index 0000000..48064ca --- /dev/null +++ b/src/page/LinePage2-2/Right/RightDown.tsx @@ -0,0 +1,273 @@ +import ReactECharts from "echarts-for-react"; +import TitleBox from "../Component/TitleBox"; +import SwitchButton from "../Component/SwitchButton"; +import ScrollBoard from "./../../Component/ScrollBoard"; +import { useState } from "react"; +import getOptions from "../../Component/LineChartRight/chart.config"; +import {useAppSelector} from "./../../../store/hooks" +import {selectLine2After} from "./../../../store/LinePageSlice" +import moment from "moment"; +function RightDown() { + const data = useAppSelector(selectLine2After); + // console.log('页面数据:',data) + // 假数据 + let tempData = [ + { + type: "day", + data: { + time: [] as string[], + input: [] as number[], + output: [] as number[], + }, + }, + { + type: "week", + data: { + time: [] as string[], + input: [] as number[], + output: [] as number[], + }, + }, + { + type: "month", + data: { + time: [] as string[], + input: [] as number[], + output: [] as number[], + }, + }, + ]; + const nameList = [ + { name: "表单", ename: "table" }, + { name: "折线", ename: "chart" }, + ]; + const [activeName, setActiveName] = useState(nameList[0].ename); + const handleButtonChange = (activeName: string) => { + setActiveName(activeName); + }; + const configDay = { + header: ["时间", "投入数量", "产出数量"], + headerHeight: 30, + rowNum: 5, + headerBGC: "rgba(79, 114, 136, 0.3)", + oddRowBGC: "rgba(79, 114, 136, 0.3)", + evenRowBGC: "rgba(76, 97, 123, 0.1)", + columnWidth: [120, 130, 130], + data: [], + }; + const configWeek = { + header: ["时间", "投入数量", "产出数量"], + headerHeight: 30, + rowNum: 5, + headerBGC: "rgba(79, 114, 136, 0.3)", + oddRowBGC: "rgba(79, 114, 136, 0.3)", + evenRowBGC: "rgba(76, 97, 123, 0.1)", + columnWidth: [120, 130, 130], + data: [], + }; + const configMonth = { + header: ["时间", "投入数量", "产出数量"], + headerHeight: 30, + rowNum: 5, + headerBGC: "rgba(79, 114, 136, 0.3)", + oddRowBGC: "rgba(79, 114, 136, 0.3)", + evenRowBGC: "rgba(76, 97, 123, 0.1)", + columnWidth: [120, 130, 130], + data: [], + }; + let arr1: any = []; + let arr2: any = []; + let arr3: any = []; + // @ts-ignore + if (data.todayProductionDets && data.todayProductionDets.length > 0) { + // @ts-ignore + data.todayProductionDets.map((item,index)=>{ + let arrInner = []; + arrInner.push(moment(item.recTime).format("HH:mm"),item.inputNum,item.outputNum); + arr1.push(arrInner); + tempData[0].data.time.push(moment(item.recTime).format("HH:mm")); + tempData[0].data.input.push(item.inputNum); + tempData[0].data.output.push(item.outputNum); + }) + }else{ + tempData[0].data.time = [] + tempData[0].data.input = [] + tempData[0].data.output = [] + } + // @ts-ignore + if (data.weekProductionDets && data.weekProductionDets.length > 0) { + // @ts-ignore + data.weekProductionDets.map((item,index)=>{ + let arrInner = []; + arrInner.push(moment(item.recTime).format("YYYY/MM/DD"),item.inputNum,item.outputNum); + arr2.push(arrInner); + tempData[1].data.time.push(moment(item.recTime).format("HH:mm")); + tempData[1].data.input.push(item.inputNum); + tempData[1].data.output.push(item.outputNum); + }) + }else{ + tempData[1].data.time = [] + tempData[1].data.input = [] + tempData[1].data.output = [] + } + // @ts-ignore + if (data.monthProductionDets && data.monthProductionDets.length > 0) { + // @ts-ignore + data.monthProductionDets.map((item,index)=>{ + let arrInner = []; + arrInner.push(moment(item.recTime).format("YYYY/MM/DD"),item.inputNum,item.outputNum); + arr3.push(arrInner); + tempData[2].data.time.push(moment(item.recTime).format("HH:mm")); + tempData[2].data.input.push(item.inputNum); + tempData[2].data.output.push(item.outputNum); + }) + }else{ + tempData[2].data.time = [] + tempData[2].data.input = [] + tempData[2].data.output = [] + } + configDay.data = arr1; + configWeek.data = arr2; + configMonth.data = arr3; + + const chartData1 = tempData[0].data; + const chartData2 = tempData[1].data; + const chartData3 = tempData[2].data; + const options1 = getOptions(chartData1); + const options2 = getOptions(chartData2); + const options3 = getOptions(chartData3); + return ( +
+ +
+ +
+
+
+
+ 当天 +
+
+
+ {activeName === "table" ? ( + arr1.length>0?:( +

+ 暂无数据 +

+ ) + ) : tempData[0].data.time.length>0 ? ( + + ) : ( +

+ 暂无数据 +

+ )} +
+
+
+ 本周 +
+
+
+ {activeName === "table" ? ( + arr2.length>0?:( +

+ 暂无数据 +

+ ) + ) : tempData[1].data.time.length>0 ? ( + + ) : ( +

+ 暂无数据 +

+ )} +
+
+
+ 本月 +
+
+
+ {activeName === "table" ? ( + arr3.length>0?:( +

+ 暂无数据 +

+ ) + ) : tempData[2].data.time.length>0 ? ( + + ) : ( +

+ 暂无数据 +

+ )} +
+
+
+ ); +} +export default RightDown; diff --git a/src/page/LinePage2-2/Right/RightUp.tsx b/src/page/LinePage2-2/Right/RightUp.tsx new file mode 100644 index 0000000..8265b0c --- /dev/null +++ b/src/page/LinePage2-2/Right/RightUp.tsx @@ -0,0 +1,52 @@ +import TitleBox from "../Component/TitleBox"; +import ScrollBoard from "./../../Component/ScrollBoard"; +import {useAppSelector} from "./../../../store/hooks" +import {selectLine2After} from "./../../../store/LinePageSlice" +function RightUp() { + const data = useAppSelector(selectLine2After); + const config = { + header: ["序号", "产线", "上片数据量", "成品下片数量"], + headerHeight: 32, + rowNum: 5, + align: ["center", "left", "left", "left"], + headerBGC: "rgba(79, 114, 136, 0.3)", + oddRowBGC: "rgba(79, 114, 136, 0.3)", + evenRowBGC: "rgba(76, 97, 123, 0.1)", + columnWidth: [70, 90, 106, 114], + data: [], + }; + let arr:any = [] + // @ts-ignore + if (data.sumProductionDets && data.sumProductionDets.length > 0) { + // @ts-ignore + data.sumProductionDets.map((item, index) => { + let arrInner = [] + arrInner.push(index + 1, item.lineName, item.inputNum, item.outputNum) + arr.push(arrInner) + }) + } + config.data = arr + return ( +
+ +
+ {arr.length>0?:(

+ 暂无数据 +

)} +
+
+ ); +} +export default RightUp; diff --git a/src/page/LinePage2-2/Right/index.tsx b/src/page/LinePage2-2/Right/index.tsx new file mode 100644 index 0000000..53c802a --- /dev/null +++ b/src/page/LinePage2-2/Right/index.tsx @@ -0,0 +1,12 @@ +import RightDown from "./RightDown"; +import RightUp from "./RightUp"; + +function Right() { + return ( +
+ + +
+ ); +} +export default Right; diff --git a/src/page/LinePage2-2/TopP.tsx b/src/page/LinePage2-2/TopP.tsx new file mode 100644 index 0000000..e7c7a64 --- /dev/null +++ b/src/page/LinePage2-2/TopP.tsx @@ -0,0 +1,14 @@ +import '../../lanhuapp/common.css'; +import "./index.css"; + +function TopP() { + return ( +
+
+
+
+
+ ); +} + +export default TopP; \ No newline at end of file diff --git a/src/page/LinePage2-2/assets/icon/alarm.png b/src/page/LinePage2-2/assets/icon/alarm.png new file mode 100644 index 0000000..eb335f3 Binary files /dev/null and b/src/page/LinePage2-2/assets/icon/alarm.png differ diff --git a/src/page/LinePage2-2/assets/icon/defect.png b/src/page/LinePage2-2/assets/icon/defect.png new file mode 100644 index 0000000..76ed17c Binary files /dev/null and b/src/page/LinePage2-2/assets/icon/defect.png differ diff --git a/src/page/LinePage2-2/assets/icon/finished.png b/src/page/LinePage2-2/assets/icon/finished.png new file mode 100644 index 0000000..99b411b Binary files /dev/null and b/src/page/LinePage2-2/assets/icon/finished.png differ diff --git a/src/page/LinePage2-2/assets/icon/g.png b/src/page/LinePage2-2/assets/icon/g.png new file mode 100644 index 0000000..bf1b107 Binary files /dev/null and b/src/page/LinePage2-2/assets/icon/g.png differ diff --git a/src/page/LinePage2-2/assets/icon/inputAndOutput.png b/src/page/LinePage2-2/assets/icon/inputAndOutput.png new file mode 100644 index 0000000..113ed13 Binary files /dev/null and b/src/page/LinePage2-2/assets/icon/inputAndOutput.png differ diff --git a/src/page/LinePage2-2/assets/icon/num.png b/src/page/LinePage2-2/assets/icon/num.png new file mode 100644 index 0000000..e77c409 Binary files /dev/null and b/src/page/LinePage2-2/assets/icon/num.png differ diff --git a/src/page/LinePage2-2/assets/icon/r.png b/src/page/LinePage2-2/assets/icon/r.png new file mode 100644 index 0000000..d11591e Binary files /dev/null and b/src/page/LinePage2-2/assets/icon/r.png differ diff --git a/src/page/LinePage2-2/assets/icon/record.png b/src/page/LinePage2-2/assets/icon/record.png new file mode 100644 index 0000000..4622f01 Binary files /dev/null and b/src/page/LinePage2-2/assets/icon/record.png differ diff --git a/src/page/LinePage2-2/assets/icon/y.png b/src/page/LinePage2-2/assets/icon/y.png new file mode 100644 index 0000000..72c796a Binary files /dev/null and b/src/page/LinePage2-2/assets/icon/y.png differ diff --git a/src/page/LinePage2-2/index.css b/src/page/LinePage2-2/index.css new file mode 100644 index 0000000..1a28491 --- /dev/null +++ b/src/page/LinePage2-2/index.css @@ -0,0 +1,264 @@ +/* 顶部 */ +.block_top { + width: 1920px; + height: 94px; + background: url(/public/svg/topback.svg) 100% no-repeat; + background-size: 100% 100%; + opacity: 1; + display: flex; + justify-content: center; +} + +.block_top_title { + width: 651px; + height: 77px; + background: url(/public/png/topTiltle.png) 100% no-repeat; + background-size: 100% 100%; + margin-top: 18px; +} +/* 中部 */ +.block_bottom { + width: 1920px; + height: 966px; + padding-top: 20px; +} + +.group_left { + width: 402px; + height: 966px; + margin: 0 0 0 24px; +} + +.group_center { + width: 1041px; + height: 966px; + margin: 0 0 0 15px; +} + +.group_right { + width: 401px; + height: 966px; + margin-left: 15px; +} + +.left_up { + width: 402px; + height: 332px; + background: url(../../../public/png/rect/lp_left_up.png) no-repeat; + background-size: 100% 100%; + background-position: 0 0; + position: relative; +} +.left_down { + width: 402px; + height: 599px; + background: url(../../../public/png/rect/lp_left_down.png) no-repeat; + background-size: 100% 100%; + background-position: 0 0; + margin-top: 14px; + position: relative; +} +.center_up { + width: 1041px; + height: 562px; + background: url(../../../public/png/rect/lp_center_up.png) no-repeat; + background-size: 100% 100%; + background-position: 0 0; + position: relative; +} +.center_down { + width: 1041px; + height: 368px; + margin-top: 17px; +} +.center_down_inner { + width: 513px; + height: 366px; + background: url(../../../public/png/rect/lp_center_down.png) no-repeat; + background-size: 100% 100%; + background-position: 0 0; + position: relative; +} +.center_down .left-box { + margin-right: 15px; + position: relative; +} +.center_down .left-box .alarm_num_title { + position: absolute; + left: 220px; + top: 22px; + font-size: 13px; + letter-spacing: 3px; + color: #fff; +} +.center_down .left-box .alarm_num { + color: #52fff1; + font-size: 40px; + text-align: center; + font-family: PingFangSC, PingFang SC; +} +.center_down .right_box .chart_box { + width: 100%; + height: 310px; + margin-top: 10px; +} +.right_up { + width: 401px; + height: 257px; + background: url(../../../public/png/rect/lp_right_up.png) no-repeat; + background-size: 100% 100%; + background-position: 0 0; +} +.right_down { + width: 401px; + height: 673px; + background: url(../../../public/png/rect/lp_right_down.png) no-repeat; + background-size: 100% 100%; + background-position: 0 0; + margin-top: 14px; + position: relative; +} +.left_up_switch { + position: absolute; + right: 10px; + top: 12px; +} +.left_up_chart { + height: 275px; + margin-top: 10px; +} +/* 左侧 */ +.left_down_title { + height: 18px; + justify-content: center; + margin-bottom: 4px; +} +.left_down_box1 { + width: 56px; + height: 13px; + background: url(/public/png/leftbar.png) 100% no-repeat; + background-size: 100% 100%; + margin-top: 2px; +} +.left_down_box2 { + width: 56px; + height: 13px; + background: url(/public/png/rightbar.png) 100% no-repeat; + background-size: 100% 100%; + margin: 2px 0 0 0px; +} +.left_down_text { + /*width: 40px;*/ + height: 18px; + overflow-wrap: break-word; + color: rgba(1, 207, 204, 1); + font-size: 18px; + letter-spacing: 5px; + font-family: PingFangSC-Regular; + white-space: nowrap; + line-height: 18px; + margin-left: 18px; + margin-right: 16px; + text-align: center; +} +.left_down_content { + height: 160px; + /* padding-bottom: 5px; */ +} +.right_down_content { + height: 185px; + /* padding-bottom: 5px; */ +} +/* 滚动表格部分 */ +.dv-scroll-board .header .header-item, +.dv-scroll-board .rows .ceil { + border-right: 1px solid #0d1728; +} +.dv-scroll-board .header .header-item:last-child, +.dv-scroll-board .rows .ceil:last-child { + border-right: none; + border: none; +} +/* chart图部分 */ +.luoyang-chart-tooltip { + background: #0a2b4f77 !important; + border: none !important; + backdrop-filter: blur(12px); +} + +.luoyang-chart-tooltip * { + color: #fff !important; +} +/* 三维页面部分 */ +.center_up .model_name { + position: absolute; + left: 0px; + top: 0px; + z-index: 1000; +} +.center_up .model_info { + position: absolute; + left: 100px; + bottom: 0px; + z-index: 1000; + width: 841px; + height: 62px; + background: url(/public/png/lp/line_part.png) 100% no-repeat; + background-size: 100% 100%; +} +.center_up .model_info .reset_btn { + position: absolute; + top: 20px; + left: 40px; + width: 140px; + height: 40px; + cursor: pointer; +} +.center_up .model_info .title { + display: inline-block; + width: 361px; + text-align: center; + font-size: 32px; + color: #fff; + letter-spacing: 5px; + position: absolute; + left: 241px; + bottom: 10px; +} +.center_up .eq_detail_info { + position: absolute; + right: 0px; + bottom: 0px; + z-index: 1002; + width: 240px; + height: 110px; + background: url(/public/png/lp/eq_msg_detail.png) 100% no-repeat; + background-size: 100% 100%; + color: #fff; + padding: 15px 0 0 15px; +} +.center_up .eq_detail_info .left_name { + display: inline-block; + width: 95px; + height: 28px; + text-align: right; + font-size: 18px; +} +.center_up .eq_detail_info .right_value { + display: inline-block; + height: 28px; + font-size: 18px; +} +.center_up .eq_info { + position: absolute; + z-index: 1002; + background: url(/public/png/lp/eq_msg_always.png) 100% no-repeat; + background-size: 100% 100%; + color: #fff; + padding: 10px 15px; +} +.center_up .eq_info .eq_info_inner { + height: 24px; + font-size: 17px; + white-space: nowrap; +} diff --git a/src/page/LinePage2-2/index.tsx b/src/page/LinePage2-2/index.tsx new file mode 100644 index 0000000..daf9389 --- /dev/null +++ b/src/page/LinePage2-2/index.tsx @@ -0,0 +1,18 @@ +import React from "react"; +import TopP from "./TopP"; +import Left from "./Left"; +import Right from "./Right"; +import Center from "./Center"; +function LinePage() { + return ( + + +
+ +
+ +
+
+ ); +} +export default LinePage; diff --git a/src/page/LinePage3-1/Center/CenterDown.tsx b/src/page/LinePage3-1/Center/CenterDown.tsx new file mode 100644 index 0000000..d9d03f7 --- /dev/null +++ b/src/page/LinePage3-1/Center/CenterDown.tsx @@ -0,0 +1,214 @@ +import ReactECharts from "echarts-for-react"; +import TitleBox from "../Component/TitleBox"; +import ScrollBoard from "./../../Component/ScrollBoard"; +import SwitchButton from "../Component/SwitchButton"; +import { useState } from "react"; +import getOptions from "../../Component/LineChart/chart.config"; +import {useAppSelector} from "./../../../store/hooks" +import {selectLine3Before} from "./../../../store/LinePageSlice" +import moment from "moment"; +function CenterDown() { + const data = useAppSelector(selectLine3Before); + // 假数据 + const dataSource = { + day: { + xData:[], + series: [] as { name: string; type: string; symbol: string; symbolSize: number; data: never[]; }[], + }, + week: { + xData:[], + series: [] as { name: string; type: string; symbol: string; symbolSize: number; data: never[]; }[], + }, + month: { + xData:[], + series: [] as { name: string; type: string; symbol: string; symbolSize: number; data: never[]; }[], + }, + }; + const nameList = [ + { name: "天", ename: "day" }, + { name: "周", ename: "week" }, + { name: "月", ename: "month" }, + ]; + const [activeName, setActiveName] = useState(nameList[0].ename); + const handleButtonChange = (activeName: string) => { + setActiveName(activeName); + }; + const config = { + header: ["序号", "报警时间", "报警设备", "报警内容"], + headerHeight: 36, + rowNum: 6, + align: ["center", "left", "left", "left"], + headerBGC: "rgba(79, 114, 136, 0.3)", + oddRowBGC: "rgba(79, 114, 136, 0.3)", + evenRowBGC: "rgba(76, 97, 123, 0.1)", + columnWidth: [80, 137, 137, 137], + data: [] + }; + // 报警数据 + let arr:any = [] + let sumAlarm = 0 + // @ts-ignore + if (data.alarms && data.alarms.length > 0) { + // @ts-ignore + sumAlarm = data.alarms.length + // @ts-ignore + data.alarms.map((item,index) => { + let arrInner = [] + arrInner.push( + index+1, + moment(item.recTime).format("YYYY/MM/DD HH:mm"), + item.name, + item.status === '故障'?"故障":"离线", + ); + arr.push(arrInner) + }); + } + config.data = arr + // 产线成品率 + // @ts-ignore + if (data.todayProductionRates && Object.keys(data.todayProductionRates).length > 0) { + // @ts-ignore + let keys = Object.keys(data.todayProductionRates) + // @ts-ignore + data.todayProductionRates[keys[0]].map((item,index)=>{ + // @ts-ignore + dataSource.day.xData.push(moment(item.recTime).format("HH:mm")) + }) + keys.map((item,index)=>{ + let obj = { + name: "", + type: "line", + symbol: "circle", + symbolSize: 4, + data:[] + } + // @ts-ignore + obj.name = data.todayProductionRates[item][0].lineName + // @ts-ignore + data.todayProductionRates[item].map((subItem,index)=>{ + // @ts-ignore + obj.data.push(subItem.passRate) + }) + dataSource.day.series.push(obj) + }) + }else{ + dataSource.day.xData = [] + dataSource.day.series = [] + } + // @ts-ignore + if (data.weekProductionRates && Object.keys(data.weekProductionRates).length > 0) { + // @ts-ignore + let keys = Object.keys(data.weekProductionRates) + // @ts-ignore + data.weekProductionRates[keys[0]].map((item,index)=>{ + // @ts-ignore + dataSource.week.xData.push(moment(item.recTime).format("HH:mm")) + }) + keys.map((item,index)=>{ + let obj = { + name: "", + type: "line", + symbol: "circle", + symbolSize: 4, + data:[] + } + // @ts-ignore + obj.name = data.weekProductionRates[item][0].lineName + // @ts-ignore + data.weekProductionRates[item].map((subItem,index)=>{ + // @ts-ignore + obj.data.push(subItem.passRate) + }) + dataSource.week.series.push(obj) + }) + }else{ + dataSource.week.xData = [] + dataSource.week.series = [] + } + // @ts-ignore + if (data.monthProductionRates && Object.keys(data.monthProductionRates).length > 0) { + // @ts-ignore + let keys = Object.keys(data.monthProductionRates) + // @ts-ignore + data.monthProductionRates[keys[0]].map((item,index)=>{ + // @ts-ignore + dataSource.month.xData.push(moment(item.recTime).format("HH:mm")) + }) + keys.map((item,index)=>{ + let obj = { + name: "", + type: "line", + symbol: "circle", + symbolSize: 4, + data:[] + } + // @ts-ignore + obj.name = data.monthProductionRates[item][0].lineName + // @ts-ignore + data.monthProductionRates[item].map((subItem,index)=>{ + // @ts-ignore + obj.data.push(subItem.passRate) + }) + dataSource.month.series.push(obj) + }) + }else{ + dataSource.month.xData = [] + dataSource.month.series = [] + } + let chartData = (dataSource as { [key: string]: any })[activeName]; + console.log('???????????',chartData) + const options = getOptions(chartData); + return ( +
+
+ + — 报警总数 — +
{sumAlarm}
+
+ {arr.length>0?:(

+ 暂无数据 +

)} +
+
+ {/* 产线成品率 */} +
+ +
+ +
+ {chartData.xData.length>0 && ( +
+ {} +
+ )} + {chartData.xData.length==0 && ( +

+ 暂无数据 +

+ )} +
+
+ ); +} +export default CenterDown; diff --git a/src/page/LinePage3-1/Center/CenterUp.tsx b/src/page/LinePage3-1/Center/CenterUp.tsx new file mode 100644 index 0000000..933f33d --- /dev/null +++ b/src/page/LinePage3-1/Center/CenterUp.tsx @@ -0,0 +1,10 @@ +import LinePageBabylon from "../../../babylonjs/LinePageBabylon"; +function CenterUp() { + const lineID = "3-1" + return ( +
+ +
+ ); +} +export default CenterUp; diff --git a/src/page/LinePage3-1/Center/index.tsx b/src/page/LinePage3-1/Center/index.tsx new file mode 100644 index 0000000..14d5036 --- /dev/null +++ b/src/page/LinePage3-1/Center/index.tsx @@ -0,0 +1,12 @@ +import CenterDown from "./CenterDown"; +import CenterUp from "./CenterUp"; + +function Center() { + return ( +
+ + +
+ ); +} +export default Center; diff --git a/src/page/LinePage3-1/Component/SwitchButton/index.css b/src/page/LinePage3-1/Component/SwitchButton/index.css new file mode 100644 index 0000000..604d81a --- /dev/null +++ b/src/page/LinePage3-1/Component/SwitchButton/index.css @@ -0,0 +1,19 @@ +.switch-button { + height: 33px; +} +.switch-button button { + color: #fff; + font-size: 18px; + padding: 4px 10px; + background-color: rgba(49, 135, 140, 0.3); + cursor: pointer; +} +.switch-button button:first-child { + border-radius: 5px 0 0 5px; +} +.switch-button button:last-child { + border-radius: 0 5px 5px 0; +} +.switch-button button.active { + background-color: rgba(86, 244, 231, 0.7); +} diff --git a/src/page/LinePage3-1/Component/SwitchButton/index.tsx b/src/page/LinePage3-1/Component/SwitchButton/index.tsx new file mode 100644 index 0000000..9209c06 --- /dev/null +++ b/src/page/LinePage3-1/Component/SwitchButton/index.tsx @@ -0,0 +1,65 @@ +import { useEffect, useState } from "react"; +import "./index.css"; +interface Name { + name: string; + ename: string; +} +interface nameListProps { + nameList: Name[]; + onChange: (value: string) => void; +} +function createActiveNameUpdater(nameList: any, activeName: string) { + let activeIndex = nameList.findIndex((obj: any) => obj.name === activeName); + + return function updateActiveName() { + activeIndex = (activeIndex + 1) % nameList.length; + return nameList[activeIndex].ename; + }; +} +function SwitchButton(props: nameListProps) { + const [activeName, setActiveName] = useState(props.nameList[0].ename); + const [timerId, setTimerId] = useState(null); + let updateActiveName = createActiveNameUpdater(props.nameList, activeName); + useEffect(() => { + const timer = setInterval(() => { + let active = updateActiveName(); + setActiveName(active); + props.onChange(active); + }, 60000); + setTimerId(timer); + return () => { + if (timerId !== null) { + clearInterval(timerId); + } + }; + }, [props.nameList.length]); + const btnClick = (ename: string) => { + if (timerId !== null) { + clearInterval(timerId); + } + setActiveName(ename); + props.onChange(ename); // 通知父组件 + const newTimer = setInterval(() => { + let active = updateActiveName(); + setActiveName(active); + props.onChange(active); + }, 60000); + setTimerId(newTimer); + }; + return ( +
+ {props.nameList.map((item, index) => { + return ( + + ); + })} +
+ ); +} +export default SwitchButton; diff --git a/src/page/LinePage3-1/Component/TitleBox/index.css b/src/page/LinePage3-1/Component/TitleBox/index.css new file mode 100644 index 0000000..3ae06db --- /dev/null +++ b/src/page/LinePage3-1/Component/TitleBox/index.css @@ -0,0 +1,13 @@ +.title_box { + font-size: 24px; + color: #52fff1; + padding: 10px 0 0 15px; +} +.title_box img { + width: 33px; + height: 33px; + vertical-align: bottom; + margin-right: 3px; + position: relative; + top: 3px; +} diff --git a/src/page/LinePage3-1/Component/TitleBox/index.tsx b/src/page/LinePage3-1/Component/TitleBox/index.tsx new file mode 100644 index 0000000..dd43a66 --- /dev/null +++ b/src/page/LinePage3-1/Component/TitleBox/index.tsx @@ -0,0 +1,53 @@ +import Defect from "./../../assets/icon/defect.png"; +import Alarm from "./../../assets/icon/alarm.png"; +import Finished from "./../../assets/icon/finished.png"; +import InputAndOutput from "./../../assets/icon/inputAndOutput.png"; +import Num from "./../../assets/icon/num.png"; +import Record from "./../../assets/icon/record.png"; +import "./index.css"; +interface titleProps { + title: string; +} +function TitleBox(props: titleProps) { + const filteredTitles = () => { + switch (props.title) { + case "left_up": + return { + img: Defect, + title: "产线报废汇总", + }; + case "left_down": + return { + img: Record, + title: "当前产线报废情况", + }; + case "center_down_left": + return { + img: Alarm, + title: "异常报警", + }; + case "center_down_right": + return { + img: Finished, + title: "产线成品率", + }; + case "right_up": + return { + img: Num, + title: "各产线总投入和产出", + }; + default: + return { + img: InputAndOutput, + title: "当前产线投入和产出", + }; + } + }; + return ( +
+ title + {filteredTitles().title} +
+ ); +} +export default TitleBox; diff --git a/src/page/LinePage3-1/Left/LeftDown.tsx b/src/page/LinePage3-1/Left/LeftDown.tsx new file mode 100644 index 0000000..bae9c71 --- /dev/null +++ b/src/page/LinePage3-1/Left/LeftDown.tsx @@ -0,0 +1,245 @@ +import ReactECharts from "echarts-for-react"; +import TitleBox from "../Component/TitleBox"; +import SwitchButton from "../Component/SwitchButton"; +import ScrollBoard from "./../../Component/ScrollBoard"; +import { useState } from "react"; +import getOptions from "../../Component/BarChart/chart.config"; +import {useAppSelector} from "./../../../store/hooks" +import {selectLine3Before} from "./../../../store/LinePageSlice" +function LeftDown() { + const data = useAppSelector(selectLine3Before); + // console.log('页面数据:',data) + const nameList = [ + { name: "表单", ename: "table" }, + { name: "柱状", ename: "chart" }, + ]; + const [activeName, setActiveName] = useState(nameList[0].ename); + const handleButtonChange = (activeName: string) => { + setActiveName(activeName); + }; + const configDay = { + header: ["序号", "工序类型", "报废数量"], + headerHeight: 30, + rowNum: 4, + align: ["center", "left", "left"], + headerBGC: "rgba(79, 114, 136, 0.3)", + oddRowBGC: "rgba(79, 114, 136, 0.3)", + evenRowBGC: "rgba(76, 97, 123, 0.1)", + columnWidth: [73, 117, 190], + data: [ + ["1", "磨边后", 224], + ["2", "包装1", 322], + ["3", "包装2", 66], + ], + }; + const configWeek = { + header: ["序号", "工序类型", "报废数量"], + headerHeight: 30, + rowNum: 4, + align: ["center", "left", "left"], + headerBGC: "rgba(79, 114, 136, 0.3)", + oddRowBGC: "rgba(79, 114, 136, 0.3)", + evenRowBGC: "rgba(76, 97, 123, 0.1)", + columnWidth: [73, 117, 190], + data: [ + ["1", "磨边后", 1119], + ["2", "包装1", 1798], + ["3", "包装2", 435], + ], + }; + const configMonth = { + header: ["序号", "工序类型", "报废数量"], + headerHeight: 30, + rowNum: 4, + align: ["center", "left", "left"], + headerBGC: "rgba(79, 114, 136, 0.3)", + oddRowBGC: "rgba(79, 114, 136, 0.3)", + evenRowBGC: "rgba(76, 97, 123, 0.1)", + columnWidth: [73, 117, 190], + data: [ + ["1", "磨边后", 5004], + ["2", "包装1", 9122], + ["3", "包装2", 1924], + ], + }; + const color1 = ["#9DD5FF", "#1295FF"]; + const color2 = ["#85F6E9", "#2EC6B4"]; + // @ts-ignore + let xData: string[] = data.scrapBars + let dataProps1: number[] = []; + let dataProps2: number[] = []; + let dataProps3: number[] = []; + let arr1: any = []; + let arr2: any = []; + let arr3: any = []; + // @ts-ignore + if (data.todayProductionScraps && data.todayProductionScraps.length > 0) { + // @ts-ignore + data.todayProductionScraps.map((item,index)=>{ + let arrInner = []; + arrInner.push(index+1,item.sectionName,item.scrapNum); + arr1.push(arrInner); + dataProps1.push(item.scrapNum); + }) + }else{ + dataProps1 = [] + } + // @ts-ignore + if (data.weekProductionScraps && data.weekProductionScraps.length > 0) { + // @ts-ignore + data.weekProductionScraps.map((item,index)=>{ + let arrInner = []; + arrInner.push(index+1,item.sectionName,item.scrapNum); + arr2.push(arrInner); + dataProps2.push(item.scrapNum); + }) + }else{ + dataProps2 = [] + } + // @ts-ignore + if (data.monthProductionScraps && data.monthProductionScraps.length > 0) { + // @ts-ignore + data.monthProductionScraps.map((item,index)=>{ + let arrInner = []; + arrInner.push(index+1,item.sectionName,item.scrapNum); + arr3.push(arrInner); + dataProps3.push(item.scrapNum); + }) + }else{ + dataProps3 = [] + } + configDay.data = arr1; + configWeek.data = arr2; + configMonth.data = arr3; + const options1 = getOptions(dataProps1,xData, color1); + const options2 = getOptions(dataProps2,xData, color2); + const options3 = getOptions(dataProps3,xData, color1); + return ( +
+ +
+ +
+
+
+
+ 当天 +
+
+
+ {activeName === "table" ? ( + arr1.length > 0 ? :(

+ 暂无数据 +

) + ) : dataProps1.length>0 ? ( + + ) : ( +

+ 暂无数据 +

+ )} +
+
+
+ 本周 +
+
+
+ {activeName === "table" ? ( + arr2.length > 0 ? :(

+ 暂无数据 +

) + ) : dataProps2.length>0 ? ( + + ) : ( +

+ 暂无数据 +

+ )} +
+
+
+ 本月 +
+
+
+ {activeName === "table" ? ( + arr3.length > 0 ? :(

+ 暂无数据 +

) + ) : dataProps3.length>0 ? ( + + ) : ( +

+ 暂无数据 +

+ )} +
+
+
+ ); +} +export default LeftDown; diff --git a/src/page/LinePage3-1/Left/LeftUp.tsx b/src/page/LinePage3-1/Left/LeftUp.tsx new file mode 100644 index 0000000..c7841fb --- /dev/null +++ b/src/page/LinePage3-1/Left/LeftUp.tsx @@ -0,0 +1,229 @@ +import ReactECharts from "echarts-for-react"; +import TitleBox from "../Component/TitleBox"; +import SwitchButton from "../Component/SwitchButton"; +import getOptions from "../../Component/SummaryBarChart/chart.config"; +import { useState } from "react"; +import {useAppSelector} from "./../../../store/hooks" +import {selectLine3Before} from "./../../../store/LinePageSlice" +function LeftUp() { + const data = useAppSelector(selectLine3Before); + console.log('页面数据1-1:',data) + // 假数据 + const dataSource = { + day: { + xData: [], + series: [] as { data: number[]; type: string; stack: string; name: any; barWidth?: number; label: { show: boolean; position: string; color: string;formatter?:any }; }[], + }, + week: { + xData: [], + series: [] as { data: number[]; type: string; stack: string; name: any; barWidth?: number; label: { show: boolean; position: string; color: string;formatter?:any }; }[], + }, + month: { + xData: [], + series: [] as { data: number[]; type: string; stack: string; name: any; barWidth?: number; label: { show: boolean; position: string; color: string;formatter?:any }; }[], + }, + }; + const nameList = [ + { name: "天", ename: "day" }, + { name: "周", ename: "week" }, + { name: "月", ename: "month" }, + ]; + const [activeName, setActiveName] = useState(nameList[0].ename); + let chartData = (dataSource as { [key: string]: any })[activeName]; + const handleButtonChange = (activeName: string) => { + setActiveName(activeName); + }; + // @ts-ignore + if (data.todayAllProductionScraps && Object.keys(data.todayAllProductionScraps).length > 0) { + let sum: number[] = []; + // 生成obj + // @ts-ignore + data.scrapBars.map((item,index) => { + let obj = { + data: [], + type: "bar", + stack: "a", + name: item, + barWidth: 14, + label: { + show: true, + position: "right", + color: "inherit", + }, + } + dataSource.day.series.push(obj) + }) + // @ts-ignore + dataSource.day.xData = Object.keys(data.todayAllProductionScraps) + dataSource.day.xData.map((item,index)=>{ + let sumIner = 0 + // @ts-ignore + data.todayAllProductionScraps[item].map((itemInner,indexInner)=>{ + sumIner += itemInner.scrapNum + dataSource.day.series.map((itemSeries,indexSeries)=>{ + // @ts-ignore + if (itemSeries.name === itemInner.sectionName) { + // @ts-ignore + itemSeries.data.push(itemInner.scrapNum) + } + }) + }) + sum.push(sumIner) + }) + dataSource.day.series.push({ + data: sum, + type: "bar", + stack: "a", + name: "", + label: { + show: true, + position: "top", + color: "#fff", + formatter: function (params: any) { + return sum[params.dataIndex]; + }, + }, + }) + }else{ + dataSource.day.xData = [] + dataSource.day.series = [] + } + // @ts-ignore + if (data.weekAllProductionScraps && Object.keys(data.weekAllProductionScraps).length > 0) { + let sum: number[] = []; + // 生成obj + // @ts-ignore + data.scrapBars.map((item,index) => { + let obj = { + data: [], + type: "bar", + stack: "a", + name: item, + barWidth: 14, + label: { + show: true, + position: "right", + color: "inherit", + }, + } + dataSource.week.series.push(obj) + }) + // @ts-ignore + dataSource.week.xData = Object.keys(data.weekAllProductionScraps) + dataSource.week.xData.map((item,index)=>{ + let sumIner = 0 + // @ts-ignore + data.weekAllProductionScraps[item].map((itemInner,indexInner)=>{ + sumIner += itemInner.scrapNum + dataSource.week.series.map((itemSeries,indexSeries)=>{ + // @ts-ignore + if (itemSeries.name === itemInner.sectionName) { + // @ts-ignore + itemSeries.data.push(itemInner.scrapNum) + } + }) + }) + sum.push(sumIner) + }) + dataSource.week.series.push({ + data: sum, + type: "bar", + stack: "a", + name: "", + label: { + show: true, + position: "top", + color: "#fff", + formatter: function (params: any) { + return sum[params.dataIndex]; + }, + }, + }) + }else{ + dataSource.week.xData = [] + dataSource.week.series = [] + } + // @ts-ignore + if (data.monthAllProductionScraps && Object.keys(data.monthAllProductionScraps).length > 0) { + let sum: number[] = []; + // 生成obj + // @ts-ignore + data.scrapBars.map((item,index) => { + let obj = { + data: [], + type: "bar", + stack: "a", + name: item, + barWidth: 14, + label: { + show: true, + position: "right", + color: "inherit", + }, + } + dataSource.month.series.push(obj) + }) + // @ts-ignore + dataSource.month.xData = Object.keys(data.monthAllProductionScraps) + dataSource.month.xData.map((item,index)=>{ + let sumIner = 0 + // @ts-ignore + data.monthAllProductionScraps[item].map((itemInner,indexInner)=>{ + sumIner += itemInner.scrapNum + dataSource.month.series.map((itemSeries,indexSeries)=>{ + // @ts-ignore + if (itemSeries.name === itemInner.sectionName) { + // @ts-ignore + itemSeries.data.push(itemInner.scrapNum) + } + }) + }) + sum.push(sumIner) + }) + dataSource.month.series.push({ + data: sum, + type: "bar", + stack: "a", + name: "", + label: { + show: true, + position: "top", + color: "#fff", + formatter: function (params: any) { + return sum[params.dataIndex]; + }, + }, + }) + }else{ + dataSource.month.xData = [] + dataSource.month.series = [] + } + const options = getOptions(chartData); + return ( +
+ +
+ +
+ {// @ts-ignore + dataSource[activeName].xData.length>0 ? ( +
+ {} +
+ ):( +

+ 暂无数据 +

+ )} +
+ ); +} +export default LeftUp; diff --git a/src/page/LinePage3-1/Left/index.tsx b/src/page/LinePage3-1/Left/index.tsx new file mode 100644 index 0000000..6524b82 --- /dev/null +++ b/src/page/LinePage3-1/Left/index.tsx @@ -0,0 +1,11 @@ +import LeftUp from "./LeftUp"; +import LeftDown from "./LeftDown"; +function Left() { + return ( +
+ + +
+ ); +} +export default Left; diff --git a/src/page/LinePage3-1/Right/RightDown.tsx b/src/page/LinePage3-1/Right/RightDown.tsx new file mode 100644 index 0000000..61de04b --- /dev/null +++ b/src/page/LinePage3-1/Right/RightDown.tsx @@ -0,0 +1,272 @@ +import ReactECharts from "echarts-for-react"; +import TitleBox from "../Component/TitleBox"; +import SwitchButton from "../Component/SwitchButton"; +import ScrollBoard from "./../../Component/ScrollBoard"; +import { useState } from "react"; +import getOptions from "../../Component/LineChartRight/chart.config"; +import {useAppSelector} from "./../../../store/hooks" +import {selectLine3Before} from "./../../../store/LinePageSlice" +import moment from "moment"; +function RightDown() { + const data = useAppSelector(selectLine3Before); + // 假数据 + let tempData = [ + { + type: "day", + data: { + time: [] as string[], + input: [] as number[], + output: [] as number[], + }, + }, + { + type: "week", + data: { + time: [] as string[], + input: [] as number[], + output: [] as number[], + }, + }, + { + type: "month", + data: { + time: [] as string[], + input: [] as number[], + output: [] as number[], + }, + }, + ]; + const nameList = [ + { name: "表单", ename: "table" }, + { name: "折线", ename: "chart" }, + ]; + const [activeName, setActiveName] = useState(nameList[0].ename); + const handleButtonChange = (activeName: string) => { + setActiveName(activeName); + }; + const configDay = { + header: ["时间", "投入数量", "产出数量"], + headerHeight: 30, + rowNum: 5, + headerBGC: "rgba(79, 114, 136, 0.3)", + oddRowBGC: "rgba(79, 114, 136, 0.3)", + evenRowBGC: "rgba(76, 97, 123, 0.1)", + columnWidth: [120, 130, 130], + data: [], + }; + const configWeek = { + header: ["时间", "投入数量", "产出数量"], + headerHeight: 30, + rowNum: 5, + headerBGC: "rgba(79, 114, 136, 0.3)", + oddRowBGC: "rgba(79, 114, 136, 0.3)", + evenRowBGC: "rgba(76, 97, 123, 0.1)", + columnWidth: [120, 130, 130], + data: [], + }; + const configMonth = { + header: ["时间", "投入数量", "产出数量"], + headerHeight: 30, + rowNum: 5, + headerBGC: "rgba(79, 114, 136, 0.3)", + oddRowBGC: "rgba(79, 114, 136, 0.3)", + evenRowBGC: "rgba(76, 97, 123, 0.1)", + columnWidth: [120, 130, 130], + data: [], + }; + let arr1: any = []; + let arr2: any = []; + let arr3: any = []; + // @ts-ignore + if (data.todayProductionDets && data.todayProductionDets.length > 0) { + // @ts-ignore + data.todayProductionDets.map((item,index)=>{ + let arrInner = []; + arrInner.push(moment(item.recTime).format("HH:mm"),item.inputNum,item.outputNum); + arr1.push(arrInner); + tempData[0].data.time.push(moment(item.recTime).format("HH:mm")); + tempData[0].data.input.push(item.inputNum); + tempData[0].data.output.push(item.outputNum); + }) + }else{ + tempData[0].data.time = [] + tempData[0].data.input = [] + tempData[0].data.output = [] + } + // @ts-ignore + if (data.weekProductionDets && data.weekProductionDets.length > 0) { + // @ts-ignore + data.weekProductionDets.map((item,index)=>{ + let arrInner = []; + arrInner.push(moment(item.recTime).format("YYYY/MM/DD"),item.inputNum,item.outputNum); + arr2.push(arrInner); + tempData[1].data.time.push(moment(item.recTime).format("HH:mm")); + tempData[1].data.input.push(item.inputNum); + tempData[1].data.output.push(item.outputNum); + }) + }else{ + tempData[1].data.time = [] + tempData[1].data.input = [] + tempData[1].data.output = [] + } + // @ts-ignore + if (data.monthProductionDets && data.monthProductionDets.length > 0) { + // @ts-ignore + data.monthProductionDets.map((item,index)=>{ + let arrInner = []; + arrInner.push(moment(item.recTime).format("YYYY/MM/DD"),item.inputNum,item.outputNum); + arr3.push(arrInner); + tempData[2].data.time.push(moment(item.recTime).format("HH:mm")); + tempData[2].data.input.push(item.inputNum); + tempData[2].data.output.push(item.outputNum); + }) + }else{ + tempData[2].data.time = [] + tempData[2].data.input = [] + tempData[2].data.output = [] + } + configDay.data = arr1; + configWeek.data = arr2; + configMonth.data = arr3; + + const chartData1 = tempData[0].data; + const chartData2 = tempData[1].data; + const chartData3 = tempData[2].data; + const options1 = getOptions(chartData1); + const options2 = getOptions(chartData2); + const options3 = getOptions(chartData3); + return ( +
+ +
+ +
+
+
+
+ 当天 +
+
+
+ {activeName === "table" ? ( + arr1.length>0?:( +

+ 暂无数据 +

+ ) + ) : tempData[0].data.time.length>0 ? ( + + ) : ( +

+ 暂无数据 +

+ )} +
+
+
+ 本周 +
+
+
+ {activeName === "table" ? ( + arr2.length>0?:( +

+ 暂无数据 +

+ ) + ) : tempData[1].data.time.length>0 ? ( + + ) : ( +

+ 暂无数据 +

+ )} +
+
+
+ 本月 +
+
+
+ {activeName === "table" ? ( + arr3.length>0?:( +

+ 暂无数据 +

+ ) + ) : tempData[2].data.time.length>0 ? ( + + ) : ( +

+ 暂无数据 +

+ )} +
+
+
+ ); +} +export default RightDown; diff --git a/src/page/LinePage3-1/Right/RightUp.tsx b/src/page/LinePage3-1/Right/RightUp.tsx new file mode 100644 index 0000000..ee87241 --- /dev/null +++ b/src/page/LinePage3-1/Right/RightUp.tsx @@ -0,0 +1,52 @@ +import TitleBox from "../Component/TitleBox"; +import ScrollBoard from "./../../Component/ScrollBoard"; +import {useAppSelector} from "./../../../store/hooks" +import {selectLine3Before} from "./../../../store/LinePageSlice" +function RightUp() { + const data = useAppSelector(selectLine3Before); + const config = { + header: ["序号", "产线", "上片数据量", "成品下片数量"], + headerHeight: 32, + rowNum: 5, + align: ["center", "left", "left", "left"], + headerBGC: "rgba(79, 114, 136, 0.3)", + oddRowBGC: "rgba(79, 114, 136, 0.3)", + evenRowBGC: "rgba(76, 97, 123, 0.1)", + columnWidth: [70, 90, 106, 114], + data: [], + }; + let arr:any = [] + // @ts-ignore + if (data.sumProductionDets && data.sumProductionDets.length > 0) { + // @ts-ignore + data.sumProductionDets.map((item, index) => { + let arrInner = [] + arrInner.push(index + 1, item.lineName, item.inputNum, item.outputNum) + arr.push(arrInner) + }) + } + config.data = arr + return ( +
+ +
+ {arr.length>0?:(

+ 暂无数据 +

)} +
+
+ ); +} +export default RightUp; diff --git a/src/page/LinePage3-1/Right/index.tsx b/src/page/LinePage3-1/Right/index.tsx new file mode 100644 index 0000000..53c802a --- /dev/null +++ b/src/page/LinePage3-1/Right/index.tsx @@ -0,0 +1,12 @@ +import RightDown from "./RightDown"; +import RightUp from "./RightUp"; + +function Right() { + return ( +
+ + +
+ ); +} +export default Right; diff --git a/src/page/LinePage3-1/TopP.tsx b/src/page/LinePage3-1/TopP.tsx new file mode 100644 index 0000000..e7c7a64 --- /dev/null +++ b/src/page/LinePage3-1/TopP.tsx @@ -0,0 +1,14 @@ +import '../../lanhuapp/common.css'; +import "./index.css"; + +function TopP() { + return ( +
+
+
+
+
+ ); +} + +export default TopP; \ No newline at end of file diff --git a/src/page/LinePage3-1/assets/icon/alarm.png b/src/page/LinePage3-1/assets/icon/alarm.png new file mode 100644 index 0000000..eb335f3 Binary files /dev/null and b/src/page/LinePage3-1/assets/icon/alarm.png differ diff --git a/src/page/LinePage3-1/assets/icon/defect.png b/src/page/LinePage3-1/assets/icon/defect.png new file mode 100644 index 0000000..76ed17c Binary files /dev/null and b/src/page/LinePage3-1/assets/icon/defect.png differ diff --git a/src/page/LinePage3-1/assets/icon/finished.png b/src/page/LinePage3-1/assets/icon/finished.png new file mode 100644 index 0000000..99b411b Binary files /dev/null and b/src/page/LinePage3-1/assets/icon/finished.png differ diff --git a/src/page/LinePage3-1/assets/icon/g.png b/src/page/LinePage3-1/assets/icon/g.png new file mode 100644 index 0000000..bf1b107 Binary files /dev/null and b/src/page/LinePage3-1/assets/icon/g.png differ diff --git a/src/page/LinePage3-1/assets/icon/inputAndOutput.png b/src/page/LinePage3-1/assets/icon/inputAndOutput.png new file mode 100644 index 0000000..113ed13 Binary files /dev/null and b/src/page/LinePage3-1/assets/icon/inputAndOutput.png differ diff --git a/src/page/LinePage3-1/assets/icon/num.png b/src/page/LinePage3-1/assets/icon/num.png new file mode 100644 index 0000000..e77c409 Binary files /dev/null and b/src/page/LinePage3-1/assets/icon/num.png differ diff --git a/src/page/LinePage3-1/assets/icon/r.png b/src/page/LinePage3-1/assets/icon/r.png new file mode 100644 index 0000000..d11591e Binary files /dev/null and b/src/page/LinePage3-1/assets/icon/r.png differ diff --git a/src/page/LinePage3-1/assets/icon/record.png b/src/page/LinePage3-1/assets/icon/record.png new file mode 100644 index 0000000..4622f01 Binary files /dev/null and b/src/page/LinePage3-1/assets/icon/record.png differ diff --git a/src/page/LinePage3-1/assets/icon/y.png b/src/page/LinePage3-1/assets/icon/y.png new file mode 100644 index 0000000..72c796a Binary files /dev/null and b/src/page/LinePage3-1/assets/icon/y.png differ diff --git a/src/page/LinePage3-1/index.css b/src/page/LinePage3-1/index.css new file mode 100644 index 0000000..1a28491 --- /dev/null +++ b/src/page/LinePage3-1/index.css @@ -0,0 +1,264 @@ +/* 顶部 */ +.block_top { + width: 1920px; + height: 94px; + background: url(/public/svg/topback.svg) 100% no-repeat; + background-size: 100% 100%; + opacity: 1; + display: flex; + justify-content: center; +} + +.block_top_title { + width: 651px; + height: 77px; + background: url(/public/png/topTiltle.png) 100% no-repeat; + background-size: 100% 100%; + margin-top: 18px; +} +/* 中部 */ +.block_bottom { + width: 1920px; + height: 966px; + padding-top: 20px; +} + +.group_left { + width: 402px; + height: 966px; + margin: 0 0 0 24px; +} + +.group_center { + width: 1041px; + height: 966px; + margin: 0 0 0 15px; +} + +.group_right { + width: 401px; + height: 966px; + margin-left: 15px; +} + +.left_up { + width: 402px; + height: 332px; + background: url(../../../public/png/rect/lp_left_up.png) no-repeat; + background-size: 100% 100%; + background-position: 0 0; + position: relative; +} +.left_down { + width: 402px; + height: 599px; + background: url(../../../public/png/rect/lp_left_down.png) no-repeat; + background-size: 100% 100%; + background-position: 0 0; + margin-top: 14px; + position: relative; +} +.center_up { + width: 1041px; + height: 562px; + background: url(../../../public/png/rect/lp_center_up.png) no-repeat; + background-size: 100% 100%; + background-position: 0 0; + position: relative; +} +.center_down { + width: 1041px; + height: 368px; + margin-top: 17px; +} +.center_down_inner { + width: 513px; + height: 366px; + background: url(../../../public/png/rect/lp_center_down.png) no-repeat; + background-size: 100% 100%; + background-position: 0 0; + position: relative; +} +.center_down .left-box { + margin-right: 15px; + position: relative; +} +.center_down .left-box .alarm_num_title { + position: absolute; + left: 220px; + top: 22px; + font-size: 13px; + letter-spacing: 3px; + color: #fff; +} +.center_down .left-box .alarm_num { + color: #52fff1; + font-size: 40px; + text-align: center; + font-family: PingFangSC, PingFang SC; +} +.center_down .right_box .chart_box { + width: 100%; + height: 310px; + margin-top: 10px; +} +.right_up { + width: 401px; + height: 257px; + background: url(../../../public/png/rect/lp_right_up.png) no-repeat; + background-size: 100% 100%; + background-position: 0 0; +} +.right_down { + width: 401px; + height: 673px; + background: url(../../../public/png/rect/lp_right_down.png) no-repeat; + background-size: 100% 100%; + background-position: 0 0; + margin-top: 14px; + position: relative; +} +.left_up_switch { + position: absolute; + right: 10px; + top: 12px; +} +.left_up_chart { + height: 275px; + margin-top: 10px; +} +/* 左侧 */ +.left_down_title { + height: 18px; + justify-content: center; + margin-bottom: 4px; +} +.left_down_box1 { + width: 56px; + height: 13px; + background: url(/public/png/leftbar.png) 100% no-repeat; + background-size: 100% 100%; + margin-top: 2px; +} +.left_down_box2 { + width: 56px; + height: 13px; + background: url(/public/png/rightbar.png) 100% no-repeat; + background-size: 100% 100%; + margin: 2px 0 0 0px; +} +.left_down_text { + /*width: 40px;*/ + height: 18px; + overflow-wrap: break-word; + color: rgba(1, 207, 204, 1); + font-size: 18px; + letter-spacing: 5px; + font-family: PingFangSC-Regular; + white-space: nowrap; + line-height: 18px; + margin-left: 18px; + margin-right: 16px; + text-align: center; +} +.left_down_content { + height: 160px; + /* padding-bottom: 5px; */ +} +.right_down_content { + height: 185px; + /* padding-bottom: 5px; */ +} +/* 滚动表格部分 */ +.dv-scroll-board .header .header-item, +.dv-scroll-board .rows .ceil { + border-right: 1px solid #0d1728; +} +.dv-scroll-board .header .header-item:last-child, +.dv-scroll-board .rows .ceil:last-child { + border-right: none; + border: none; +} +/* chart图部分 */ +.luoyang-chart-tooltip { + background: #0a2b4f77 !important; + border: none !important; + backdrop-filter: blur(12px); +} + +.luoyang-chart-tooltip * { + color: #fff !important; +} +/* 三维页面部分 */ +.center_up .model_name { + position: absolute; + left: 0px; + top: 0px; + z-index: 1000; +} +.center_up .model_info { + position: absolute; + left: 100px; + bottom: 0px; + z-index: 1000; + width: 841px; + height: 62px; + background: url(/public/png/lp/line_part.png) 100% no-repeat; + background-size: 100% 100%; +} +.center_up .model_info .reset_btn { + position: absolute; + top: 20px; + left: 40px; + width: 140px; + height: 40px; + cursor: pointer; +} +.center_up .model_info .title { + display: inline-block; + width: 361px; + text-align: center; + font-size: 32px; + color: #fff; + letter-spacing: 5px; + position: absolute; + left: 241px; + bottom: 10px; +} +.center_up .eq_detail_info { + position: absolute; + right: 0px; + bottom: 0px; + z-index: 1002; + width: 240px; + height: 110px; + background: url(/public/png/lp/eq_msg_detail.png) 100% no-repeat; + background-size: 100% 100%; + color: #fff; + padding: 15px 0 0 15px; +} +.center_up .eq_detail_info .left_name { + display: inline-block; + width: 95px; + height: 28px; + text-align: right; + font-size: 18px; +} +.center_up .eq_detail_info .right_value { + display: inline-block; + height: 28px; + font-size: 18px; +} +.center_up .eq_info { + position: absolute; + z-index: 1002; + background: url(/public/png/lp/eq_msg_always.png) 100% no-repeat; + background-size: 100% 100%; + color: #fff; + padding: 10px 15px; +} +.center_up .eq_info .eq_info_inner { + height: 24px; + font-size: 17px; + white-space: nowrap; +} diff --git a/src/page/LinePage3-1/index.tsx b/src/page/LinePage3-1/index.tsx new file mode 100644 index 0000000..daf9389 --- /dev/null +++ b/src/page/LinePage3-1/index.tsx @@ -0,0 +1,18 @@ +import React from "react"; +import TopP from "./TopP"; +import Left from "./Left"; +import Right from "./Right"; +import Center from "./Center"; +function LinePage() { + return ( + + +
+ +
+ +
+
+ ); +} +export default LinePage; diff --git a/src/page/LinePage3-2/Center/CenterDown.tsx b/src/page/LinePage3-2/Center/CenterDown.tsx new file mode 100644 index 0000000..3d6276e --- /dev/null +++ b/src/page/LinePage3-2/Center/CenterDown.tsx @@ -0,0 +1,214 @@ +import ReactECharts from "echarts-for-react"; +import TitleBox from "../Component/TitleBox"; +import ScrollBoard from "./../../Component/ScrollBoard"; +import SwitchButton from "../Component/SwitchButton"; +import { useState } from "react"; +import getOptions from "../../Component/LineChart/chart.config"; +import {useAppSelector} from "./../../../store/hooks" +import {selectLine3After} from "./../../../store/LinePageSlice" +import moment from "moment"; +function CenterDown() { + const data = useAppSelector(selectLine3After); + // 假数据 + const dataSource = { + day: { + xData:[], + series: [] as { name: string; type: string; symbol: string; symbolSize: number; data: never[]; }[], + }, + week: { + xData:[], + series: [] as { name: string; type: string; symbol: string; symbolSize: number; data: never[]; }[], + }, + month: { + xData:[], + series: [] as { name: string; type: string; symbol: string; symbolSize: number; data: never[]; }[], + }, + }; + const nameList = [ + { name: "天", ename: "day" }, + { name: "周", ename: "week" }, + { name: "月", ename: "month" }, + ]; + const [activeName, setActiveName] = useState(nameList[0].ename); + const handleButtonChange = (activeName: string) => { + setActiveName(activeName); + }; + const config = { + header: ["序号", "报警时间", "报警设备", "报警内容"], + headerHeight: 36, + rowNum: 6, + align: ["center", "left", "left", "left"], + headerBGC: "rgba(79, 114, 136, 0.3)", + oddRowBGC: "rgba(79, 114, 136, 0.3)", + evenRowBGC: "rgba(76, 97, 123, 0.1)", + columnWidth: [80, 137, 137, 137], + data: [] + }; + // 报警数据 + let arr:any = [] + let sumAlarm = 0 + // @ts-ignore + if (data.alarms && data.alarms.length > 0) { + // @ts-ignore + sumAlarm = data.alarms.length + // @ts-ignore + data.alarms.map((item,index) => { + let arrInner = [] + arrInner.push( + index+1, + moment(item.recTime).format("YYYY/MM/DD HH:mm"), + item.name, + item.status === '故障'?"故障":"离线", + ); + arr.push(arrInner) + }); + } + config.data = arr + // 产线成品率 + // @ts-ignore + if (data.todayProductionRates && Object.keys(data.todayProductionRates).length > 0) { + // @ts-ignore + let keys = Object.keys(data.todayProductionRates) + // @ts-ignore + data.todayProductionRates[keys[0]].map((item,index)=>{ + // @ts-ignore + dataSource.day.xData.push(moment(item.recTime).format("HH:mm")) + }) + keys.map((item,index)=>{ + let obj = { + name: "", + type: "line", + symbol: "circle", + symbolSize: 4, + data:[] + } + // @ts-ignore + obj.name = data.todayProductionRates[item][0].lineName + // @ts-ignore + data.todayProductionRates[item].map((subItem,index)=>{ + // @ts-ignore + obj.data.push(subItem.passRate) + }) + dataSource.day.series.push(obj) + }) + }else{ + dataSource.day.xData = [] + dataSource.day.series = [] + } + // @ts-ignore + if (data.weekProductionRates && Object.keys(data.weekProductionRates).length > 0) { + // @ts-ignore + let keys = Object.keys(data.weekProductionRates) + // @ts-ignore + data.weekProductionRates[keys[0]].map((item,index)=>{ + // @ts-ignore + dataSource.week.xData.push(moment(item.recTime).format("HH:mm")) + }) + keys.map((item,index)=>{ + let obj = { + name: "", + type: "line", + symbol: "circle", + symbolSize: 4, + data:[] + } + // @ts-ignore + obj.name = data.weekProductionRates[item][0].lineName + // @ts-ignore + data.weekProductionRates[item].map((subItem,index)=>{ + // @ts-ignore + obj.data.push(subItem.passRate) + }) + dataSource.week.series.push(obj) + }) + }else{ + dataSource.week.xData = [] + dataSource.week.series = [] + } + // @ts-ignore + if (data.monthProductionRates && Object.keys(data.monthProductionRates).length > 0) { + // @ts-ignore + let keys = Object.keys(data.monthProductionRates) + // @ts-ignore + data.monthProductionRates[keys[0]].map((item,index)=>{ + // @ts-ignore + dataSource.month.xData.push(moment(item.recTime).format("HH:mm")) + }) + keys.map((item,index)=>{ + let obj = { + name: "", + type: "line", + symbol: "circle", + symbolSize: 4, + data:[] + } + // @ts-ignore + obj.name = data.monthProductionRates[item][0].lineName + // @ts-ignore + data.monthProductionRates[item].map((subItem,index)=>{ + // @ts-ignore + obj.data.push(subItem.passRate) + }) + dataSource.month.series.push(obj) + }) + }else{ + dataSource.month.xData = [] + dataSource.month.series = [] + } + let chartData = (dataSource as { [key: string]: any })[activeName]; + console.log('???????????',chartData) + const options = getOptions(chartData); + return ( +
+
+ + — 报警总数 — +
{sumAlarm}
+
+ {arr.length>0?:(

+ 暂无数据 +

)} +
+
+ {/* 产线成品率 */} +
+ +
+ +
+ {chartData.xData.length>0 && ( +
+ {} +
+ )} + {chartData.xData.length==0 && ( +

+ 暂无数据 +

+ )} +
+
+ ); +} +export default CenterDown; diff --git a/src/page/LinePage3-2/Center/CenterUp.tsx b/src/page/LinePage3-2/Center/CenterUp.tsx new file mode 100644 index 0000000..19a9b5e --- /dev/null +++ b/src/page/LinePage3-2/Center/CenterUp.tsx @@ -0,0 +1,10 @@ +import LinePageBabylon from "../../../babylonjs/LinePageBabylon"; +function CenterUp() { + const lineID = "3-2"; + return ( +
+ +
+ ); +} +export default CenterUp; diff --git a/src/page/LinePage3-2/Center/index.tsx b/src/page/LinePage3-2/Center/index.tsx new file mode 100644 index 0000000..14d5036 --- /dev/null +++ b/src/page/LinePage3-2/Center/index.tsx @@ -0,0 +1,12 @@ +import CenterDown from "./CenterDown"; +import CenterUp from "./CenterUp"; + +function Center() { + return ( +
+ + +
+ ); +} +export default Center; diff --git a/src/page/LinePage3-2/Component/SwitchButton/index.css b/src/page/LinePage3-2/Component/SwitchButton/index.css new file mode 100644 index 0000000..604d81a --- /dev/null +++ b/src/page/LinePage3-2/Component/SwitchButton/index.css @@ -0,0 +1,19 @@ +.switch-button { + height: 33px; +} +.switch-button button { + color: #fff; + font-size: 18px; + padding: 4px 10px; + background-color: rgba(49, 135, 140, 0.3); + cursor: pointer; +} +.switch-button button:first-child { + border-radius: 5px 0 0 5px; +} +.switch-button button:last-child { + border-radius: 0 5px 5px 0; +} +.switch-button button.active { + background-color: rgba(86, 244, 231, 0.7); +} diff --git a/src/page/LinePage3-2/Component/SwitchButton/index.tsx b/src/page/LinePage3-2/Component/SwitchButton/index.tsx new file mode 100644 index 0000000..9209c06 --- /dev/null +++ b/src/page/LinePage3-2/Component/SwitchButton/index.tsx @@ -0,0 +1,65 @@ +import { useEffect, useState } from "react"; +import "./index.css"; +interface Name { + name: string; + ename: string; +} +interface nameListProps { + nameList: Name[]; + onChange: (value: string) => void; +} +function createActiveNameUpdater(nameList: any, activeName: string) { + let activeIndex = nameList.findIndex((obj: any) => obj.name === activeName); + + return function updateActiveName() { + activeIndex = (activeIndex + 1) % nameList.length; + return nameList[activeIndex].ename; + }; +} +function SwitchButton(props: nameListProps) { + const [activeName, setActiveName] = useState(props.nameList[0].ename); + const [timerId, setTimerId] = useState(null); + let updateActiveName = createActiveNameUpdater(props.nameList, activeName); + useEffect(() => { + const timer = setInterval(() => { + let active = updateActiveName(); + setActiveName(active); + props.onChange(active); + }, 60000); + setTimerId(timer); + return () => { + if (timerId !== null) { + clearInterval(timerId); + } + }; + }, [props.nameList.length]); + const btnClick = (ename: string) => { + if (timerId !== null) { + clearInterval(timerId); + } + setActiveName(ename); + props.onChange(ename); // 通知父组件 + const newTimer = setInterval(() => { + let active = updateActiveName(); + setActiveName(active); + props.onChange(active); + }, 60000); + setTimerId(newTimer); + }; + return ( +
+ {props.nameList.map((item, index) => { + return ( + + ); + })} +
+ ); +} +export default SwitchButton; diff --git a/src/page/LinePage3-2/Component/TitleBox/index.css b/src/page/LinePage3-2/Component/TitleBox/index.css new file mode 100644 index 0000000..3ae06db --- /dev/null +++ b/src/page/LinePage3-2/Component/TitleBox/index.css @@ -0,0 +1,13 @@ +.title_box { + font-size: 24px; + color: #52fff1; + padding: 10px 0 0 15px; +} +.title_box img { + width: 33px; + height: 33px; + vertical-align: bottom; + margin-right: 3px; + position: relative; + top: 3px; +} diff --git a/src/page/LinePage3-2/Component/TitleBox/index.tsx b/src/page/LinePage3-2/Component/TitleBox/index.tsx new file mode 100644 index 0000000..dd43a66 --- /dev/null +++ b/src/page/LinePage3-2/Component/TitleBox/index.tsx @@ -0,0 +1,53 @@ +import Defect from "./../../assets/icon/defect.png"; +import Alarm from "./../../assets/icon/alarm.png"; +import Finished from "./../../assets/icon/finished.png"; +import InputAndOutput from "./../../assets/icon/inputAndOutput.png"; +import Num from "./../../assets/icon/num.png"; +import Record from "./../../assets/icon/record.png"; +import "./index.css"; +interface titleProps { + title: string; +} +function TitleBox(props: titleProps) { + const filteredTitles = () => { + switch (props.title) { + case "left_up": + return { + img: Defect, + title: "产线报废汇总", + }; + case "left_down": + return { + img: Record, + title: "当前产线报废情况", + }; + case "center_down_left": + return { + img: Alarm, + title: "异常报警", + }; + case "center_down_right": + return { + img: Finished, + title: "产线成品率", + }; + case "right_up": + return { + img: Num, + title: "各产线总投入和产出", + }; + default: + return { + img: InputAndOutput, + title: "当前产线投入和产出", + }; + } + }; + return ( +
+ title + {filteredTitles().title} +
+ ); +} +export default TitleBox; diff --git a/src/page/LinePage3-2/Left/LeftDown.tsx b/src/page/LinePage3-2/Left/LeftDown.tsx new file mode 100644 index 0000000..d5f6169 --- /dev/null +++ b/src/page/LinePage3-2/Left/LeftDown.tsx @@ -0,0 +1,245 @@ +import ReactECharts from "echarts-for-react"; +import TitleBox from "../Component/TitleBox"; +import SwitchButton from "../Component/SwitchButton"; +import ScrollBoard from "./../../Component/ScrollBoard"; +import { useState } from "react"; +import getOptions from "../../Component/BarChart/chart.config"; +import {useAppSelector} from "./../../../store/hooks" +import {selectLine3After} from "./../../../store/LinePageSlice" +function LeftDown() { + const data = useAppSelector(selectLine3After); + // console.log('页面数据:',data) + const nameList = [ + { name: "表单", ename: "table" }, + { name: "柱状", ename: "chart" }, + ]; + const [activeName, setActiveName] = useState(nameList[0].ename); + const handleButtonChange = (activeName: string) => { + setActiveName(activeName); + }; + const configDay = { + header: ["序号", "工序类型", "报废数量"], + headerHeight: 30, + rowNum: 4, + align: ["center", "left", "left"], + headerBGC: "rgba(79, 114, 136, 0.3)", + oddRowBGC: "rgba(79, 114, 136, 0.3)", + evenRowBGC: "rgba(76, 97, 123, 0.1)", + columnWidth: [73, 117, 190], + data: [ + ["1", "磨边后", 224], + ["2", "包装1", 322], + ["3", "包装2", 66], + ], + }; + const configWeek = { + header: ["序号", "工序类型", "报废数量"], + headerHeight: 30, + rowNum: 4, + align: ["center", "left", "left"], + headerBGC: "rgba(79, 114, 136, 0.3)", + oddRowBGC: "rgba(79, 114, 136, 0.3)", + evenRowBGC: "rgba(76, 97, 123, 0.1)", + columnWidth: [73, 117, 190], + data: [ + ["1", "磨边后", 1119], + ["2", "包装1", 1798], + ["3", "包装2", 435], + ], + }; + const configMonth = { + header: ["序号", "工序类型", "报废数量"], + headerHeight: 30, + rowNum: 4, + align: ["center", "left", "left"], + headerBGC: "rgba(79, 114, 136, 0.3)", + oddRowBGC: "rgba(79, 114, 136, 0.3)", + evenRowBGC: "rgba(76, 97, 123, 0.1)", + columnWidth: [73, 117, 190], + data: [ + ["1", "磨边后", 5004], + ["2", "包装1", 9122], + ["3", "包装2", 1924], + ], + }; + const color1 = ["#9DD5FF", "#1295FF"]; + const color2 = ["#85F6E9", "#2EC6B4"]; + // @ts-ignore + let xData: string[] = data.scrapBars + let dataProps1: number[] = []; + let dataProps2: number[] = []; + let dataProps3: number[] = []; + let arr1: any = []; + let arr2: any = []; + let arr3: any = []; + // @ts-ignore + if (data.todayProductionScraps && data.todayProductionScraps.length > 0) { + // @ts-ignore + data.todayProductionScraps.map((item,index)=>{ + let arrInner = []; + arrInner.push(index+1,item.sectionName,item.scrapNum); + arr1.push(arrInner); + dataProps1.push(item.scrapNum); + }) + }else{ + dataProps1 = [] + } + // @ts-ignore + if (data.weekProductionScraps && data.weekProductionScraps.length > 0) { + // @ts-ignore + data.weekProductionScraps.map((item,index)=>{ + let arrInner = []; + arrInner.push(index+1,item.sectionName,item.scrapNum); + arr2.push(arrInner); + dataProps2.push(item.scrapNum); + }) + }else{ + dataProps2 = [] + } + // @ts-ignore + if (data.monthProductionScraps && data.monthProductionScraps.length > 0) { + // @ts-ignore + data.monthProductionScraps.map((item,index)=>{ + let arrInner = []; + arrInner.push(index+1,item.sectionName,item.scrapNum); + arr3.push(arrInner); + dataProps3.push(item.scrapNum); + }) + }else{ + dataProps3 = [] + } + configDay.data = arr1; + configWeek.data = arr2; + configMonth.data = arr3; + const options1 = getOptions(dataProps1,xData, color1); + const options2 = getOptions(dataProps2,xData, color2); + const options3 = getOptions(dataProps3,xData, color1); + return ( +
+ +
+ +
+
+
+
+ 当天 +
+
+
+ {activeName === "table" ? ( + arr1.length > 0 ? :(

+ 暂无数据 +

) + ) : dataProps1.length>0 ? ( + + ) : ( +

+ 暂无数据 +

+ )} +
+
+
+ 本周 +
+
+
+ {activeName === "table" ? ( + arr2.length > 0 ? :(

+ 暂无数据 +

) + ) : dataProps2.length>0 ? ( + + ) : ( +

+ 暂无数据 +

+ )} +
+
+
+ 本月 +
+
+
+ {activeName === "table" ? ( + arr3.length > 0 ? :(

+ 暂无数据 +

) + ) : dataProps3.length>0 ? ( + + ) : ( +

+ 暂无数据 +

+ )} +
+
+
+ ); +} +export default LeftDown; diff --git a/src/page/LinePage3-2/Left/LeftUp.tsx b/src/page/LinePage3-2/Left/LeftUp.tsx new file mode 100644 index 0000000..9090a2d --- /dev/null +++ b/src/page/LinePage3-2/Left/LeftUp.tsx @@ -0,0 +1,229 @@ +import ReactECharts from "echarts-for-react"; +import TitleBox from "../Component/TitleBox"; +import SwitchButton from "../Component/SwitchButton"; +import getOptions from "../../Component/SummaryBarChart/chart.config"; +import { useState } from "react"; +import {useAppSelector} from "./../../../store/hooks" +import {selectLine3After} from "./../../../store/LinePageSlice" +function LeftUp() { + const data = useAppSelector(selectLine3After); + console.log('页面数据1-1:',data) + // 假数据 + const dataSource = { + day: { + xData: [], + series: [] as { data: number[]; type: string; stack: string; name: any; barWidth?: number; label: { show: boolean; position: string; color: string;formatter?:any }; }[], + }, + week: { + xData: [], + series: [] as { data: number[]; type: string; stack: string; name: any; barWidth?: number; label: { show: boolean; position: string; color: string;formatter?:any }; }[], + }, + month: { + xData: [], + series: [] as { data: number[]; type: string; stack: string; name: any; barWidth?: number; label: { show: boolean; position: string; color: string;formatter?:any }; }[], + }, + }; + const nameList = [ + { name: "天", ename: "day" }, + { name: "周", ename: "week" }, + { name: "月", ename: "month" }, + ]; + const [activeName, setActiveName] = useState(nameList[0].ename); + let chartData = (dataSource as { [key: string]: any })[activeName]; + const handleButtonChange = (activeName: string) => { + setActiveName(activeName); + }; + // @ts-ignore + if (data.todayAllProductionScraps && Object.keys(data.todayAllProductionScraps).length > 0) { + let sum: number[] = []; + // 生成obj + // @ts-ignore + data.scrapBars.map((item,index) => { + let obj = { + data: [], + type: "bar", + stack: "a", + name: item, + barWidth: 14, + label: { + show: true, + position: "right", + color: "inherit", + }, + } + dataSource.day.series.push(obj) + }) + // @ts-ignore + dataSource.day.xData = Object.keys(data.todayAllProductionScraps) + dataSource.day.xData.map((item,index)=>{ + let sumIner = 0 + // @ts-ignore + data.todayAllProductionScraps[item].map((itemInner,indexInner)=>{ + sumIner += itemInner.scrapNum + dataSource.day.series.map((itemSeries,indexSeries)=>{ + // @ts-ignore + if (itemSeries.name === itemInner.sectionName) { + // @ts-ignore + itemSeries.data.push(itemInner.scrapNum) + } + }) + }) + sum.push(sumIner) + }) + dataSource.day.series.push({ + data: sum, + type: "bar", + stack: "a", + name: "", + label: { + show: true, + position: "top", + color: "#fff", + formatter: function (params: any) { + return sum[params.dataIndex]; + }, + }, + }) + }else{ + dataSource.day.xData = [] + dataSource.day.series = [] + } + // @ts-ignore + if (data.weekAllProductionScraps && Object.keys(data.weekAllProductionScraps).length > 0) { + let sum: number[] = []; + // 生成obj + // @ts-ignore + data.scrapBars.map((item,index) => { + let obj = { + data: [], + type: "bar", + stack: "a", + name: item, + barWidth: 14, + label: { + show: true, + position: "right", + color: "inherit", + }, + } + dataSource.week.series.push(obj) + }) + // @ts-ignore + dataSource.week.xData = Object.keys(data.weekAllProductionScraps) + dataSource.week.xData.map((item,index)=>{ + let sumIner = 0 + // @ts-ignore + data.weekAllProductionScraps[item].map((itemInner,indexInner)=>{ + sumIner += itemInner.scrapNum + dataSource.week.series.map((itemSeries,indexSeries)=>{ + // @ts-ignore + if (itemSeries.name === itemInner.sectionName) { + // @ts-ignore + itemSeries.data.push(itemInner.scrapNum) + } + }) + }) + sum.push(sumIner) + }) + dataSource.week.series.push({ + data: sum, + type: "bar", + stack: "a", + name: "", + label: { + show: true, + position: "top", + color: "#fff", + formatter: function (params: any) { + return sum[params.dataIndex]; + }, + }, + }) + }else{ + dataSource.week.xData = [] + dataSource.week.series = [] + } + // @ts-ignore + if (data.monthAllProductionScraps && Object.keys(data.monthAllProductionScraps).length > 0) { + let sum: number[] = []; + // 生成obj + // @ts-ignore + data.scrapBars.map((item,index) => { + let obj = { + data: [], + type: "bar", + stack: "a", + name: item, + barWidth: 14, + label: { + show: true, + position: "right", + color: "inherit", + }, + } + dataSource.month.series.push(obj) + }) + // @ts-ignore + dataSource.month.xData = Object.keys(data.monthAllProductionScraps) + dataSource.month.xData.map((item,index)=>{ + let sumIner = 0 + // @ts-ignore + data.monthAllProductionScraps[item].map((itemInner,indexInner)=>{ + sumIner += itemInner.scrapNum + dataSource.month.series.map((itemSeries,indexSeries)=>{ + // @ts-ignore + if (itemSeries.name === itemInner.sectionName) { + // @ts-ignore + itemSeries.data.push(itemInner.scrapNum) + } + }) + }) + sum.push(sumIner) + }) + dataSource.month.series.push({ + data: sum, + type: "bar", + stack: "a", + name: "", + label: { + show: true, + position: "top", + color: "#fff", + formatter: function (params: any) { + return sum[params.dataIndex]; + }, + }, + }) + }else{ + dataSource.month.xData = [] + dataSource.month.series = [] + } + const options = getOptions(chartData); + return ( +
+ +
+ +
+ {// @ts-ignore + dataSource[activeName].xData.length>0 ? ( +
+ {} +
+ ):( +

+ 暂无数据 +

+ )} +
+ ); +} +export default LeftUp; diff --git a/src/page/LinePage3-2/Left/index.tsx b/src/page/LinePage3-2/Left/index.tsx new file mode 100644 index 0000000..6524b82 --- /dev/null +++ b/src/page/LinePage3-2/Left/index.tsx @@ -0,0 +1,11 @@ +import LeftUp from "./LeftUp"; +import LeftDown from "./LeftDown"; +function Left() { + return ( +
+ + +
+ ); +} +export default Left; diff --git a/src/page/LinePage3-2/Right/RightDown.tsx b/src/page/LinePage3-2/Right/RightDown.tsx new file mode 100644 index 0000000..e2991c1 --- /dev/null +++ b/src/page/LinePage3-2/Right/RightDown.tsx @@ -0,0 +1,273 @@ +import ReactECharts from "echarts-for-react"; +import TitleBox from "../Component/TitleBox"; +import SwitchButton from "../Component/SwitchButton"; +import ScrollBoard from "./../../Component/ScrollBoard"; +import { useState } from "react"; +import getOptions from "../../Component/LineChartRight/chart.config"; +import {useAppSelector} from "./../../../store/hooks" +import {selectLine3After} from "./../../../store/LinePageSlice" +import moment from "moment"; +function RightDown() { + const data = useAppSelector(selectLine3After); + // console.log('页面数据:',data) + // 假数据 + let tempData = [ + { + type: "day", + data: { + time: [] as string[], + input: [] as number[], + output: [] as number[], + }, + }, + { + type: "week", + data: { + time: [] as string[], + input: [] as number[], + output: [] as number[], + }, + }, + { + type: "month", + data: { + time: [] as string[], + input: [] as number[], + output: [] as number[], + }, + }, + ]; + const nameList = [ + { name: "表单", ename: "table" }, + { name: "折线", ename: "chart" }, + ]; + const [activeName, setActiveName] = useState(nameList[0].ename); + const handleButtonChange = (activeName: string) => { + setActiveName(activeName); + }; + const configDay = { + header: ["时间", "投入数量", "产出数量"], + headerHeight: 30, + rowNum: 5, + headerBGC: "rgba(79, 114, 136, 0.3)", + oddRowBGC: "rgba(79, 114, 136, 0.3)", + evenRowBGC: "rgba(76, 97, 123, 0.1)", + columnWidth: [120, 130, 130], + data: [], + }; + const configWeek = { + header: ["时间", "投入数量", "产出数量"], + headerHeight: 30, + rowNum: 5, + headerBGC: "rgba(79, 114, 136, 0.3)", + oddRowBGC: "rgba(79, 114, 136, 0.3)", + evenRowBGC: "rgba(76, 97, 123, 0.1)", + columnWidth: [120, 130, 130], + data: [], + }; + const configMonth = { + header: ["时间", "投入数量", "产出数量"], + headerHeight: 30, + rowNum: 5, + headerBGC: "rgba(79, 114, 136, 0.3)", + oddRowBGC: "rgba(79, 114, 136, 0.3)", + evenRowBGC: "rgba(76, 97, 123, 0.1)", + columnWidth: [120, 130, 130], + data: [], + }; + let arr1: any = []; + let arr2: any = []; + let arr3: any = []; + // @ts-ignore + if (data.todayProductionDets && data.todayProductionDets.length > 0) { + // @ts-ignore + data.todayProductionDets.map((item,index)=>{ + let arrInner = []; + arrInner.push(moment(item.recTime).format("HH:mm"),item.inputNum,item.outputNum); + arr1.push(arrInner); + tempData[0].data.time.push(moment(item.recTime).format("HH:mm")); + tempData[0].data.input.push(item.inputNum); + tempData[0].data.output.push(item.outputNum); + }) + }else{ + tempData[0].data.time = [] + tempData[0].data.input = [] + tempData[0].data.output = [] + } + // @ts-ignore + if (data.weekProductionDets && data.weekProductionDets.length > 0) { + // @ts-ignore + data.weekProductionDets.map((item,index)=>{ + let arrInner = []; + arrInner.push(moment(item.recTime).format("YYYY/MM/DD"),item.inputNum,item.outputNum); + arr2.push(arrInner); + tempData[1].data.time.push(moment(item.recTime).format("HH:mm")); + tempData[1].data.input.push(item.inputNum); + tempData[1].data.output.push(item.outputNum); + }) + }else{ + tempData[1].data.time = [] + tempData[1].data.input = [] + tempData[1].data.output = [] + } + // @ts-ignore + if (data.monthProductionDets && data.monthProductionDets.length > 0) { + // @ts-ignore + data.monthProductionDets.map((item,index)=>{ + let arrInner = []; + arrInner.push(moment(item.recTime).format("YYYY/MM/DD"),item.inputNum,item.outputNum); + arr3.push(arrInner); + tempData[2].data.time.push(moment(item.recTime).format("HH:mm")); + tempData[2].data.input.push(item.inputNum); + tempData[2].data.output.push(item.outputNum); + }) + }else{ + tempData[2].data.time = [] + tempData[2].data.input = [] + tempData[2].data.output = [] + } + configDay.data = arr1; + configWeek.data = arr2; + configMonth.data = arr3; + + const chartData1 = tempData[0].data; + const chartData2 = tempData[1].data; + const chartData3 = tempData[2].data; + const options1 = getOptions(chartData1); + const options2 = getOptions(chartData2); + const options3 = getOptions(chartData3); + return ( +
+ +
+ +
+
+
+
+ 当天 +
+
+
+ {activeName === "table" ? ( + arr1.length>0?:( +

+ 暂无数据 +

+ ) + ) : tempData[0].data.time.length>0 ? ( + + ) : ( +

+ 暂无数据 +

+ )} +
+
+
+ 本周 +
+
+
+ {activeName === "table" ? ( + arr2.length>0?:( +

+ 暂无数据 +

+ ) + ) : tempData[1].data.time.length>0 ? ( + + ) : ( +

+ 暂无数据 +

+ )} +
+
+
+ 本月 +
+
+
+ {activeName === "table" ? ( + arr3.length>0?:( +

+ 暂无数据 +

+ ) + ) : tempData[2].data.time.length>0 ? ( + + ) : ( +

+ 暂无数据 +

+ )} +
+
+
+ ); +} +export default RightDown; diff --git a/src/page/LinePage3-2/Right/RightUp.tsx b/src/page/LinePage3-2/Right/RightUp.tsx new file mode 100644 index 0000000..8bb8eae --- /dev/null +++ b/src/page/LinePage3-2/Right/RightUp.tsx @@ -0,0 +1,52 @@ +import TitleBox from "../Component/TitleBox"; +import ScrollBoard from "./../../Component/ScrollBoard"; +import {useAppSelector} from "./../../../store/hooks" +import {selectLine3After} from "./../../../store/LinePageSlice" +function RightUp() { + const data = useAppSelector(selectLine3After); + const config = { + header: ["序号", "产线", "上片数据量", "成品下片数量"], + headerHeight: 32, + rowNum: 5, + align: ["center", "left", "left", "left"], + headerBGC: "rgba(79, 114, 136, 0.3)", + oddRowBGC: "rgba(79, 114, 136, 0.3)", + evenRowBGC: "rgba(76, 97, 123, 0.1)", + columnWidth: [70, 90, 106, 114], + data: [], + }; + let arr:any = [] + // @ts-ignore + if (data.sumProductionDets && data.sumProductionDets.length > 0) { + // @ts-ignore + data.sumProductionDets.map((item, index) => { + let arrInner = [] + arrInner.push(index + 1, item.lineName, item.inputNum, item.outputNum) + arr.push(arrInner) + }) + } + config.data = arr + return ( +
+ +
+ {arr.length>0?:(

+ 暂无数据 +

)} +
+
+ ); +} +export default RightUp; diff --git a/src/page/LinePage3-2/Right/index.tsx b/src/page/LinePage3-2/Right/index.tsx new file mode 100644 index 0000000..53c802a --- /dev/null +++ b/src/page/LinePage3-2/Right/index.tsx @@ -0,0 +1,12 @@ +import RightDown from "./RightDown"; +import RightUp from "./RightUp"; + +function Right() { + return ( +
+ + +
+ ); +} +export default Right; diff --git a/src/page/LinePage3-2/TopP.tsx b/src/page/LinePage3-2/TopP.tsx new file mode 100644 index 0000000..e7c7a64 --- /dev/null +++ b/src/page/LinePage3-2/TopP.tsx @@ -0,0 +1,14 @@ +import '../../lanhuapp/common.css'; +import "./index.css"; + +function TopP() { + return ( +
+
+
+
+
+ ); +} + +export default TopP; \ No newline at end of file diff --git a/src/page/LinePage3-2/assets/icon/alarm.png b/src/page/LinePage3-2/assets/icon/alarm.png new file mode 100644 index 0000000..eb335f3 Binary files /dev/null and b/src/page/LinePage3-2/assets/icon/alarm.png differ diff --git a/src/page/LinePage3-2/assets/icon/defect.png b/src/page/LinePage3-2/assets/icon/defect.png new file mode 100644 index 0000000..76ed17c Binary files /dev/null and b/src/page/LinePage3-2/assets/icon/defect.png differ diff --git a/src/page/LinePage3-2/assets/icon/finished.png b/src/page/LinePage3-2/assets/icon/finished.png new file mode 100644 index 0000000..99b411b Binary files /dev/null and b/src/page/LinePage3-2/assets/icon/finished.png differ diff --git a/src/page/LinePage3-2/assets/icon/g.png b/src/page/LinePage3-2/assets/icon/g.png new file mode 100644 index 0000000..bf1b107 Binary files /dev/null and b/src/page/LinePage3-2/assets/icon/g.png differ diff --git a/src/page/LinePage3-2/assets/icon/inputAndOutput.png b/src/page/LinePage3-2/assets/icon/inputAndOutput.png new file mode 100644 index 0000000..113ed13 Binary files /dev/null and b/src/page/LinePage3-2/assets/icon/inputAndOutput.png differ diff --git a/src/page/LinePage3-2/assets/icon/num.png b/src/page/LinePage3-2/assets/icon/num.png new file mode 100644 index 0000000..e77c409 Binary files /dev/null and b/src/page/LinePage3-2/assets/icon/num.png differ diff --git a/src/page/LinePage3-2/assets/icon/r.png b/src/page/LinePage3-2/assets/icon/r.png new file mode 100644 index 0000000..d11591e Binary files /dev/null and b/src/page/LinePage3-2/assets/icon/r.png differ diff --git a/src/page/LinePage3-2/assets/icon/record.png b/src/page/LinePage3-2/assets/icon/record.png new file mode 100644 index 0000000..4622f01 Binary files /dev/null and b/src/page/LinePage3-2/assets/icon/record.png differ diff --git a/src/page/LinePage3-2/assets/icon/y.png b/src/page/LinePage3-2/assets/icon/y.png new file mode 100644 index 0000000..72c796a Binary files /dev/null and b/src/page/LinePage3-2/assets/icon/y.png differ diff --git a/src/page/LinePage3-2/index.css b/src/page/LinePage3-2/index.css new file mode 100644 index 0000000..1a28491 --- /dev/null +++ b/src/page/LinePage3-2/index.css @@ -0,0 +1,264 @@ +/* 顶部 */ +.block_top { + width: 1920px; + height: 94px; + background: url(/public/svg/topback.svg) 100% no-repeat; + background-size: 100% 100%; + opacity: 1; + display: flex; + justify-content: center; +} + +.block_top_title { + width: 651px; + height: 77px; + background: url(/public/png/topTiltle.png) 100% no-repeat; + background-size: 100% 100%; + margin-top: 18px; +} +/* 中部 */ +.block_bottom { + width: 1920px; + height: 966px; + padding-top: 20px; +} + +.group_left { + width: 402px; + height: 966px; + margin: 0 0 0 24px; +} + +.group_center { + width: 1041px; + height: 966px; + margin: 0 0 0 15px; +} + +.group_right { + width: 401px; + height: 966px; + margin-left: 15px; +} + +.left_up { + width: 402px; + height: 332px; + background: url(../../../public/png/rect/lp_left_up.png) no-repeat; + background-size: 100% 100%; + background-position: 0 0; + position: relative; +} +.left_down { + width: 402px; + height: 599px; + background: url(../../../public/png/rect/lp_left_down.png) no-repeat; + background-size: 100% 100%; + background-position: 0 0; + margin-top: 14px; + position: relative; +} +.center_up { + width: 1041px; + height: 562px; + background: url(../../../public/png/rect/lp_center_up.png) no-repeat; + background-size: 100% 100%; + background-position: 0 0; + position: relative; +} +.center_down { + width: 1041px; + height: 368px; + margin-top: 17px; +} +.center_down_inner { + width: 513px; + height: 366px; + background: url(../../../public/png/rect/lp_center_down.png) no-repeat; + background-size: 100% 100%; + background-position: 0 0; + position: relative; +} +.center_down .left-box { + margin-right: 15px; + position: relative; +} +.center_down .left-box .alarm_num_title { + position: absolute; + left: 220px; + top: 22px; + font-size: 13px; + letter-spacing: 3px; + color: #fff; +} +.center_down .left-box .alarm_num { + color: #52fff1; + font-size: 40px; + text-align: center; + font-family: PingFangSC, PingFang SC; +} +.center_down .right_box .chart_box { + width: 100%; + height: 310px; + margin-top: 10px; +} +.right_up { + width: 401px; + height: 257px; + background: url(../../../public/png/rect/lp_right_up.png) no-repeat; + background-size: 100% 100%; + background-position: 0 0; +} +.right_down { + width: 401px; + height: 673px; + background: url(../../../public/png/rect/lp_right_down.png) no-repeat; + background-size: 100% 100%; + background-position: 0 0; + margin-top: 14px; + position: relative; +} +.left_up_switch { + position: absolute; + right: 10px; + top: 12px; +} +.left_up_chart { + height: 275px; + margin-top: 10px; +} +/* 左侧 */ +.left_down_title { + height: 18px; + justify-content: center; + margin-bottom: 4px; +} +.left_down_box1 { + width: 56px; + height: 13px; + background: url(/public/png/leftbar.png) 100% no-repeat; + background-size: 100% 100%; + margin-top: 2px; +} +.left_down_box2 { + width: 56px; + height: 13px; + background: url(/public/png/rightbar.png) 100% no-repeat; + background-size: 100% 100%; + margin: 2px 0 0 0px; +} +.left_down_text { + /*width: 40px;*/ + height: 18px; + overflow-wrap: break-word; + color: rgba(1, 207, 204, 1); + font-size: 18px; + letter-spacing: 5px; + font-family: PingFangSC-Regular; + white-space: nowrap; + line-height: 18px; + margin-left: 18px; + margin-right: 16px; + text-align: center; +} +.left_down_content { + height: 160px; + /* padding-bottom: 5px; */ +} +.right_down_content { + height: 185px; + /* padding-bottom: 5px; */ +} +/* 滚动表格部分 */ +.dv-scroll-board .header .header-item, +.dv-scroll-board .rows .ceil { + border-right: 1px solid #0d1728; +} +.dv-scroll-board .header .header-item:last-child, +.dv-scroll-board .rows .ceil:last-child { + border-right: none; + border: none; +} +/* chart图部分 */ +.luoyang-chart-tooltip { + background: #0a2b4f77 !important; + border: none !important; + backdrop-filter: blur(12px); +} + +.luoyang-chart-tooltip * { + color: #fff !important; +} +/* 三维页面部分 */ +.center_up .model_name { + position: absolute; + left: 0px; + top: 0px; + z-index: 1000; +} +.center_up .model_info { + position: absolute; + left: 100px; + bottom: 0px; + z-index: 1000; + width: 841px; + height: 62px; + background: url(/public/png/lp/line_part.png) 100% no-repeat; + background-size: 100% 100%; +} +.center_up .model_info .reset_btn { + position: absolute; + top: 20px; + left: 40px; + width: 140px; + height: 40px; + cursor: pointer; +} +.center_up .model_info .title { + display: inline-block; + width: 361px; + text-align: center; + font-size: 32px; + color: #fff; + letter-spacing: 5px; + position: absolute; + left: 241px; + bottom: 10px; +} +.center_up .eq_detail_info { + position: absolute; + right: 0px; + bottom: 0px; + z-index: 1002; + width: 240px; + height: 110px; + background: url(/public/png/lp/eq_msg_detail.png) 100% no-repeat; + background-size: 100% 100%; + color: #fff; + padding: 15px 0 0 15px; +} +.center_up .eq_detail_info .left_name { + display: inline-block; + width: 95px; + height: 28px; + text-align: right; + font-size: 18px; +} +.center_up .eq_detail_info .right_value { + display: inline-block; + height: 28px; + font-size: 18px; +} +.center_up .eq_info { + position: absolute; + z-index: 1002; + background: url(/public/png/lp/eq_msg_always.png) 100% no-repeat; + background-size: 100% 100%; + color: #fff; + padding: 10px 15px; +} +.center_up .eq_info .eq_info_inner { + height: 24px; + font-size: 17px; + white-space: nowrap; +} diff --git a/src/page/LinePage3-2/index.tsx b/src/page/LinePage3-2/index.tsx new file mode 100644 index 0000000..daf9389 --- /dev/null +++ b/src/page/LinePage3-2/index.tsx @@ -0,0 +1,18 @@ +import React from "react"; +import TopP from "./TopP"; +import Left from "./Left"; +import Right from "./Right"; +import Center from "./Center"; +function LinePage() { + return ( + + +
+ +
+ +
+
+ ); +} +export default LinePage; diff --git a/src/page/LinePage4-1/Center/CenterDown.tsx b/src/page/LinePage4-1/Center/CenterDown.tsx new file mode 100644 index 0000000..d4b3b02 --- /dev/null +++ b/src/page/LinePage4-1/Center/CenterDown.tsx @@ -0,0 +1,214 @@ +import ReactECharts from "echarts-for-react"; +import TitleBox from "../Component/TitleBox"; +import ScrollBoard from "./../../Component/ScrollBoard"; +import SwitchButton from "../Component/SwitchButton"; +import { useState } from "react"; +import getOptions from "../../Component/LineChart/chart.config"; +import {useAppSelector} from "./../../../store/hooks" +import {selectLine4Before} from "./../../../store/LinePageSlice" +import moment from "moment"; +function CenterDown() { + const data = useAppSelector(selectLine4Before); + // 假数据 + const dataSource = { + day: { + xData:[], + series: [] as { name: string; type: string; symbol: string; symbolSize: number; data: never[]; }[], + }, + week: { + xData:[], + series: [] as { name: string; type: string; symbol: string; symbolSize: number; data: never[]; }[], + }, + month: { + xData:[], + series: [] as { name: string; type: string; symbol: string; symbolSize: number; data: never[]; }[], + }, + }; + const nameList = [ + { name: "天", ename: "day" }, + { name: "周", ename: "week" }, + { name: "月", ename: "month" }, + ]; + const [activeName, setActiveName] = useState(nameList[0].ename); + const handleButtonChange = (activeName: string) => { + setActiveName(activeName); + }; + const config = { + header: ["序号", "报警时间", "报警设备", "报警内容"], + headerHeight: 36, + rowNum: 6, + align: ["center", "left", "left", "left"], + headerBGC: "rgba(79, 114, 136, 0.3)", + oddRowBGC: "rgba(79, 114, 136, 0.3)", + evenRowBGC: "rgba(76, 97, 123, 0.1)", + columnWidth: [80, 137, 137, 137], + data: [] + }; + // 报警数据 + let arr:any = [] + let sumAlarm = 0 + // @ts-ignore + if (data.alarms && data.alarms.length > 0) { + // @ts-ignore + sumAlarm = data.alarms.length + // @ts-ignore + data.alarms.map((item,index) => { + let arrInner = [] + arrInner.push( + index+1, + moment(item.recTime).format("YYYY/MM/DD HH:mm"), + item.name, + item.status === '故障'?"故障":"离线", + ); + arr.push(arrInner) + }); + } + config.data = arr + // 产线成品率 + // @ts-ignore + if (data.todayProductionRates && Object.keys(data.todayProductionRates).length > 0) { + // @ts-ignore + let keys = Object.keys(data.todayProductionRates) + // @ts-ignore + data.todayProductionRates[keys[0]].map((item,index)=>{ + // @ts-ignore + dataSource.day.xData.push(moment(item.recTime).format("HH:mm")) + }) + keys.map((item,index)=>{ + let obj = { + name: "", + type: "line", + symbol: "circle", + symbolSize: 4, + data:[] + } + // @ts-ignore + obj.name = data.todayProductionRates[item][0].lineName + // @ts-ignore + data.todayProductionRates[item].map((subItem,index)=>{ + // @ts-ignore + obj.data.push(subItem.passRate) + }) + dataSource.day.series.push(obj) + }) + }else{ + dataSource.day.xData = [] + dataSource.day.series = [] + } + // @ts-ignore + if (data.weekProductionRates && Object.keys(data.weekProductionRates).length > 0) { + // @ts-ignore + let keys = Object.keys(data.weekProductionRates) + // @ts-ignore + data.weekProductionRates[keys[0]].map((item,index)=>{ + // @ts-ignore + dataSource.week.xData.push(moment(item.recTime).format("HH:mm")) + }) + keys.map((item,index)=>{ + let obj = { + name: "", + type: "line", + symbol: "circle", + symbolSize: 4, + data:[] + } + // @ts-ignore + obj.name = data.weekProductionRates[item][0].lineName + // @ts-ignore + data.weekProductionRates[item].map((subItem,index)=>{ + // @ts-ignore + obj.data.push(subItem.passRate) + }) + dataSource.week.series.push(obj) + }) + }else{ + dataSource.week.xData = [] + dataSource.week.series = [] + } + // @ts-ignore + if (data.monthProductionRates && Object.keys(data.monthProductionRates).length > 0) { + // @ts-ignore + let keys = Object.keys(data.monthProductionRates) + // @ts-ignore + data.monthProductionRates[keys[0]].map((item,index)=>{ + // @ts-ignore + dataSource.month.xData.push(moment(item.recTime).format("HH:mm")) + }) + keys.map((item,index)=>{ + let obj = { + name: "", + type: "line", + symbol: "circle", + symbolSize: 4, + data:[] + } + // @ts-ignore + obj.name = data.monthProductionRates[item][0].lineName + // @ts-ignore + data.monthProductionRates[item].map((subItem,index)=>{ + // @ts-ignore + obj.data.push(subItem.passRate) + }) + dataSource.month.series.push(obj) + }) + }else{ + dataSource.month.xData = [] + dataSource.month.series = [] + } + let chartData = (dataSource as { [key: string]: any })[activeName]; + console.log('???????????',chartData) + const options = getOptions(chartData); + return ( +
+
+ + — 报警总数 — +
{sumAlarm}
+
+ {arr.length>0?:(

+ 暂无数据 +

)} +
+
+ {/* 产线成品率 */} +
+ +
+ +
+ {chartData.xData.length>0 && ( +
+ {} +
+ )} + {chartData.xData.length==0 && ( +

+ 暂无数据 +

+ )} +
+
+ ); +} +export default CenterDown; diff --git a/src/page/LinePage4-1/Center/CenterUp.tsx b/src/page/LinePage4-1/Center/CenterUp.tsx new file mode 100644 index 0000000..9bc4128 --- /dev/null +++ b/src/page/LinePage4-1/Center/CenterUp.tsx @@ -0,0 +1,10 @@ +import LinePageBabylon from "../../../babylonjs/LinePageBabylon"; +function CenterUp() { + const lineID = "4-1" + return ( +
+ +
+ ); +} +export default CenterUp; diff --git a/src/page/LinePage4-1/Center/index.tsx b/src/page/LinePage4-1/Center/index.tsx new file mode 100644 index 0000000..14d5036 --- /dev/null +++ b/src/page/LinePage4-1/Center/index.tsx @@ -0,0 +1,12 @@ +import CenterDown from "./CenterDown"; +import CenterUp from "./CenterUp"; + +function Center() { + return ( +
+ + +
+ ); +} +export default Center; diff --git a/src/page/LinePage4-1/Component/SwitchButton/index.css b/src/page/LinePage4-1/Component/SwitchButton/index.css new file mode 100644 index 0000000..604d81a --- /dev/null +++ b/src/page/LinePage4-1/Component/SwitchButton/index.css @@ -0,0 +1,19 @@ +.switch-button { + height: 33px; +} +.switch-button button { + color: #fff; + font-size: 18px; + padding: 4px 10px; + background-color: rgba(49, 135, 140, 0.3); + cursor: pointer; +} +.switch-button button:first-child { + border-radius: 5px 0 0 5px; +} +.switch-button button:last-child { + border-radius: 0 5px 5px 0; +} +.switch-button button.active { + background-color: rgba(86, 244, 231, 0.7); +} diff --git a/src/page/LinePage4-1/Component/SwitchButton/index.tsx b/src/page/LinePage4-1/Component/SwitchButton/index.tsx new file mode 100644 index 0000000..9209c06 --- /dev/null +++ b/src/page/LinePage4-1/Component/SwitchButton/index.tsx @@ -0,0 +1,65 @@ +import { useEffect, useState } from "react"; +import "./index.css"; +interface Name { + name: string; + ename: string; +} +interface nameListProps { + nameList: Name[]; + onChange: (value: string) => void; +} +function createActiveNameUpdater(nameList: any, activeName: string) { + let activeIndex = nameList.findIndex((obj: any) => obj.name === activeName); + + return function updateActiveName() { + activeIndex = (activeIndex + 1) % nameList.length; + return nameList[activeIndex].ename; + }; +} +function SwitchButton(props: nameListProps) { + const [activeName, setActiveName] = useState(props.nameList[0].ename); + const [timerId, setTimerId] = useState(null); + let updateActiveName = createActiveNameUpdater(props.nameList, activeName); + useEffect(() => { + const timer = setInterval(() => { + let active = updateActiveName(); + setActiveName(active); + props.onChange(active); + }, 60000); + setTimerId(timer); + return () => { + if (timerId !== null) { + clearInterval(timerId); + } + }; + }, [props.nameList.length]); + const btnClick = (ename: string) => { + if (timerId !== null) { + clearInterval(timerId); + } + setActiveName(ename); + props.onChange(ename); // 通知父组件 + const newTimer = setInterval(() => { + let active = updateActiveName(); + setActiveName(active); + props.onChange(active); + }, 60000); + setTimerId(newTimer); + }; + return ( +
+ {props.nameList.map((item, index) => { + return ( + + ); + })} +
+ ); +} +export default SwitchButton; diff --git a/src/page/LinePage4-1/Component/TitleBox/index.css b/src/page/LinePage4-1/Component/TitleBox/index.css new file mode 100644 index 0000000..3ae06db --- /dev/null +++ b/src/page/LinePage4-1/Component/TitleBox/index.css @@ -0,0 +1,13 @@ +.title_box { + font-size: 24px; + color: #52fff1; + padding: 10px 0 0 15px; +} +.title_box img { + width: 33px; + height: 33px; + vertical-align: bottom; + margin-right: 3px; + position: relative; + top: 3px; +} diff --git a/src/page/LinePage4-1/Component/TitleBox/index.tsx b/src/page/LinePage4-1/Component/TitleBox/index.tsx new file mode 100644 index 0000000..dd43a66 --- /dev/null +++ b/src/page/LinePage4-1/Component/TitleBox/index.tsx @@ -0,0 +1,53 @@ +import Defect from "./../../assets/icon/defect.png"; +import Alarm from "./../../assets/icon/alarm.png"; +import Finished from "./../../assets/icon/finished.png"; +import InputAndOutput from "./../../assets/icon/inputAndOutput.png"; +import Num from "./../../assets/icon/num.png"; +import Record from "./../../assets/icon/record.png"; +import "./index.css"; +interface titleProps { + title: string; +} +function TitleBox(props: titleProps) { + const filteredTitles = () => { + switch (props.title) { + case "left_up": + return { + img: Defect, + title: "产线报废汇总", + }; + case "left_down": + return { + img: Record, + title: "当前产线报废情况", + }; + case "center_down_left": + return { + img: Alarm, + title: "异常报警", + }; + case "center_down_right": + return { + img: Finished, + title: "产线成品率", + }; + case "right_up": + return { + img: Num, + title: "各产线总投入和产出", + }; + default: + return { + img: InputAndOutput, + title: "当前产线投入和产出", + }; + } + }; + return ( +
+ title + {filteredTitles().title} +
+ ); +} +export default TitleBox; diff --git a/src/page/LinePage4-1/Left/LeftDown.tsx b/src/page/LinePage4-1/Left/LeftDown.tsx new file mode 100644 index 0000000..94e3368 --- /dev/null +++ b/src/page/LinePage4-1/Left/LeftDown.tsx @@ -0,0 +1,245 @@ +import ReactECharts from "echarts-for-react"; +import TitleBox from "../Component/TitleBox"; +import SwitchButton from "../Component/SwitchButton"; +import ScrollBoard from "./../../Component/ScrollBoard"; +import { useState } from "react"; +import getOptions from "../../Component/BarChart/chart.config"; +import {useAppSelector} from "./../../../store/hooks" +import {selectLine4Before} from "./../../../store/LinePageSlice" +function LeftDown() { + const data = useAppSelector(selectLine4Before); + // console.log('页面数据:',data) + const nameList = [ + { name: "表单", ename: "table" }, + { name: "柱状", ename: "chart" }, + ]; + const [activeName, setActiveName] = useState(nameList[0].ename); + const handleButtonChange = (activeName: string) => { + setActiveName(activeName); + }; + const configDay = { + header: ["序号", "工序类型", "报废数量"], + headerHeight: 30, + rowNum: 4, + align: ["center", "left", "left"], + headerBGC: "rgba(79, 114, 136, 0.3)", + oddRowBGC: "rgba(79, 114, 136, 0.3)", + evenRowBGC: "rgba(76, 97, 123, 0.1)", + columnWidth: [73, 117, 190], + data: [ + ["1", "磨边后", 224], + ["2", "包装1", 322], + ["3", "包装2", 66], + ], + }; + const configWeek = { + header: ["序号", "工序类型", "报废数量"], + headerHeight: 30, + rowNum: 4, + align: ["center", "left", "left"], + headerBGC: "rgba(79, 114, 136, 0.3)", + oddRowBGC: "rgba(79, 114, 136, 0.3)", + evenRowBGC: "rgba(76, 97, 123, 0.1)", + columnWidth: [73, 117, 190], + data: [ + ["1", "磨边后", 1119], + ["2", "包装1", 1798], + ["3", "包装2", 435], + ], + }; + const configMonth = { + header: ["序号", "工序类型", "报废数量"], + headerHeight: 30, + rowNum: 4, + align: ["center", "left", "left"], + headerBGC: "rgba(79, 114, 136, 0.3)", + oddRowBGC: "rgba(79, 114, 136, 0.3)", + evenRowBGC: "rgba(76, 97, 123, 0.1)", + columnWidth: [73, 117, 190], + data: [ + ["1", "磨边后", 5004], + ["2", "包装1", 9122], + ["3", "包装2", 1924], + ], + }; + const color1 = ["#9DD5FF", "#1295FF"]; + const color2 = ["#85F6E9", "#2EC6B4"]; + // @ts-ignore + let xData: string[] = data.scrapBars + let dataProps1: number[] = []; + let dataProps2: number[] = []; + let dataProps3: number[] = []; + let arr1: any = []; + let arr2: any = []; + let arr3: any = []; + // @ts-ignore + if (data.todayProductionScraps && data.todayProductionScraps.length > 0) { + // @ts-ignore + data.todayProductionScraps.map((item,index)=>{ + let arrInner = []; + arrInner.push(index+1,item.sectionName,item.scrapNum); + arr1.push(arrInner); + dataProps1.push(item.scrapNum); + }) + }else{ + dataProps1 = [] + } + // @ts-ignore + if (data.weekProductionScraps && data.weekProductionScraps.length > 0) { + // @ts-ignore + data.weekProductionScraps.map((item,index)=>{ + let arrInner = []; + arrInner.push(index+1,item.sectionName,item.scrapNum); + arr2.push(arrInner); + dataProps2.push(item.scrapNum); + }) + }else{ + dataProps2 = [] + } + // @ts-ignore + if (data.monthProductionScraps && data.monthProductionScraps.length > 0) { + // @ts-ignore + data.monthProductionScraps.map((item,index)=>{ + let arrInner = []; + arrInner.push(index+1,item.sectionName,item.scrapNum); + arr3.push(arrInner); + dataProps3.push(item.scrapNum); + }) + }else{ + dataProps3 = [] + } + configDay.data = arr1; + configWeek.data = arr2; + configMonth.data = arr3; + const options1 = getOptions(dataProps1,xData, color1); + const options2 = getOptions(dataProps2,xData, color2); + const options3 = getOptions(dataProps3,xData, color1); + return ( +
+ +
+ +
+
+
+
+ 当天 +
+
+
+ {activeName === "table" ? ( + arr1.length > 0 ? :(

+ 暂无数据 +

) + ) : dataProps1.length>0 ? ( + + ) : ( +

+ 暂无数据 +

+ )} +
+
+
+ 本周 +
+
+
+ {activeName === "table" ? ( + arr2.length > 0 ? :(

+ 暂无数据 +

) + ) : dataProps2.length>0 ? ( + + ) : ( +

+ 暂无数据 +

+ )} +
+
+
+ 本月 +
+
+
+ {activeName === "table" ? ( + arr3.length > 0 ? :(

+ 暂无数据 +

) + ) : dataProps3.length>0 ? ( + + ) : ( +

+ 暂无数据 +

+ )} +
+
+
+ ); +} +export default LeftDown; diff --git a/src/page/LinePage4-1/Left/LeftUp.tsx b/src/page/LinePage4-1/Left/LeftUp.tsx new file mode 100644 index 0000000..7705eff --- /dev/null +++ b/src/page/LinePage4-1/Left/LeftUp.tsx @@ -0,0 +1,228 @@ +import ReactECharts from "echarts-for-react"; +import TitleBox from "../Component/TitleBox"; +import SwitchButton from "../Component/SwitchButton"; +import getOptions from "../../Component/SummaryBarChart/chart.config"; +import { useState } from "react"; +import {useAppSelector} from "./../../../store/hooks" +import {selectLine4Before} from "./../../../store/LinePageSlice" +function LeftUp() { + const data = useAppSelector(selectLine4Before); + // 假数据 + const dataSource = { + day: { + xData: [], + series: [] as { data: number[]; type: string; stack: string; name: any; barWidth?: number; label: { show: boolean; position: string; color: string;formatter?:any }; }[], + }, + week: { + xData: [], + series: [] as { data: number[]; type: string; stack: string; name: any; barWidth?: number; label: { show: boolean; position: string; color: string;formatter?:any }; }[], + }, + month: { + xData: [], + series: [] as { data: number[]; type: string; stack: string; name: any; barWidth?: number; label: { show: boolean; position: string; color: string;formatter?:any }; }[], + }, + }; + const nameList = [ + { name: "天", ename: "day" }, + { name: "周", ename: "week" }, + { name: "月", ename: "month" }, + ]; + const [activeName, setActiveName] = useState(nameList[0].ename); + let chartData = (dataSource as { [key: string]: any })[activeName]; + const handleButtonChange = (activeName: string) => { + setActiveName(activeName); + }; + // @ts-ignore + if (data.todayAllProductionScraps && Object.keys(data.todayAllProductionScraps).length > 0) { + let sum: number[] = []; + // 生成obj + // @ts-ignore + data.scrapBars.map((item,index) => { + let obj = { + data: [], + type: "bar", + stack: "a", + name: item, + barWidth: 14, + label: { + show: true, + position: "right", + color: "inherit", + }, + } + dataSource.day.series.push(obj) + }) + // @ts-ignore + dataSource.day.xData = Object.keys(data.todayAllProductionScraps) + dataSource.day.xData.map((item,index)=>{ + let sumIner = 0 + // @ts-ignore + data.todayAllProductionScraps[item].map((itemInner,indexInner)=>{ + sumIner += itemInner.scrapNum + dataSource.day.series.map((itemSeries,indexSeries)=>{ + // @ts-ignore + if (itemSeries.name === itemInner.sectionName) { + // @ts-ignore + itemSeries.data.push(itemInner.scrapNum) + } + }) + }) + sum.push(sumIner) + }) + dataSource.day.series.push({ + data: sum, + type: "bar", + stack: "a", + name: "", + label: { + show: true, + position: "top", + color: "#fff", + formatter: function (params: any) { + return sum[params.dataIndex]; + }, + }, + }) + }else{ + dataSource.day.xData = [] + dataSource.day.series = [] + } + // @ts-ignore + if (data.weekAllProductionScraps && Object.keys(data.weekAllProductionScraps).length > 0) { + let sum: number[] = []; + // 生成obj + // @ts-ignore + data.scrapBars.map((item,index) => { + let obj = { + data: [], + type: "bar", + stack: "a", + name: item, + barWidth: 14, + label: { + show: true, + position: "right", + color: "inherit", + }, + } + dataSource.week.series.push(obj) + }) + // @ts-ignore + dataSource.week.xData = Object.keys(data.weekAllProductionScraps) + dataSource.week.xData.map((item,index)=>{ + let sumIner = 0 + // @ts-ignore + data.weekAllProductionScraps[item].map((itemInner,indexInner)=>{ + sumIner += itemInner.scrapNum + dataSource.week.series.map((itemSeries,indexSeries)=>{ + // @ts-ignore + if (itemSeries.name === itemInner.sectionName) { + // @ts-ignore + itemSeries.data.push(itemInner.scrapNum) + } + }) + }) + sum.push(sumIner) + }) + dataSource.week.series.push({ + data: sum, + type: "bar", + stack: "a", + name: "", + label: { + show: true, + position: "top", + color: "#fff", + formatter: function (params: any) { + return sum[params.dataIndex]; + }, + }, + }) + }else{ + dataSource.week.xData = [] + dataSource.week.series = [] + } + // @ts-ignore + if (data.monthAllProductionScraps && Object.keys(data.monthAllProductionScraps).length > 0) { + let sum: number[] = []; + // 生成obj + // @ts-ignore + data.scrapBars.map((item,index) => { + let obj = { + data: [], + type: "bar", + stack: "a", + name: item, + barWidth: 14, + label: { + show: true, + position: "right", + color: "inherit", + }, + } + dataSource.month.series.push(obj) + }) + // @ts-ignore + dataSource.month.xData = Object.keys(data.monthAllProductionScraps) + dataSource.month.xData.map((item,index)=>{ + let sumIner = 0 + // @ts-ignore + data.monthAllProductionScraps[item].map((itemInner,indexInner)=>{ + sumIner += itemInner.scrapNum + dataSource.month.series.map((itemSeries,indexSeries)=>{ + // @ts-ignore + if (itemSeries.name === itemInner.sectionName) { + // @ts-ignore + itemSeries.data.push(itemInner.scrapNum) + } + }) + }) + sum.push(sumIner) + }) + dataSource.month.series.push({ + data: sum, + type: "bar", + stack: "a", + name: "", + label: { + show: true, + position: "top", + color: "#fff", + formatter: function (params: any) { + return sum[params.dataIndex]; + }, + }, + }) + }else{ + dataSource.month.xData = [] + dataSource.month.series = [] + } + const options = getOptions(chartData); + return ( +
+ +
+ +
+ {// @ts-ignore + dataSource[activeName].xData.length>0 ? ( +
+ {} +
+ ):( +

+ 暂无数据 +

+ )} +
+ ); +} +export default LeftUp; diff --git a/src/page/LinePage4-1/Left/index.tsx b/src/page/LinePage4-1/Left/index.tsx new file mode 100644 index 0000000..6524b82 --- /dev/null +++ b/src/page/LinePage4-1/Left/index.tsx @@ -0,0 +1,11 @@ +import LeftUp from "./LeftUp"; +import LeftDown from "./LeftDown"; +function Left() { + return ( +
+ + +
+ ); +} +export default Left; diff --git a/src/page/LinePage4-1/Right/RightDown.tsx b/src/page/LinePage4-1/Right/RightDown.tsx new file mode 100644 index 0000000..733ebff --- /dev/null +++ b/src/page/LinePage4-1/Right/RightDown.tsx @@ -0,0 +1,273 @@ +import ReactECharts from "echarts-for-react"; +import TitleBox from "../Component/TitleBox"; +import SwitchButton from "../Component/SwitchButton"; +import ScrollBoard from "./../../Component/ScrollBoard"; +import { useState } from "react"; +import getOptions from "../../Component/LineChartRight/chart.config"; +import {useAppSelector} from "./../../../store/hooks" +import {selectLine4Before} from "./../../../store/LinePageSlice" +import moment from "moment"; +function RightDown() { + const data = useAppSelector(selectLine4Before); + // console.log('页面数据:',data) + // 假数据 + let tempData = [ + { + type: "day", + data: { + time: [] as string[], + input: [] as number[], + output: [] as number[], + }, + }, + { + type: "week", + data: { + time: [] as string[], + input: [] as number[], + output: [] as number[], + }, + }, + { + type: "month", + data: { + time: [] as string[], + input: [] as number[], + output: [] as number[], + }, + }, + ]; + const nameList = [ + { name: "表单", ename: "table" }, + { name: "折线", ename: "chart" }, + ]; + const [activeName, setActiveName] = useState(nameList[0].ename); + const handleButtonChange = (activeName: string) => { + setActiveName(activeName); + }; + const configDay = { + header: ["时间", "投入数量", "产出数量"], + headerHeight: 30, + rowNum: 5, + headerBGC: "rgba(79, 114, 136, 0.3)", + oddRowBGC: "rgba(79, 114, 136, 0.3)", + evenRowBGC: "rgba(76, 97, 123, 0.1)", + columnWidth: [120, 130, 130], + data: [], + }; + const configWeek = { + header: ["时间", "投入数量", "产出数量"], + headerHeight: 30, + rowNum: 5, + headerBGC: "rgba(79, 114, 136, 0.3)", + oddRowBGC: "rgba(79, 114, 136, 0.3)", + evenRowBGC: "rgba(76, 97, 123, 0.1)", + columnWidth: [120, 130, 130], + data: [], + }; + const configMonth = { + header: ["时间", "投入数量", "产出数量"], + headerHeight: 30, + rowNum: 5, + headerBGC: "rgba(79, 114, 136, 0.3)", + oddRowBGC: "rgba(79, 114, 136, 0.3)", + evenRowBGC: "rgba(76, 97, 123, 0.1)", + columnWidth: [120, 130, 130], + data: [], + }; + let arr1: any = []; + let arr2: any = []; + let arr3: any = []; + // @ts-ignore + if (data.todayProductionDets && data.todayProductionDets.length > 0) { + // @ts-ignore + data.todayProductionDets.map((item,index)=>{ + let arrInner = []; + arrInner.push(moment(item.recTime).format("HH:mm"),item.inputNum,item.outputNum); + arr1.push(arrInner); + tempData[0].data.time.push(moment(item.recTime).format("HH:mm")); + tempData[0].data.input.push(item.inputNum); + tempData[0].data.output.push(item.outputNum); + }) + }else{ + tempData[0].data.time = [] + tempData[0].data.input = [] + tempData[0].data.output = [] + } + // @ts-ignore + if (data.weekProductionDets && data.weekProductionDets.length > 0) { + // @ts-ignore + data.weekProductionDets.map((item,index)=>{ + let arrInner = []; + arrInner.push(moment(item.recTime).format("YYYY/MM/DD"),item.inputNum,item.outputNum); + arr2.push(arrInner); + tempData[1].data.time.push(moment(item.recTime).format("HH:mm")); + tempData[1].data.input.push(item.inputNum); + tempData[1].data.output.push(item.outputNum); + }) + }else{ + tempData[1].data.time = [] + tempData[1].data.input = [] + tempData[1].data.output = [] + } + // @ts-ignore + if (data.monthProductionDets && data.monthProductionDets.length > 0) { + // @ts-ignore + data.monthProductionDets.map((item,index)=>{ + let arrInner = []; + arrInner.push(moment(item.recTime).format("YYYY/MM/DD"),item.inputNum,item.outputNum); + arr3.push(arrInner); + tempData[2].data.time.push(moment(item.recTime).format("HH:mm")); + tempData[2].data.input.push(item.inputNum); + tempData[2].data.output.push(item.outputNum); + }) + }else{ + tempData[2].data.time = [] + tempData[2].data.input = [] + tempData[2].data.output = [] + } + configDay.data = arr1; + configWeek.data = arr2; + configMonth.data = arr3; + + const chartData1 = tempData[0].data; + const chartData2 = tempData[1].data; + const chartData3 = tempData[2].data; + const options1 = getOptions(chartData1); + const options2 = getOptions(chartData2); + const options3 = getOptions(chartData3); + return ( +
+ +
+ +
+
+
+
+ 当天 +
+
+
+ {activeName === "table" ? ( + arr1.length>0?:( +

+ 暂无数据 +

+ ) + ) : tempData[0].data.time.length>0 ? ( + + ) : ( +

+ 暂无数据 +

+ )} +
+
+
+ 本周 +
+
+
+ {activeName === "table" ? ( + arr2.length>0?:( +

+ 暂无数据 +

+ ) + ) : tempData[1].data.time.length>0 ? ( + + ) : ( +

+ 暂无数据 +

+ )} +
+
+
+ 本月 +
+
+
+ {activeName === "table" ? ( + arr3.length>0?:( +

+ 暂无数据 +

+ ) + ) : tempData[2].data.time.length>0 ? ( + + ) : ( +

+ 暂无数据 +

+ )} +
+
+
+ ); +} +export default RightDown; diff --git a/src/page/LinePage4-1/Right/RightUp.tsx b/src/page/LinePage4-1/Right/RightUp.tsx new file mode 100644 index 0000000..7ef32e7 --- /dev/null +++ b/src/page/LinePage4-1/Right/RightUp.tsx @@ -0,0 +1,52 @@ +import TitleBox from "../Component/TitleBox"; +import ScrollBoard from "./../../Component/ScrollBoard"; +import {useAppSelector} from "./../../../store/hooks" +import {selectLine4Before} from "./../../../store/LinePageSlice" +function RightUp() { + const data = useAppSelector(selectLine4Before); + const config = { + header: ["序号", "产线", "上片数据量", "成品下片数量"], + headerHeight: 32, + rowNum: 5, + align: ["center", "left", "left", "left"], + headerBGC: "rgba(79, 114, 136, 0.3)", + oddRowBGC: "rgba(79, 114, 136, 0.3)", + evenRowBGC: "rgba(76, 97, 123, 0.1)", + columnWidth: [70, 90, 106, 114], + data: [], + }; + let arr:any = [] + // @ts-ignore + if (data.sumProductionDets && data.sumProductionDets.length > 0) { + // @ts-ignore + data.sumProductionDets.map((item, index) => { + let arrInner = [] + arrInner.push(index + 1, item.lineName, item.inputNum, item.outputNum) + arr.push(arrInner) + }) + } + config.data = arr + return ( +
+ +
+ {arr.length>0?:(

+ 暂无数据 +

)} +
+
+ ); +} +export default RightUp; diff --git a/src/page/LinePage4-1/Right/index.tsx b/src/page/LinePage4-1/Right/index.tsx new file mode 100644 index 0000000..53c802a --- /dev/null +++ b/src/page/LinePage4-1/Right/index.tsx @@ -0,0 +1,12 @@ +import RightDown from "./RightDown"; +import RightUp from "./RightUp"; + +function Right() { + return ( +
+ + +
+ ); +} +export default Right; diff --git a/src/page/LinePage4-1/TopP.tsx b/src/page/LinePage4-1/TopP.tsx new file mode 100644 index 0000000..e7c7a64 --- /dev/null +++ b/src/page/LinePage4-1/TopP.tsx @@ -0,0 +1,14 @@ +import '../../lanhuapp/common.css'; +import "./index.css"; + +function TopP() { + return ( +
+
+
+
+
+ ); +} + +export default TopP; \ No newline at end of file diff --git a/src/page/LinePage4-1/assets/icon/alarm.png b/src/page/LinePage4-1/assets/icon/alarm.png new file mode 100644 index 0000000..eb335f3 Binary files /dev/null and b/src/page/LinePage4-1/assets/icon/alarm.png differ diff --git a/src/page/LinePage4-1/assets/icon/defect.png b/src/page/LinePage4-1/assets/icon/defect.png new file mode 100644 index 0000000..76ed17c Binary files /dev/null and b/src/page/LinePage4-1/assets/icon/defect.png differ diff --git a/src/page/LinePage4-1/assets/icon/finished.png b/src/page/LinePage4-1/assets/icon/finished.png new file mode 100644 index 0000000..99b411b Binary files /dev/null and b/src/page/LinePage4-1/assets/icon/finished.png differ diff --git a/src/page/LinePage4-1/assets/icon/g.png b/src/page/LinePage4-1/assets/icon/g.png new file mode 100644 index 0000000..bf1b107 Binary files /dev/null and b/src/page/LinePage4-1/assets/icon/g.png differ diff --git a/src/page/LinePage4-1/assets/icon/inputAndOutput.png b/src/page/LinePage4-1/assets/icon/inputAndOutput.png new file mode 100644 index 0000000..113ed13 Binary files /dev/null and b/src/page/LinePage4-1/assets/icon/inputAndOutput.png differ diff --git a/src/page/LinePage4-1/assets/icon/num.png b/src/page/LinePage4-1/assets/icon/num.png new file mode 100644 index 0000000..e77c409 Binary files /dev/null and b/src/page/LinePage4-1/assets/icon/num.png differ diff --git a/src/page/LinePage4-1/assets/icon/r.png b/src/page/LinePage4-1/assets/icon/r.png new file mode 100644 index 0000000..d11591e Binary files /dev/null and b/src/page/LinePage4-1/assets/icon/r.png differ diff --git a/src/page/LinePage4-1/assets/icon/record.png b/src/page/LinePage4-1/assets/icon/record.png new file mode 100644 index 0000000..4622f01 Binary files /dev/null and b/src/page/LinePage4-1/assets/icon/record.png differ diff --git a/src/page/LinePage4-1/assets/icon/y.png b/src/page/LinePage4-1/assets/icon/y.png new file mode 100644 index 0000000..72c796a Binary files /dev/null and b/src/page/LinePage4-1/assets/icon/y.png differ diff --git a/src/page/LinePage4-1/index.css b/src/page/LinePage4-1/index.css new file mode 100644 index 0000000..1a28491 --- /dev/null +++ b/src/page/LinePage4-1/index.css @@ -0,0 +1,264 @@ +/* 顶部 */ +.block_top { + width: 1920px; + height: 94px; + background: url(/public/svg/topback.svg) 100% no-repeat; + background-size: 100% 100%; + opacity: 1; + display: flex; + justify-content: center; +} + +.block_top_title { + width: 651px; + height: 77px; + background: url(/public/png/topTiltle.png) 100% no-repeat; + background-size: 100% 100%; + margin-top: 18px; +} +/* 中部 */ +.block_bottom { + width: 1920px; + height: 966px; + padding-top: 20px; +} + +.group_left { + width: 402px; + height: 966px; + margin: 0 0 0 24px; +} + +.group_center { + width: 1041px; + height: 966px; + margin: 0 0 0 15px; +} + +.group_right { + width: 401px; + height: 966px; + margin-left: 15px; +} + +.left_up { + width: 402px; + height: 332px; + background: url(../../../public/png/rect/lp_left_up.png) no-repeat; + background-size: 100% 100%; + background-position: 0 0; + position: relative; +} +.left_down { + width: 402px; + height: 599px; + background: url(../../../public/png/rect/lp_left_down.png) no-repeat; + background-size: 100% 100%; + background-position: 0 0; + margin-top: 14px; + position: relative; +} +.center_up { + width: 1041px; + height: 562px; + background: url(../../../public/png/rect/lp_center_up.png) no-repeat; + background-size: 100% 100%; + background-position: 0 0; + position: relative; +} +.center_down { + width: 1041px; + height: 368px; + margin-top: 17px; +} +.center_down_inner { + width: 513px; + height: 366px; + background: url(../../../public/png/rect/lp_center_down.png) no-repeat; + background-size: 100% 100%; + background-position: 0 0; + position: relative; +} +.center_down .left-box { + margin-right: 15px; + position: relative; +} +.center_down .left-box .alarm_num_title { + position: absolute; + left: 220px; + top: 22px; + font-size: 13px; + letter-spacing: 3px; + color: #fff; +} +.center_down .left-box .alarm_num { + color: #52fff1; + font-size: 40px; + text-align: center; + font-family: PingFangSC, PingFang SC; +} +.center_down .right_box .chart_box { + width: 100%; + height: 310px; + margin-top: 10px; +} +.right_up { + width: 401px; + height: 257px; + background: url(../../../public/png/rect/lp_right_up.png) no-repeat; + background-size: 100% 100%; + background-position: 0 0; +} +.right_down { + width: 401px; + height: 673px; + background: url(../../../public/png/rect/lp_right_down.png) no-repeat; + background-size: 100% 100%; + background-position: 0 0; + margin-top: 14px; + position: relative; +} +.left_up_switch { + position: absolute; + right: 10px; + top: 12px; +} +.left_up_chart { + height: 275px; + margin-top: 10px; +} +/* 左侧 */ +.left_down_title { + height: 18px; + justify-content: center; + margin-bottom: 4px; +} +.left_down_box1 { + width: 56px; + height: 13px; + background: url(/public/png/leftbar.png) 100% no-repeat; + background-size: 100% 100%; + margin-top: 2px; +} +.left_down_box2 { + width: 56px; + height: 13px; + background: url(/public/png/rightbar.png) 100% no-repeat; + background-size: 100% 100%; + margin: 2px 0 0 0px; +} +.left_down_text { + /*width: 40px;*/ + height: 18px; + overflow-wrap: break-word; + color: rgba(1, 207, 204, 1); + font-size: 18px; + letter-spacing: 5px; + font-family: PingFangSC-Regular; + white-space: nowrap; + line-height: 18px; + margin-left: 18px; + margin-right: 16px; + text-align: center; +} +.left_down_content { + height: 160px; + /* padding-bottom: 5px; */ +} +.right_down_content { + height: 185px; + /* padding-bottom: 5px; */ +} +/* 滚动表格部分 */ +.dv-scroll-board .header .header-item, +.dv-scroll-board .rows .ceil { + border-right: 1px solid #0d1728; +} +.dv-scroll-board .header .header-item:last-child, +.dv-scroll-board .rows .ceil:last-child { + border-right: none; + border: none; +} +/* chart图部分 */ +.luoyang-chart-tooltip { + background: #0a2b4f77 !important; + border: none !important; + backdrop-filter: blur(12px); +} + +.luoyang-chart-tooltip * { + color: #fff !important; +} +/* 三维页面部分 */ +.center_up .model_name { + position: absolute; + left: 0px; + top: 0px; + z-index: 1000; +} +.center_up .model_info { + position: absolute; + left: 100px; + bottom: 0px; + z-index: 1000; + width: 841px; + height: 62px; + background: url(/public/png/lp/line_part.png) 100% no-repeat; + background-size: 100% 100%; +} +.center_up .model_info .reset_btn { + position: absolute; + top: 20px; + left: 40px; + width: 140px; + height: 40px; + cursor: pointer; +} +.center_up .model_info .title { + display: inline-block; + width: 361px; + text-align: center; + font-size: 32px; + color: #fff; + letter-spacing: 5px; + position: absolute; + left: 241px; + bottom: 10px; +} +.center_up .eq_detail_info { + position: absolute; + right: 0px; + bottom: 0px; + z-index: 1002; + width: 240px; + height: 110px; + background: url(/public/png/lp/eq_msg_detail.png) 100% no-repeat; + background-size: 100% 100%; + color: #fff; + padding: 15px 0 0 15px; +} +.center_up .eq_detail_info .left_name { + display: inline-block; + width: 95px; + height: 28px; + text-align: right; + font-size: 18px; +} +.center_up .eq_detail_info .right_value { + display: inline-block; + height: 28px; + font-size: 18px; +} +.center_up .eq_info { + position: absolute; + z-index: 1002; + background: url(/public/png/lp/eq_msg_always.png) 100% no-repeat; + background-size: 100% 100%; + color: #fff; + padding: 10px 15px; +} +.center_up .eq_info .eq_info_inner { + height: 24px; + font-size: 17px; + white-space: nowrap; +} diff --git a/src/page/LinePage4-1/index.tsx b/src/page/LinePage4-1/index.tsx new file mode 100644 index 0000000..daf9389 --- /dev/null +++ b/src/page/LinePage4-1/index.tsx @@ -0,0 +1,18 @@ +import React from "react"; +import TopP from "./TopP"; +import Left from "./Left"; +import Right from "./Right"; +import Center from "./Center"; +function LinePage() { + return ( + + +
+ +
+ +
+
+ ); +} +export default LinePage; diff --git a/src/page/LinePage4-2/Center/CenterDown.tsx b/src/page/LinePage4-2/Center/CenterDown.tsx new file mode 100644 index 0000000..6c54410 --- /dev/null +++ b/src/page/LinePage4-2/Center/CenterDown.tsx @@ -0,0 +1,214 @@ +import ReactECharts from "echarts-for-react"; +import TitleBox from "../Component/TitleBox"; +import ScrollBoard from "./../../Component/ScrollBoard"; +import SwitchButton from "../Component/SwitchButton"; +import { useState } from "react"; +import getOptions from "../../Component/LineChart/chart.config"; +import {useAppSelector} from "./../../../store/hooks" +import {selectLine4After} from "./../../../store/LinePageSlice" +import moment from "moment"; +function CenterDown() { + const data = useAppSelector(selectLine4After); + // 假数据 + const dataSource = { + day: { + xData:[], + series: [] as { name: string; type: string; symbol: string; symbolSize: number; data: never[]; }[], + }, + week: { + xData:[], + series: [] as { name: string; type: string; symbol: string; symbolSize: number; data: never[]; }[], + }, + month: { + xData:[], + series: [] as { name: string; type: string; symbol: string; symbolSize: number; data: never[]; }[], + }, + }; + const nameList = [ + { name: "天", ename: "day" }, + { name: "周", ename: "week" }, + { name: "月", ename: "month" }, + ]; + const [activeName, setActiveName] = useState(nameList[0].ename); + const handleButtonChange = (activeName: string) => { + setActiveName(activeName); + }; + const config = { + header: ["序号", "报警时间", "报警设备", "报警内容"], + headerHeight: 36, + rowNum: 6, + align: ["center", "left", "left", "left"], + headerBGC: "rgba(79, 114, 136, 0.3)", + oddRowBGC: "rgba(79, 114, 136, 0.3)", + evenRowBGC: "rgba(76, 97, 123, 0.1)", + columnWidth: [80, 137, 137, 137], + data: [] + }; + // 报警数据 + let arr:any = [] + let sumAlarm = 0 + // @ts-ignore + if (data.alarms && data.alarms.length > 0) { + // @ts-ignore + sumAlarm = data.alarms.length + // @ts-ignore + data.alarms.map((item,index) => { + let arrInner = [] + arrInner.push( + index+1, + moment(item.recTime).format("YYYY/MM/DD HH:mm"), + item.name, + item.status === '故障'?"故障":"离线", + ); + arr.push(arrInner) + }); + } + config.data = arr + // 产线成品率 + // @ts-ignore + if (data.todayProductionRates && Object.keys(data.todayProductionRates).length > 0) { + // @ts-ignore + let keys = Object.keys(data.todayProductionRates) + // @ts-ignore + data.todayProductionRates[keys[0]].map((item,index)=>{ + // @ts-ignore + dataSource.day.xData.push(moment(item.recTime).format("HH:mm")) + }) + keys.map((item,index)=>{ + let obj = { + name: "", + type: "line", + symbol: "circle", + symbolSize: 4, + data:[] + } + // @ts-ignore + obj.name = data.todayProductionRates[item][0].lineName + // @ts-ignore + data.todayProductionRates[item].map((subItem,index)=>{ + // @ts-ignore + obj.data.push(subItem.passRate) + }) + dataSource.day.series.push(obj) + }) + }else{ + dataSource.day.xData = [] + dataSource.day.series = [] + } + // @ts-ignore + if (data.weekProductionRates && Object.keys(data.weekProductionRates).length > 0) { + // @ts-ignore + let keys = Object.keys(data.weekProductionRates) + // @ts-ignore + data.weekProductionRates[keys[0]].map((item,index)=>{ + // @ts-ignore + dataSource.week.xData.push(moment(item.recTime).format("HH:mm")) + }) + keys.map((item,index)=>{ + let obj = { + name: "", + type: "line", + symbol: "circle", + symbolSize: 4, + data:[] + } + // @ts-ignore + obj.name = data.weekProductionRates[item][0].lineName + // @ts-ignore + data.weekProductionRates[item].map((subItem,index)=>{ + // @ts-ignore + obj.data.push(subItem.passRate) + }) + dataSource.week.series.push(obj) + }) + }else{ + dataSource.week.xData = [] + dataSource.week.series = [] + } + // @ts-ignore + if (data.monthProductionRates && Object.keys(data.monthProductionRates).length > 0) { + // @ts-ignore + let keys = Object.keys(data.monthProductionRates) + // @ts-ignore + data.monthProductionRates[keys[0]].map((item,index)=>{ + // @ts-ignore + dataSource.month.xData.push(moment(item.recTime).format("HH:mm")) + }) + keys.map((item,index)=>{ + let obj = { + name: "", + type: "line", + symbol: "circle", + symbolSize: 4, + data:[] + } + // @ts-ignore + obj.name = data.monthProductionRates[item][0].lineName + // @ts-ignore + data.monthProductionRates[item].map((subItem,index)=>{ + // @ts-ignore + obj.data.push(subItem.passRate) + }) + dataSource.month.series.push(obj) + }) + }else{ + dataSource.month.xData = [] + dataSource.month.series = [] + } + let chartData = (dataSource as { [key: string]: any })[activeName]; + console.log('???????????',chartData) + const options = getOptions(chartData); + return ( +
+
+ + — 报警总数 — +
{sumAlarm}
+
+ {arr.length>0?:(

+ 暂无数据 +

)} +
+
+ {/* 产线成品率 */} +
+ +
+ +
+ {chartData.xData.length>0 && ( +
+ {} +
+ )} + {chartData.xData.length==0 && ( +

+ 暂无数据 +

+ )} +
+
+ ); +} +export default CenterDown; diff --git a/src/page/LinePage4-2/Center/CenterUp.tsx b/src/page/LinePage4-2/Center/CenterUp.tsx new file mode 100644 index 0000000..eab4e77 --- /dev/null +++ b/src/page/LinePage4-2/Center/CenterUp.tsx @@ -0,0 +1,10 @@ +import LinePageBabylon from "../../../babylonjs/LinePageBabylon"; +function CenterUp() { + const lineID = "4-2"; + return ( +
+ +
+ ); +} +export default CenterUp; diff --git a/src/page/LinePage4-2/Center/index.tsx b/src/page/LinePage4-2/Center/index.tsx new file mode 100644 index 0000000..14d5036 --- /dev/null +++ b/src/page/LinePage4-2/Center/index.tsx @@ -0,0 +1,12 @@ +import CenterDown from "./CenterDown"; +import CenterUp from "./CenterUp"; + +function Center() { + return ( +
+ + +
+ ); +} +export default Center; diff --git a/src/page/LinePage4-2/Component/SwitchButton/index.css b/src/page/LinePage4-2/Component/SwitchButton/index.css new file mode 100644 index 0000000..604d81a --- /dev/null +++ b/src/page/LinePage4-2/Component/SwitchButton/index.css @@ -0,0 +1,19 @@ +.switch-button { + height: 33px; +} +.switch-button button { + color: #fff; + font-size: 18px; + padding: 4px 10px; + background-color: rgba(49, 135, 140, 0.3); + cursor: pointer; +} +.switch-button button:first-child { + border-radius: 5px 0 0 5px; +} +.switch-button button:last-child { + border-radius: 0 5px 5px 0; +} +.switch-button button.active { + background-color: rgba(86, 244, 231, 0.7); +} diff --git a/src/page/LinePage4-2/Component/SwitchButton/index.tsx b/src/page/LinePage4-2/Component/SwitchButton/index.tsx new file mode 100644 index 0000000..9209c06 --- /dev/null +++ b/src/page/LinePage4-2/Component/SwitchButton/index.tsx @@ -0,0 +1,65 @@ +import { useEffect, useState } from "react"; +import "./index.css"; +interface Name { + name: string; + ename: string; +} +interface nameListProps { + nameList: Name[]; + onChange: (value: string) => void; +} +function createActiveNameUpdater(nameList: any, activeName: string) { + let activeIndex = nameList.findIndex((obj: any) => obj.name === activeName); + + return function updateActiveName() { + activeIndex = (activeIndex + 1) % nameList.length; + return nameList[activeIndex].ename; + }; +} +function SwitchButton(props: nameListProps) { + const [activeName, setActiveName] = useState(props.nameList[0].ename); + const [timerId, setTimerId] = useState(null); + let updateActiveName = createActiveNameUpdater(props.nameList, activeName); + useEffect(() => { + const timer = setInterval(() => { + let active = updateActiveName(); + setActiveName(active); + props.onChange(active); + }, 60000); + setTimerId(timer); + return () => { + if (timerId !== null) { + clearInterval(timerId); + } + }; + }, [props.nameList.length]); + const btnClick = (ename: string) => { + if (timerId !== null) { + clearInterval(timerId); + } + setActiveName(ename); + props.onChange(ename); // 通知父组件 + const newTimer = setInterval(() => { + let active = updateActiveName(); + setActiveName(active); + props.onChange(active); + }, 60000); + setTimerId(newTimer); + }; + return ( +
+ {props.nameList.map((item, index) => { + return ( + + ); + })} +
+ ); +} +export default SwitchButton; diff --git a/src/page/LinePage4-2/Component/TitleBox/index.css b/src/page/LinePage4-2/Component/TitleBox/index.css new file mode 100644 index 0000000..3ae06db --- /dev/null +++ b/src/page/LinePage4-2/Component/TitleBox/index.css @@ -0,0 +1,13 @@ +.title_box { + font-size: 24px; + color: #52fff1; + padding: 10px 0 0 15px; +} +.title_box img { + width: 33px; + height: 33px; + vertical-align: bottom; + margin-right: 3px; + position: relative; + top: 3px; +} diff --git a/src/page/LinePage4-2/Component/TitleBox/index.tsx b/src/page/LinePage4-2/Component/TitleBox/index.tsx new file mode 100644 index 0000000..dd43a66 --- /dev/null +++ b/src/page/LinePage4-2/Component/TitleBox/index.tsx @@ -0,0 +1,53 @@ +import Defect from "./../../assets/icon/defect.png"; +import Alarm from "./../../assets/icon/alarm.png"; +import Finished from "./../../assets/icon/finished.png"; +import InputAndOutput from "./../../assets/icon/inputAndOutput.png"; +import Num from "./../../assets/icon/num.png"; +import Record from "./../../assets/icon/record.png"; +import "./index.css"; +interface titleProps { + title: string; +} +function TitleBox(props: titleProps) { + const filteredTitles = () => { + switch (props.title) { + case "left_up": + return { + img: Defect, + title: "产线报废汇总", + }; + case "left_down": + return { + img: Record, + title: "当前产线报废情况", + }; + case "center_down_left": + return { + img: Alarm, + title: "异常报警", + }; + case "center_down_right": + return { + img: Finished, + title: "产线成品率", + }; + case "right_up": + return { + img: Num, + title: "各产线总投入和产出", + }; + default: + return { + img: InputAndOutput, + title: "当前产线投入和产出", + }; + } + }; + return ( +
+ title + {filteredTitles().title} +
+ ); +} +export default TitleBox; diff --git a/src/page/LinePage4-2/Left/LeftDown.tsx b/src/page/LinePage4-2/Left/LeftDown.tsx new file mode 100644 index 0000000..ad3c553 --- /dev/null +++ b/src/page/LinePage4-2/Left/LeftDown.tsx @@ -0,0 +1,245 @@ +import ReactECharts from "echarts-for-react"; +import TitleBox from "../Component/TitleBox"; +import SwitchButton from "../Component/SwitchButton"; +import ScrollBoard from "./../../Component/ScrollBoard"; +import { useState } from "react"; +import getOptions from "../../Component/BarChart/chart.config"; +import {useAppSelector} from "./../../../store/hooks" +import {selectLine4After} from "./../../../store/LinePageSlice" +function LeftDown() { + const data = useAppSelector(selectLine4After); + // console.log('页面数据:',data) + const nameList = [ + { name: "表单", ename: "table" }, + { name: "柱状", ename: "chart" }, + ]; + const [activeName, setActiveName] = useState(nameList[0].ename); + const handleButtonChange = (activeName: string) => { + setActiveName(activeName); + }; + const configDay = { + header: ["序号", "工序类型", "报废数量"], + headerHeight: 30, + rowNum: 4, + align: ["center", "left", "left"], + headerBGC: "rgba(79, 114, 136, 0.3)", + oddRowBGC: "rgba(79, 114, 136, 0.3)", + evenRowBGC: "rgba(76, 97, 123, 0.1)", + columnWidth: [73, 117, 190], + data: [ + ["1", "磨边后", 224], + ["2", "包装1", 322], + ["3", "包装2", 66], + ], + }; + const configWeek = { + header: ["序号", "工序类型", "报废数量"], + headerHeight: 30, + rowNum: 4, + align: ["center", "left", "left"], + headerBGC: "rgba(79, 114, 136, 0.3)", + oddRowBGC: "rgba(79, 114, 136, 0.3)", + evenRowBGC: "rgba(76, 97, 123, 0.1)", + columnWidth: [73, 117, 190], + data: [ + ["1", "磨边后", 1119], + ["2", "包装1", 1798], + ["3", "包装2", 435], + ], + }; + const configMonth = { + header: ["序号", "工序类型", "报废数量"], + headerHeight: 30, + rowNum: 4, + align: ["center", "left", "left"], + headerBGC: "rgba(79, 114, 136, 0.3)", + oddRowBGC: "rgba(79, 114, 136, 0.3)", + evenRowBGC: "rgba(76, 97, 123, 0.1)", + columnWidth: [73, 117, 190], + data: [ + ["1", "磨边后", 5004], + ["2", "包装1", 9122], + ["3", "包装2", 1924], + ], + }; + const color1 = ["#9DD5FF", "#1295FF"]; + const color2 = ["#85F6E9", "#2EC6B4"]; + // @ts-ignore + let xData: string[] = data.scrapBars + let dataProps1: number[] = []; + let dataProps2: number[] = []; + let dataProps3: number[] = []; + let arr1: any = []; + let arr2: any = []; + let arr3: any = []; + // @ts-ignore + if (data.todayProductionScraps && data.todayProductionScraps.length > 0) { + // @ts-ignore + data.todayProductionScraps.map((item,index)=>{ + let arrInner = []; + arrInner.push(index+1,item.sectionName,item.scrapNum); + arr1.push(arrInner); + dataProps1.push(item.scrapNum); + }) + }else{ + dataProps1 = [] + } + // @ts-ignore + if (data.weekProductionScraps && data.weekProductionScraps.length > 0) { + // @ts-ignore + data.weekProductionScraps.map((item,index)=>{ + let arrInner = []; + arrInner.push(index+1,item.sectionName,item.scrapNum); + arr2.push(arrInner); + dataProps2.push(item.scrapNum); + }) + }else{ + dataProps2 = [] + } + // @ts-ignore + if (data.monthProductionScraps && data.monthProductionScraps.length > 0) { + // @ts-ignore + data.monthProductionScraps.map((item,index)=>{ + let arrInner = []; + arrInner.push(index+1,item.sectionName,item.scrapNum); + arr3.push(arrInner); + dataProps3.push(item.scrapNum); + }) + }else{ + dataProps3 = [] + } + configDay.data = arr1; + configWeek.data = arr2; + configMonth.data = arr3; + const options1 = getOptions(dataProps1,xData, color1); + const options2 = getOptions(dataProps2,xData, color2); + const options3 = getOptions(dataProps3,xData, color1); + return ( +
+ +
+ +
+
+
+
+ 当天 +
+
+
+ {activeName === "table" ? ( + arr1.length > 0 ? :(

+ 暂无数据 +

) + ) : dataProps1.length>0 ? ( + + ) : ( +

+ 暂无数据 +

+ )} +
+
+
+ 本周 +
+
+
+ {activeName === "table" ? ( + arr2.length > 0 ? :(

+ 暂无数据 +

) + ) : dataProps2.length>0 ? ( + + ) : ( +

+ 暂无数据 +

+ )} +
+
+
+ 本月 +
+
+
+ {activeName === "table" ? ( + arr3.length > 0 ? :(

+ 暂无数据 +

) + ) : dataProps3.length>0 ? ( + + ) : ( +

+ 暂无数据 +

+ )} +
+
+
+ ); +} +export default LeftDown; diff --git a/src/page/LinePage4-2/Left/LeftUp.tsx b/src/page/LinePage4-2/Left/LeftUp.tsx new file mode 100644 index 0000000..54473c3 --- /dev/null +++ b/src/page/LinePage4-2/Left/LeftUp.tsx @@ -0,0 +1,229 @@ +import ReactECharts from "echarts-for-react"; +import TitleBox from "../Component/TitleBox"; +import SwitchButton from "../Component/SwitchButton"; +import getOptions from "../../Component/SummaryBarChart/chart.config"; +import { useState } from "react"; +import {useAppSelector} from "./../../../store/hooks" +import {selectLine4After} from "./../../../store/LinePageSlice" +function LeftUp() { + const data = useAppSelector(selectLine4After); + // 假数据 + const dataSource = { + day: { + xData: [], + series: [] as { data: number[]; type: string; stack: string; name: any; barWidth?: number; label: { show: boolean; position: string; color: string;formatter?:any }; }[], + }, + week: { + xData: [], + series: [] as { data: number[]; type: string; stack: string; name: any; barWidth?: number; label: { show: boolean; position: string; color: string;formatter?:any }; }[], + }, + month: { + xData: [], + series: [] as { data: number[]; type: string; stack: string; name: any; barWidth?: number; label: { show: boolean; position: string; color: string;formatter?:any }; }[], + }, + }; + const nameList = [ + { name: "天", ename: "day" }, + { name: "周", ename: "week" }, + { name: "月", ename: "month" }, + ]; + const [activeName, setActiveName] = useState(nameList[0].ename); + let chartData = (dataSource as { [key: string]: any })[activeName]; + const handleButtonChange = (activeName: string) => { + setActiveName(activeName); + }; + console.log('',chartData) + // @ts-ignore + if (data.todayAllProductionScraps && Object.keys(data.todayAllProductionScraps).length > 0) { + let sum: number[] = []; + // 生成obj + // @ts-ignore + data.scrapBars.map((item,index) => { + let obj = { + data: [], + type: "bar", + stack: "a", + name: item, + barWidth: 14, + label: { + show: true, + position: "right", + color: "inherit", + }, + } + dataSource.day.series.push(obj) + }) + // @ts-ignore + dataSource.day.xData = Object.keys(data.todayAllProductionScraps) + dataSource.day.xData.map((item,index)=>{ + let sumIner = 0 + // @ts-ignore + data.todayAllProductionScraps[item].map((itemInner,indexInner)=>{ + sumIner += itemInner.scrapNum + dataSource.day.series.map((itemSeries,indexSeries)=>{ + // @ts-ignore + if (itemSeries.name === itemInner.sectionName) { + // @ts-ignore + itemSeries.data.push(itemInner.scrapNum) + } + }) + }) + sum.push(sumIner) + }) + dataSource.day.series.push({ + data: sum, + type: "bar", + stack: "a", + name: "", + label: { + show: true, + position: "top", + color: "#fff", + formatter: function (params: any) { + return sum[params.dataIndex]; + }, + }, + }) + }else{ + dataSource.day.xData = [] + dataSource.day.series = [] + } + // @ts-ignore + if (data.weekAllProductionScraps && Object.keys(data.weekAllProductionScraps).length > 0) { + let sum: number[] = []; + // 生成obj + // @ts-ignore + data.scrapBars.map((item,index) => { + let obj = { + data: [], + type: "bar", + stack: "a", + name: item, + barWidth: 14, + label: { + show: true, + position: "right", + color: "inherit", + }, + } + dataSource.week.series.push(obj) + }) + // @ts-ignore + dataSource.week.xData = Object.keys(data.weekAllProductionScraps) + dataSource.week.xData.map((item,index)=>{ + let sumIner = 0 + // @ts-ignore + data.weekAllProductionScraps[item].map((itemInner,indexInner)=>{ + sumIner += itemInner.scrapNum + dataSource.week.series.map((itemSeries,indexSeries)=>{ + // @ts-ignore + if (itemSeries.name === itemInner.sectionName) { + // @ts-ignore + itemSeries.data.push(itemInner.scrapNum) + } + }) + }) + sum.push(sumIner) + }) + dataSource.week.series.push({ + data: sum, + type: "bar", + stack: "a", + name: "", + label: { + show: true, + position: "top", + color: "#fff", + formatter: function (params: any) { + return sum[params.dataIndex]; + }, + }, + }) + }else{ + dataSource.week.xData = [] + dataSource.week.series = [] + } + // @ts-ignore + if (data.monthAllProductionScraps && Object.keys(data.monthAllProductionScraps).length > 0) { + let sum: number[] = []; + // 生成obj + // @ts-ignore + data.scrapBars.map((item,index) => { + let obj = { + data: [], + type: "bar", + stack: "a", + name: item, + barWidth: 14, + label: { + show: true, + position: "right", + color: "inherit", + }, + } + dataSource.month.series.push(obj) + }) + // @ts-ignore + dataSource.month.xData = Object.keys(data.monthAllProductionScraps) + dataSource.month.xData.map((item,index)=>{ + let sumIner = 0 + // @ts-ignore + data.monthAllProductionScraps[item].map((itemInner,indexInner)=>{ + sumIner += itemInner.scrapNum + dataSource.month.series.map((itemSeries,indexSeries)=>{ + // @ts-ignore + if (itemSeries.name === itemInner.sectionName) { + // @ts-ignore + itemSeries.data.push(itemInner.scrapNum) + } + }) + }) + sum.push(sumIner) + }) + dataSource.month.series.push({ + data: sum, + type: "bar", + stack: "a", + name: "", + label: { + show: true, + position: "top", + color: "#fff", + formatter: function (params: any) { + return sum[params.dataIndex]; + }, + }, + }) + }else{ + dataSource.month.xData = [] + dataSource.month.series = [] + } + const options = getOptions(chartData); + return ( +
+ +
+ +
+ {// @ts-ignore + dataSource[activeName].xData.length>0 ? ( +
+ {} +
+ ):( +

+ 暂无数据 +

+ )} +
+ ); +} +export default LeftUp; diff --git a/src/page/LinePage4-2/Left/index.tsx b/src/page/LinePage4-2/Left/index.tsx new file mode 100644 index 0000000..6524b82 --- /dev/null +++ b/src/page/LinePage4-2/Left/index.tsx @@ -0,0 +1,11 @@ +import LeftUp from "./LeftUp"; +import LeftDown from "./LeftDown"; +function Left() { + return ( +
+ + +
+ ); +} +export default Left; diff --git a/src/page/LinePage4-2/Right/RightDown.tsx b/src/page/LinePage4-2/Right/RightDown.tsx new file mode 100644 index 0000000..45afc20 --- /dev/null +++ b/src/page/LinePage4-2/Right/RightDown.tsx @@ -0,0 +1,273 @@ +import ReactECharts from "echarts-for-react"; +import TitleBox from "../Component/TitleBox"; +import SwitchButton from "../Component/SwitchButton"; +import ScrollBoard from "./../../Component/ScrollBoard"; +import { useState } from "react"; +import getOptions from "../../Component/LineChartRight/chart.config"; +import {useAppSelector} from "./../../../store/hooks" +import {selectLine4After} from "./../../../store/LinePageSlice" +import moment from "moment"; +function RightDown() { + const data = useAppSelector(selectLine4After); + // console.log('页面数据:',data) + // 假数据 + let tempData = [ + { + type: "day", + data: { + time: [] as string[], + input: [] as number[], + output: [] as number[], + }, + }, + { + type: "week", + data: { + time: [] as string[], + input: [] as number[], + output: [] as number[], + }, + }, + { + type: "month", + data: { + time: [] as string[], + input: [] as number[], + output: [] as number[], + }, + }, + ]; + const nameList = [ + { name: "表单", ename: "table" }, + { name: "折线", ename: "chart" }, + ]; + const [activeName, setActiveName] = useState(nameList[0].ename); + const handleButtonChange = (activeName: string) => { + setActiveName(activeName); + }; + const configDay = { + header: ["时间", "投入数量", "产出数量"], + headerHeight: 30, + rowNum: 5, + headerBGC: "rgba(79, 114, 136, 0.3)", + oddRowBGC: "rgba(79, 114, 136, 0.3)", + evenRowBGC: "rgba(76, 97, 123, 0.1)", + columnWidth: [120, 130, 130], + data: [], + }; + const configWeek = { + header: ["时间", "投入数量", "产出数量"], + headerHeight: 30, + rowNum: 5, + headerBGC: "rgba(79, 114, 136, 0.3)", + oddRowBGC: "rgba(79, 114, 136, 0.3)", + evenRowBGC: "rgba(76, 97, 123, 0.1)", + columnWidth: [120, 130, 130], + data: [], + }; + const configMonth = { + header: ["时间", "投入数量", "产出数量"], + headerHeight: 30, + rowNum: 5, + headerBGC: "rgba(79, 114, 136, 0.3)", + oddRowBGC: "rgba(79, 114, 136, 0.3)", + evenRowBGC: "rgba(76, 97, 123, 0.1)", + columnWidth: [120, 130, 130], + data: [], + }; + let arr1: any = []; + let arr2: any = []; + let arr3: any = []; + // @ts-ignore + if (data.todayProductionDets && data.todayProductionDets.length > 0) { + // @ts-ignore + data.todayProductionDets.map((item,index)=>{ + let arrInner = []; + arrInner.push(moment(item.recTime).format("HH:mm"),item.inputNum,item.outputNum); + arr1.push(arrInner); + tempData[0].data.time.push(moment(item.recTime).format("HH:mm")); + tempData[0].data.input.push(item.inputNum); + tempData[0].data.output.push(item.outputNum); + }) + }else{ + tempData[0].data.time = [] + tempData[0].data.input = [] + tempData[0].data.output = [] + } + // @ts-ignore + if (data.weekProductionDets && data.weekProductionDets.length > 0) { + // @ts-ignore + data.weekProductionDets.map((item,index)=>{ + let arrInner = []; + arrInner.push(moment(item.recTime).format("YYYY/MM/DD"),item.inputNum,item.outputNum); + arr2.push(arrInner); + tempData[1].data.time.push(moment(item.recTime).format("HH:mm")); + tempData[1].data.input.push(item.inputNum); + tempData[1].data.output.push(item.outputNum); + }) + }else{ + tempData[1].data.time = [] + tempData[1].data.input = [] + tempData[1].data.output = [] + } + // @ts-ignore + if (data.monthProductionDets && data.monthProductionDets.length > 0) { + // @ts-ignore + data.monthProductionDets.map((item,index)=>{ + let arrInner = []; + arrInner.push(moment(item.recTime).format("YYYY/MM/DD"),item.inputNum,item.outputNum); + arr3.push(arrInner); + tempData[2].data.time.push(moment(item.recTime).format("HH:mm")); + tempData[2].data.input.push(item.inputNum); + tempData[2].data.output.push(item.outputNum); + }) + }else{ + tempData[2].data.time = [] + tempData[2].data.input = [] + tempData[2].data.output = [] + } + configDay.data = arr1; + configWeek.data = arr2; + configMonth.data = arr3; + + const chartData1 = tempData[0].data; + const chartData2 = tempData[1].data; + const chartData3 = tempData[2].data; + const options1 = getOptions(chartData1); + const options2 = getOptions(chartData2); + const options3 = getOptions(chartData3); + return ( +
+ +
+ +
+
+
+
+ 当天 +
+
+
+ {activeName === "table" ? ( + arr1.length>0?:( +

+ 暂无数据 +

+ ) + ) : tempData[0].data.time.length>0 ? ( + + ) : ( +

+ 暂无数据 +

+ )} +
+
+
+ 本周 +
+
+
+ {activeName === "table" ? ( + arr2.length>0?:( +

+ 暂无数据 +

+ ) + ) : tempData[1].data.time.length>0 ? ( + + ) : ( +

+ 暂无数据 +

+ )} +
+
+
+ 本月 +
+
+
+ {activeName === "table" ? ( + arr3.length>0?:( +

+ 暂无数据 +

+ ) + ) : tempData[2].data.time.length>0 ? ( + + ) : ( +

+ 暂无数据 +

+ )} +
+
+
+ ); +} +export default RightDown; diff --git a/src/page/LinePage4-2/Right/RightUp.tsx b/src/page/LinePage4-2/Right/RightUp.tsx new file mode 100644 index 0000000..a13347c --- /dev/null +++ b/src/page/LinePage4-2/Right/RightUp.tsx @@ -0,0 +1,52 @@ +import TitleBox from "../Component/TitleBox"; +import ScrollBoard from "./../../Component/ScrollBoard"; +import {useAppSelector} from "./../../../store/hooks" +import {selectLine4After} from "./../../../store/LinePageSlice" +function RightUp() { + const data = useAppSelector(selectLine4After); + const config = { + header: ["序号", "产线", "上片数据量", "成品下片数量"], + headerHeight: 32, + rowNum: 5, + align: ["center", "left", "left", "left"], + headerBGC: "rgba(79, 114, 136, 0.3)", + oddRowBGC: "rgba(79, 114, 136, 0.3)", + evenRowBGC: "rgba(76, 97, 123, 0.1)", + columnWidth: [70, 90, 106, 114], + data: [], + }; + let arr:any = [] + // @ts-ignore + if (data.sumProductionDets && data.sumProductionDets.length > 0) { + // @ts-ignore + data.sumProductionDets.map((item, index) => { + let arrInner = [] + arrInner.push(index + 1, item.lineName, item.inputNum, item.outputNum) + arr.push(arrInner) + }) + } + config.data = arr + return ( +
+ +
+ {arr.length>0?:(

+ 暂无数据 +

)} +
+
+ ); +} +export default RightUp; diff --git a/src/page/LinePage4-2/Right/index.tsx b/src/page/LinePage4-2/Right/index.tsx new file mode 100644 index 0000000..53c802a --- /dev/null +++ b/src/page/LinePage4-2/Right/index.tsx @@ -0,0 +1,12 @@ +import RightDown from "./RightDown"; +import RightUp from "./RightUp"; + +function Right() { + return ( +
+ + +
+ ); +} +export default Right; diff --git a/src/page/LinePage4-2/TopP.tsx b/src/page/LinePage4-2/TopP.tsx new file mode 100644 index 0000000..e7c7a64 --- /dev/null +++ b/src/page/LinePage4-2/TopP.tsx @@ -0,0 +1,14 @@ +import '../../lanhuapp/common.css'; +import "./index.css"; + +function TopP() { + return ( +
+
+
+
+
+ ); +} + +export default TopP; \ No newline at end of file diff --git a/src/page/LinePage4-2/assets/icon/alarm.png b/src/page/LinePage4-2/assets/icon/alarm.png new file mode 100644 index 0000000..eb335f3 Binary files /dev/null and b/src/page/LinePage4-2/assets/icon/alarm.png differ diff --git a/src/page/LinePage4-2/assets/icon/defect.png b/src/page/LinePage4-2/assets/icon/defect.png new file mode 100644 index 0000000..76ed17c Binary files /dev/null and b/src/page/LinePage4-2/assets/icon/defect.png differ diff --git a/src/page/LinePage4-2/assets/icon/finished.png b/src/page/LinePage4-2/assets/icon/finished.png new file mode 100644 index 0000000..99b411b Binary files /dev/null and b/src/page/LinePage4-2/assets/icon/finished.png differ diff --git a/src/page/LinePage4-2/assets/icon/g.png b/src/page/LinePage4-2/assets/icon/g.png new file mode 100644 index 0000000..bf1b107 Binary files /dev/null and b/src/page/LinePage4-2/assets/icon/g.png differ diff --git a/src/page/LinePage4-2/assets/icon/inputAndOutput.png b/src/page/LinePage4-2/assets/icon/inputAndOutput.png new file mode 100644 index 0000000..113ed13 Binary files /dev/null and b/src/page/LinePage4-2/assets/icon/inputAndOutput.png differ diff --git a/src/page/LinePage4-2/assets/icon/num.png b/src/page/LinePage4-2/assets/icon/num.png new file mode 100644 index 0000000..e77c409 Binary files /dev/null and b/src/page/LinePage4-2/assets/icon/num.png differ diff --git a/src/page/LinePage4-2/assets/icon/r.png b/src/page/LinePage4-2/assets/icon/r.png new file mode 100644 index 0000000..d11591e Binary files /dev/null and b/src/page/LinePage4-2/assets/icon/r.png differ diff --git a/src/page/LinePage4-2/assets/icon/record.png b/src/page/LinePage4-2/assets/icon/record.png new file mode 100644 index 0000000..4622f01 Binary files /dev/null and b/src/page/LinePage4-2/assets/icon/record.png differ diff --git a/src/page/LinePage4-2/assets/icon/y.png b/src/page/LinePage4-2/assets/icon/y.png new file mode 100644 index 0000000..72c796a Binary files /dev/null and b/src/page/LinePage4-2/assets/icon/y.png differ diff --git a/src/page/LinePage4-2/index.css b/src/page/LinePage4-2/index.css new file mode 100644 index 0000000..1a28491 --- /dev/null +++ b/src/page/LinePage4-2/index.css @@ -0,0 +1,264 @@ +/* 顶部 */ +.block_top { + width: 1920px; + height: 94px; + background: url(/public/svg/topback.svg) 100% no-repeat; + background-size: 100% 100%; + opacity: 1; + display: flex; + justify-content: center; +} + +.block_top_title { + width: 651px; + height: 77px; + background: url(/public/png/topTiltle.png) 100% no-repeat; + background-size: 100% 100%; + margin-top: 18px; +} +/* 中部 */ +.block_bottom { + width: 1920px; + height: 966px; + padding-top: 20px; +} + +.group_left { + width: 402px; + height: 966px; + margin: 0 0 0 24px; +} + +.group_center { + width: 1041px; + height: 966px; + margin: 0 0 0 15px; +} + +.group_right { + width: 401px; + height: 966px; + margin-left: 15px; +} + +.left_up { + width: 402px; + height: 332px; + background: url(../../../public/png/rect/lp_left_up.png) no-repeat; + background-size: 100% 100%; + background-position: 0 0; + position: relative; +} +.left_down { + width: 402px; + height: 599px; + background: url(../../../public/png/rect/lp_left_down.png) no-repeat; + background-size: 100% 100%; + background-position: 0 0; + margin-top: 14px; + position: relative; +} +.center_up { + width: 1041px; + height: 562px; + background: url(../../../public/png/rect/lp_center_up.png) no-repeat; + background-size: 100% 100%; + background-position: 0 0; + position: relative; +} +.center_down { + width: 1041px; + height: 368px; + margin-top: 17px; +} +.center_down_inner { + width: 513px; + height: 366px; + background: url(../../../public/png/rect/lp_center_down.png) no-repeat; + background-size: 100% 100%; + background-position: 0 0; + position: relative; +} +.center_down .left-box { + margin-right: 15px; + position: relative; +} +.center_down .left-box .alarm_num_title { + position: absolute; + left: 220px; + top: 22px; + font-size: 13px; + letter-spacing: 3px; + color: #fff; +} +.center_down .left-box .alarm_num { + color: #52fff1; + font-size: 40px; + text-align: center; + font-family: PingFangSC, PingFang SC; +} +.center_down .right_box .chart_box { + width: 100%; + height: 310px; + margin-top: 10px; +} +.right_up { + width: 401px; + height: 257px; + background: url(../../../public/png/rect/lp_right_up.png) no-repeat; + background-size: 100% 100%; + background-position: 0 0; +} +.right_down { + width: 401px; + height: 673px; + background: url(../../../public/png/rect/lp_right_down.png) no-repeat; + background-size: 100% 100%; + background-position: 0 0; + margin-top: 14px; + position: relative; +} +.left_up_switch { + position: absolute; + right: 10px; + top: 12px; +} +.left_up_chart { + height: 275px; + margin-top: 10px; +} +/* 左侧 */ +.left_down_title { + height: 18px; + justify-content: center; + margin-bottom: 4px; +} +.left_down_box1 { + width: 56px; + height: 13px; + background: url(/public/png/leftbar.png) 100% no-repeat; + background-size: 100% 100%; + margin-top: 2px; +} +.left_down_box2 { + width: 56px; + height: 13px; + background: url(/public/png/rightbar.png) 100% no-repeat; + background-size: 100% 100%; + margin: 2px 0 0 0px; +} +.left_down_text { + /*width: 40px;*/ + height: 18px; + overflow-wrap: break-word; + color: rgba(1, 207, 204, 1); + font-size: 18px; + letter-spacing: 5px; + font-family: PingFangSC-Regular; + white-space: nowrap; + line-height: 18px; + margin-left: 18px; + margin-right: 16px; + text-align: center; +} +.left_down_content { + height: 160px; + /* padding-bottom: 5px; */ +} +.right_down_content { + height: 185px; + /* padding-bottom: 5px; */ +} +/* 滚动表格部分 */ +.dv-scroll-board .header .header-item, +.dv-scroll-board .rows .ceil { + border-right: 1px solid #0d1728; +} +.dv-scroll-board .header .header-item:last-child, +.dv-scroll-board .rows .ceil:last-child { + border-right: none; + border: none; +} +/* chart图部分 */ +.luoyang-chart-tooltip { + background: #0a2b4f77 !important; + border: none !important; + backdrop-filter: blur(12px); +} + +.luoyang-chart-tooltip * { + color: #fff !important; +} +/* 三维页面部分 */ +.center_up .model_name { + position: absolute; + left: 0px; + top: 0px; + z-index: 1000; +} +.center_up .model_info { + position: absolute; + left: 100px; + bottom: 0px; + z-index: 1000; + width: 841px; + height: 62px; + background: url(/public/png/lp/line_part.png) 100% no-repeat; + background-size: 100% 100%; +} +.center_up .model_info .reset_btn { + position: absolute; + top: 20px; + left: 40px; + width: 140px; + height: 40px; + cursor: pointer; +} +.center_up .model_info .title { + display: inline-block; + width: 361px; + text-align: center; + font-size: 32px; + color: #fff; + letter-spacing: 5px; + position: absolute; + left: 241px; + bottom: 10px; +} +.center_up .eq_detail_info { + position: absolute; + right: 0px; + bottom: 0px; + z-index: 1002; + width: 240px; + height: 110px; + background: url(/public/png/lp/eq_msg_detail.png) 100% no-repeat; + background-size: 100% 100%; + color: #fff; + padding: 15px 0 0 15px; +} +.center_up .eq_detail_info .left_name { + display: inline-block; + width: 95px; + height: 28px; + text-align: right; + font-size: 18px; +} +.center_up .eq_detail_info .right_value { + display: inline-block; + height: 28px; + font-size: 18px; +} +.center_up .eq_info { + position: absolute; + z-index: 1002; + background: url(/public/png/lp/eq_msg_always.png) 100% no-repeat; + background-size: 100% 100%; + color: #fff; + padding: 10px 15px; +} +.center_up .eq_info .eq_info_inner { + height: 24px; + font-size: 17px; + white-space: nowrap; +} diff --git a/src/page/LinePage4-2/index.tsx b/src/page/LinePage4-2/index.tsx new file mode 100644 index 0000000..daf9389 --- /dev/null +++ b/src/page/LinePage4-2/index.tsx @@ -0,0 +1,18 @@ +import React from "react"; +import TopP from "./TopP"; +import Left from "./Left"; +import Right from "./Right"; +import Center from "./Center"; +function LinePage() { + return ( + + +
+ +
+ +
+
+ ); +} +export default LinePage; diff --git a/src/page/LinePage5-1/Center/CenterDown.tsx b/src/page/LinePage5-1/Center/CenterDown.tsx new file mode 100644 index 0000000..0ca2227 --- /dev/null +++ b/src/page/LinePage5-1/Center/CenterDown.tsx @@ -0,0 +1,214 @@ +import ReactECharts from "echarts-for-react"; +import TitleBox from "../Component/TitleBox"; +import ScrollBoard from "./../../Component/ScrollBoard"; +import SwitchButton from "../Component/SwitchButton"; +import { useState } from "react"; +import getOptions from "../../Component/LineChart/chart.config"; +import {useAppSelector} from "./../../../store/hooks" +import {selectLine5Before} from "./../../../store/LinePageSlice" +import moment from "moment"; +function CenterDown() { + const data = useAppSelector(selectLine5Before); + // 假数据 + const dataSource = { + day: { + xData:[], + series: [] as { name: string; type: string; symbol: string; symbolSize: number; data: never[]; }[], + }, + week: { + xData:[], + series: [] as { name: string; type: string; symbol: string; symbolSize: number; data: never[]; }[], + }, + month: { + xData:[], + series: [] as { name: string; type: string; symbol: string; symbolSize: number; data: never[]; }[], + }, + }; + const nameList = [ + { name: "天", ename: "day" }, + { name: "周", ename: "week" }, + { name: "月", ename: "month" }, + ]; + const [activeName, setActiveName] = useState(nameList[0].ename); + const handleButtonChange = (activeName: string) => { + setActiveName(activeName); + }; + const config = { + header: ["序号", "报警时间", "报警设备", "报警内容"], + headerHeight: 36, + rowNum: 6, + align: ["center", "left", "left", "left"], + headerBGC: "rgba(79, 114, 136, 0.3)", + oddRowBGC: "rgba(79, 114, 136, 0.3)", + evenRowBGC: "rgba(76, 97, 123, 0.1)", + columnWidth: [80, 137, 137, 137], + data: [] + }; + // 报警数据 + let arr:any = [] + let sumAlarm = 0 + // @ts-ignore + if (data.alarms && data.alarms.length > 0) { + // @ts-ignore + sumAlarm = data.alarms.length + // @ts-ignore + data.alarms.map((item,index) => { + let arrInner = [] + arrInner.push( + index+1, + moment(item.recTime).format("YYYY/MM/DD HH:mm"), + item.name, + item.status === '故障'?"故障":"离线", + ); + arr.push(arrInner) + }); + } + config.data = arr + // 产线成品率 + // @ts-ignore + if (data.todayProductionRates && Object.keys(data.todayProductionRates).length > 0) { + // @ts-ignore + let keys = Object.keys(data.todayProductionRates) + // @ts-ignore + data.todayProductionRates[keys[0]].map((item,index)=>{ + // @ts-ignore + dataSource.day.xData.push(moment(item.recTime).format("HH:mm")) + }) + keys.map((item,index)=>{ + let obj = { + name: "", + type: "line", + symbol: "circle", + symbolSize: 4, + data:[] + } + // @ts-ignore + obj.name = data.todayProductionRates[item][0].lineName + // @ts-ignore + data.todayProductionRates[item].map((subItem,index)=>{ + // @ts-ignore + obj.data.push(subItem.passRate) + }) + dataSource.day.series.push(obj) + }) + }else{ + dataSource.day.xData = [] + dataSource.day.series = [] + } + // @ts-ignore + if (data.weekProductionRates && Object.keys(data.weekProductionRates).length > 0) { + // @ts-ignore + let keys = Object.keys(data.weekProductionRates) + // @ts-ignore + data.weekProductionRates[keys[0]].map((item,index)=>{ + // @ts-ignore + dataSource.week.xData.push(moment(item.recTime).format("HH:mm")) + }) + keys.map((item,index)=>{ + let obj = { + name: "", + type: "line", + symbol: "circle", + symbolSize: 4, + data:[] + } + // @ts-ignore + obj.name = data.weekProductionRates[item][0].lineName + // @ts-ignore + data.weekProductionRates[item].map((subItem,index)=>{ + // @ts-ignore + obj.data.push(subItem.passRate) + }) + dataSource.week.series.push(obj) + }) + }else{ + dataSource.week.xData = [] + dataSource.week.series = [] + } + // @ts-ignore + if (data.monthProductionRates && Object.keys(data.monthProductionRates).length > 0) { + // @ts-ignore + let keys = Object.keys(data.monthProductionRates) + // @ts-ignore + data.monthProductionRates[keys[0]].map((item,index)=>{ + // @ts-ignore + dataSource.month.xData.push(moment(item.recTime).format("HH:mm")) + }) + keys.map((item,index)=>{ + let obj = { + name: "", + type: "line", + symbol: "circle", + symbolSize: 4, + data:[] + } + // @ts-ignore + obj.name = data.monthProductionRates[item][0].lineName + // @ts-ignore + data.monthProductionRates[item].map((subItem,index)=>{ + // @ts-ignore + obj.data.push(subItem.passRate) + }) + dataSource.month.series.push(obj) + }) + }else{ + dataSource.month.xData = [] + dataSource.month.series = [] + } + let chartData = (dataSource as { [key: string]: any })[activeName]; + console.log('???????????',chartData) + const options = getOptions(chartData); + return ( +
+
+ + — 报警总数 — +
{sumAlarm}
+
+ {arr.length>0?:(

+ 暂无数据 +

)} +
+
+ {/* 产线成品率 */} +
+ +
+ +
+ {chartData.xData.length>0 && ( +
+ {} +
+ )} + {chartData.xData.length==0 && ( +

+ 暂无数据 +

+ )} +
+
+ ); +} +export default CenterDown; diff --git a/src/page/LinePage5-1/Center/CenterUp.tsx b/src/page/LinePage5-1/Center/CenterUp.tsx new file mode 100644 index 0000000..08dd7b9 --- /dev/null +++ b/src/page/LinePage5-1/Center/CenterUp.tsx @@ -0,0 +1,10 @@ +import LinePageBabylon from "../../../babylonjs/LinePageBabylon"; +function CenterUp() { + const lineID = "5-1" + return ( +
+ +
+ ); +} +export default CenterUp; diff --git a/src/page/LinePage5-1/Center/index.tsx b/src/page/LinePage5-1/Center/index.tsx new file mode 100644 index 0000000..14d5036 --- /dev/null +++ b/src/page/LinePage5-1/Center/index.tsx @@ -0,0 +1,12 @@ +import CenterDown from "./CenterDown"; +import CenterUp from "./CenterUp"; + +function Center() { + return ( +
+ + +
+ ); +} +export default Center; diff --git a/src/page/LinePage5-1/Component/SwitchButton/index.css b/src/page/LinePage5-1/Component/SwitchButton/index.css new file mode 100644 index 0000000..604d81a --- /dev/null +++ b/src/page/LinePage5-1/Component/SwitchButton/index.css @@ -0,0 +1,19 @@ +.switch-button { + height: 33px; +} +.switch-button button { + color: #fff; + font-size: 18px; + padding: 4px 10px; + background-color: rgba(49, 135, 140, 0.3); + cursor: pointer; +} +.switch-button button:first-child { + border-radius: 5px 0 0 5px; +} +.switch-button button:last-child { + border-radius: 0 5px 5px 0; +} +.switch-button button.active { + background-color: rgba(86, 244, 231, 0.7); +} diff --git a/src/page/LinePage5-1/Component/SwitchButton/index.tsx b/src/page/LinePage5-1/Component/SwitchButton/index.tsx new file mode 100644 index 0000000..9209c06 --- /dev/null +++ b/src/page/LinePage5-1/Component/SwitchButton/index.tsx @@ -0,0 +1,65 @@ +import { useEffect, useState } from "react"; +import "./index.css"; +interface Name { + name: string; + ename: string; +} +interface nameListProps { + nameList: Name[]; + onChange: (value: string) => void; +} +function createActiveNameUpdater(nameList: any, activeName: string) { + let activeIndex = nameList.findIndex((obj: any) => obj.name === activeName); + + return function updateActiveName() { + activeIndex = (activeIndex + 1) % nameList.length; + return nameList[activeIndex].ename; + }; +} +function SwitchButton(props: nameListProps) { + const [activeName, setActiveName] = useState(props.nameList[0].ename); + const [timerId, setTimerId] = useState(null); + let updateActiveName = createActiveNameUpdater(props.nameList, activeName); + useEffect(() => { + const timer = setInterval(() => { + let active = updateActiveName(); + setActiveName(active); + props.onChange(active); + }, 60000); + setTimerId(timer); + return () => { + if (timerId !== null) { + clearInterval(timerId); + } + }; + }, [props.nameList.length]); + const btnClick = (ename: string) => { + if (timerId !== null) { + clearInterval(timerId); + } + setActiveName(ename); + props.onChange(ename); // 通知父组件 + const newTimer = setInterval(() => { + let active = updateActiveName(); + setActiveName(active); + props.onChange(active); + }, 60000); + setTimerId(newTimer); + }; + return ( +
+ {props.nameList.map((item, index) => { + return ( + + ); + })} +
+ ); +} +export default SwitchButton; diff --git a/src/page/LinePage5-1/Component/TitleBox/index.css b/src/page/LinePage5-1/Component/TitleBox/index.css new file mode 100644 index 0000000..3ae06db --- /dev/null +++ b/src/page/LinePage5-1/Component/TitleBox/index.css @@ -0,0 +1,13 @@ +.title_box { + font-size: 24px; + color: #52fff1; + padding: 10px 0 0 15px; +} +.title_box img { + width: 33px; + height: 33px; + vertical-align: bottom; + margin-right: 3px; + position: relative; + top: 3px; +} diff --git a/src/page/LinePage5-1/Component/TitleBox/index.tsx b/src/page/LinePage5-1/Component/TitleBox/index.tsx new file mode 100644 index 0000000..dd43a66 --- /dev/null +++ b/src/page/LinePage5-1/Component/TitleBox/index.tsx @@ -0,0 +1,53 @@ +import Defect from "./../../assets/icon/defect.png"; +import Alarm from "./../../assets/icon/alarm.png"; +import Finished from "./../../assets/icon/finished.png"; +import InputAndOutput from "./../../assets/icon/inputAndOutput.png"; +import Num from "./../../assets/icon/num.png"; +import Record from "./../../assets/icon/record.png"; +import "./index.css"; +interface titleProps { + title: string; +} +function TitleBox(props: titleProps) { + const filteredTitles = () => { + switch (props.title) { + case "left_up": + return { + img: Defect, + title: "产线报废汇总", + }; + case "left_down": + return { + img: Record, + title: "当前产线报废情况", + }; + case "center_down_left": + return { + img: Alarm, + title: "异常报警", + }; + case "center_down_right": + return { + img: Finished, + title: "产线成品率", + }; + case "right_up": + return { + img: Num, + title: "各产线总投入和产出", + }; + default: + return { + img: InputAndOutput, + title: "当前产线投入和产出", + }; + } + }; + return ( +
+ title + {filteredTitles().title} +
+ ); +} +export default TitleBox; diff --git a/src/page/LinePage5-1/Left/LeftDown.tsx b/src/page/LinePage5-1/Left/LeftDown.tsx new file mode 100644 index 0000000..a12ee94 --- /dev/null +++ b/src/page/LinePage5-1/Left/LeftDown.tsx @@ -0,0 +1,245 @@ +import ReactECharts from "echarts-for-react"; +import TitleBox from "../Component/TitleBox"; +import SwitchButton from "../Component/SwitchButton"; +import ScrollBoard from "./../../Component/ScrollBoard"; +import { useState } from "react"; +import getOptions from "../../Component/BarChart/chart.config"; +import {useAppSelector} from "./../../../store/hooks" +import {selectLine5Before} from "./../../../store/LinePageSlice" +function LeftDown() { + const data = useAppSelector(selectLine5Before); + // console.log('页面数据:',data) + const nameList = [ + { name: "表单", ename: "table" }, + { name: "柱状", ename: "chart" }, + ]; + const [activeName, setActiveName] = useState(nameList[0].ename); + const handleButtonChange = (activeName: string) => { + setActiveName(activeName); + }; + const configDay = { + header: ["序号", "工序类型", "报废数量"], + headerHeight: 30, + rowNum: 4, + align: ["center", "left", "left"], + headerBGC: "rgba(79, 114, 136, 0.3)", + oddRowBGC: "rgba(79, 114, 136, 0.3)", + evenRowBGC: "rgba(76, 97, 123, 0.1)", + columnWidth: [73, 117, 190], + data: [ + ["1", "磨边后", 224], + ["2", "包装1", 322], + ["3", "包装2", 66], + ], + }; + const configWeek = { + header: ["序号", "工序类型", "报废数量"], + headerHeight: 30, + rowNum: 4, + align: ["center", "left", "left"], + headerBGC: "rgba(79, 114, 136, 0.3)", + oddRowBGC: "rgba(79, 114, 136, 0.3)", + evenRowBGC: "rgba(76, 97, 123, 0.1)", + columnWidth: [73, 117, 190], + data: [ + ["1", "磨边后", 1119], + ["2", "包装1", 1798], + ["3", "包装2", 435], + ], + }; + const configMonth = { + header: ["序号", "工序类型", "报废数量"], + headerHeight: 30, + rowNum: 4, + align: ["center", "left", "left"], + headerBGC: "rgba(79, 114, 136, 0.3)", + oddRowBGC: "rgba(79, 114, 136, 0.3)", + evenRowBGC: "rgba(76, 97, 123, 0.1)", + columnWidth: [73, 117, 190], + data: [ + ["1", "磨边后", 5004], + ["2", "包装1", 9122], + ["3", "包装2", 1924], + ], + }; + const color1 = ["#9DD5FF", "#1295FF"]; + const color2 = ["#85F6E9", "#2EC6B4"]; + // @ts-ignore + let xData: string[] = data.scrapBars + let dataProps1: number[] = []; + let dataProps2: number[] = []; + let dataProps3: number[] = []; + let arr1: any = []; + let arr2: any = []; + let arr3: any = []; + // @ts-ignore + if (data.todayProductionScraps && data.todayProductionScraps.length > 0) { + // @ts-ignore + data.todayProductionScraps.map((item,index)=>{ + let arrInner = []; + arrInner.push(index+1,item.sectionName,item.scrapNum); + arr1.push(arrInner); + dataProps1.push(item.scrapNum); + }) + }else{ + dataProps1 = [] + } + // @ts-ignore + if (data.weekProductionScraps && data.weekProductionScraps.length > 0) { + // @ts-ignore + data.weekProductionScraps.map((item,index)=>{ + let arrInner = []; + arrInner.push(index+1,item.sectionName,item.scrapNum); + arr2.push(arrInner); + dataProps2.push(item.scrapNum); + }) + }else{ + dataProps2 = [] + } + // @ts-ignore + if (data.monthProductionScraps && data.monthProductionScraps.length > 0) { + // @ts-ignore + data.monthProductionScraps.map((item,index)=>{ + let arrInner = []; + arrInner.push(index+1,item.sectionName,item.scrapNum); + arr3.push(arrInner); + dataProps3.push(item.scrapNum); + }) + }else{ + dataProps3 = [] + } + configDay.data = arr1; + configWeek.data = arr2; + configMonth.data = arr3; + const options1 = getOptions(dataProps1,xData, color1); + const options2 = getOptions(dataProps2,xData, color2); + const options3 = getOptions(dataProps3,xData, color1); + return ( +
+ +
+ +
+
+
+
+ 当天 +
+
+
+ {activeName === "table" ? ( + arr1.length > 0 ? :(

+ 暂无数据 +

) + ) : dataProps1.length>0 ? ( + + ) : ( +

+ 暂无数据 +

+ )} +
+
+
+ 本周 +
+
+
+ {activeName === "table" ? ( + arr2.length > 0 ? :(

+ 暂无数据 +

) + ) : dataProps2.length>0 ? ( + + ) : ( +

+ 暂无数据 +

+ )} +
+
+
+ 本月 +
+
+
+ {activeName === "table" ? ( + arr3.length > 0 ? :(

+ 暂无数据 +

) + ) : dataProps3.length>0 ? ( + + ) : ( +

+ 暂无数据 +

+ )} +
+
+
+ ); +} +export default LeftDown; diff --git a/src/page/LinePage5-1/Left/LeftUp.tsx b/src/page/LinePage5-1/Left/LeftUp.tsx new file mode 100644 index 0000000..0365d02 --- /dev/null +++ b/src/page/LinePage5-1/Left/LeftUp.tsx @@ -0,0 +1,228 @@ +import ReactECharts from "echarts-for-react"; +import TitleBox from "../Component/TitleBox"; +import SwitchButton from "../Component/SwitchButton"; +import getOptions from "../../Component/SummaryBarChart/chart.config"; +import { useState } from "react"; +import {useAppSelector} from "./../../../store/hooks" +import {selectLine5Before} from "./../../../store/LinePageSlice" +function LeftUp() { + const data = useAppSelector(selectLine5Before); + // 假数据 + const dataSource = { + day: { + xData: [], + series: [] as { data: number[]; type: string; stack: string; name: any; barWidth?: number; label: { show: boolean; position: string; color: string;formatter?:any }; }[], + }, + week: { + xData: [], + series: [] as { data: number[]; type: string; stack: string; name: any; barWidth?: number; label: { show: boolean; position: string; color: string;formatter?:any }; }[], + }, + month: { + xData: [], + series: [] as { data: number[]; type: string; stack: string; name: any; barWidth?: number; label: { show: boolean; position: string; color: string;formatter?:any }; }[], + }, + }; + const nameList = [ + { name: "天", ename: "day" }, + { name: "周", ename: "week" }, + { name: "月", ename: "month" }, + ]; + const [activeName, setActiveName] = useState(nameList[0].ename); + let chartData = (dataSource as { [key: string]: any })[activeName]; + const handleButtonChange = (activeName: string) => { + setActiveName(activeName); + }; + // @ts-ignore + if (data.todayAllProductionScraps && Object.keys(data.todayAllProductionScraps).length > 0) { + let sum: number[] = []; + // 生成obj + // @ts-ignore + data.scrapBars.map((item,index) => { + let obj = { + data: [], + type: "bar", + stack: "a", + name: item, + barWidth: 14, + label: { + show: true, + position: "right", + color: "inherit", + }, + } + dataSource.day.series.push(obj) + }) + // @ts-ignore + dataSource.day.xData = Object.keys(data.todayAllProductionScraps) + dataSource.day.xData.map((item,index)=>{ + let sumIner = 0 + // @ts-ignore + data.todayAllProductionScraps[item].map((itemInner,indexInner)=>{ + sumIner += itemInner.scrapNum + dataSource.day.series.map((itemSeries,indexSeries)=>{ + // @ts-ignore + if (itemSeries.name === itemInner.sectionName) { + // @ts-ignore + itemSeries.data.push(itemInner.scrapNum) + } + }) + }) + sum.push(sumIner) + }) + dataSource.day.series.push({ + data: sum, + type: "bar", + stack: "a", + name: "", + label: { + show: true, + position: "top", + color: "#fff", + formatter: function (params: any) { + return sum[params.dataIndex]; + }, + }, + }) + }else{ + dataSource.day.xData = [] + dataSource.day.series = [] + } + // @ts-ignore + if (data.weekAllProductionScraps && Object.keys(data.weekAllProductionScraps).length > 0) { + let sum: number[] = []; + // 生成obj + // @ts-ignore + data.scrapBars.map((item,index) => { + let obj = { + data: [], + type: "bar", + stack: "a", + name: item, + barWidth: 14, + label: { + show: true, + position: "right", + color: "inherit", + }, + } + dataSource.week.series.push(obj) + }) + // @ts-ignore + dataSource.week.xData = Object.keys(data.weekAllProductionScraps) + dataSource.week.xData.map((item,index)=>{ + let sumIner = 0 + // @ts-ignore + data.weekAllProductionScraps[item].map((itemInner,indexInner)=>{ + sumIner += itemInner.scrapNum + dataSource.week.series.map((itemSeries,indexSeries)=>{ + // @ts-ignore + if (itemSeries.name === itemInner.sectionName) { + // @ts-ignore + itemSeries.data.push(itemInner.scrapNum) + } + }) + }) + sum.push(sumIner) + }) + dataSource.week.series.push({ + data: sum, + type: "bar", + stack: "a", + name: "", + label: { + show: true, + position: "top", + color: "#fff", + formatter: function (params: any) { + return sum[params.dataIndex]; + }, + }, + }) + }else{ + dataSource.week.xData = [] + dataSource.week.series = [] + } + // @ts-ignore + if (data.monthAllProductionScraps && Object.keys(data.monthAllProductionScraps).length > 0) { + let sum: number[] = []; + // 生成obj + // @ts-ignore + data.scrapBars.map((item,index) => { + let obj = { + data: [], + type: "bar", + stack: "a", + name: item, + barWidth: 14, + label: { + show: true, + position: "right", + color: "inherit", + }, + } + dataSource.month.series.push(obj) + }) + // @ts-ignore + dataSource.month.xData = Object.keys(data.monthAllProductionScraps) + dataSource.month.xData.map((item,index)=>{ + let sumIner = 0 + // @ts-ignore + data.monthAllProductionScraps[item].map((itemInner,indexInner)=>{ + sumIner += itemInner.scrapNum + dataSource.month.series.map((itemSeries,indexSeries)=>{ + // @ts-ignore + if (itemSeries.name === itemInner.sectionName) { + // @ts-ignore + itemSeries.data.push(itemInner.scrapNum) + } + }) + }) + sum.push(sumIner) + }) + dataSource.month.series.push({ + data: sum, + type: "bar", + stack: "a", + name: "", + label: { + show: true, + position: "top", + color: "#fff", + formatter: function (params: any) { + return sum[params.dataIndex]; + }, + }, + }) + }else{ + dataSource.month.xData = [] + dataSource.month.series = [] + } + const options = getOptions(chartData); + return ( +
+ +
+ +
+ {// @ts-ignore + dataSource[activeName].xData.length>0 ? ( +
+ {} +
+ ):( +

+ 暂无数据 +

+ )} +
+ ); +} +export default LeftUp; diff --git a/src/page/LinePage5-1/Left/index.tsx b/src/page/LinePage5-1/Left/index.tsx new file mode 100644 index 0000000..6524b82 --- /dev/null +++ b/src/page/LinePage5-1/Left/index.tsx @@ -0,0 +1,11 @@ +import LeftUp from "./LeftUp"; +import LeftDown from "./LeftDown"; +function Left() { + return ( +
+ + +
+ ); +} +export default Left; diff --git a/src/page/LinePage5-1/Right/RightDown.tsx b/src/page/LinePage5-1/Right/RightDown.tsx new file mode 100644 index 0000000..8c365f0 --- /dev/null +++ b/src/page/LinePage5-1/Right/RightDown.tsx @@ -0,0 +1,273 @@ +import ReactECharts from "echarts-for-react"; +import TitleBox from "../Component/TitleBox"; +import SwitchButton from "../Component/SwitchButton"; +import ScrollBoard from "./../../Component/ScrollBoard"; +import { useState } from "react"; +import getOptions from "../../Component/LineChartRight/chart.config"; +import {useAppSelector} from "./../../../store/hooks" +import {selectLine5Before} from "./../../../store/LinePageSlice" +import moment from "moment"; +function RightDown() { + const data = useAppSelector(selectLine5Before); + // console.log('页面数据:',data) + // 假数据 + let tempData = [ + { + type: "day", + data: { + time: [] as string[], + input: [] as number[], + output: [] as number[], + }, + }, + { + type: "week", + data: { + time: [] as string[], + input: [] as number[], + output: [] as number[], + }, + }, + { + type: "month", + data: { + time: [] as string[], + input: [] as number[], + output: [] as number[], + }, + }, + ]; + const nameList = [ + { name: "表单", ename: "table" }, + { name: "折线", ename: "chart" }, + ]; + const [activeName, setActiveName] = useState(nameList[0].ename); + const handleButtonChange = (activeName: string) => { + setActiveName(activeName); + }; + const configDay = { + header: ["时间", "投入数量", "产出数量"], + headerHeight: 30, + rowNum: 5, + headerBGC: "rgba(79, 114, 136, 0.3)", + oddRowBGC: "rgba(79, 114, 136, 0.3)", + evenRowBGC: "rgba(76, 97, 123, 0.1)", + columnWidth: [120, 130, 130], + data: [], + }; + const configWeek = { + header: ["时间", "投入数量", "产出数量"], + headerHeight: 30, + rowNum: 5, + headerBGC: "rgba(79, 114, 136, 0.3)", + oddRowBGC: "rgba(79, 114, 136, 0.3)", + evenRowBGC: "rgba(76, 97, 123, 0.1)", + columnWidth: [120, 130, 130], + data: [], + }; + const configMonth = { + header: ["时间", "投入数量", "产出数量"], + headerHeight: 30, + rowNum: 5, + headerBGC: "rgba(79, 114, 136, 0.3)", + oddRowBGC: "rgba(79, 114, 136, 0.3)", + evenRowBGC: "rgba(76, 97, 123, 0.1)", + columnWidth: [120, 130, 130], + data: [], + }; + let arr1: any = []; + let arr2: any = []; + let arr3: any = []; + // @ts-ignore + if (data.todayProductionDets && data.todayProductionDets.length > 0) { + // @ts-ignore + data.todayProductionDets.map((item,index)=>{ + let arrInner = []; + arrInner.push(moment(item.recTime).format("HH:mm"),item.inputNum,item.outputNum); + arr1.push(arrInner); + tempData[0].data.time.push(moment(item.recTime).format("HH:mm")); + tempData[0].data.input.push(item.inputNum); + tempData[0].data.output.push(item.outputNum); + }) + }else{ + tempData[0].data.time = [] + tempData[0].data.input = [] + tempData[0].data.output = [] + } + // @ts-ignore + if (data.weekProductionDets && data.weekProductionDets.length > 0) { + // @ts-ignore + data.weekProductionDets.map((item,index)=>{ + let arrInner = []; + arrInner.push(moment(item.recTime).format("YYYY/MM/DD"),item.inputNum,item.outputNum); + arr2.push(arrInner); + tempData[1].data.time.push(moment(item.recTime).format("HH:mm")); + tempData[1].data.input.push(item.inputNum); + tempData[1].data.output.push(item.outputNum); + }) + }else{ + tempData[1].data.time = [] + tempData[1].data.input = [] + tempData[1].data.output = [] + } + // @ts-ignore + if (data.monthProductionDets && data.monthProductionDets.length > 0) { + // @ts-ignore + data.monthProductionDets.map((item,index)=>{ + let arrInner = []; + arrInner.push(moment(item.recTime).format("YYYY/MM/DD"),item.inputNum,item.outputNum); + arr3.push(arrInner); + tempData[2].data.time.push(moment(item.recTime).format("HH:mm")); + tempData[2].data.input.push(item.inputNum); + tempData[2].data.output.push(item.outputNum); + }) + }else{ + tempData[2].data.time = [] + tempData[2].data.input = [] + tempData[2].data.output = [] + } + configDay.data = arr1; + configWeek.data = arr2; + configMonth.data = arr3; + + const chartData1 = tempData[0].data; + const chartData2 = tempData[1].data; + const chartData3 = tempData[2].data; + const options1 = getOptions(chartData1); + const options2 = getOptions(chartData2); + const options3 = getOptions(chartData3); + return ( +
+ +
+ +
+
+
+
+ 当天 +
+
+
+ {activeName === "table" ? ( + arr1.length>0?:( +

+ 暂无数据 +

+ ) + ) : tempData[0].data.time.length>0 ? ( + + ) : ( +

+ 暂无数据 +

+ )} +
+
+
+ 本周 +
+
+
+ {activeName === "table" ? ( + arr2.length>0?:( +

+ 暂无数据 +

+ ) + ) : tempData[1].data.time.length>0 ? ( + + ) : ( +

+ 暂无数据 +

+ )} +
+
+
+ 本月 +
+
+
+ {activeName === "table" ? ( + arr3.length>0?:( +

+ 暂无数据 +

+ ) + ) : tempData[2].data.time.length>0 ? ( + + ) : ( +

+ 暂无数据 +

+ )} +
+
+
+ ); +} +export default RightDown; diff --git a/src/page/LinePage5-1/Right/RightUp.tsx b/src/page/LinePage5-1/Right/RightUp.tsx new file mode 100644 index 0000000..c55103e --- /dev/null +++ b/src/page/LinePage5-1/Right/RightUp.tsx @@ -0,0 +1,52 @@ +import TitleBox from "../Component/TitleBox"; +import ScrollBoard from "./../../Component/ScrollBoard"; +import {useAppSelector} from "./../../../store/hooks" +import {selectLine5Before} from "./../../../store/LinePageSlice" +function RightUp() { + const data = useAppSelector(selectLine5Before); + const config = { + header: ["序号", "产线", "上片数据量", "成品下片数量"], + headerHeight: 32, + rowNum: 5, + align: ["center", "left", "left", "left"], + headerBGC: "rgba(79, 114, 136, 0.3)", + oddRowBGC: "rgba(79, 114, 136, 0.3)", + evenRowBGC: "rgba(76, 97, 123, 0.1)", + columnWidth: [70, 90, 106, 114], + data: [], + }; + let arr:any = [] + // @ts-ignore + if (data.sumProductionDets && data.sumProductionDets.length > 0) { + // @ts-ignore + data.sumProductionDets.map((item, index) => { + let arrInner = [] + arrInner.push(index + 1, item.lineName, item.inputNum, item.outputNum) + arr.push(arrInner) + }) + } + config.data = arr + return ( +
+ +
+ {arr.length>0?:(

+ 暂无数据 +

)} +
+
+ ); +} +export default RightUp; diff --git a/src/page/LinePage5-1/Right/index.tsx b/src/page/LinePage5-1/Right/index.tsx new file mode 100644 index 0000000..53c802a --- /dev/null +++ b/src/page/LinePage5-1/Right/index.tsx @@ -0,0 +1,12 @@ +import RightDown from "./RightDown"; +import RightUp from "./RightUp"; + +function Right() { + return ( +
+ + +
+ ); +} +export default Right; diff --git a/src/page/LinePage5-1/TopP.tsx b/src/page/LinePage5-1/TopP.tsx new file mode 100644 index 0000000..e7c7a64 --- /dev/null +++ b/src/page/LinePage5-1/TopP.tsx @@ -0,0 +1,14 @@ +import '../../lanhuapp/common.css'; +import "./index.css"; + +function TopP() { + return ( +
+
+
+
+
+ ); +} + +export default TopP; \ No newline at end of file diff --git a/src/page/LinePage5-1/assets/icon/alarm.png b/src/page/LinePage5-1/assets/icon/alarm.png new file mode 100644 index 0000000..eb335f3 Binary files /dev/null and b/src/page/LinePage5-1/assets/icon/alarm.png differ diff --git a/src/page/LinePage5-1/assets/icon/defect.png b/src/page/LinePage5-1/assets/icon/defect.png new file mode 100644 index 0000000..76ed17c Binary files /dev/null and b/src/page/LinePage5-1/assets/icon/defect.png differ diff --git a/src/page/LinePage5-1/assets/icon/finished.png b/src/page/LinePage5-1/assets/icon/finished.png new file mode 100644 index 0000000..99b411b Binary files /dev/null and b/src/page/LinePage5-1/assets/icon/finished.png differ diff --git a/src/page/LinePage5-1/assets/icon/g.png b/src/page/LinePage5-1/assets/icon/g.png new file mode 100644 index 0000000..bf1b107 Binary files /dev/null and b/src/page/LinePage5-1/assets/icon/g.png differ diff --git a/src/page/LinePage5-1/assets/icon/inputAndOutput.png b/src/page/LinePage5-1/assets/icon/inputAndOutput.png new file mode 100644 index 0000000..113ed13 Binary files /dev/null and b/src/page/LinePage5-1/assets/icon/inputAndOutput.png differ diff --git a/src/page/LinePage5-1/assets/icon/num.png b/src/page/LinePage5-1/assets/icon/num.png new file mode 100644 index 0000000..e77c409 Binary files /dev/null and b/src/page/LinePage5-1/assets/icon/num.png differ diff --git a/src/page/LinePage5-1/assets/icon/r.png b/src/page/LinePage5-1/assets/icon/r.png new file mode 100644 index 0000000..d11591e Binary files /dev/null and b/src/page/LinePage5-1/assets/icon/r.png differ diff --git a/src/page/LinePage5-1/assets/icon/record.png b/src/page/LinePage5-1/assets/icon/record.png new file mode 100644 index 0000000..4622f01 Binary files /dev/null and b/src/page/LinePage5-1/assets/icon/record.png differ diff --git a/src/page/LinePage5-1/assets/icon/y.png b/src/page/LinePage5-1/assets/icon/y.png new file mode 100644 index 0000000..72c796a Binary files /dev/null and b/src/page/LinePage5-1/assets/icon/y.png differ diff --git a/src/page/LinePage5-1/index.css b/src/page/LinePage5-1/index.css new file mode 100644 index 0000000..1a28491 --- /dev/null +++ b/src/page/LinePage5-1/index.css @@ -0,0 +1,264 @@ +/* 顶部 */ +.block_top { + width: 1920px; + height: 94px; + background: url(/public/svg/topback.svg) 100% no-repeat; + background-size: 100% 100%; + opacity: 1; + display: flex; + justify-content: center; +} + +.block_top_title { + width: 651px; + height: 77px; + background: url(/public/png/topTiltle.png) 100% no-repeat; + background-size: 100% 100%; + margin-top: 18px; +} +/* 中部 */ +.block_bottom { + width: 1920px; + height: 966px; + padding-top: 20px; +} + +.group_left { + width: 402px; + height: 966px; + margin: 0 0 0 24px; +} + +.group_center { + width: 1041px; + height: 966px; + margin: 0 0 0 15px; +} + +.group_right { + width: 401px; + height: 966px; + margin-left: 15px; +} + +.left_up { + width: 402px; + height: 332px; + background: url(../../../public/png/rect/lp_left_up.png) no-repeat; + background-size: 100% 100%; + background-position: 0 0; + position: relative; +} +.left_down { + width: 402px; + height: 599px; + background: url(../../../public/png/rect/lp_left_down.png) no-repeat; + background-size: 100% 100%; + background-position: 0 0; + margin-top: 14px; + position: relative; +} +.center_up { + width: 1041px; + height: 562px; + background: url(../../../public/png/rect/lp_center_up.png) no-repeat; + background-size: 100% 100%; + background-position: 0 0; + position: relative; +} +.center_down { + width: 1041px; + height: 368px; + margin-top: 17px; +} +.center_down_inner { + width: 513px; + height: 366px; + background: url(../../../public/png/rect/lp_center_down.png) no-repeat; + background-size: 100% 100%; + background-position: 0 0; + position: relative; +} +.center_down .left-box { + margin-right: 15px; + position: relative; +} +.center_down .left-box .alarm_num_title { + position: absolute; + left: 220px; + top: 22px; + font-size: 13px; + letter-spacing: 3px; + color: #fff; +} +.center_down .left-box .alarm_num { + color: #52fff1; + font-size: 40px; + text-align: center; + font-family: PingFangSC, PingFang SC; +} +.center_down .right_box .chart_box { + width: 100%; + height: 310px; + margin-top: 10px; +} +.right_up { + width: 401px; + height: 257px; + background: url(../../../public/png/rect/lp_right_up.png) no-repeat; + background-size: 100% 100%; + background-position: 0 0; +} +.right_down { + width: 401px; + height: 673px; + background: url(../../../public/png/rect/lp_right_down.png) no-repeat; + background-size: 100% 100%; + background-position: 0 0; + margin-top: 14px; + position: relative; +} +.left_up_switch { + position: absolute; + right: 10px; + top: 12px; +} +.left_up_chart { + height: 275px; + margin-top: 10px; +} +/* 左侧 */ +.left_down_title { + height: 18px; + justify-content: center; + margin-bottom: 4px; +} +.left_down_box1 { + width: 56px; + height: 13px; + background: url(/public/png/leftbar.png) 100% no-repeat; + background-size: 100% 100%; + margin-top: 2px; +} +.left_down_box2 { + width: 56px; + height: 13px; + background: url(/public/png/rightbar.png) 100% no-repeat; + background-size: 100% 100%; + margin: 2px 0 0 0px; +} +.left_down_text { + /*width: 40px;*/ + height: 18px; + overflow-wrap: break-word; + color: rgba(1, 207, 204, 1); + font-size: 18px; + letter-spacing: 5px; + font-family: PingFangSC-Regular; + white-space: nowrap; + line-height: 18px; + margin-left: 18px; + margin-right: 16px; + text-align: center; +} +.left_down_content { + height: 160px; + /* padding-bottom: 5px; */ +} +.right_down_content { + height: 185px; + /* padding-bottom: 5px; */ +} +/* 滚动表格部分 */ +.dv-scroll-board .header .header-item, +.dv-scroll-board .rows .ceil { + border-right: 1px solid #0d1728; +} +.dv-scroll-board .header .header-item:last-child, +.dv-scroll-board .rows .ceil:last-child { + border-right: none; + border: none; +} +/* chart图部分 */ +.luoyang-chart-tooltip { + background: #0a2b4f77 !important; + border: none !important; + backdrop-filter: blur(12px); +} + +.luoyang-chart-tooltip * { + color: #fff !important; +} +/* 三维页面部分 */ +.center_up .model_name { + position: absolute; + left: 0px; + top: 0px; + z-index: 1000; +} +.center_up .model_info { + position: absolute; + left: 100px; + bottom: 0px; + z-index: 1000; + width: 841px; + height: 62px; + background: url(/public/png/lp/line_part.png) 100% no-repeat; + background-size: 100% 100%; +} +.center_up .model_info .reset_btn { + position: absolute; + top: 20px; + left: 40px; + width: 140px; + height: 40px; + cursor: pointer; +} +.center_up .model_info .title { + display: inline-block; + width: 361px; + text-align: center; + font-size: 32px; + color: #fff; + letter-spacing: 5px; + position: absolute; + left: 241px; + bottom: 10px; +} +.center_up .eq_detail_info { + position: absolute; + right: 0px; + bottom: 0px; + z-index: 1002; + width: 240px; + height: 110px; + background: url(/public/png/lp/eq_msg_detail.png) 100% no-repeat; + background-size: 100% 100%; + color: #fff; + padding: 15px 0 0 15px; +} +.center_up .eq_detail_info .left_name { + display: inline-block; + width: 95px; + height: 28px; + text-align: right; + font-size: 18px; +} +.center_up .eq_detail_info .right_value { + display: inline-block; + height: 28px; + font-size: 18px; +} +.center_up .eq_info { + position: absolute; + z-index: 1002; + background: url(/public/png/lp/eq_msg_always.png) 100% no-repeat; + background-size: 100% 100%; + color: #fff; + padding: 10px 15px; +} +.center_up .eq_info .eq_info_inner { + height: 24px; + font-size: 17px; + white-space: nowrap; +} diff --git a/src/page/LinePage5-1/index.tsx b/src/page/LinePage5-1/index.tsx new file mode 100644 index 0000000..daf9389 --- /dev/null +++ b/src/page/LinePage5-1/index.tsx @@ -0,0 +1,18 @@ +import React from "react"; +import TopP from "./TopP"; +import Left from "./Left"; +import Right from "./Right"; +import Center from "./Center"; +function LinePage() { + return ( + + +
+ +
+ +
+
+ ); +} +export default LinePage; diff --git a/src/page/LinePage5-2/Center/CenterDown.tsx b/src/page/LinePage5-2/Center/CenterDown.tsx new file mode 100644 index 0000000..919b10f --- /dev/null +++ b/src/page/LinePage5-2/Center/CenterDown.tsx @@ -0,0 +1,214 @@ +import ReactECharts from "echarts-for-react"; +import TitleBox from "../Component/TitleBox"; +import ScrollBoard from "./../../Component/ScrollBoard"; +import SwitchButton from "../Component/SwitchButton"; +import { useState } from "react"; +import getOptions from "../../Component/LineChart/chart.config"; +import {useAppSelector} from "./../../../store/hooks" +import {selectLine5After} from "./../../../store/LinePageSlice" +import moment from "moment"; +function CenterDown() { + const data = useAppSelector(selectLine5After); + // 假数据 + const dataSource = { + day: { + xData:[], + series: [] as { name: string; type: string; symbol: string; symbolSize: number; data: never[]; }[], + }, + week: { + xData:[], + series: [] as { name: string; type: string; symbol: string; symbolSize: number; data: never[]; }[], + }, + month: { + xData:[], + series: [] as { name: string; type: string; symbol: string; symbolSize: number; data: never[]; }[], + }, + }; + const nameList = [ + { name: "天", ename: "day" }, + { name: "周", ename: "week" }, + { name: "月", ename: "month" }, + ]; + const [activeName, setActiveName] = useState(nameList[0].ename); + const handleButtonChange = (activeName: string) => { + setActiveName(activeName); + }; + const config = { + header: ["序号", "报警时间", "报警设备", "报警内容"], + headerHeight: 36, + rowNum: 6, + align: ["center", "left", "left", "left"], + headerBGC: "rgba(79, 114, 136, 0.3)", + oddRowBGC: "rgba(79, 114, 136, 0.3)", + evenRowBGC: "rgba(76, 97, 123, 0.1)", + columnWidth: [80, 137, 137, 137], + data: [] + }; + // 报警数据 + let arr:any = [] + let sumAlarm = 0 + // @ts-ignore + if (data.alarms && data.alarms.length > 0) { + // @ts-ignore + sumAlarm = data.alarms.length + // @ts-ignore + data.alarms.map((item,index) => { + let arrInner = [] + arrInner.push( + index+1, + moment(item.recTime).format("YYYY/MM/DD HH:mm"), + item.name, + item.status === '故障'?"故障":"离线", + ); + arr.push(arrInner) + }); + } + config.data = arr + // 产线成品率 + // @ts-ignore + if (data.todayProductionRates && Object.keys(data.todayProductionRates).length > 0) { + // @ts-ignore + let keys = Object.keys(data.todayProductionRates) + // @ts-ignore + data.todayProductionRates[keys[0]].map((item,index)=>{ + // @ts-ignore + dataSource.day.xData.push(moment(item.recTime).format("HH:mm")) + }) + keys.map((item,index)=>{ + let obj = { + name: "", + type: "line", + symbol: "circle", + symbolSize: 4, + data:[] + } + // @ts-ignore + obj.name = data.todayProductionRates[item][0].lineName + // @ts-ignore + data.todayProductionRates[item].map((subItem,index)=>{ + // @ts-ignore + obj.data.push(subItem.passRate) + }) + dataSource.day.series.push(obj) + }) + }else{ + dataSource.day.xData = [] + dataSource.day.series = [] + } + // @ts-ignore + if (data.weekProductionRates && Object.keys(data.weekProductionRates).length > 0) { + // @ts-ignore + let keys = Object.keys(data.weekProductionRates) + // @ts-ignore + data.weekProductionRates[keys[0]].map((item,index)=>{ + // @ts-ignore + dataSource.week.xData.push(moment(item.recTime).format("HH:mm")) + }) + keys.map((item,index)=>{ + let obj = { + name: "", + type: "line", + symbol: "circle", + symbolSize: 4, + data:[] + } + // @ts-ignore + obj.name = data.weekProductionRates[item][0].lineName + // @ts-ignore + data.weekProductionRates[item].map((subItem,index)=>{ + // @ts-ignore + obj.data.push(subItem.passRate) + }) + dataSource.week.series.push(obj) + }) + }else{ + dataSource.week.xData = [] + dataSource.week.series = [] + } + // @ts-ignore + if (data.monthProductionRates && Object.keys(data.monthProductionRates).length > 0) { + // @ts-ignore + let keys = Object.keys(data.monthProductionRates) + // @ts-ignore + data.monthProductionRates[keys[0]].map((item,index)=>{ + // @ts-ignore + dataSource.month.xData.push(moment(item.recTime).format("HH:mm")) + }) + keys.map((item,index)=>{ + let obj = { + name: "", + type: "line", + symbol: "circle", + symbolSize: 4, + data:[] + } + // @ts-ignore + obj.name = data.monthProductionRates[item][0].lineName + // @ts-ignore + data.monthProductionRates[item].map((subItem,index)=>{ + // @ts-ignore + obj.data.push(subItem.passRate) + }) + dataSource.month.series.push(obj) + }) + }else{ + dataSource.month.xData = [] + dataSource.month.series = [] + } + let chartData = (dataSource as { [key: string]: any })[activeName]; + console.log('???????????',chartData) + const options = getOptions(chartData); + return ( +
+
+ + — 报警总数 — +
{sumAlarm}
+
+ {arr.length>0?:(

+ 暂无数据 +

)} +
+
+ {/* 产线成品率 */} +
+ +
+ +
+ {chartData.xData.length>0 && ( +
+ {} +
+ )} + {chartData.xData.length==0 && ( +

+ 暂无数据 +

+ )} +
+
+ ); +} +export default CenterDown; diff --git a/src/page/LinePage5-2/Center/CenterUp.tsx b/src/page/LinePage5-2/Center/CenterUp.tsx new file mode 100644 index 0000000..d800861 --- /dev/null +++ b/src/page/LinePage5-2/Center/CenterUp.tsx @@ -0,0 +1,10 @@ +import LinePageBabylon from "../../../babylonjs/LinePageBabylon"; +function CenterUp() { + const lineID = "5-2"; + return ( +
+ +
+ ); +} +export default CenterUp; diff --git a/src/page/LinePage5-2/Center/index.tsx b/src/page/LinePage5-2/Center/index.tsx new file mode 100644 index 0000000..14d5036 --- /dev/null +++ b/src/page/LinePage5-2/Center/index.tsx @@ -0,0 +1,12 @@ +import CenterDown from "./CenterDown"; +import CenterUp from "./CenterUp"; + +function Center() { + return ( +
+ + +
+ ); +} +export default Center; diff --git a/src/page/LinePage5-2/Component/SwitchButton/index.css b/src/page/LinePage5-2/Component/SwitchButton/index.css new file mode 100644 index 0000000..604d81a --- /dev/null +++ b/src/page/LinePage5-2/Component/SwitchButton/index.css @@ -0,0 +1,19 @@ +.switch-button { + height: 33px; +} +.switch-button button { + color: #fff; + font-size: 18px; + padding: 4px 10px; + background-color: rgba(49, 135, 140, 0.3); + cursor: pointer; +} +.switch-button button:first-child { + border-radius: 5px 0 0 5px; +} +.switch-button button:last-child { + border-radius: 0 5px 5px 0; +} +.switch-button button.active { + background-color: rgba(86, 244, 231, 0.7); +} diff --git a/src/page/LinePage5-2/Component/SwitchButton/index.tsx b/src/page/LinePage5-2/Component/SwitchButton/index.tsx new file mode 100644 index 0000000..9209c06 --- /dev/null +++ b/src/page/LinePage5-2/Component/SwitchButton/index.tsx @@ -0,0 +1,65 @@ +import { useEffect, useState } from "react"; +import "./index.css"; +interface Name { + name: string; + ename: string; +} +interface nameListProps { + nameList: Name[]; + onChange: (value: string) => void; +} +function createActiveNameUpdater(nameList: any, activeName: string) { + let activeIndex = nameList.findIndex((obj: any) => obj.name === activeName); + + return function updateActiveName() { + activeIndex = (activeIndex + 1) % nameList.length; + return nameList[activeIndex].ename; + }; +} +function SwitchButton(props: nameListProps) { + const [activeName, setActiveName] = useState(props.nameList[0].ename); + const [timerId, setTimerId] = useState(null); + let updateActiveName = createActiveNameUpdater(props.nameList, activeName); + useEffect(() => { + const timer = setInterval(() => { + let active = updateActiveName(); + setActiveName(active); + props.onChange(active); + }, 60000); + setTimerId(timer); + return () => { + if (timerId !== null) { + clearInterval(timerId); + } + }; + }, [props.nameList.length]); + const btnClick = (ename: string) => { + if (timerId !== null) { + clearInterval(timerId); + } + setActiveName(ename); + props.onChange(ename); // 通知父组件 + const newTimer = setInterval(() => { + let active = updateActiveName(); + setActiveName(active); + props.onChange(active); + }, 60000); + setTimerId(newTimer); + }; + return ( +
+ {props.nameList.map((item, index) => { + return ( + + ); + })} +
+ ); +} +export default SwitchButton; diff --git a/src/page/LinePage5-2/Component/TitleBox/index.css b/src/page/LinePage5-2/Component/TitleBox/index.css new file mode 100644 index 0000000..3ae06db --- /dev/null +++ b/src/page/LinePage5-2/Component/TitleBox/index.css @@ -0,0 +1,13 @@ +.title_box { + font-size: 24px; + color: #52fff1; + padding: 10px 0 0 15px; +} +.title_box img { + width: 33px; + height: 33px; + vertical-align: bottom; + margin-right: 3px; + position: relative; + top: 3px; +} diff --git a/src/page/LinePage5-2/Component/TitleBox/index.tsx b/src/page/LinePage5-2/Component/TitleBox/index.tsx new file mode 100644 index 0000000..dd43a66 --- /dev/null +++ b/src/page/LinePage5-2/Component/TitleBox/index.tsx @@ -0,0 +1,53 @@ +import Defect from "./../../assets/icon/defect.png"; +import Alarm from "./../../assets/icon/alarm.png"; +import Finished from "./../../assets/icon/finished.png"; +import InputAndOutput from "./../../assets/icon/inputAndOutput.png"; +import Num from "./../../assets/icon/num.png"; +import Record from "./../../assets/icon/record.png"; +import "./index.css"; +interface titleProps { + title: string; +} +function TitleBox(props: titleProps) { + const filteredTitles = () => { + switch (props.title) { + case "left_up": + return { + img: Defect, + title: "产线报废汇总", + }; + case "left_down": + return { + img: Record, + title: "当前产线报废情况", + }; + case "center_down_left": + return { + img: Alarm, + title: "异常报警", + }; + case "center_down_right": + return { + img: Finished, + title: "产线成品率", + }; + case "right_up": + return { + img: Num, + title: "各产线总投入和产出", + }; + default: + return { + img: InputAndOutput, + title: "当前产线投入和产出", + }; + } + }; + return ( +
+ title + {filteredTitles().title} +
+ ); +} +export default TitleBox; diff --git a/src/page/LinePage5-2/Left/LeftDown.tsx b/src/page/LinePage5-2/Left/LeftDown.tsx new file mode 100644 index 0000000..7f35755 --- /dev/null +++ b/src/page/LinePage5-2/Left/LeftDown.tsx @@ -0,0 +1,245 @@ +import ReactECharts from "echarts-for-react"; +import TitleBox from "../Component/TitleBox"; +import SwitchButton from "../Component/SwitchButton"; +import ScrollBoard from "./../../Component/ScrollBoard"; +import { useState } from "react"; +import getOptions from "../../Component/BarChart/chart.config"; +import {useAppSelector} from "./../../../store/hooks" +import {selectLine5After} from "./../../../store/LinePageSlice" +function LeftDown() { + const data = useAppSelector(selectLine5After); + // console.log('页面数据:',data) + const nameList = [ + { name: "表单", ename: "table" }, + { name: "柱状", ename: "chart" }, + ]; + const [activeName, setActiveName] = useState(nameList[0].ename); + const handleButtonChange = (activeName: string) => { + setActiveName(activeName); + }; + const configDay = { + header: ["序号", "工序类型", "报废数量"], + headerHeight: 30, + rowNum: 4, + align: ["center", "left", "left"], + headerBGC: "rgba(79, 114, 136, 0.3)", + oddRowBGC: "rgba(79, 114, 136, 0.3)", + evenRowBGC: "rgba(76, 97, 123, 0.1)", + columnWidth: [73, 117, 190], + data: [ + ["1", "磨边后", 224], + ["2", "包装1", 322], + ["3", "包装2", 66], + ], + }; + const configWeek = { + header: ["序号", "工序类型", "报废数量"], + headerHeight: 30, + rowNum: 4, + align: ["center", "left", "left"], + headerBGC: "rgba(79, 114, 136, 0.3)", + oddRowBGC: "rgba(79, 114, 136, 0.3)", + evenRowBGC: "rgba(76, 97, 123, 0.1)", + columnWidth: [73, 117, 190], + data: [ + ["1", "磨边后", 1119], + ["2", "包装1", 1798], + ["3", "包装2", 435], + ], + }; + const configMonth = { + header: ["序号", "工序类型", "报废数量"], + headerHeight: 30, + rowNum: 4, + align: ["center", "left", "left"], + headerBGC: "rgba(79, 114, 136, 0.3)", + oddRowBGC: "rgba(79, 114, 136, 0.3)", + evenRowBGC: "rgba(76, 97, 123, 0.1)", + columnWidth: [73, 117, 190], + data: [ + ["1", "磨边后", 5004], + ["2", "包装1", 9122], + ["3", "包装2", 1924], + ], + }; + const color1 = ["#9DD5FF", "#1295FF"]; + const color2 = ["#85F6E9", "#2EC6B4"]; + // @ts-ignore + let xData: string[] = data.scrapBars + let dataProps1: number[] = []; + let dataProps2: number[] = []; + let dataProps3: number[] = []; + let arr1: any = []; + let arr2: any = []; + let arr3: any = []; + // @ts-ignore + if (data.todayProductionScraps && data.todayProductionScraps.length > 0) { + // @ts-ignore + data.todayProductionScraps.map((item,index)=>{ + let arrInner = []; + arrInner.push(index+1,item.sectionName,item.scrapNum); + arr1.push(arrInner); + dataProps1.push(item.scrapNum); + }) + }else{ + dataProps1 = [] + } + // @ts-ignore + if (data.weekProductionScraps && data.weekProductionScraps.length > 0) { + // @ts-ignore + data.weekProductionScraps.map((item,index)=>{ + let arrInner = []; + arrInner.push(index+1,item.sectionName,item.scrapNum); + arr2.push(arrInner); + dataProps2.push(item.scrapNum); + }) + }else{ + dataProps2 = [] + } + // @ts-ignore + if (data.monthProductionScraps && data.monthProductionScraps.length > 0) { + // @ts-ignore + data.monthProductionScraps.map((item,index)=>{ + let arrInner = []; + arrInner.push(index+1,item.sectionName,item.scrapNum); + arr3.push(arrInner); + dataProps3.push(item.scrapNum); + }) + }else{ + dataProps3 = [] + } + configDay.data = arr1; + configWeek.data = arr2; + configMonth.data = arr3; + const options1 = getOptions(dataProps1,xData, color1); + const options2 = getOptions(dataProps2,xData, color2); + const options3 = getOptions(dataProps3,xData, color1); + return ( +
+ +
+ +
+
+
+
+ 当天 +
+
+
+ {activeName === "table" ? ( + arr1.length > 0 ? :(

+ 暂无数据 +

) + ) : dataProps1.length>0 ? ( + + ) : ( +

+ 暂无数据 +

+ )} +
+
+
+ 本周 +
+
+
+ {activeName === "table" ? ( + arr2.length > 0 ? :(

+ 暂无数据 +

) + ) : dataProps2.length>0 ? ( + + ) : ( +

+ 暂无数据 +

+ )} +
+
+
+ 本月 +
+
+
+ {activeName === "table" ? ( + arr3.length > 0 ? :(

+ 暂无数据 +

) + ) : dataProps3.length>0 ? ( + + ) : ( +

+ 暂无数据 +

+ )} +
+
+
+ ); +} +export default LeftDown; diff --git a/src/page/LinePage5-2/Left/LeftUp.tsx b/src/page/LinePage5-2/Left/LeftUp.tsx new file mode 100644 index 0000000..71df85f --- /dev/null +++ b/src/page/LinePage5-2/Left/LeftUp.tsx @@ -0,0 +1,229 @@ +import ReactECharts from "echarts-for-react"; +import TitleBox from "../Component/TitleBox"; +import SwitchButton from "../Component/SwitchButton"; +import getOptions from "../../Component/SummaryBarChart/chart.config"; +import { useState } from "react"; +import {useAppSelector} from "./../../../store/hooks" +import {selectLine5After} from "./../../../store/LinePageSlice" +function LeftUp() { + const data = useAppSelector(selectLine5After); + console.log('页面数据1-1:',data) + // 假数据 + const dataSource = { + day: { + xData: [], + series: [] as { data: number[]; type: string; stack: string; name: any; barWidth?: number; label: { show: boolean; position: string; color: string;formatter?:any }; }[], + }, + week: { + xData: [], + series: [] as { data: number[]; type: string; stack: string; name: any; barWidth?: number; label: { show: boolean; position: string; color: string;formatter?:any }; }[], + }, + month: { + xData: [], + series: [] as { data: number[]; type: string; stack: string; name: any; barWidth?: number; label: { show: boolean; position: string; color: string;formatter?:any }; }[], + }, + }; + const nameList = [ + { name: "天", ename: "day" }, + { name: "周", ename: "week" }, + { name: "月", ename: "month" }, + ]; + const [activeName, setActiveName] = useState(nameList[0].ename); + let chartData = (dataSource as { [key: string]: any })[activeName]; + const handleButtonChange = (activeName: string) => { + setActiveName(activeName); + }; + // @ts-ignore + if (data.todayAllProductionScraps && Object.keys(data.todayAllProductionScraps).length > 0) { + let sum: number[] = []; + // 生成obj + // @ts-ignore + data.scrapBars.map((item,index) => { + let obj = { + data: [], + type: "bar", + stack: "a", + name: item, + barWidth: 14, + label: { + show: true, + position: "right", + color: "inherit", + }, + } + dataSource.day.series.push(obj) + }) + // @ts-ignore + dataSource.day.xData = Object.keys(data.todayAllProductionScraps) + dataSource.day.xData.map((item,index)=>{ + let sumIner = 0 + // @ts-ignore + data.todayAllProductionScraps[item].map((itemInner,indexInner)=>{ + sumIner += itemInner.scrapNum + dataSource.day.series.map((itemSeries,indexSeries)=>{ + // @ts-ignore + if (itemSeries.name === itemInner.sectionName) { + // @ts-ignore + itemSeries.data.push(itemInner.scrapNum) + } + }) + }) + sum.push(sumIner) + }) + dataSource.day.series.push({ + data: sum, + type: "bar", + stack: "a", + name: "", + label: { + show: true, + position: "top", + color: "#fff", + formatter: function (params: any) { + return sum[params.dataIndex]; + }, + }, + }) + }else{ + dataSource.day.xData = [] + dataSource.day.series = [] + } + // @ts-ignore + if (data.weekAllProductionScraps && Object.keys(data.weekAllProductionScraps).length > 0) { + let sum: number[] = []; + // 生成obj + // @ts-ignore + data.scrapBars.map((item,index) => { + let obj = { + data: [], + type: "bar", + stack: "a", + name: item, + barWidth: 14, + label: { + show: true, + position: "right", + color: "inherit", + }, + } + dataSource.week.series.push(obj) + }) + // @ts-ignore + dataSource.week.xData = Object.keys(data.weekAllProductionScraps) + dataSource.week.xData.map((item,index)=>{ + let sumIner = 0 + // @ts-ignore + data.weekAllProductionScraps[item].map((itemInner,indexInner)=>{ + sumIner += itemInner.scrapNum + dataSource.week.series.map((itemSeries,indexSeries)=>{ + // @ts-ignore + if (itemSeries.name === itemInner.sectionName) { + // @ts-ignore + itemSeries.data.push(itemInner.scrapNum) + } + }) + }) + sum.push(sumIner) + }) + dataSource.week.series.push({ + data: sum, + type: "bar", + stack: "a", + name: "", + label: { + show: true, + position: "top", + color: "#fff", + formatter: function (params: any) { + return sum[params.dataIndex]; + }, + }, + }) + }else{ + dataSource.week.xData = [] + dataSource.week.series = [] + } + // @ts-ignore + if (data.monthAllProductionScraps && Object.keys(data.monthAllProductionScraps).length > 0) { + let sum: number[] = []; + // 生成obj + // @ts-ignore + data.scrapBars.map((item,index) => { + let obj = { + data: [], + type: "bar", + stack: "a", + name: item, + barWidth: 14, + label: { + show: true, + position: "right", + color: "inherit", + }, + } + dataSource.month.series.push(obj) + }) + // @ts-ignore + dataSource.month.xData = Object.keys(data.monthAllProductionScraps) + dataSource.month.xData.map((item,index)=>{ + let sumIner = 0 + // @ts-ignore + data.monthAllProductionScraps[item].map((itemInner,indexInner)=>{ + sumIner += itemInner.scrapNum + dataSource.month.series.map((itemSeries,indexSeries)=>{ + // @ts-ignore + if (itemSeries.name === itemInner.sectionName) { + // @ts-ignore + itemSeries.data.push(itemInner.scrapNum) + } + }) + }) + sum.push(sumIner) + }) + dataSource.month.series.push({ + data: sum, + type: "bar", + stack: "a", + name: "", + label: { + show: true, + position: "top", + color: "#fff", + formatter: function (params: any) { + return sum[params.dataIndex]; + }, + }, + }) + }else{ + dataSource.month.xData = [] + dataSource.month.series = [] + } + const options = getOptions(chartData); + return ( +
+ +
+ +
+ {// @ts-ignore + dataSource[activeName].xData.length>0 ? ( +
+ {} +
+ ):( +

+ 暂无数据 +

+ )} +
+ ); +} +export default LeftUp; diff --git a/src/page/LinePage5-2/Left/index.tsx b/src/page/LinePage5-2/Left/index.tsx new file mode 100644 index 0000000..6524b82 --- /dev/null +++ b/src/page/LinePage5-2/Left/index.tsx @@ -0,0 +1,11 @@ +import LeftUp from "./LeftUp"; +import LeftDown from "./LeftDown"; +function Left() { + return ( +
+ + +
+ ); +} +export default Left; diff --git a/src/page/LinePage5-2/Right/RightDown.tsx b/src/page/LinePage5-2/Right/RightDown.tsx new file mode 100644 index 0000000..6fe188e --- /dev/null +++ b/src/page/LinePage5-2/Right/RightDown.tsx @@ -0,0 +1,272 @@ +import ReactECharts from "echarts-for-react"; +import TitleBox from "../Component/TitleBox"; +import SwitchButton from "../Component/SwitchButton"; +import ScrollBoard from "./../../Component/ScrollBoard"; +import { useState } from "react"; +import getOptions from "../../Component/LineChartRight/chart.config"; +import {useAppSelector} from "./../../../store/hooks" +import {selectLine5After} from "./../../../store/LinePageSlice" +import moment from "moment"; +function RightDown() { + const data = useAppSelector(selectLine5After); + // 假数据 + let tempData = [ + { + type: "day", + data: { + time: [] as string[], + input: [] as number[], + output: [] as number[], + }, + }, + { + type: "week", + data: { + time: [] as string[], + input: [] as number[], + output: [] as number[], + }, + }, + { + type: "month", + data: { + time: [] as string[], + input: [] as number[], + output: [] as number[], + }, + }, + ]; + const nameList = [ + { name: "表单", ename: "table" }, + { name: "折线", ename: "chart" }, + ]; + const [activeName, setActiveName] = useState(nameList[0].ename); + const handleButtonChange = (activeName: string) => { + setActiveName(activeName); + }; + const configDay = { + header: ["时间", "投入数量", "产出数量"], + headerHeight: 30, + rowNum: 5, + headerBGC: "rgba(79, 114, 136, 0.3)", + oddRowBGC: "rgba(79, 114, 136, 0.3)", + evenRowBGC: "rgba(76, 97, 123, 0.1)", + columnWidth: [120, 130, 130], + data: [], + }; + const configWeek = { + header: ["时间", "投入数量", "产出数量"], + headerHeight: 30, + rowNum: 5, + headerBGC: "rgba(79, 114, 136, 0.3)", + oddRowBGC: "rgba(79, 114, 136, 0.3)", + evenRowBGC: "rgba(76, 97, 123, 0.1)", + columnWidth: [120, 130, 130], + data: [], + }; + const configMonth = { + header: ["时间", "投入数量", "产出数量"], + headerHeight: 30, + rowNum: 5, + headerBGC: "rgba(79, 114, 136, 0.3)", + oddRowBGC: "rgba(79, 114, 136, 0.3)", + evenRowBGC: "rgba(76, 97, 123, 0.1)", + columnWidth: [120, 130, 130], + data: [], + }; + let arr1: any = []; + let arr2: any = []; + let arr3: any = []; + // @ts-ignore + if (data.todayProductionDets && data.todayProductionDets.length > 0) { + // @ts-ignore + data.todayProductionDets.map((item,index)=>{ + let arrInner = []; + arrInner.push(moment(item.recTime).format("HH:mm"),item.inputNum,item.outputNum); + arr1.push(arrInner); + tempData[0].data.time.push(moment(item.recTime).format("HH:mm")); + tempData[0].data.input.push(item.inputNum); + tempData[0].data.output.push(item.outputNum); + }) + }else{ + tempData[0].data.time = [] + tempData[0].data.input = [] + tempData[0].data.output = [] + } + // @ts-ignore + if (data.weekProductionDets && data.weekProductionDets.length > 0) { + // @ts-ignore + data.weekProductionDets.map((item,index)=>{ + let arrInner = []; + arrInner.push(moment(item.recTime).format("YYYY/MM/DD"),item.inputNum,item.outputNum); + arr2.push(arrInner); + tempData[1].data.time.push(moment(item.recTime).format("HH:mm")); + tempData[1].data.input.push(item.inputNum); + tempData[1].data.output.push(item.outputNum); + }) + }else{ + tempData[1].data.time = [] + tempData[1].data.input = [] + tempData[1].data.output = [] + } + // @ts-ignore + if (data.monthProductionDets && data.monthProductionDets.length > 0) { + // @ts-ignore + data.monthProductionDets.map((item,index)=>{ + let arrInner = []; + arrInner.push(moment(item.recTime).format("YYYY/MM/DD"),item.inputNum,item.outputNum); + arr3.push(arrInner); + tempData[2].data.time.push(moment(item.recTime).format("HH:mm")); + tempData[2].data.input.push(item.inputNum); + tempData[2].data.output.push(item.outputNum); + }) + }else{ + tempData[2].data.time = [] + tempData[2].data.input = [] + tempData[2].data.output = [] + } + configDay.data = arr1; + configWeek.data = arr2; + configMonth.data = arr3; + + const chartData1 = tempData[0].data; + const chartData2 = tempData[1].data; + const chartData3 = tempData[2].data; + const options1 = getOptions(chartData1); + const options2 = getOptions(chartData2); + const options3 = getOptions(chartData3); + return ( +
+ +
+ +
+
+
+
+ 当天 +
+
+
+ {activeName === "table" ? ( + arr1.length>0?:( +

+ 暂无数据 +

+ ) + ) : tempData[0].data.time.length>0 ? ( + + ) : ( +

+ 暂无数据 +

+ )} +
+
+
+ 本周 +
+
+
+ {activeName === "table" ? ( + arr2.length>0?:( +

+ 暂无数据 +

+ ) + ) : tempData[1].data.time.length>0 ? ( + + ) : ( +

+ 暂无数据 +

+ )} +
+
+
+ 本月 +
+
+
+ {activeName === "table" ? ( + arr3.length>0?:( +

+ 暂无数据 +

+ ) + ) : tempData[2].data.time.length>0 ? ( + + ) : ( +

+ 暂无数据 +

+ )} +
+
+
+ ); +} +export default RightDown; diff --git a/src/page/LinePage5-2/Right/RightUp.tsx b/src/page/LinePage5-2/Right/RightUp.tsx new file mode 100644 index 0000000..4644deb --- /dev/null +++ b/src/page/LinePage5-2/Right/RightUp.tsx @@ -0,0 +1,52 @@ +import TitleBox from "../Component/TitleBox"; +import ScrollBoard from "./../../Component/ScrollBoard"; +import {useAppSelector} from "./../../../store/hooks" +import {selectLine5After} from "./../../../store/LinePageSlice" +function RightUp() { + const data = useAppSelector(selectLine5After); + const config = { + header: ["序号", "产线", "上片数据量", "成品下片数量"], + headerHeight: 32, + rowNum: 5, + align: ["center", "left", "left", "left"], + headerBGC: "rgba(79, 114, 136, 0.3)", + oddRowBGC: "rgba(79, 114, 136, 0.3)", + evenRowBGC: "rgba(76, 97, 123, 0.1)", + columnWidth: [70, 90, 106, 114], + data: [], + }; + let arr:any = [] + // @ts-ignore + if (data.sumProductionDets && data.sumProductionDets.length > 0) { + // @ts-ignore + data.sumProductionDets.map((item, index) => { + let arrInner = [] + arrInner.push(index + 1, item.lineName, item.inputNum, item.outputNum) + arr.push(arrInner) + }) + } + config.data = arr + return ( +
+ +
+ {arr.length>0?:(

+ 暂无数据 +

)} +
+
+ ); +} +export default RightUp; diff --git a/src/page/LinePage5-2/Right/index.tsx b/src/page/LinePage5-2/Right/index.tsx new file mode 100644 index 0000000..53c802a --- /dev/null +++ b/src/page/LinePage5-2/Right/index.tsx @@ -0,0 +1,12 @@ +import RightDown from "./RightDown"; +import RightUp from "./RightUp"; + +function Right() { + return ( +
+ + +
+ ); +} +export default Right; diff --git a/src/page/LinePage5-2/TopP.tsx b/src/page/LinePage5-2/TopP.tsx new file mode 100644 index 0000000..e7c7a64 --- /dev/null +++ b/src/page/LinePage5-2/TopP.tsx @@ -0,0 +1,14 @@ +import '../../lanhuapp/common.css'; +import "./index.css"; + +function TopP() { + return ( +
+
+
+
+
+ ); +} + +export default TopP; \ No newline at end of file diff --git a/src/page/LinePage5-2/assets/icon/alarm.png b/src/page/LinePage5-2/assets/icon/alarm.png new file mode 100644 index 0000000..eb335f3 Binary files /dev/null and b/src/page/LinePage5-2/assets/icon/alarm.png differ diff --git a/src/page/LinePage5-2/assets/icon/defect.png b/src/page/LinePage5-2/assets/icon/defect.png new file mode 100644 index 0000000..76ed17c Binary files /dev/null and b/src/page/LinePage5-2/assets/icon/defect.png differ diff --git a/src/page/LinePage5-2/assets/icon/finished.png b/src/page/LinePage5-2/assets/icon/finished.png new file mode 100644 index 0000000..99b411b Binary files /dev/null and b/src/page/LinePage5-2/assets/icon/finished.png differ diff --git a/src/page/LinePage5-2/assets/icon/g.png b/src/page/LinePage5-2/assets/icon/g.png new file mode 100644 index 0000000..bf1b107 Binary files /dev/null and b/src/page/LinePage5-2/assets/icon/g.png differ diff --git a/src/page/LinePage5-2/assets/icon/inputAndOutput.png b/src/page/LinePage5-2/assets/icon/inputAndOutput.png new file mode 100644 index 0000000..113ed13 Binary files /dev/null and b/src/page/LinePage5-2/assets/icon/inputAndOutput.png differ diff --git a/src/page/LinePage5-2/assets/icon/num.png b/src/page/LinePage5-2/assets/icon/num.png new file mode 100644 index 0000000..e77c409 Binary files /dev/null and b/src/page/LinePage5-2/assets/icon/num.png differ diff --git a/src/page/LinePage5-2/assets/icon/r.png b/src/page/LinePage5-2/assets/icon/r.png new file mode 100644 index 0000000..d11591e Binary files /dev/null and b/src/page/LinePage5-2/assets/icon/r.png differ diff --git a/src/page/LinePage5-2/assets/icon/record.png b/src/page/LinePage5-2/assets/icon/record.png new file mode 100644 index 0000000..4622f01 Binary files /dev/null and b/src/page/LinePage5-2/assets/icon/record.png differ diff --git a/src/page/LinePage5-2/assets/icon/y.png b/src/page/LinePage5-2/assets/icon/y.png new file mode 100644 index 0000000..72c796a Binary files /dev/null and b/src/page/LinePage5-2/assets/icon/y.png differ diff --git a/src/page/LinePage5-2/index.css b/src/page/LinePage5-2/index.css new file mode 100644 index 0000000..1a28491 --- /dev/null +++ b/src/page/LinePage5-2/index.css @@ -0,0 +1,264 @@ +/* 顶部 */ +.block_top { + width: 1920px; + height: 94px; + background: url(/public/svg/topback.svg) 100% no-repeat; + background-size: 100% 100%; + opacity: 1; + display: flex; + justify-content: center; +} + +.block_top_title { + width: 651px; + height: 77px; + background: url(/public/png/topTiltle.png) 100% no-repeat; + background-size: 100% 100%; + margin-top: 18px; +} +/* 中部 */ +.block_bottom { + width: 1920px; + height: 966px; + padding-top: 20px; +} + +.group_left { + width: 402px; + height: 966px; + margin: 0 0 0 24px; +} + +.group_center { + width: 1041px; + height: 966px; + margin: 0 0 0 15px; +} + +.group_right { + width: 401px; + height: 966px; + margin-left: 15px; +} + +.left_up { + width: 402px; + height: 332px; + background: url(../../../public/png/rect/lp_left_up.png) no-repeat; + background-size: 100% 100%; + background-position: 0 0; + position: relative; +} +.left_down { + width: 402px; + height: 599px; + background: url(../../../public/png/rect/lp_left_down.png) no-repeat; + background-size: 100% 100%; + background-position: 0 0; + margin-top: 14px; + position: relative; +} +.center_up { + width: 1041px; + height: 562px; + background: url(../../../public/png/rect/lp_center_up.png) no-repeat; + background-size: 100% 100%; + background-position: 0 0; + position: relative; +} +.center_down { + width: 1041px; + height: 368px; + margin-top: 17px; +} +.center_down_inner { + width: 513px; + height: 366px; + background: url(../../../public/png/rect/lp_center_down.png) no-repeat; + background-size: 100% 100%; + background-position: 0 0; + position: relative; +} +.center_down .left-box { + margin-right: 15px; + position: relative; +} +.center_down .left-box .alarm_num_title { + position: absolute; + left: 220px; + top: 22px; + font-size: 13px; + letter-spacing: 3px; + color: #fff; +} +.center_down .left-box .alarm_num { + color: #52fff1; + font-size: 40px; + text-align: center; + font-family: PingFangSC, PingFang SC; +} +.center_down .right_box .chart_box { + width: 100%; + height: 310px; + margin-top: 10px; +} +.right_up { + width: 401px; + height: 257px; + background: url(../../../public/png/rect/lp_right_up.png) no-repeat; + background-size: 100% 100%; + background-position: 0 0; +} +.right_down { + width: 401px; + height: 673px; + background: url(../../../public/png/rect/lp_right_down.png) no-repeat; + background-size: 100% 100%; + background-position: 0 0; + margin-top: 14px; + position: relative; +} +.left_up_switch { + position: absolute; + right: 10px; + top: 12px; +} +.left_up_chart { + height: 275px; + margin-top: 10px; +} +/* 左侧 */ +.left_down_title { + height: 18px; + justify-content: center; + margin-bottom: 4px; +} +.left_down_box1 { + width: 56px; + height: 13px; + background: url(/public/png/leftbar.png) 100% no-repeat; + background-size: 100% 100%; + margin-top: 2px; +} +.left_down_box2 { + width: 56px; + height: 13px; + background: url(/public/png/rightbar.png) 100% no-repeat; + background-size: 100% 100%; + margin: 2px 0 0 0px; +} +.left_down_text { + /*width: 40px;*/ + height: 18px; + overflow-wrap: break-word; + color: rgba(1, 207, 204, 1); + font-size: 18px; + letter-spacing: 5px; + font-family: PingFangSC-Regular; + white-space: nowrap; + line-height: 18px; + margin-left: 18px; + margin-right: 16px; + text-align: center; +} +.left_down_content { + height: 160px; + /* padding-bottom: 5px; */ +} +.right_down_content { + height: 185px; + /* padding-bottom: 5px; */ +} +/* 滚动表格部分 */ +.dv-scroll-board .header .header-item, +.dv-scroll-board .rows .ceil { + border-right: 1px solid #0d1728; +} +.dv-scroll-board .header .header-item:last-child, +.dv-scroll-board .rows .ceil:last-child { + border-right: none; + border: none; +} +/* chart图部分 */ +.luoyang-chart-tooltip { + background: #0a2b4f77 !important; + border: none !important; + backdrop-filter: blur(12px); +} + +.luoyang-chart-tooltip * { + color: #fff !important; +} +/* 三维页面部分 */ +.center_up .model_name { + position: absolute; + left: 0px; + top: 0px; + z-index: 1000; +} +.center_up .model_info { + position: absolute; + left: 100px; + bottom: 0px; + z-index: 1000; + width: 841px; + height: 62px; + background: url(/public/png/lp/line_part.png) 100% no-repeat; + background-size: 100% 100%; +} +.center_up .model_info .reset_btn { + position: absolute; + top: 20px; + left: 40px; + width: 140px; + height: 40px; + cursor: pointer; +} +.center_up .model_info .title { + display: inline-block; + width: 361px; + text-align: center; + font-size: 32px; + color: #fff; + letter-spacing: 5px; + position: absolute; + left: 241px; + bottom: 10px; +} +.center_up .eq_detail_info { + position: absolute; + right: 0px; + bottom: 0px; + z-index: 1002; + width: 240px; + height: 110px; + background: url(/public/png/lp/eq_msg_detail.png) 100% no-repeat; + background-size: 100% 100%; + color: #fff; + padding: 15px 0 0 15px; +} +.center_up .eq_detail_info .left_name { + display: inline-block; + width: 95px; + height: 28px; + text-align: right; + font-size: 18px; +} +.center_up .eq_detail_info .right_value { + display: inline-block; + height: 28px; + font-size: 18px; +} +.center_up .eq_info { + position: absolute; + z-index: 1002; + background: url(/public/png/lp/eq_msg_always.png) 100% no-repeat; + background-size: 100% 100%; + color: #fff; + padding: 10px 15px; +} +.center_up .eq_info .eq_info_inner { + height: 24px; + font-size: 17px; + white-space: nowrap; +} diff --git a/src/page/LinePage5-2/index.tsx b/src/page/LinePage5-2/index.tsx new file mode 100644 index 0000000..daf9389 --- /dev/null +++ b/src/page/LinePage5-2/index.tsx @@ -0,0 +1,18 @@ +import React from "react"; +import TopP from "./TopP"; +import Left from "./Left"; +import Right from "./Right"; +import Center from "./Center"; +function LinePage() { + return ( + + +
+ +
+ +
+
+ ); +} +export default LinePage; diff --git a/src/store/UpdateData.tsx b/src/store/UpdateData.tsx index ce4d426..0c2260e 100644 --- a/src/store/UpdateData.tsx +++ b/src/store/UpdateData.tsx @@ -14,13 +14,6 @@ import { UpdateLine5Before, UpdateLine5After } from "./LinePageSlice" - -//将消息显示在网页上 -// @ts-ignore -function setMessageInnerHTML(innerHTML) { - console.log(innerHTML) -} - // let initLineGlassStatus: Object = { // LINE_1_1: 1, // LINE_1_2U: 1, @@ -87,61 +80,111 @@ function UpdateData() { let websocket4_2 = null; let websocket5_1 = null; let websocket5_2 = null; + const dispatch = useAppDispatch(); + // 测试接口开始=================== + // console.log(myUrl) + // axios.defaults.headers.common['Authorization'] = 'Bearer test1'; + // axios.defaults.headers.common['tenant-id'] = 1; + // axios.get(myUrl + '/admin-api/monitoring/ViewController/productionMonitoring?key=1-1') + // .then((res) => { + // dispatch(UpdateLine1Before(res.data)); + // }) + // axios.get(myUrl + '/admin-api/monitoring/ViewController/productionMonitoring?key=1-2') + // .then((res) => { + // dispatch(UpdateLine1After(res.data)); + // }) + // axios.get(myUrl + '/admin-api/monitoring/ViewController/productionMonitoring?key=2-1') + // .then((res) => { + // dispatch(UpdateLine2Before(res.data)); + // }) + // axios.get(myUrl + '/admin-api/monitoring/ViewController/productionMonitoring?key=2-2') + // .then((res) => { + // dispatch(UpdateLine2After(res.data)); + // }) + // axios.get(myUrl + '/admin-api/monitoring/ViewController/productionMonitoring?key=3-1') + // .then((res) => { + // dispatch(UpdateLine3Before(res.data)); + // }) + // axios.get(myUrl + '/admin-api/monitoring/ViewController/productionMonitoring?key=3-2') + // .then((res) => { + // dispatch(UpdateLine3After(res.data)); + // }) + // axios.get(myUrl + '/admin-api/monitoring/ViewController/productionMonitoring?key=4-1') + // .then((res) => { + // dispatch(UpdateLine4Before(res.data)); + // }) + // axios.get(myUrl + '/admin-api/monitoring/ViewController/productionMonitoring?key=4-2') + // .then((res) => { + // dispatch(UpdateLine4After(res.data)); + // }) + // axios.get(myUrl + '/admin-api/monitoring/ViewController/productionMonitoring?key=5-1') + // .then((res) => { + // dispatch(UpdateLine5Before(res.data)); + // }) + // axios.get(myUrl + '/admin-api/monitoring/ViewController/productionMonitoring?key=5-2') + // .then((res) => { + // dispatch(UpdateLine5After(res.data)); + // }) + // console.log('===========================================') + // return ( + // null + // ) + // 测试接口结束==================== if ('WebSocket' in window) { websocket1_1 = new WebSocket("ws://" + myUrl + "/websocket/message?userId=1-1"); - // websocket1_2 = new WebSocket("ws://" + myUrl + "/websocket/message?userId=1-2"); - // websocket2_1 = new WebSocket("ws://" + myUrl + "/websocket/message?userId=2-1"); - // websocket2_2 = new WebSocket("ws://" + myUrl + "/websocket/message?userId=2-2"); - // websocket3_1 = new WebSocket("ws://" + myUrl + "/websocket/message?userId=3-1"); - // websocket3_2 = new WebSocket("ws://" + myUrl + "/websocket/message?userId=3-2"); - // websocket4_1 = new WebSocket("ws://" + myUrl + "/websocket/message?userId=4-1"); - // websocket4_2 = new WebSocket("ws://" + myUrl + "/websocket/message?userId=4-2"); - // websocket5_1 = new WebSocket("ws://" + myUrl + "/websocket/message?userId=5-1"); - // websocket5_2 = new WebSocket("ws://" + myUrl + "/websocket/message?userId=5-2"); + websocket1_2 = new WebSocket("ws://" + myUrl + "/websocket/message?userId=1-2"); + websocket2_1 = new WebSocket("ws://" + myUrl + "/websocket/message?userId=2-1"); + websocket2_2 = new WebSocket("ws://" + myUrl + "/websocket/message?userId=2-2"); + websocket3_1 = new WebSocket("ws://" + myUrl + "/websocket/message?userId=3-1"); + websocket3_2 = new WebSocket("ws://" + myUrl + "/websocket/message?userId=3-2"); + websocket4_1 = new WebSocket("ws://" + myUrl + "/websocket/message?userId=4-1"); + websocket4_2 = new WebSocket("ws://" + myUrl + "/websocket/message?userId=4-2"); + websocket5_1 = new WebSocket("ws://" + myUrl + "/websocket/message?userId=5-1"); + websocket5_2 = new WebSocket("ws://" + myUrl + "/websocket/message?userId=5-2"); //连接成功建立的回调方法 } else { alert('Not support websocket'); } // @ts-ignore websocket1_1.onopen = function (event) { - setMessageInnerHTML("websocket1_1-open"); + console.log("websocket1_1-open"); } // @ts-ignore - // websocket1_2.onopen = function (event) { - // setMessageInnerHTML("websocket1_2-open"); - // } - // // @ts-ignore - // websocket2_1.onopen = function (event) { - // setMessageInnerHTML("websocket1_1-open"); - // } - // // @ts-ignore - // websocket2_2.onopen = function (event) { - // setMessageInnerHTML("websocket1_2-open"); - // } - // // @ts-ignore - // websocket3_1.onopen = function (event) { - // setMessageInnerHTML("websocket1_1-open"); - // } - // // @ts-ignore - // websocket3_2.onopen = function (event) { - // setMessageInnerHTML("websocket1_2-open"); - // } - // // @ts-ignore - // websocket4_1.onopen = function (event) { - // setMessageInnerHTML("websocket1_1-open"); - // } - // // @ts-ignore - // websocket4_2.onopen = function (event) { - // setMessageInnerHTML("websocket1_2-open"); - // } - // // @ts-ignore - // websocket5_1.onopen = function (event) { - // setMessageInnerHTML("websocket1_1-open"); - // } - // // @ts-ignore - // websocket5_2.onopen = function (event) { - // setMessageInnerHTML("websocket1_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 websocket1_1.onmessage = function (event) { @@ -152,120 +195,107 @@ function UpdateData() { console.log("websocket: [unable to msgData] : ", event.data); } if (!Object.prototype.toString.call(msgData).includes('Object')) return; - console.log(msgData) 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; - // console.log(msgData) - // 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; - // console.log(msgData) - // 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; - // console.log(msgData) - // 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; - // console.log(msgData) - // 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; - // console.log(msgData) - // 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; - // console.log(msgData) - // 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; - // console.log(msgData) - // 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; - // console.log(msgData) - // 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; - // console.log(msgData) - // dispatch(UpdateLine5After(msgData)); - // } - - const dispatch = useAppDispatch(); - + 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 )