This commit is contained in:
lb 2023-11-02 13:44:32 +08:00
förälder e11565ab7e
incheckning 62d441496c
6 ändrade filer med 534 tillägg och 7 borttagningar

Visa fil

@ -0,0 +1,164 @@
import BottomBarItem from '../BottomItemBackground';
import { Radio } from 'antd';
import cls from './index.module.css';
import { useState } from 'react';
const SmallBox = (props) => {
return (
<div
className="small-box"
style={{
boxShadow: 'inset 0 0 18px 10px #fff1',
borderRadius: '3px',
padding: '6px',
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
color: '#fff',
position: 'relative',
userSelect: 'none',
}}
>
{props.split !== false && (
<span
className="vertical-line"
style={{
position: 'absolute',
display: 'inline-block',
width: '2px',
height: '80%',
top: '10%',
left: '50%',
background:
'linear-gradient(to bottom, transparent, #fff3, #fffa, #fff3, transparent)',
}}
></span>
)}
{props.children}
</div>
);
};
function WindFrequence(props) {
const [dataSource, setDataSource] = useState('fan');
function handleSourceChange(e) {
console.log('val', e.target.value);
if (e.target.value == 'fan') {
setDataSource('fan');
} else if (e.target.value == 'switcher') {
setDataSource('switcher');
} else if (e.target.value == 'heating') {
setDataSource('heating');
}
}
return (
<BottomBarItem
icon="pause"
title="当前温度"
className={props.className}
style={props.style}
>
<div className={cls.floatHead}>
<div className={cls.alignRight}>
<Radio.Group
defaultValue="fan"
buttonStyle="solid"
className={cls.radioGroup}
onChange={handleSourceChange}
>
<Radio.Button value="fan" className="radio-group__item">
风机
</Radio.Button>
<Radio.Button value="switcher" className="radio-group__item">
风阀
</Radio.Button>
<Radio.Button value="heating" className="radio-group__item">
电加热
</Radio.Button>
</Radio.Group>
</div>
</div>
<div className={cls.mainContent + ' ' + cls.grid}>
<SmallBox>
<h1 className={cls.areaName}>A1区板上</h1>
<div className={cls.areaContent}>
<span className={cls.areaValue}>123.8</span>
<span className={cls.areaValue}>123.8</span>
<span className={cls.areaValue}>123.8</span>
</div>
</SmallBox>
<SmallBox>
<h1 className={cls.areaName}>A1区板上</h1>
<div className={cls.areaContent}>
<span className={cls.areaValue}>123.8</span>
<span className={cls.areaValue}>123.8</span>
<span className={cls.areaValue}>123.8</span>
</div>
</SmallBox>
<SmallBox>
<h1 className={cls.areaName}>A1区板上</h1>
<div className={cls.areaContent}>
<span className={cls.areaValue}>123.8</span>
<span className={cls.areaValue}>123.8</span>
<span className={cls.areaValue}>123.8</span>
</div>
</SmallBox>
<SmallBox>
<h1 className={cls.areaName}>A1区板上</h1>
<div className={cls.areaContent}>
<span className={cls.areaValue}>123.8</span>
<span className={cls.areaValue}>123.8</span>
<span className={cls.areaValue}>123.8</span>
</div>
</SmallBox>
<SmallBox>
<h1 className={cls.areaName}>A1区板上</h1>
<div className={cls.areaContent}>
<span className={cls.areaValue}>123.8</span>
<span className={cls.areaValue}>123.8</span>
<span className={cls.areaValue}>123.8</span>
</div>
</SmallBox>
<SmallBox split={false}>
<div className={cls.areaPureContent}>
<span className={cls.areaPureValue}>123.8</span>
<span className={cls.areaPureValue}>123.8</span>
<span className={cls.areaPureValue}>123.8</span>
</div>
</SmallBox>
<SmallBox>
<h1 className={cls.areaName}>A1区板上</h1>
<div className={cls.areaContent}>
<span className={cls.areaValue}>123.8</span>
<span className={cls.areaValue}>123.8</span>
<span className={cls.areaValue}>123.8</span>
</div>
</SmallBox>
<SmallBox split={false}>
<div className={cls.areaPureContent}>
<span className={cls.areaPureValue}>123.8</span>
<span className={cls.areaPureValue}>123.8</span>
<span className={cls.areaPureValue}>123.8</span>
</div>
</SmallBox>
<SmallBox>
<h1 className={cls.areaName}>A1区板上</h1>
<div className={cls.areaContent}>
<span className={cls.areaValue}>123.8</span>
</div>
</SmallBox>
<SmallBox>
<h1 className={cls.areaName}>A1区板上</h1>
<div className={cls.areaContent}>
<span className={cls.areaValue}>123.8</span>
</div>
</SmallBox>
</div>
</BottomBarItem>
);
}
export default WindFrequence;

Visa fil

@ -0,0 +1,139 @@
.chart {
height: 100%;
}
.gas {
position: relative;
}
.currentFlow {
position: absolute;
top: 20px;
left: 50%;
transform: translateX(-50%);
padding: 8px 22px;
border-radius: 2px;
letter-spacing: 2px;
box-shadow: inset 0 0 22px 0px hsla(0, 0%, 100%, 0.15);
line-height: 18px;
font-size: 18px;
text-align: center;
color: #12fff5;
}
.floatHead {
position: absolute;
top: 22px;
right: 24px;
height: 32px;
width: 410px;
display: flex;
align-items: center;
justify-content: flex-end;
}
.mainContent {
padding-top: 16px;
}
.alignRight {
text-align: right;
justify-self: flex-end;
}
.grid {
display: grid;
gap: 6px;
grid-template-columns: repeat(2, minmax(100px, 1fr));
grid-auto-rows: minmax(64px, min-content);
}
.areaName {
color: #fff;
font-size: 20px;
line-height: 1;
letter-spacing: 1.5px;
margin: 0;
padding-left: 20px;
width: 50%;
}
.areaPureContent {
display: flex;
}
.areaPureValue {
padding: 0 8px;
}
.areaPureValue:not(:first-child) {
border-left: 2px solid #fff6;
}
.areaContent {
width: 50%;
padding-left: 12px;
display: flex;
flex-direction: column;
}
.areaPureValue,
.areaValue {
display: inline-block;
font-size: 17px;
line-height: 22px;
letter-spacing: 1.2px;
}
.switchLabel {
color: white;
margin-left: 6px;
}
.legend:last-child {
margin-left: 8px;
}
.legend > span {
display: inline-block;
color: #dff1fe;
font-size: 14px;
letter-spacing: 2px;
}
.legend > span:first-child {
width: 12px;
height: 12px;
margin-right: 4px;
border-radius: 2px;
}
.gasIcon {
background: #12fff5;
}
.gas2Icon {
background: #2760ff;
}
.radioGroup {
user-select: none;
}
.radioGroup * {
border: none !important;
border-radius: 0 !important;
}
.radioGroup *:focus-within {
box-shadow: none !important;
}
.radioGroup *::before {
width: 0 !important;
}
.radioGroup_button_wrapper {
color: #fff !important;
background: #03233c !important;
}

Visa fil

@ -0,0 +1,198 @@
//
import cls from './index.module.css';
import BottomBarItem from '../BottomItemBackground';
import ReactECharts from 'echarts-for-react';
import * as echarts from 'echarts';
import { randomInt } from '../../../utils';
import { Switch } from 'antd';
import { useState, useContext } from 'react';
import SocketContext from '../../../store/socket-data-provider';
function WindFrequence(props) {
const [showChart, setShowChart] = useState(true);
const { runState, hisState } = useContext(SocketContext);
let dataList = [];
let seriesData = [];
const colors = [
'#12FFF5',
'#2760FF',
'#FFD160',
'#E80091',
'#8064ff',
'#ff8a3b',
'#8cd26d',
'#2aa1ff',
];
let options = null;
if (showChart) {
// keys() sort()
seriesData = hisState?.combustionAir
? Object.keys(hisState.combustionAir)
.sort()
.map((key) => hisState.combustionAir[key])
: Array(8)
.fill(1)
.map((_) => Array(7).fill(0));
// debug
console.log(
'助燃风 chart series data',
hisState?.combustionAir,
seriesData,
);
options = {
color: colors,
grid: { top: 32, right: 12, bottom: 20, left: 48 },
xAxis: {
type: 'category',
data: Array(7)
.fill(1)
.map((_, index) => {
const today = new Date();
const dtimestamp = today - index * 24 * 60 * 60 * 1000;
return `${new Date(dtimestamp).getMonth() + 1}.${new Date(
dtimestamp,
).getDate()}`;
})
.reverse(),
axisLabel: {
color: '#fff',
fontSize: 12,
},
axisTick: { show: false },
axisLine: {
lineStyle: {
width: 1,
color: '#213259',
},
},
},
yAxis: {
name: '单位/m³',
nameTextStyle: {
color: '#fff',
fontSize: 10,
align: 'right',
},
type: 'value',
axisLabel: {
color: '#fff',
fontSize: 12,
},
axisLine: {
show: true,
lineStyle: {
color: '#213259',
},
},
splitLine: {
lineStyle: {
color: '#213259a0',
},
},
// interval: 10,
// min: 0,
// max: 100,
},
series: seriesData.map((v, i) => ({
name: i + 1 + '#风机',
data: v,
type: 'line',
symbol: 'circle',
areaStyle: {
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
{ offset: 0, color: colors[i] + '40' },
{ offset: 0.5, color: colors[i] + '20' },
{ offset: 1, color: colors[i] + '00' },
]),
},
})),
tooltip: {
trigger: 'axis',
},
};
} else {
dataList = runState?.combustionAirPressureArr
? [
{ id: 1, name: '1#风机', value: '0m³/h' },
{ id: 2, name: '2#风机', value: '0m³/h' },
{ id: 3, name: '3#风机', value: '0m³/h' },
{ id: 4, name: '4#风机', value: '0m³/h' },
{ id: 5, name: '5#风机', value: '0m³/h' },
{ id: 6, name: '6#风机', value: '0m³/h' },
{ id: 7, name: '7#风机', value: '0m³/h' },
{ id: 8, name: '8#风机', value: '0m³/h' },
{ id: 9, name: '9#风机', value: '0m³/h' },
{ id: 10, name: '10#风机', value: '0m³/h' },
{ id: 11, name: '11#风机', value: '0m³/h' },
{ id: 12, name: '12#风机', value: '0m³/h' },
{ id: 13, name: '13#风机', value: '0m³/h' },
{ id: 14, name: '14#风机', value: '0m³/h' },
{ id: 15, name: '15#风机', value: '0m³/h' },
{ id: 16, name: '16#风机', value: '0m³/h' },
].map((item, index) => ({
...item,
value: runState.combustionAirPressureArr[index] ?? '/',
}))
: [
{ id: 1, name: '1#风机', value: '0m³/h' },
{ id: 2, name: '2#风机', value: '0m³/h' },
{ id: 3, name: '3#风机', value: '0m³/h' },
{ id: 4, name: '4#风机', value: '0m³/h' },
{ id: 5, name: '5#风机', value: '0m³/h' },
{ id: 6, name: '6#风机', value: '0m³/h' },
{ id: 7, name: '7#风机', value: '0m³/h' },
{ id: 8, name: '8#风机', value: '0m³/h' },
{ id: 9, name: '9#风机', value: '0m³/h' },
{ id: 10, name: '10#风机', value: '0m³/h' },
{ id: 11, name: '11#风机', value: '0m³/h' },
{ id: 12, name: '12#风机', value: '0m³/h' },
{ id: 13, name: '13#风机', value: '0m³/h' },
{ id: 14, name: '14#风机', value: '0m³/h' },
{ id: 15, name: '15#风机', value: '0m³/h' },
{ id: 16, name: '16#风机', value: '0m³/h' },
];
}
function handleSwitchChange(val) {
if (val) {
setShowChart(true);
} else {
setShowChart(false);
}
}
return (
<BottomBarItem
icon="pause"
title="风机运行频率"
className={cls.relative}
style={props.style}
>
<div className={cls.headWidget}>
<div className="flex items-center">
<Switch size="small" defaultChecked onChange={handleSwitchChange} />
{showChart && <span className={cls.switchLabel}>历史详情</span>}
{!showChart && <span className={cls.switchLabel}>实时流量</span>}
</div>
</div>
<div className={cls.chart}>
{showChart && (
<ReactECharts option={options} style={{ height: '100%' }} />
)}
{!showChart && (
<div className={cls.gridList}>
{dataList.map((item) => (
<div key={item.id} className={cls.listItem}>
{item.name}: {item.value}
</div>
))}
</div>
)}
</div>
</BottomBarItem>
);
}
export default WindFrequence;

Visa fil

@ -0,0 +1,29 @@
.gridList {
margin-top: 12px;
display: grid;
grid-template-columns: 1fr 1fr;
/* grid-auto-row: ; */
gap: 6px;
}
.listItem {
border-radius: 2px;
padding: 9px 0;
text-align: center;
color: #fff;
box-shadow: inset 0 0 16px 4px rgba(255, 255, 255, 0.197);
}
.headWidget {
position: absolute;
top: 22px;
right: 24px;
height: 32px;
width: 410px;
display: flex;
align-items: center;
justify-content: flex-start;
color: #fff;
}
.relative {
position: relative;
}

Visa fil

@ -1,7 +1,6 @@
import React from 'react';
import Kiln from '../../../公共组件/窑炉信息/Kiln';
import GasFlow from '../../../公共组件/天然气流量';
import WindFlow from '../../../公共组件/助燃风流量';
import CurrentTemp from '../../../公共组件/当前温度';
import WindFrequence from '../../../公共组件/风机运行频率';
import { motion } from 'framer-motion';
@ -16,9 +15,8 @@ export default function index() {
exit={{ opacity: 0, position: 'relative' }}
transition={{ type: 'tween' }}
>
<Kiln />
<GasFlow style={{ flex: 1, width: '100%', marginTop: '24px' }} />
<WindFlow style={{ flex: 1, width: '100%', marginTop: '24px' }} />
<CurrentTemp style={{ width: '100%' }} />
<WindFrequence style={{ flex: 1, marginTop: '24px', width: '100%' }} />
</motion.div>
);
}

Visa fil

@ -117,7 +117,6 @@ export default function Home({ active }) {
marginLeft: '40px',
width: '625px',
height: '100%',
background: '#fff3',
}}
>
{active == '窑炉总览' && <LeftBar key="kiln-total" />}