update 当前产线生产规格

This commit is contained in:
lb 2023-12-28 10:14:14 +08:00
parent b57b65ffd4
commit c2802627d6
7 changed files with 249 additions and 155 deletions

View File

@ -1,60 +1,36 @@
import BottomBarItem from "../BottomItemBackground"; import BottomBarItem from "../BottomItemBackground";
import React, { Component } from "react";
import cls from "./righttable.module.scss"; import cls from "./righttable.module.scss";
import { useSelector } from "react-redux";
import { ScrollBoard } from "@jiaminghi/data-view-react"; import { ScrollBoard } from "@jiaminghi/data-view-react";
let data = [ function Chart1(props) {
["产线0", "10mm", "10mm", "10mm"], const rawData = useSelector((state) => state.cutting.productData);
["产线2", "8mm", "8mm", "8mm"],
["产线3", "15mm", "15mm", "15mm"],
["产线4", "15mm", "15mm", "15mm"],
["产线42", "15mm", "15mm", "15mm"],
["产线5", "15mm", "15mm", "15mm"],
["产线6", "15mm", "15mm", "15mm"],
];
let header = ["产线名", "原板宽度", "净板宽", "玻璃厚度"];
let config = { let config = {
headerBGC: "rgba(4, 44, 76, 0.3)", // headerBGC: "rgba(4, 44, 76, 0.3)",
headerBGC: "#044A8460",
header: [ header: [
'<span style="color:#fff">产线名<span/>', '<span style="color:#fff; padding-left: 8px;">产线名<span/>',
'<span style="color:#fff">原板宽度<span/>', '<span style="color:#fff; padding-left: 8px;">原板宽度<span/>',
'<span style="color:#fff">净板宽<span/>', '<span style="color:#fff; padding-left: 8px;">净板宽<span/>',
'<span style="color:#fff">玻璃厚度<span/>', '<span style="color:#fff; padding-left: 8px;">玻璃厚度<span/>',
], ],
oddRowBGC: "#042444", // oddRowBGC: "#042444",
evenRowBGC: "#042c4c", // evenRowBGC: "#042c4c",
oddRowBGC: "#044A8460",
evenRowBGC: "#0b549970",
columnWidth: [128], columnWidth: [128],
headerHeight: 40, headerHeight: 40,
hoverPause: false, hoverPause: false,
data: replaceStyle(data, 0.7), data: replaceStyle(filterData(rawData), 0.7),
}; };
function replaceStyle(Arr, opencity) {
let temp = [];
for (let i = 0; i < Arr.length; i++) {
temp[i] = [];
for (let j = 0; j < Arr[i].length; j++) {
temp[i][
j
] = ` <span style="color:rgba(255, 255, 255,${opencity})">${Arr[i][j]}<span/>`;
}
}
return temp;
}
class Chart1 extends Component {
render() {
return ( return (
<BottomBarItem <BottomBarItem
icon="pause" icon="pause"
title="当前产线生产规格" title="当前产线生产规格"
className={this.props.className} className={props.className}
style={Object.assign(this.props.style, { filter: "grayscale(100%)" })} style={props.style}
> >
<div <div
className={cls.CenterChart1itemDetailBorder} className={cls.CenterChart1itemDetailBorder}
@ -68,6 +44,97 @@ class Chart1 extends Component {
</BottomBarItem> </BottomBarItem>
); );
} }
}
export default Chart1; export default Chart1;
//
var rawData = [
{
id: 1,
length: 1209,
productionLine: "Y61",
square: 123.3,
thick: 2,
wide: 1089,
},
{
id: 2,
length: 1119,
productionLine: "Y62",
square: 103.3,
thick: 2,
wide: 1339,
},
{
id: 3,
length: 1019,
productionLine: "Y63",
square: 233,
thick: 1,
wide: 1111,
},
{
id: 4,
length: 2000,
productionLine: "Y64",
square: 233,
thick: 1,
wide: 1232,
},
{
id: 5,
length: 1560,
productionLine: "Y65",
square: 233,
thick: 1,
wide: 996,
},
{
id: 6,
length: 1990,
productionLine: "Y66",
square: 233,
thick: 1,
wide: 416,
},
];
function filterData(rawData) {
return (rawData ?? []).map((item) => [
// 线
item.productionLine,
//
item.length,
//
item.wide,
//
item.thick,
]);
}
// let data = [
// ["线0", "10mm", "10mm", "10mm"],
// ["线2", "8mm", "8mm", "8mm"],
// ["线3", "15mm", "15mm", "15mm"],
// ["线4", "15mm", "15mm", "15mm"],
// ["线42", "15mm", "15mm", "15mm"],
// ["线5", "15mm", "15mm", "15mm"],
// ["线6", "15mm", "15mm", "15mm"],
// ];
// let header = ["线", "", "", ""];
function replaceStyle(Arr, opencity) {
let temp = [];
for (let i = 0; i < Arr.length; i++) {
temp[i] = [];
for (let j = 0; j < Arr[i].length; j++) {
temp[i][j] = `<span style="color:rgba(255, 255, 255,${opencity})">${
Arr[i][j]
} ${j == 0 ? "" : "mm"}<span/>`;
}
}
return temp;
}

View File

@ -19,7 +19,7 @@ function FaultTotal(props) {
? isra.yearStatistic ? isra.yearStatistic
: []; : [];
const series = preHandleStatisticData(currentStatistic, isra.checkType); const series = preHandleStatisticData(currentStatistic, isra.checkType ?? []);
const options = getOptions(series, isra, currentStatistic); const options = getOptions(series, isra, currentStatistic);
function handleDateChange(v) { function handleDateChange(v) {

View File

@ -1,32 +1,105 @@
import React, { Component } from "react"; import cls from "./righttable.module.scss";
import "./righttable.module.scss"; import { ScrollBoard } from "@jiaminghi/data-view-react";
import { useSelector } from "react-redux";
// import { ScrollBoard } from '@jiaminghi/data-view-react'; function CurrentSpec(props) {
const rawData = useSelector((state) => state.cutting.productData);
let config = {
// headerBGC: "rgba(4, 44, 76, 0.3)",
headerBGC: "#044A8460",
header: [
'<span style="color:#fff; padding-left: 8px;">产线名<span/>',
'<span style="color:#fff; padding-left: 8px;">原板宽度<span/>',
'<span style="color:#fff; padding-left: 8px;">净板宽<span/>',
'<span style="color:#fff; padding-left: 8px;">玻璃厚度<span/>',
],
// oddRowBGC: "#042444",
// evenRowBGC: "#042c4c",
oddRowBGC: "#044A8460",
evenRowBGC: "#0b549970",
columnWidth: [90],
rowNum: 3,
hoverPause: true,
headerHeight: 40,
data: replaceStyle(filterData(rawData), 0.8),
};
let data = [ return (
["产线0", "10mm", "10mm", "10mm"], <div className={cls.CenterChart1itemDetailBorder} style={{ opacity: 0.75 }}>
["产线2", "8mm", "8mm", "8mm"], <h2 className={cls.CenterChart1itemTXT}>当前产线生产规格</h2>
["产线3", "15mm", "15mm", "15mm"], <div className={cls.TableContainer}>
["产线4", "15mm", "15mm", "15mm"], <ScrollBoard config={config} />
</div>
</div>
);
}
export default CurrentSpec;
//
var rawData = [
{
id: 1,
length: 1209,
productionLine: "Y61",
square: 123.3,
thick: 2,
wide: 1089,
},
{
id: 2,
length: 1119,
productionLine: "Y62",
square: 103.3,
thick: 2,
wide: 1339,
},
{
id: 3,
length: 1019,
productionLine: "Y63",
square: 233,
thick: 1,
wide: 1111,
},
{
id: 4,
length: 2000,
productionLine: "Y64",
square: 233,
thick: 1,
wide: 1232,
},
{
id: 5,
length: 1560,
productionLine: "Y65",
square: 233,
thick: 1,
wide: 996,
},
{
id: 6,
length: 1990,
productionLine: "Y66",
square: 233,
thick: 1,
wide: 416,
},
]; ];
let header = ["产线名", "原板宽度", "净板宽", "玻璃厚度"]; function filterData(rawData) {
return (rawData ?? []).map((item) => [
let config = { // 线
headerBGC: "rgba(4, 44, 76, 0.3)", item.productionLine,
header: [ //
'<span style="color:#fff">产线名<span/>', item.length,
'<span style="color:#fff">原板宽度<span/>', //
'<span style="color:#fff">净板宽<span/>', item.wide,
'<span style="color:#fff">玻璃厚度<span/>', //
], item.thick,
oddRowBGC: "#042444", ]);
evenRowBGC: "#042c4c", }
columnWidth: [90],
headerHeight: 40,
hoverPause: false,
data: replaceStyle(data, 0.7),
};
function replaceStyle(Arr, opencity) { function replaceStyle(Arr, opencity) {
let temp = []; let temp = [];
@ -34,32 +107,11 @@ function replaceStyle(Arr, opencity) {
for (let i = 0; i < Arr.length; i++) { for (let i = 0; i < Arr.length; i++) {
temp[i] = []; temp[i] = [];
for (let j = 0; j < Arr[i].length; j++) { for (let j = 0; j < Arr[i].length; j++) {
temp[i][ temp[i][j] = `<span style="color:rgba(255, 255, 255,${opencity})">${
j Arr[i][j]
] = ` <span style="color:rgba(255, 255, 255,${opencity})">${Arr[i][j]}<span/>`; } ${j == 0 ? "" : "mm"}<span/>`;
} }
} }
return temp; return temp;
} }
class Chart1 extends Component {
render() {
return (
<div className="CenterChart1itemDetailBorder" style={{ opacity: 0.75 }}>
<h2 className="CenterChart1itemTXT"> 当前产线生产规格</h2>
<div className="CenterChart1itemContainer">
<span className="CenterFormitemDetailBorderLine1"></span>
<span className="CenterFormitemDetailBorderLine2"></span>
<span className="CenterFormitemDetailBorderLine3"></span>
{/* <ScrollBoard
config={config}
style={{ width: '105%', height: '240%' }}
/> */}
</div>
</div>
);
}
}
export default Chart1;

View File

@ -1,50 +1,23 @@
.CenterChart1itemDetailBorder { .CenterChart1itemDetailBorder {
width: 100%; width: 100%;
height: 240px; height: 200px;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-content: flex-start; justify-content: flex-start;
color: #fff;
background-color: rgba(4, 44, 76, 0.2); background-color: rgba(4, 44, 76, 0.2);
.CenterChart1itemTXT {
width: 100%;
height: 10%;
font-size: 20px;
color: rgba(255, 255, 255, 0.8);
text-align: center;
margin-top: 2%;
}
.CenterChart1itemContainer {
width: 95%;
height: 100px;
position: relative;
.CenterFormitemDetailBorderLine1 { .CenterChart1itemTXT {
width: 1px; user-select: none;
height: 200px; padding: 8px 0;
background-color: #041c2c; font-size: 18px;
float: left; font-weight: 400;
margin-left: 18%; letter-spacing: 1px;
z-index: 10; color: rgba(255, 255, 255, 0.9);
position: absolute; text-align: center;
}
.CenterFormitemDetailBorderLine2 {
width: 1px;
height: 200px;
background-color: #041c2c;
float: left;
margin-left: 46%;
z-index: 10;
position: absolute;
}
.CenterFormitemDetailBorderLine3 {
width: 1px;
height: 200px;
background-color: #041c2c;
float: left;
margin-left: 72%;
z-index: 10;
position: absolute;
} }
.TableContainer {
flex: 1;
} }
} }

View File

@ -11,9 +11,9 @@ export default function index() {
<div className={cls.leftGrid}> <div className={cls.leftGrid}>
<Item1 /> <Item1 />
</div> </div>
{/* <div className={cls.rightTable}> <div className={cls.rightTable}>
<Item2 /> <Item2 />
</div> */} </div>
</div> </div>
</> </>
); );

View File

@ -2,6 +2,7 @@ import { createSlice } from "@reduxjs/toolkit";
export const initialState = { export const initialState = {
table: [], table: [],
productData: [],
chart: { chart: {
year: [], year: [],
week: [], week: [],
@ -15,8 +16,9 @@ const cuttingSlice = createSlice({
initialState, initialState,
reducers: { reducers: {
setCuttingTable: (state, action) => { setCuttingTable: (state, action) => {
console.log("setting cuttting table..."); if ("data" in action.payload) state.table = action.payload.data;
state.table = action.payload; if ("productData" in action.payload)
state.productData = action.payload.productData;
}, },
setCuttingChart: (state, action) => { setCuttingChart: (state, action) => {
switch (action.payload.dateType) { switch (action.payload.dateType) {

View File

@ -293,7 +293,7 @@ new XClient(
case "table": case "table":
store.dispatch({ store.dispatch({
type: "cutting/setCuttingTable", type: "cutting/setCuttingTable",
payload: serializedData.data, payload: serializedData,
}); });
break; break;
case "chart": case "chart":