update gas

This commit is contained in:
lb 2023-07-13 16:56:01 +08:00
parent eddf31332f
commit e531907301
6 changed files with 38 additions and 36 deletions

View File

@ -1,3 +1,4 @@
//
import cls from './index.module.css';
import BottomBarItem from '../BottomBarItem';
import ReactECharts from 'echarts-for-react';
@ -26,7 +27,7 @@ function GasI(props) {
let options = null;
if (showChart) {
// keys() sort()
hisState?.combustionAir
seriesData = hisState?.combustionAir
? Object.keys(hisState.combustionAir)
.sort()
.map((key) => hisState.combustionAir[key])
@ -35,7 +36,11 @@ function GasI(props) {
.map((_) => Array(7).fill(0));
// debug
console.log('gasI series data', hisState?.combustionAir, seriesData);
console.log(
'助燃风 chart series data',
hisState?.combustionAir,
seriesData,
);
options = {
color: colors,
grid: { top: 32, right: 12, bottom: 20, left: 48 },
@ -74,7 +79,6 @@ function GasI(props) {
axisLabel: {
color: '#fff',
fontSize: 12,
formatter: '{value} %',
},
axisLine: {
show: true,
@ -87,14 +91,15 @@ function GasI(props) {
color: '#213259a0',
},
},
interval: 10,
min: 0,
max: 100,
// 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' },
@ -108,7 +113,7 @@ function GasI(props) {
},
};
} else {
runState?.combustionAirFlow
dataList = runState?.combustionAirPressureArr
? [
{ id: 1, name: '1#助燃风', value: '0m³/h' },
{ id: 2, name: '2#助燃风', value: '0m³/h' },
@ -120,7 +125,7 @@ function GasI(props) {
{ id: 8, name: '8#助燃风', value: '0m³/h' },
].map((item, index) => ({
...item,
value: runState.combustionAirFlow[index],
value: runState.combustionAirPressureArr[index] ?? '/',
}))
: [
{ id: 1, name: '1#助燃风', value: '0m³/h' },
@ -133,7 +138,7 @@ function GasI(props) {
{ id: 8, name: '8#助燃风', value: '0m³/h' },
];
// debug
console.log('gasI grid data', runState?.combustionAirFlow);
console.log('助燃风 实时 data', runState?.combustionAirPressureArr);
}
function handleSwitchChange(val) {
@ -148,7 +153,8 @@ function GasI(props) {
<div className={cls.headWidget}>
<div className="flex items-center">
<Switch size="small" defaultChecked onChange={handleSwitchChange} />
<span className={cls.switchLabel}>历史详情</span>
{showChart && <span className={cls.switchLabel}>历史详情</span>}
{!showChart && <span className={cls.switchLabel}>实时流量</span>}
</div>
</div>

View File

@ -6,23 +6,23 @@ function getData(type) {
switch (type) {
case 'gas-i':
data = [
{ id: 1, name: '1#天然气I', value: '122m³/h' },
{ id: 2, name: '2#天然气I', value: '200m³/h' },
{ id: 3, name: '3#天然气I', value: '112m³/h' },
{ id: 4, name: '4#天然气I', value: '189m³/h' },
{ id: 5, name: '5#天然气I', value: '109m³/h' },
{ id: 6, name: '6#天然气I', value: '167m³/h' },
{ id: 7, name: '7#天然气I', value: '172m³/h' },
{ id: 8, name: '8#天然气I', value: '145m³/h' },
{ id: 1, name: '1#天然气I', value: '0m³/h' },
{ id: 2, name: '2#天然气I', value: '0m³/h' },
{ id: 3, name: '3#天然气I', value: '0m³/h' },
{ id: 4, name: '4#天然气I', value: '0m³/h' },
{ id: 5, name: '5#天然气I', value: '0m³/h' },
{ id: 6, name: '6#天然气I', value: '0m³/h' },
{ id: 7, name: '7#天然气I', value: '0m³/h' },
{ id: 8, name: '8#天然气I', value: '0m³/h' },
];
break;
case 'gas-ii':
data = [
{ id: 11, name: '1#天然气II', value: '85m³/h' },
{ id: 12, name: '2#天然气II', value: '45m³/h' },
{ id: 13, name: '3#天然气II', value: '6m³/h' },
{ id: 14, name: '4#天然气II', value: '72m³/h' },
{ id: 15, name: '5#天然气II', value: '83m³/h' },
{ id: 11, name: '1#天然气II', value: '0m³/h' },
{ id: 12, name: '2#天然气II', value: '0m³/h' },
{ id: 13, name: '3#天然气II', value: '0m³/h' },
{ id: 14, name: '4#天然气II', value: '0m³/h' },
{ id: 15, name: '5#天然气II', value: '0m³/h' },
];
break;
}

View File

@ -1,3 +1,4 @@
//
import cls from './index.module.css';
import BottomBarItem from '../BottomBarItem';
@ -35,7 +36,8 @@ function GasII(props) {
<div className={cls.headWidget}>
<div className="flex items-center">
<Switch size="small" defaultChecked onChange={handleSwitchChange} />
<span className={cls.switchLabel}>历史详情</span>
{showChart && <span className={cls.switchLabel}>历史详情</span>}
{!showChart && <span className={cls.switchLabel}>实时流量</span>}
</div>
<Radio.Group

View File

@ -9,7 +9,7 @@ const Slider = (props) => {
};
return (
<div id="slider" className="slider">
<input type="range" value={v} onInput={handleInput} />
<input type="range" value={v} onInput={handleInput} onChange={() => {}} />
</div>
);
};

View File

@ -1,6 +1,4 @@
import React from 'react';
import { useEffect, useState } from 'react';
import './global.less';
import './index.less';
import Head from '../components/Head';
@ -9,15 +7,12 @@ import BottomBar from '../components/BottomBar';
import RightBar from '../components/RightBar';
import CenterTopData from '../components/CenterTopData';
import Slider from '../components/Slider';
import V3DBG from '../assets/V3DBG.png';
import V3D from './V3D';
import { SocketContextProvider } from '../store/socket-data-provider';
import V3DBG from '../assets/V3DBG.png';
// import V3D from './V3D';
export default function index() {
const [width, setWidth] = useState(window.innerWidth);
const [value, setValue] = useState(100);
const v = (value / 100).toFixed(2);

View File

@ -21,12 +21,11 @@ export const SocketContextProvider = (props) => {
let incommingData = JSON.parse(e.data);
switch (incommingData.type) {
case 'RunData':
console.log('run data arrived, set RunData');
console.log('run data arrived, set 运行时数据');
setRunState(incommingData.data);
break;
case 'HisData':
console.log('his data arrived, set HisData');
// setHisState(prevHisState => ({ ...prevHisState, ...incommingData.data }));
console.log('his data arrived, set 历史数据');
setHisState(incommingData.data);
break;
}