紧凑样式

This commit is contained in:
mmc
2026-05-14 17:23:12 +08:00
parent 6cadb14a9c
commit 995c8c482b
16 changed files with 248 additions and 268 deletions

View File

@@ -153,8 +153,8 @@ export default function StationDashboard() {
};
return (
<div style={{ background: '#f8fafc', padding: '16px', minHeight: '100vh', width: '100%', boxSizing: 'border-box' }}>
<Row gutter={[16, 16]} style={{ margin: '0 16px 16px 16px' }}>
<div style={{ background: '#f8fafc', padding: '8px', minHeight: '100vh', width: '100%', boxSizing: 'border-box' }}>
<Row gutter={[8, 8]} style={{ margin: '0 4px 0px 4px' }}>
{[
{ title: '今日发电量', value: '4,752', unit: 'kWh', sub: '日目标 5,000 kWh', color: '#00B42A', bg: '#E8FFEA', icon: <ThunderboltOutlined /> },
{ title: '当前功率', value: '812.6', unit: 'kW', sub: '装机容量 1,000 kWp', color: '#165DFF', bg: '#E8F3FF', icon: <DashboardOutlined /> },
@@ -164,31 +164,31 @@ export default function StationDashboard() {
{ title: '节省运维成本', value: '¥ 36,540', unit: '', sub: '本月累计节省', color: '#FF7D00', bg: '#FFF7E8', icon: <MoneyCollectOutlined /> },
].map((item, idx) => (
<Col key={idx} style={{
flex: '0 0 auto', // 关键:不拉伸
width: '240px', // 固定卡片宽度
flex: '1 1 auto', // 允许伸缩
width: 'clamp(180px, 15vw, 240px)', // 自适应宽度
maxWidth: '240px',
minWidth: '240px'
minWidth: '160px'
}}>
<Card
bordered={false}
style={{ ...cardStyle, height: "100%" }}
bodyStyle={{ padding: '16px' }}
bodyStyle={{ padding: '12px' }}
>
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}>
<div>
<div style={{ color: '#000', fontSize: '14px', fontWeight: 600, marginBottom: 8 }}>{item.title}</div>
<div style={{ color: '#000', fontSize: '13px', fontWeight: 600, marginBottom: 4 }}>{item.title}</div>
<div style={{ display: 'flex', alignItems: 'baseline' }}>
<span style={{ color: item.color, fontSize: '24px', fontWeight: 800 }}>{item.value}</span>
{item.unit && <span style={{ color: '#666', fontSize: '14px', marginLeft: 4 }}>{item.unit}</span>}
<span style={{ color: item.color, fontSize: 'clamp(18px, 1.5vw, 22px)', fontWeight: 800 }}>{item.value}</span>
{item.unit && <span style={{ color: '#666', fontSize: '12px', marginLeft: 4 }}>{item.unit}</span>}
</div>
<div style={{ fontSize: '12px', color: '#999', marginTop: 8 }}>{item.sub}</div>
<div style={{ fontSize: '11px', color: '#999', marginTop: 4 }}>{item.sub}</div>
</div>
<div style={{
width: 50, height: 50, background: item.bg, borderRadius: '50%',
width: 40, height: 40, background: item.bg, borderRadius: '50%',
display: 'flex', justifyContent: 'center', alignItems: 'center',
boxShadow: `0 2px 8px ${item.color}1A`
}}>
{React.cloneElement(item.icon as React.ReactElement, { style: { fontSize: 28, color: item.color } })}
{React.cloneElement(item.icon as React.ReactElement, { style: { fontSize: 22, color: item.color } })}
</div>
</div>
</Card>
@@ -196,16 +196,16 @@ export default function StationDashboard() {
))}
</Row>
{/* 主体布局 */}
<Row gutter={[16, 16]}>
<Row gutter={[8, 8]}>
{/* 左侧:图表列 */}
<Col xs={24} xl={6}>
<Space direction="vertical" size={16} style={{ width: '100%' }}>
<Card title={<span style={{ fontWeight: 800 }}>发电趋势</span>} extra={<Space><SyncOutlined /><FullscreenOutlined /></Space>} bordered={false} style={cardStyle} bodyStyle={{ padding: '12px' }}>
<div style={{ fontSize: 12, color: '#666', marginBottom: 12 }}>今日发电功率趋势 (kW)</div>
<Space direction="vertical" size={8} style={{ width: '100%' }}>
<Card title={<span style={{ fontWeight: 800 }}>发电趋势</span>} extra={<Space><SyncOutlined /><FullscreenOutlined /></Space>} bordered={false} style={cardStyle} bodyStyle={{ padding: '8px' }}>
<div style={{ fontSize: 11, color: '#666', marginBottom: 8 }}>今日发电功率趋势 (kW)</div>
<UniversalLineChart
data={powerTrendData}
xKey="time"
height={220}
height={200}
smooth
dot
backgroundColor="transparent"
@@ -224,11 +224,11 @@ export default function StationDashboard() {
},
]}
/> </Card>
<Card title={<span style={{ fontWeight: 800 }}>辐照度与温度趋势</span>} bordered={false} style={cardStyle} bodyStyle={{ padding: '12px' }}>
<Card title={<span style={{ fontWeight: 800 }}>辐照度与温度趋势</span>} bordered={false} style={cardStyle} bodyStyle={{ padding: '8px' }}>
<UniversalLineChart
data={irradianceData}
xKey="time"
height={220}
height={200}
smooth
dot
backgroundColor="transparent"
@@ -285,7 +285,7 @@ export default function StationDashboard() {
{/* 中间:底图与状态 */}
<Col xs={24} xl={12}>
<Space direction="vertical" size={16} style={{ width: '100%' }}>
<Space direction="vertical" size={8} style={{ width: '100%' }}>
<Card
title={
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}>
@@ -456,7 +456,7 @@ export default function StationDashboard() {
{/* 右侧:状态与分析 */}
<Col xs={24} xl={6}>
<Space direction="vertical" size={16} style={{ width: '100%' }}>
<Space direction="vertical" size={8} style={{ width: '100%' }}>
<Card
title={<span style={{ fontWeight: 800 }}>实时告警</span>}
extra={<Button type="link" size="small">更多 &gt;</Button>}
@@ -595,8 +595,6 @@ export default function StationDashboard() {
<div style={{ fontSize: 14, color: '#333', marginBottom: 6 }}>
{weatherdata.weather}
</div>
</div>
</div>
<div style={{ fontSize: 12, color: '#666', lineHeight: 1.6 }}>