diff --git a/frontend/src/pages/RackManagement.jsx b/frontend/src/pages/RackManagement.jsx index dfcab2d..c074014 100644 --- a/frontend/src/pages/RackManagement.jsx +++ b/frontend/src/pages/RackManagement.jsx @@ -220,6 +220,13 @@ const RackCard = ({ rack, onEdit, onDelete, onView, selected, onSelect }) => { > {rack.height}U / {usedU} + 0 ? Math.min((usedU / rack.height) * 100, 100) : 0} + showInfo={false} + size="small" + strokeColor={usedU / rack.height >= 0.8 ? '#ff4d4f' : usedU / rack.height >= 0.6 ? '#faad14' : '#52c41a'} + style={{ marginTop: '4px' }} + />
@@ -670,10 +677,26 @@ function RackManagement() { key: 'heightUsage', render: (_, record) => { const used = record.Devices?.reduce((sum, d) => sum + (d.height || 1), 0) || 0; + const percentage = record.height > 0 ? Math.min((used / record.height) * 100, 100) : 0; + const status = percentage >= 80 ? 'exception' : percentage >= 60 ? 'active' : 'normal'; return ( - - {record.height}U / 已用 {used} U位 - +
+
+ + {record.height}U / 已用 {used}U + + = 80 ? '#ff4d4f' : percentage >= 60 ? '#faad14' : '#52c41a' }}> + {percentage.toFixed(0)}% + +
+ = 80 ? '#ff4d4f' : percentage >= 60 ? '#faad14' : '#52c41a'} + /> +
); }, sorter: (a, b) =>