卡片样式

This commit is contained in:
mmc
2026-06-02 13:50:00 +08:00
parent d1dd2b4c70
commit 16f0be3da6
4 changed files with 174 additions and 70 deletions

View File

@@ -27,12 +27,60 @@ const { Text, Title } = Typography;
// 模拟数据(完全匹配参考图)
const overviewCards = [
{ title: '本月发电量', value: '138.6', unit: 'MWh', trend: '环比 ↑ +6.2%', color: '#00B42A', bg: '#E8FFEA', icon: <RiseOutlined /> },
{ title: 'PR均值', value: '82.8', unit: '%', trend: '环比 ↑ +1.1%', color: '#165DFF', bg: '#E8F3FF', icon: <LineChartOutlined /> },
{ title: '运维工单完成率', value: '93.4', unit: '%', trend: '本月累计 126 单', color: '#165DFF', bg: '#E8F3FF', icon: <FileDoneOutlined /> },
{ title: '告警闭环率', value: '94.2', unit: '%', trend: '严重告警 8 条', color: '#F53F3F', bg: '#FFF1F0', icon: <BellOutlined /> },
{ title: '清洗收益提升', value: '+7.6', unit: '%', trend: '预估增发 12,850 kWh', color: '#00B42A', bg: '#E8FFEA', icon: <ThunderboltOutlined /> },
{ title: '自动生成报告', value: '24', unit: '份', trend: '本月累计', color: '#722ED1', bg: '#F9F0FF', icon: <FileTextOutlined /> },
{
title: '本月发电量',
value: '138.6',
unit: 'MWh',
trend: '环比 ↑ +6.2%',
color: '#00B42A',
iconBg: '#E8FFEA',
icon: <ThunderboltOutlined style={{ color: '#00B42A', fontSize: 24 }} />
},
{
title: 'PR均值',
value: '82.8',
unit: '%',
trend: '环比 ↑ +1.1%',
color: '#165DFF',
iconBg: '#E8F3FF',
icon: <LineChartOutlined style={{ color: '#165DFF', fontSize: 24 }} />
},
{
title: '运维工单完成率',
value: '93.4',
unit: '%',
trend: '本月累计 126 单',
color: '#165DFF',
iconBg: '#E8F3FF',
icon: <CheckCircleOutlined style={{ color: '#165DFF', fontSize: 24 }} />
},
{
title: '告警闭环率',
value: '94.2',
unit: '%',
trend: '严重告警 8 条',
color: '#F53F3F',
iconBg: '#FFF1F0',
icon: <BellOutlined style={{ color: '#F53F3F', fontSize: 24 }} />
},
{
title: '清洗收益提升',
value: '+7.6',
unit: '%',
trend: '预估增发 12,850 kWh',
color: '#00B42A',
iconBg: '#E8FFEA',
icon: <ThunderboltOutlined style={{ color: '#00B42A', fontSize: 24 }} />
},
{
title: '自动生成报告',
value: '24',
unit: '份',
trend: '本月累计',
color: '#722ED1',
iconBg: '#F9F0FF',
icon: <FileTextOutlined style={{ color: '#722ED1', fontSize: 24 }} />
},
];
const monthlyPowerData = [
@@ -132,11 +180,7 @@ export default function ReportCenterPage() {
.report-tabs .ant-tabs-nav {
margin-bottom: 8px !important;
}
.report-tabs .ant-tabs-tab {
padding: 2px 4px !important;
font-size: 14px;
font-weight: 500;
}
.filter-label {
font-size: 12px;
color: #86909C;
@@ -153,7 +197,7 @@ export default function ReportCenterPage() {
}
`}
</style>
<div style={{ display: 'flex', alignItems: 'center', marginBottom: 16 }}>
<div style={{ display: 'flex', alignItems: 'center', marginBottom: 8 }}>
<Typography.Title level={4} style={{ margin: '0 32px 0 0', }}>报表中心</Typography.Title>
{/* 页面头部标签 */}
@@ -169,66 +213,52 @@ export default function ReportCenterPage() {
<Row
gutter={[8, 8]}
gutter={[12, 12]}
style={{
marginBottom: 8,
flexWrap: 'wrap',
}}
>
{overviewCards.map((card, idx) => (
<Col key={idx} style={{ minWidth: '168px', flex: '1 0 auto', maxWidth: "250px" }}>
<Col key={idx} style={{ minWidth: '180px', flex: '1 0 auto', maxWidth: "240px" }}>
<Card
bordered={false}
bodyStyle={{ padding: '16px' }}
style={{
borderRadius: 8,
height: 120,
display: 'flex',
flexDirection: 'column',
justifyContent: 'center'
}}
bodyStyle={{ padding: '20px 20px', display: 'flex', alignItems: 'center', justifyContent: 'space-between' }}
style={{ borderRadius: 8, boxShadow: '0 2px 8px rgba(0,0,0,0.06)' }}
>
<Statistic
title={
<span style={{ fontSize: 14, color: '#666', fontWeight: 500 }}>
{card.title}
</span>
}
value={card.value}
precision={card.title === 'PR均值' ? 1 : 1}
suffix={
card.unit && (
<span style={{ fontSize: 16, marginLeft: 4 }}>{card.unit}</span>
)
}
valueStyle={{
color: card.color,
fontSize: 28,
fontWeight: 700,
marginBottom: 4
{/* 左侧文字区域 */}
<div style={{ flex: 1, display: 'flex', flexDirection: 'column', alignItems: 'flex-start' }}>
<div style={{ fontSize: 14, color: '#86909C', marginBottom: 8, fontWeight: 500 }}>
{card.title}
</div>
<div style={{ fontSize: 28, fontWeight: 700, color: card.color, lineHeight: 1, marginBottom: 8 }}>
{card.value}
<span style={{ fontSize: 14, fontWeight: 500, marginLeft: 2, color: '#1D2129' }}>{card.unit}</span>
</div>
{/* 底部环比/备注 */}
<div style={{ fontSize: 12, color: '#86909C', fontWeight: 500 }}>
{card.trend}
</div>
</div>
{/* 右侧圆形图标区域 */}
<div
style={{
width: 48,
height: 48,
borderRadius: '50%',
backgroundColor: card.iconBg || '#f0f7ff',
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
flexShrink: 0,
marginLeft: 8
}}
/>
>
{card.icon}
</div>
{card.rate && (
<div style={{ fontSize: 12, color: '#999', marginTop: 2 }}>
环比
<span
style={{
marginLeft: 4,
color: card.rateUp ? '#52c41a' : '#ff4d4f',
fontWeight: 600
}}
>
{card.rate}
</span>
</div>
)}
{card.desc && (
<div style={{ fontSize: 12, color: '#999', marginTop: 2 }}>
{card.desc}
</div>
)}
</Card>
</Col>
))}

View File

@@ -450,8 +450,8 @@ const WorkOrderPage = () => {
<Card bordered={false} bodyStyle={{ padding: '20px 16px' }} style={cardStyle}>
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}>
<div>
<div style={{ fontSize: 'clamp(12px, 0.8vw, 13px)', color: '#86909C', marginBottom: 8 }}>{item.title}</div>
<div style={{ display: 'flex', alignItems: 'baseline', gap: 6, marginBottom: 8 }}>
<div style={{ fontSize: 'clamp(12px, 0.8vw, 13px)', color: '#86909C', marginBottom: 2 }}>{item.title}</div>
<div style={{ display: 'flex', alignItems: 'baseline', gap: 6, marginBottom: 2 }}>
<div style={{ fontSize: 'clamp(20px, 1.4vw, 24px)', fontWeight: 800, color: '#1D2129' }}>{item.value}</div>
{item.unit && <span style={{ fontSize: 13, color: '#1D2129', fontWeight: 600 }}>{item.unit}</span>}
</div>