update
This commit is contained in:
parent
19825dcb5f
commit
ac711e6f2a
22
package-lock.json
generated
22
package-lock.json
generated
@ -73,7 +73,8 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/plugin-proposal-private-property-in-object": "^7.21.11",
|
"@babel/plugin-proposal-private-property-in-object": "^7.21.11",
|
||||||
"less": "^4.2.0",
|
"less": "^4.2.0",
|
||||||
"less-loader": "^11.1.3"
|
"less-loader": "^11.1.3",
|
||||||
|
"typescript": "^5.3.3"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@aashutoshrathi/word-wrap": {
|
"node_modules/@aashutoshrathi/word-wrap": {
|
||||||
@ -18583,6 +18584,19 @@
|
|||||||
"is-typedarray": "^1.0.0"
|
"is-typedarray": "^1.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/typescript": {
|
||||||
|
"version": "5.3.3",
|
||||||
|
"resolved": "https://registry.npmmirror.com/typescript/-/typescript-5.3.3.tgz",
|
||||||
|
"integrity": "sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw==",
|
||||||
|
"dev": true,
|
||||||
|
"bin": {
|
||||||
|
"tsc": "bin/tsc",
|
||||||
|
"tsserver": "bin/tsserver"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=14.17"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/unbox-primitive": {
|
"node_modules/unbox-primitive": {
|
||||||
"version": "1.0.2",
|
"version": "1.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.2.tgz",
|
||||||
@ -32873,6 +32887,12 @@
|
|||||||
"is-typedarray": "^1.0.0"
|
"is-typedarray": "^1.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"typescript": {
|
||||||
|
"version": "5.3.3",
|
||||||
|
"resolved": "https://registry.npmmirror.com/typescript/-/typescript-5.3.3.tgz",
|
||||||
|
"integrity": "sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"unbox-primitive": {
|
"unbox-primitive": {
|
||||||
"version": "1.0.2",
|
"version": "1.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.2.tgz",
|
||||||
|
@ -91,7 +91,8 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/plugin-proposal-private-property-in-object": "^7.21.11",
|
"@babel/plugin-proposal-private-property-in-object": "^7.21.11",
|
||||||
"less": "^4.2.0",
|
"less": "^4.2.0",
|
||||||
"less-loader": "^11.1.3"
|
"less-loader": "^11.1.3",
|
||||||
|
"typescript": "^5.3.3"
|
||||||
},
|
},
|
||||||
"jest": {
|
"jest": {
|
||||||
"roots": [
|
"roots": [
|
||||||
|
1
src/components/Common/TodayFaultTotal/1.json
Normal file
1
src/components/Common/TodayFaultTotal/1.json
Normal file
@ -0,0 +1 @@
|
|||||||
|
1.json
|
@ -1,163 +1,210 @@
|
|||||||
import cls from './index.module.css';
|
import cls from "./index.module.css";
|
||||||
import GraphBase from '../GraphBase';
|
import GraphBase from "../GraphBase";
|
||||||
import ReactECharts from 'echarts-for-react';
|
import ReactECharts from "echarts-for-react";
|
||||||
|
import { useSelector, useDispatch } from "react-redux";
|
||||||
|
import { useEffect } from "react";
|
||||||
|
|
||||||
function FaultTotal(props) {
|
function FaultTotal(props) {
|
||||||
const options = {
|
const isra = useSelector((state) => state.isra);
|
||||||
color: [
|
const dispatch = useDispatch();
|
||||||
'#2760FF',
|
|
||||||
'#5B9BFF',
|
|
||||||
'#FFD160',
|
|
||||||
'#8167F6',
|
|
||||||
'#99D66C',
|
|
||||||
'#FF8A40',
|
|
||||||
'#12FFF5',
|
|
||||||
],
|
|
||||||
grid: { top: 42, right: 12, bottom: 20, left: 48 },
|
|
||||||
legend: {
|
|
||||||
top: 10,
|
|
||||||
padding: 5,
|
|
||||||
itemWidth: 12,
|
|
||||||
itemHeight: 12,
|
|
||||||
itemGap: 12,
|
|
||||||
height: 12,
|
|
||||||
textStyle: {
|
|
||||||
color: '#DFF1FE',
|
|
||||||
fontSize: 12,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
xAxis: {
|
|
||||||
type: 'category',
|
|
||||||
data: Array(5)
|
|
||||||
.fill(1)
|
|
||||||
.map((_, index) => {
|
|
||||||
return '产线' + (index + 1);
|
|
||||||
}),
|
|
||||||
axisLabel: {
|
|
||||||
color: '#fff',
|
|
||||||
fontSize: 12,
|
|
||||||
},
|
|
||||||
axisTick: { show: false },
|
|
||||||
axisLine: {
|
|
||||||
lineStyle: {
|
|
||||||
width: 1,
|
|
||||||
color: '#213259',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
yAxis: {
|
|
||||||
name: '单位/个',
|
|
||||||
nameTextStyle: {
|
|
||||||
color: '#fff',
|
|
||||||
fontSize: 10,
|
|
||||||
align: 'right',
|
|
||||||
},
|
|
||||||
type: 'value',
|
|
||||||
axisLabel: {
|
|
||||||
color: '#fff',
|
|
||||||
fontSize: 12,
|
|
||||||
formatter: '{value}',
|
|
||||||
},
|
|
||||||
axisLine: {
|
|
||||||
show: true,
|
|
||||||
lineStyle: {
|
|
||||||
color: '#213259',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
splitLine: {
|
|
||||||
lineStyle: {
|
|
||||||
color: '#213259a0',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
// interval: 10,
|
|
||||||
// min: 0,
|
|
||||||
// max: 100,
|
|
||||||
},
|
|
||||||
series: [
|
|
||||||
{
|
|
||||||
name: '缺陷1',
|
|
||||||
type: 'bar',
|
|
||||||
stack: 'abcd',
|
|
||||||
emphasis: {
|
|
||||||
focus: 'series',
|
|
||||||
},
|
|
||||||
data: [320, 332, 301, 334, 390, 330, 320],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: '缺陷2',
|
|
||||||
type: 'bar',
|
|
||||||
stack: 'abcd',
|
|
||||||
emphasis: {
|
|
||||||
focus: 'series',
|
|
||||||
},
|
|
||||||
data: [120, 132, 101, 134, 90, 230, 210],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: '缺陷3',
|
|
||||||
type: 'bar',
|
|
||||||
stack: 'abcd',
|
|
||||||
emphasis: {
|
|
||||||
focus: 'series',
|
|
||||||
},
|
|
||||||
data: [220, 182, 191, 234, 290, 330, 310],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: '缺陷4',
|
|
||||||
type: 'bar',
|
|
||||||
stack: 'abcd',
|
|
||||||
emphasis: {
|
|
||||||
focus: 'series',
|
|
||||||
},
|
|
||||||
data: [150, 232, 201, 154, 190, 330, 410],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: '缺陷5',
|
|
||||||
type: 'bar',
|
|
||||||
stack: 'abcd',
|
|
||||||
emphasis: {
|
|
||||||
focus: 'series',
|
|
||||||
},
|
|
||||||
data: [862, 1018, 964, 1026, 1679, 1600, 1570],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: '缺陷6',
|
|
||||||
type: 'bar',
|
|
||||||
barGap: 20,
|
|
||||||
barWidth: 12,
|
|
||||||
stack: 'abcd',
|
|
||||||
emphasis: {
|
|
||||||
focus: 'series',
|
|
||||||
},
|
|
||||||
data: [620, 732, 701, 734, 1090, 1130, 1120],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
tooltip: {
|
|
||||||
trigger: 'axis',
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
function handleDateChange(v) {
|
useEffect(() => {
|
||||||
console.log('date ', v);
|
// 设置缺陷
|
||||||
}
|
dispatch({
|
||||||
|
type: "isra/setCheckTypeList",
|
||||||
|
payload: [
|
||||||
|
"Lehrer",
|
||||||
|
"Anwalt",
|
||||||
|
"Professorin",
|
||||||
|
"Professor",
|
||||||
|
"Lehrerin",
|
||||||
|
"Anwältin",
|
||||||
|
],
|
||||||
|
});
|
||||||
|
|
||||||
// 根据使用的页面决定背景的大小
|
dispatch({
|
||||||
const bgSize =
|
type: "isra/setDayStatistic",
|
||||||
props.page == 'home' ? ['middle', 'short'] : ['middle', 'long'];
|
payload: [
|
||||||
|
// 产线1
|
||||||
|
{
|
||||||
|
name: "10.1.1.1",
|
||||||
|
sum: 500,
|
||||||
|
data: [
|
||||||
|
{ checkType: "Lehrer", checkNum: 100 },
|
||||||
|
{ checkType: "Anwalt", checkNum: 200 },
|
||||||
|
{ checkType: "Professor", checkNum: 200 },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
// 产线2
|
||||||
|
{
|
||||||
|
name: "10.1.1.2",
|
||||||
|
sum: 730,
|
||||||
|
data: [
|
||||||
|
{ checkType: "Lehrer", checkNum: 200 },
|
||||||
|
{ checkType: "Anwalt", checkNum: 130 },
|
||||||
|
{ checkType: "Lehrerin", checkNum: 400 },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
});
|
||||||
|
}, []);
|
||||||
|
|
||||||
return (
|
const options = {
|
||||||
<GraphBase
|
color: [
|
||||||
icon="battery"
|
"#FF8A40",
|
||||||
title="产线缺陷统计"
|
"#FFD160",
|
||||||
dateOptions={['日', '周', '月', '年']}
|
"#99D66C",
|
||||||
onDateChange={handleDateChange}
|
"#5B9BFF",
|
||||||
size={bgSize}
|
"#8167F6",
|
||||||
style={{ width: '600px' }}
|
"#2760FF",
|
||||||
>
|
"#12FFF5",
|
||||||
<div className={cls.chart}>
|
],
|
||||||
<ReactECharts option={options} style={{ height: '100%' }} />
|
grid: { top: 42, right: 12, bottom: 20, left: 48 },
|
||||||
</div>
|
legend: {
|
||||||
</GraphBase>
|
top: 10,
|
||||||
);
|
padding: 5,
|
||||||
|
itemWidth: 12,
|
||||||
|
itemHeight: 12,
|
||||||
|
itemGap: 12,
|
||||||
|
height: 12,
|
||||||
|
textStyle: {
|
||||||
|
color: "#DFF1FE",
|
||||||
|
fontSize: 12,
|
||||||
|
},
|
||||||
|
// data: isra.checkTypeList,
|
||||||
|
},
|
||||||
|
xAxis: {
|
||||||
|
type: "category",
|
||||||
|
data: Array(5)
|
||||||
|
.fill(1)
|
||||||
|
.map((_, index) => {
|
||||||
|
return "产线" + (index + 1);
|
||||||
|
}),
|
||||||
|
axisLabel: {
|
||||||
|
color: "#fff",
|
||||||
|
fontSize: 12,
|
||||||
|
},
|
||||||
|
axisTick: { show: false },
|
||||||
|
axisLine: {
|
||||||
|
lineStyle: {
|
||||||
|
width: 1,
|
||||||
|
color: "#213259",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
yAxis: {
|
||||||
|
name: "单位/个",
|
||||||
|
nameTextStyle: {
|
||||||
|
color: "#fff",
|
||||||
|
fontSize: 10,
|
||||||
|
align: "right",
|
||||||
|
},
|
||||||
|
type: "value",
|
||||||
|
axisLabel: {
|
||||||
|
color: "#fff",
|
||||||
|
fontSize: 12,
|
||||||
|
formatter: "{value}",
|
||||||
|
},
|
||||||
|
axisLine: {
|
||||||
|
show: true,
|
||||||
|
lineStyle: {
|
||||||
|
color: "#213259",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
splitLine: {
|
||||||
|
lineStyle: {
|
||||||
|
color: "#213259a0",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
// interval: 10,
|
||||||
|
// min: 0,
|
||||||
|
// max: 100,
|
||||||
|
},
|
||||||
|
series: [
|
||||||
|
{
|
||||||
|
name: "缺陷1",
|
||||||
|
type: "bar",
|
||||||
|
stack: "abcd",
|
||||||
|
emphasis: {
|
||||||
|
focus: "series",
|
||||||
|
},
|
||||||
|
data: [320, 332, 301, 334, 390, 330, 320],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "缺陷2",
|
||||||
|
type: "bar",
|
||||||
|
stack: "abcd",
|
||||||
|
emphasis: {
|
||||||
|
focus: "series",
|
||||||
|
},
|
||||||
|
data: [120, 132, 101, 134, 90, 230, 210],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "缺陷3",
|
||||||
|
type: "bar",
|
||||||
|
stack: "abcd",
|
||||||
|
emphasis: {
|
||||||
|
focus: "series",
|
||||||
|
},
|
||||||
|
data: [220, 182, 191, 234, 290, 330, 310],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "缺陷4",
|
||||||
|
type: "bar",
|
||||||
|
stack: "abcd",
|
||||||
|
emphasis: {
|
||||||
|
focus: "series",
|
||||||
|
},
|
||||||
|
data: [150, 232, 201, 154, 190, 330, 410],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "缺陷5",
|
||||||
|
type: "bar",
|
||||||
|
stack: "abcd",
|
||||||
|
emphasis: {
|
||||||
|
focus: "series",
|
||||||
|
},
|
||||||
|
data: [862, 1018, 964, 1026, 1679, 1600, 1570],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "缺陷6",
|
||||||
|
type: "bar",
|
||||||
|
barGap: 20,
|
||||||
|
barWidth: 12,
|
||||||
|
stack: "abcd",
|
||||||
|
emphasis: {
|
||||||
|
focus: "series",
|
||||||
|
},
|
||||||
|
data: [620, 732, 701, 734, 1090, 1130, 1120],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
tooltip: {
|
||||||
|
trigger: "axis",
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
function handleDateChange(v) {
|
||||||
|
console.log("date ", v);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 根据使用的页面决定背景的大小
|
||||||
|
const bgSize =
|
||||||
|
props.page == "home" ? ["middle", "short"] : ["middle", "long"];
|
||||||
|
|
||||||
|
return (
|
||||||
|
<GraphBase
|
||||||
|
icon="battery"
|
||||||
|
title="产线缺陷统计"
|
||||||
|
dateOptions={["日", "周", "月", "年"]}
|
||||||
|
onDateChange={handleDateChange}
|
||||||
|
size={bgSize}
|
||||||
|
style={{ width: "600px" }}
|
||||||
|
>
|
||||||
|
<div className={cls.chart}>
|
||||||
|
<ReactECharts option={options} style={{ height: "100%" }} />
|
||||||
|
</div>
|
||||||
|
</GraphBase>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default FaultTotal;
|
export default FaultTotal;
|
||||||
|
40
src/store/features/QualityIsraSlice.js
Normal file
40
src/store/features/QualityIsraSlice.js
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
import { createSlice } from "@reduxjs/toolkit";
|
||||||
|
|
||||||
|
export const initialState = {
|
||||||
|
checkTypeList: [],
|
||||||
|
dayStatistic: [],
|
||||||
|
monthStatistic: [],
|
||||||
|
yearStatistic: [],
|
||||||
|
weekStatistic: [],
|
||||||
|
};
|
||||||
|
|
||||||
|
const israSlice = createSlice({
|
||||||
|
name: "isra",
|
||||||
|
initialState,
|
||||||
|
reducers: {
|
||||||
|
setCheckTypeList: (state, action) => {
|
||||||
|
state.checkTypeList = action.payload;
|
||||||
|
},
|
||||||
|
setDayStatistic: (state, action) => {
|
||||||
|
state.dayStatistic = action.payload;
|
||||||
|
},
|
||||||
|
setMonthStatistic: (state, action) => {
|
||||||
|
state.monthStatistic = action.payload;
|
||||||
|
},
|
||||||
|
setYearStatistic: (state, action) => {
|
||||||
|
state.yearStatistic = action.payload;
|
||||||
|
},
|
||||||
|
setWeekStatistic: (state, action) => {
|
||||||
|
state.weekStatistic = action.payload;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
export default israSlice.reducer;
|
||||||
|
export const {
|
||||||
|
setCheckTypeList,
|
||||||
|
setDayStatistic,
|
||||||
|
setWeekStatistic,
|
||||||
|
setMonthStatistic,
|
||||||
|
setYearStatistic,
|
||||||
|
} = israSlice.actions;
|
@ -1,57 +0,0 @@
|
|||||||
{
|
|
||||||
"data": {
|
|
||||||
"AnnealFanFrequencyInfo": {
|
|
||||||
"1#退火A2区1#风机": "49",
|
|
||||||
"1#退火A2区2#风机": "49",
|
|
||||||
"1#退火B区1#风机": "19",
|
|
||||||
"1#退火B区2#风机": "17",
|
|
||||||
"1#退火C区1#风机": "15",
|
|
||||||
"1#退火C区2#风机": "2",
|
|
||||||
"1#退火F1区风机": "80",
|
|
||||||
"1#退火F2区风机": "45",
|
|
||||||
"1#退火RET1区1#风机": "50",
|
|
||||||
"1#退火RET1区2#风机": "24",
|
|
||||||
"2#退火A2区1#风机": "0",
|
|
||||||
"2#退火A2区2#风机": "18",
|
|
||||||
"2#退火B区1#风机": "56",
|
|
||||||
"2#退火B区2#风机": "14",
|
|
||||||
"2#退火C区1#风机": "72",
|
|
||||||
"2#退火C区2#风机": "83",
|
|
||||||
"2#退火F1区风机": "45",
|
|
||||||
"2#退火F2区风机": "54",
|
|
||||||
"2#退火RET1区1#风机": "64",
|
|
||||||
"2#退火RET1区2#风机": "98",
|
|
||||||
"3#退火A2区1#风机": "45",
|
|
||||||
"3#退火A2区2#风机": "42",
|
|
||||||
"3#退火B区1#风机": "17",
|
|
||||||
"3#退火B区2#风机": "71",
|
|
||||||
"3#退火C区1#风机": "69",
|
|
||||||
"3#退火C区2#风机": "51",
|
|
||||||
"3#退火F1区风机": "64",
|
|
||||||
"3#退火F2区风机": "18",
|
|
||||||
"3#退火RET1区1#风机": "26",
|
|
||||||
"3#退火RET1区2#风机": "74",
|
|
||||||
"4#退火A2区1#风机": "22",
|
|
||||||
"4#退火A2区2#风机": "77",
|
|
||||||
"4#退火B区1#风机": "96",
|
|
||||||
"4#退火B区2#风机": "76",
|
|
||||||
"4#退火C区1#风机": "16",
|
|
||||||
"4#退火C区2#风机": "12",
|
|
||||||
"4#退火F1区风机": "65",
|
|
||||||
"4#退火F2区风机": "12",
|
|
||||||
"4#退火RET1区1#风机": "68",
|
|
||||||
"4#退火RET1区2#风机": "34",
|
|
||||||
"5#退火A2区1#风机": "76",
|
|
||||||
"5#退火A2区2#风机": "65",
|
|
||||||
"5#退火B区1#风机": "79",
|
|
||||||
"5#退火B区2#风机": "65",
|
|
||||||
"5#退火C区1#风机": "16",
|
|
||||||
"5#退火C区2#风机": "92",
|
|
||||||
"5#退火F1区风机": "6",
|
|
||||||
"5#退火F2区风机": "86",
|
|
||||||
"5#退火RET1区1#风机": "99",
|
|
||||||
"5#退火RET1区2#风机": "62"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"type": "AnnealFanFrequencyInfo"
|
|
||||||
}
|
|
@ -9,6 +9,7 @@ import temperatureReducer from "./features/temperatureSlice";
|
|||||||
import annealTemperatureReducer from "./features/annealTemperatureSlice";
|
import annealTemperatureReducer from "./features/annealTemperatureSlice";
|
||||||
import fanInfoReducer from "./features/fanInfo";
|
import fanInfoReducer from "./features/fanInfo";
|
||||||
import energySlice from "./features/EnergySlice";
|
import energySlice from "./features/EnergySlice";
|
||||||
|
import israReducer from "./features/QualityIsraSlice";
|
||||||
import annealFanFrequenceReducer from "./features/annealFanFrequenceSlice";
|
import annealFanFrequenceReducer from "./features/annealFanFrequenceSlice";
|
||||||
import annealFanInfoReducer from "./features/annealFanInfoSlice";
|
import annealFanInfoReducer from "./features/annealFanInfoSlice";
|
||||||
|
|
||||||
@ -37,6 +38,8 @@ export const store = configureStore({
|
|||||||
// 温度
|
// 温度
|
||||||
annealTemperature: annealTemperatureReducer,
|
annealTemperature: annealTemperatureReducer,
|
||||||
// 能耗
|
// 能耗
|
||||||
energy: energySlice
|
energy: energySlice,
|
||||||
|
// 能耗
|
||||||
|
isra: israReducer,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
22
src/utils/checkTypeHelper.ts
Normal file
22
src/utils/checkTypeHelper.ts
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
type CheckTypeItem = {
|
||||||
|
checkDiscard?: boolean;
|
||||||
|
checkType: string;
|
||||||
|
checkNum: number;
|
||||||
|
ip?: string;
|
||||||
|
israDefectType?: string;
|
||||||
|
israSeriousGrade?: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
type ProductLineItem = {
|
||||||
|
name: string;
|
||||||
|
sum: number;
|
||||||
|
data: CheckTypeItem[];
|
||||||
|
};
|
||||||
|
|
||||||
|
export type MessageItem = {
|
||||||
|
checkTypeList: string[];
|
||||||
|
dayStatistic?: ProductLineItem[];
|
||||||
|
weekStatistic?: ProductLineItem[];
|
||||||
|
monthStatistic?: ProductLineItem[];
|
||||||
|
yearStatistic?: ProductLineItem[];
|
||||||
|
};
|
@ -1,6 +1,7 @@
|
|||||||
import { store } from "../store";
|
import { store } from "../store";
|
||||||
|
import { MessageItem } from "./checkTypeHelper";
|
||||||
|
|
||||||
export function randomInt(min, max, includeMax = false) {
|
export function randomInt(min: number, max: number, includeMax = false) {
|
||||||
let Fn = includeMax ? Math.ceil : Math.floor;
|
let Fn = includeMax ? Math.ceil : Math.floor;
|
||||||
let num = Fn(Math.random() * max);
|
let num = Fn(Math.random() * max);
|
||||||
while (num < min) {
|
while (num < min) {
|
||||||
@ -13,7 +14,15 @@ export function randomInt(min, max, includeMax = false) {
|
|||||||
* new XClient('ws://192.168.1.12:8081/xc-screen/websocket/xc001', 'DCS')
|
* new XClient('ws://192.168.1.12:8081/xc-screen/websocket/xc001', 'DCS')
|
||||||
*/
|
*/
|
||||||
class XClient {
|
class XClient {
|
||||||
constructor(url, name, onmessage) {
|
url: string;
|
||||||
|
name: string;
|
||||||
|
ws: WebSocket;
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
url: string,
|
||||||
|
name: string,
|
||||||
|
onmessage: (msg: MessageEvent) => void
|
||||||
|
) {
|
||||||
this.url = url;
|
this.url = url;
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.ws = new WebSocket(url);
|
this.ws = new WebSocket(url);
|
||||||
@ -22,7 +31,7 @@ class XClient {
|
|||||||
};
|
};
|
||||||
this.ws.onmessage = onmessage;
|
this.ws.onmessage = onmessage;
|
||||||
this.ws.onerror = (err) => {
|
this.ws.onerror = (err) => {
|
||||||
console.log("[*] websocket error!", err, err.data);
|
console.log("[*] websocket error!", err);
|
||||||
};
|
};
|
||||||
this.ws.onclose = (e) => {
|
this.ws.onclose = (e) => {
|
||||||
console.log(`[*] ${this.name} ws closed`);
|
console.log(`[*] ${this.name} ws closed`);
|
||||||
@ -34,8 +43,8 @@ new XClient(
|
|||||||
"ws://m306416y13.yicp.fun:35441/xc-screen/websocket/xc001",
|
"ws://m306416y13.yicp.fun:35441/xc-screen/websocket/xc001",
|
||||||
// "ws://192.168.1.12:8081/xc-screen/websocket/xc001",
|
// "ws://192.168.1.12:8081/xc-screen/websocket/xc001",
|
||||||
"DCS_DATA",
|
"DCS_DATA",
|
||||||
(msg) => {
|
(msg: MessageEvent) => {
|
||||||
let serializedData = null;
|
let serializedData: { type: string; data: any } | null = null;
|
||||||
try {
|
try {
|
||||||
serializedData = JSON.parse(msg.data);
|
serializedData = JSON.parse(msg.data);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@ -169,7 +178,7 @@ new XClient(
|
|||||||
"ws://192.168.1.74:48080/websocket/message?userId=ENERGY111",
|
"ws://192.168.1.74:48080/websocket/message?userId=ENERGY111",
|
||||||
"MES_DATA",
|
"MES_DATA",
|
||||||
(msg) => {
|
(msg) => {
|
||||||
let serializedData = null;
|
let serializedData: { type: string; data: any } | null = null;
|
||||||
try {
|
try {
|
||||||
serializedData = JSON.parse(msg.data);
|
serializedData = JSON.parse(msg.data);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@ -190,3 +199,52 @@ new XClient(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// 产线缺陷相关数据
|
||||||
|
new XClient(
|
||||||
|
"ws://192.168.0.33:48082/websocket/message?userId=IS111",
|
||||||
|
"QUALITY_DATA",
|
||||||
|
(msg) => {
|
||||||
|
let serializedData: MessageItem | null = null;
|
||||||
|
try {
|
||||||
|
serializedData = JSON.parse(msg.data);
|
||||||
|
} catch (error) {
|
||||||
|
console.log("[*] websocket: [unable to serialize] ---> ", msg);
|
||||||
|
}
|
||||||
|
if (serializedData == null) return;
|
||||||
|
// 处理 checkTypeList
|
||||||
|
store.dispatch({
|
||||||
|
type: "isra/setCheckTypeList",
|
||||||
|
payload: serializedData.checkTypeList,
|
||||||
|
});
|
||||||
|
// for (const checkType of serializedData.checkTypeList) {
|
||||||
|
// store.dispatch({
|
||||||
|
// type: 'isra/setCheckTypeList',
|
||||||
|
// payload: serializedData.checkTypeList
|
||||||
|
// })
|
||||||
|
// }
|
||||||
|
|
||||||
|
// 处理 dayStatistic 等数据
|
||||||
|
if ("dayStatistic" in serializedData) {
|
||||||
|
store.dispatch({
|
||||||
|
type: "isra/setDayStatistic",
|
||||||
|
payload: serializedData.dayStatistic,
|
||||||
|
});
|
||||||
|
} else if ("weekStatistic" in serializedData) {
|
||||||
|
store.dispatch({
|
||||||
|
type: "isra/setWeekStatistic",
|
||||||
|
payload: serializedData.weekStatistic,
|
||||||
|
});
|
||||||
|
} else if ("monthStatistic" in serializedData) {
|
||||||
|
store.dispatch({
|
||||||
|
type: "isra/setMonthStatistic",
|
||||||
|
payload: serializedData.monthStatistic,
|
||||||
|
});
|
||||||
|
} else if ("yearStatistic" in serializedData) {
|
||||||
|
store.dispatch({
|
||||||
|
type: "isra/setYearStatistic",
|
||||||
|
payload: serializedData.yearStatistic,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
4
src/utils/index.types.ts
Normal file
4
src/utils/index.types.ts
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
export type MessageEvent = {
|
||||||
|
type: string;
|
||||||
|
data: any;
|
||||||
|
}
|
109
tsconfig.json
Normal file
109
tsconfig.json
Normal file
@ -0,0 +1,109 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
/* Visit https://aka.ms/tsconfig to read more about this file */
|
||||||
|
|
||||||
|
/* Projects */
|
||||||
|
// "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */
|
||||||
|
// "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
|
||||||
|
// "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */
|
||||||
|
// "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */
|
||||||
|
// "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
|
||||||
|
// "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
|
||||||
|
|
||||||
|
/* Language and Environment */
|
||||||
|
"target": "es2016", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
|
||||||
|
// "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
|
||||||
|
"jsx": "preserve", /* Specify what JSX code is generated. */
|
||||||
|
// "experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */
|
||||||
|
// "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
|
||||||
|
// "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */
|
||||||
|
// "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */
|
||||||
|
// "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */
|
||||||
|
// "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */
|
||||||
|
// "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
|
||||||
|
// "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
|
||||||
|
// "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
|
||||||
|
|
||||||
|
/* Modules */
|
||||||
|
"module": "commonjs", /* Specify what module code is generated. */
|
||||||
|
// "rootDir": "./", /* Specify the root folder within your source files. */
|
||||||
|
// "moduleResolution": "node10", /* Specify how TypeScript looks up a file from a given module specifier. */
|
||||||
|
// "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
|
||||||
|
// "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
|
||||||
|
// "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
|
||||||
|
// "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */
|
||||||
|
// "types": [], /* Specify type package names to be included without being referenced in a source file. */
|
||||||
|
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
|
||||||
|
// "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */
|
||||||
|
// "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set. */
|
||||||
|
// "resolvePackageJsonExports": true, /* Use the package.json 'exports' field when resolving package imports. */
|
||||||
|
// "resolvePackageJsonImports": true, /* Use the package.json 'imports' field when resolving imports. */
|
||||||
|
// "customConditions": [], /* Conditions to set in addition to the resolver-specific defaults when resolving imports. */
|
||||||
|
// "resolveJsonModule": true, /* Enable importing .json files. */
|
||||||
|
// "allowArbitraryExtensions": true, /* Enable importing files with any extension, provided a declaration file is present. */
|
||||||
|
// "noResolve": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */
|
||||||
|
|
||||||
|
/* JavaScript Support */
|
||||||
|
"allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */
|
||||||
|
// "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */
|
||||||
|
// "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */
|
||||||
|
|
||||||
|
/* Emit */
|
||||||
|
// "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
|
||||||
|
// "declarationMap": true, /* Create sourcemaps for d.ts files. */
|
||||||
|
// "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
|
||||||
|
// "sourceMap": true, /* Create source map files for emitted JavaScript files. */
|
||||||
|
// "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
|
||||||
|
// "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
|
||||||
|
// "outDir": "./", /* Specify an output folder for all emitted files. */
|
||||||
|
// "removeComments": true, /* Disable emitting comments. */
|
||||||
|
// "noEmit": true, /* Disable emitting files from a compilation. */
|
||||||
|
// "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
|
||||||
|
// "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */
|
||||||
|
// "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
|
||||||
|
// "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */
|
||||||
|
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
|
||||||
|
// "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */
|
||||||
|
// "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
|
||||||
|
// "newLine": "crlf", /* Set the newline character for emitting files. */
|
||||||
|
// "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */
|
||||||
|
// "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */
|
||||||
|
// "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */
|
||||||
|
// "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */
|
||||||
|
// "declarationDir": "./", /* Specify the output directory for generated declaration files. */
|
||||||
|
// "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */
|
||||||
|
|
||||||
|
/* Interop Constraints */
|
||||||
|
// "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
|
||||||
|
// "verbatimModuleSyntax": true, /* Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting. */
|
||||||
|
// "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
|
||||||
|
"esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */
|
||||||
|
// "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
|
||||||
|
"forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
|
||||||
|
|
||||||
|
/* Type Checking */
|
||||||
|
"strict": true, /* Enable all strict type-checking options. */
|
||||||
|
// "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */
|
||||||
|
// "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */
|
||||||
|
// "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
|
||||||
|
// "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */
|
||||||
|
// "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
|
||||||
|
// "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */
|
||||||
|
// "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */
|
||||||
|
// "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
|
||||||
|
// "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */
|
||||||
|
// "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */
|
||||||
|
// "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
|
||||||
|
// "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
|
||||||
|
// "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
|
||||||
|
// "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */
|
||||||
|
// "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
|
||||||
|
// "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */
|
||||||
|
// "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
|
||||||
|
// "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */
|
||||||
|
|
||||||
|
/* Completeness */
|
||||||
|
// "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
|
||||||
|
"skipLibCheck": true /* Skip type checking all .d.ts files. */
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user