卡片的自适应修改

This commit is contained in:
mmc
2026-05-14 09:37:15 +08:00
parent c0e8a1cd3e
commit 2ae097eed0
10 changed files with 874 additions and 790 deletions

View File

@@ -208,76 +208,104 @@ const RealTimeMonitorPage = () => {
</Col>
<Col span={10}>
<Row gutter={16} style={{ marginBottom: 16 }}>
<Col span={8}>
<Card bordered={false} style={{ borderRadius: 8 }}>
<Statistic
title="当前总功率"
value={66.8}
suffix="kW"
prefix={<ThunderboltOutlined />}
valueStyle={{ color: '#1890ff', fontSize: 24, fontWeight: 700 }}
/>
</Card>
</Col>
<Col span={8}>
<Card bordered={false} style={{ borderRadius: 8 }}>
<Statistic
title="并网状态"
value="并网正常"
prefix={<CheckCircleOutlined />}
valueStyle={{ color: '#52c41a', fontSize: 20, fontWeight: 700 }}
/>
</Card>
</Col>
<Col span={8}>
<Card bordered={false} style={{ borderRadius: 8 }}>
<Statistic
title="电网电压"
value={380.2}
suffix="v"
prefix={<BarChartOutlined />}
valueStyle={{ color: '#1890ff', fontSize: 24, fontWeight: 700 }}
/>
</Card>
</Col>
</Row>
<Row
gutter={[8, 8]}
style={{
marginBottom: 16,
flexWrap: 'wrap',
}}
>
{[
{
title: '当前总功率',
value: '812.6',
unit: 'kW',
color: '#165DFF',
bg: '#E8F3FF',
icon: <ThunderboltOutlined />,
sub: '额定功率 1,000 kW'
},
{
title: '并网状态',
value: '并网正常',
unit: '',
color: '#00B42A',
bg: '#E8FFEA',
icon: <CheckCircleOutlined />,
sub: '频率 50.02 Hz'
},
{
title: '电网电压',
value: '380.2',
unit: 'V',
color: '#165DFF',
bg: '#E8F3FF',
icon: <BarChartOutlined />,
sub: 'A相 380.1 V'
},
{
title: '今日累计发电量',
value: '4,752',
unit: 'kWh',
color: '#00B42A',
bg: '#E8FFEA',
icon: <RiseOutlined />,
sub: '昨日 5,000 kWh'
},
{
title: '当前辐照度',
value: '815',
unit: 'W/m²',
color: '#165DFF',
bg: '#E8F3FF',
icon: <SunOutlined />,
sub: '较昨日 +5.6%'
},
{
title: '环境温度',
value: '28.0',
unit: '℃',
color: '#165DFF',
bg: '#E8F3FF',
icon: <CloudOutlined />,
sub: '较昨日 +1.2 ℃'
},
].map((item, idx) => (
<Col key={idx} style={{ minWidth: '168px', flex: '0 0 auto' }}>
<Card
bordered={false}
style={{ borderRadius: 8, width: 168, height: 100 }}
bodyStyle={{ padding: '16px', height: '100%' }}
>
<div style={{ display: 'flex', alignItems: 'flex-start', gap: 12 }}>
{/* 左侧图标 */}
<div style={{
width: 30,
height: 30,
borderRadius: '50%',
background: item.bg,
display: 'flex',
justifyContent: 'center',
alignItems: 'center',
flexShrink: 0
}}>
{React.cloneElement(item.icon, { style: { fontSize: 20, color: item.color } })}
</div>
<Row gutter={16} style={{ marginBottom: 16 }}>
<Col span={8}>
<Card bordered={false} style={{ borderRadius: 8 }}>
<Statistic
title="今日发电量"
value={4752}
suffix="kWh"
prefix={<RiseOutlined />}
valueStyle={{ color: '#52c41a', fontSize: 24, fontWeight: 700 }}
/>
</Card>
</Col>
<Col span={8}>
<Card bordered={false} style={{ borderRadius: 8 }}>
<Statistic
title="辐照度"
value={815}
suffix="W/m²"
prefix={<SunOutlined />}
valueStyle={{ color: '#faad14', fontSize: 24, fontWeight: 700 }}
/>
</Card>
</Col>
<Col span={8}>
<Card bordered={false} style={{ borderRadius: 8 }}>
<Statistic
title="环境温度"
value={28.4}
suffix="℃"
valueStyle={{ color: '#1890ff', fontSize: 24, fontWeight: 700 }}
/>
</Card>
</Col>
{/* 右侧文字 */}
<div style={{ flex: 1, minWidth: 0 }}>
<div style={{ fontSize: 12, color: '#333', marginBottom: 4 }}>{item.title}</div>
<div style={{ display: 'flex', alignItems: 'baseline', marginBottom: 4 }}>
<span style={{ color: item.color, fontSize: 20, fontWeight: 600 }}>{item.value}</span>
{item.unit && <span style={{ color: item.color, fontSize: 12, marginLeft: 4 }}>{item.unit}</span>}
</div>
<div style={{ fontSize: 10, color: '#999' }}>{item.sub}</div>
</div>
</div>
</Card>
</Col>
))}
</Row>
{/* 👇 修改后的实时功率曲线:两天对比 */}
<Card title="实时功率曲线" style={{ marginBottom: 16, borderRadius: 8 }}>
<Line