装备控制界面

This commit is contained in:
mmc
2026-05-09 16:44:39 +08:00
parent a7aa27242f
commit 48c6d1d4bc
9 changed files with 725 additions and 441 deletions

View File

@@ -1,4 +1,4 @@
import React from 'react';
import React, { useState, useEffect } from 'react';
import { Card, Row, Col, Statistic, Button, Space, Tag, Typography } from 'antd';
import {
CloudOutlined, ThunderboltOutlined, BarChartOutlined,
@@ -6,10 +6,43 @@ import {
MinusOutlined, PlusOutlined, SyncOutlined
} from '@ant-design/icons';
import { Line, Bar, Pie } from '@ant-design/charts';
import { getWeatherData } from '../lib/utils';
const { Text } = Typography;
export default function StationDashboard() {
// ==============================================
// 🔥 接入真实天气状态(从你第一个组件复制过来)
// ==============================================
const [weatherdata, setWeatherData] = useState({
province: "江苏省",
city: "南通市",
district: "崇川区",
adcode: "320613",
weather: "晴",
weather_icon: "100",
temperature: 18,
wind_direction: "西南风",
wind_power: "2级",
humidity: 53,
report_time: "2026-03-27 12:35:08"
});
// 请求天气接口
useEffect(() => {
const fetchWeather = async () => {
try {
const res = await getWeatherData();
setWeatherData(res);
} catch (err) {
console.error("天气接口请求失败", err);
}
};
fetchWeather();
}, []);
// 模拟数据
const stationOverview = {
todayEnergy: 45.9,
@@ -471,7 +504,6 @@ export default function StationDashboard() {
</Row>
</Card>
{/* 天气信息 */}
<Card
title={<span style={{ fontWeight: 800, fontSize: 14, color: '#0837A8' }}>天气信息</span>}
bordered={false}
@@ -482,22 +514,25 @@ export default function StationDashboard() {
}}
bodyStyle={{ padding: 4 }}
>
<div style={{ display: 'flex', alignItems: 'center' }}>
<CloudOutlined style={{ fontSize: 32, color: '#1890ff', marginRight: 12 }} />
<div style={{ display: 'flex', flexDirection: 'row', gap: 12, alignItems: 'center' }}>
<div style={{ display: 'flex', alignItems: 'center', position: 'relative', }}>
{/* 右侧文字 */}
<div style={{ display: 'flex', flexDirection: 'row', gap: 24, alignItems: 'center', width: "100%" }}>
<div>
<div style={{ fontSize: 24, fontWeight: 800, color: '#1890ff' }}>22℃</div>
<div style={{ fontSize: 14, color: '#666', marginBottom: 2 }}>阴天</div>
<div style={{ fontSize: 24, fontWeight: 800, color: '#1890ff' }}>{weatherdata.temperature}℃</div>
<div style={{ fontSize: 14, color: '#666' }}>{weatherdata.weather}</div>
</div>
<div>
<div style={{ fontSize: 11, color: '#999' }}>辐照度 89 W/m²</div>
<div style={{ fontSize: 11, color: '#999' }}>风速 4.1 m/s</div>
<div style={{ fontSize: 11, color: '#999' }}>中卫市</div>
<div style={{ fontSize: 11, color: '#999' }}>湿度 {weatherdata.humidity}%</div>
<div style={{ fontSize: 11, color: '#999' }}>{weatherdata.wind_direction} {weatherdata.wind_power}</div>
<div style={{ fontSize: 11, color: '#999' }}>{weatherdata.city} | {weatherdata.district}</div>
</div>
</div>
</div>
</Card>
{/* 清洗建议 */}
<Card
title={