装备总览界面卡片优化

This commit is contained in:
mmc
2026-06-02 14:15:16 +08:00
parent 16f0be3da6
commit 5f011fd435

View File

@@ -355,10 +355,54 @@ export default function DeviceOverviewPage({ onViewStatus, selectedSn, onDeviceS
const completionRate = totalTasks > 0 ? Math.round((completedTasks / totalTasks) * 100) : 0;
return [
{ title: '无人机机场状态', icon: <EnvironmentOutlined />, value: `${onlineDrones} / ${totalDrones}`, sub: `可调度 ${onlineDrones} 架`, color: '#1890ff' },
{ title: '机器人', icon: <BranchesOutlined />, value: `${totalMowers} 台`, sub: `作业中 ${activeMowers}`, color: '#13c2c2' },
{ title: '无人机', icon: <CloudOutlined />, value: `${totalDrones} 架`, sub: `待命 ${washDroneStandby}`, color: '#eb2f96' },
{ title: '今日任务执行', icon: <CheckCircleOutlined />, value: `${completedTasks} / ${totalTasks}`, sub: `完成率 ${completionRate}%`, color: '#2f54eb' },
{
title: '无人机机场状态',
icon: <EnvironmentOutlined style={{ color: '#165DFF', fontSize: 24 }} />,
value: `${onlineDrones} / ${totalDrones}`,
sub: `可调度 ${onlineDrones} 架`,
color: '#165DFF',
iconBg: '#E8F3FF'
},
{
title: '巡检机器人',
icon: <RobotOutlined style={{ color: '#13c2c2', fontSize: 24 }} />,
value: `${totalRobots} 台`,
sub: `执行中 ${activeRobots}`,
color: '#13c2c2',
iconBg: '#E6FFFA'
},
{
title: '除草机器人',
icon: <CarOutlined style={{ color: '#722ED1', fontSize: 24 }} />,
value: `${totalMowers} 台`,
sub: `作业中 ${activeMowers}`,
color: '#722ED1',
iconBg: '#F9F0FF'
},
{
title: '清洗无人机',
icon: <CloudOutlined style={{ color: '#eb2f96', fontSize: 24 }} />,
value: `${totalDrones} 架`,
sub: `待命 ${washDroneStandby}`,
color: '#eb2f96',
iconBg: '#FFF1F3'
},
//{
// title: '设备平均电量',
// icon: <ThunderboltOutlined style={{ color: '#52c41a', fontSize: 24 }} />,
// value: `${finalAvgBattery}%`,
// sub: '',
// color: '#52c41a',
// iconBg: '#E8FFEA'
//},
{
title: '今日任务执行',
icon: <CheckCircleOutlined style={{ color: '#2f54eb', fontSize: 24 }} />,
value: `${completedTasks} / ${totalTasks}`,
sub: `完成率 ${completionRate}%`,
color: '#2f54eb',
iconBg: '#E8F3FF'
},
];
}, [devicesAll, planedevices, persistentDroneData, uavState, taskStats]);
@@ -416,19 +460,43 @@ export default function DeviceOverviewPage({ onViewStatus, selectedSn, onDeviceS
return (
<Content style={{ margin: '0 8', }}>
<Row gutter={[8, 8]} style={{ marginBottom: 12, flexWrap: 'wrap' }}>
<Row gutter={[12, 12]} style={{ marginBottom: 8, flexWrap: 'wrap' }}>
{dynamicTopCards.map((card, idx) => (
<Col key={idx} style={{ minWidth: '360px', flex: '0 0 auto' }}>
<Card bordered={false} style={{ borderRadius: 8, boxShadow: '0 2px 8px rgba(0,0,0,0.05)', height: 90 }} bodyStyle={{ padding: '12px', height: '100%' }}>
<div style={{ display: 'flex', alignItems: 'center', gap: 10, height: '100%' }}>
<div style={{ width: 40, height: 40, borderRadius: 8, background: `${card.color}15`, color: card.color, display: 'flex', alignItems: 'center', justifyContent: 'center', fontSize: 'clamp(14px, 1.2vw, 18px)', flexShrink: 0 }}>
{card.icon}
<Col key={idx} style={{ minWidth: '200px', flex: '1 0 auto', maxWidth: "260px" }}>
<Card
bordered={false}
bodyStyle={{ padding: '20px 20px', display: 'flex', alignItems: 'flex-start', justifyContent: 'space-between' }}
style={{ borderRadius: 8, boxShadow: '0 2px 8px rgba(0,0,0,0.06)', height: 101 }}
>
{/* 左侧文字区域 */}
<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={{ flex: 1, minWidth: 0 }}>
<div style={{ fontSize: 'clamp(11px, 0.9vw, 13px)', color: '#666' }}>{card.title}</div>
<div style={{ fontSize: 'clamp(18px, 1.6vw, 24px)', fontWeight: 700, color: '#222', lineHeight: '30px' }}>{card.value}</div>
{card.sub && <div style={{ fontSize: 'clamp(10px, 0.8vw, 12px)', color: '#999', marginTop: 2 }}>{card.sub}</div>}
<div style={{ fontSize: 28, fontWeight: 700, color: card.color, lineHeight: 1, marginBottom: 8 }}>
{card.value}
</div>
{/* 底部环比/备注 */}
{card.sub && <div style={{ fontSize: 12, color: '#86909C', fontWeight: 500 }}>
{card.sub}
</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>
</Col>