78 lines
2.2 KiB
TypeScript
78 lines
2.2 KiB
TypeScript
import React from 'react';
|
|
import { EnvironmentOutlined, RocketOutlined, PieChartOutlined } from '@ant-design/icons';
|
|
import './maritime-card.less';
|
|
|
|
// 无人船图标组件
|
|
const USVIcon = () => (
|
|
<svg viewBox="0 0 24 24" width="1em" height="1em" fill="currentColor">
|
|
<path d="M20 21c-1.39 0-2.78-.47-4-1.32-2.44 1.71-5.56 1.71-8 0C6.78 20.53 5.39 21 4 21H2v2h2c1.38 0 2.74-.35 4-.99 2.52 1.29 5.48 1.29 8 0 1.26.64 2.63.99 4 .99h2v-2h-2zM3.95 19H4c1.6 0 3.02-.88 4-2 .98 1.12 2.4 2 4 2s3.02-.88 4-2c.98 1.12 2.4 2 4 2h.05l1.89-6.68c.08-.26.06-.54-.06-.78s-.34-.42-.6-.5L20 10.62V6c0-1.1-.9-2-2-2h-3V1H9v3H6c-1.1 0-2 .9-2 2v4.62l-1.29.42c-.26.08-.48.26-.6.5s-.15.52-.06.78L3.95 19zM6 6h12v3.97L12 8 6 9.97V6z"/>
|
|
</svg>
|
|
);
|
|
|
|
interface MaritimeKpiStripProps {
|
|
deviceTotal: number;
|
|
seaAreaCount: number;
|
|
todayNew: number;
|
|
successRate: number;
|
|
taskNewLabel?: string;
|
|
}
|
|
|
|
const MaritimeKpiStrip: React.FC<MaritimeKpiStripProps> = ({
|
|
deviceTotal,
|
|
seaAreaCount,
|
|
todayNew,
|
|
successRate,
|
|
taskNewLabel = '当日任务',
|
|
}) => {
|
|
const kpis = [
|
|
{
|
|
key: 'ship',
|
|
label: '设备总数',
|
|
value: deviceTotal,
|
|
icon: <USVIcon />,
|
|
accent: 'ship',
|
|
},
|
|
{
|
|
key: 'area',
|
|
label: '海域总数',
|
|
value: seaAreaCount,
|
|
icon: <EnvironmentOutlined />,
|
|
accent: 'anchor',
|
|
},
|
|
{
|
|
key: 'task',
|
|
label: taskNewLabel,
|
|
value: todayNew,
|
|
icon: <RocketOutlined />,
|
|
accent: 'alert',
|
|
},
|
|
{
|
|
key: 'rate',
|
|
label: '执行成功率',
|
|
value: successRate,
|
|
unit: '%',
|
|
icon: <PieChartOutlined />,
|
|
accent: 'route',
|
|
},
|
|
];
|
|
|
|
return (
|
|
<div className="maritime-kpi-strip">
|
|
{kpis.map((kpi) => (
|
|
<div key={kpi.key} className={`maritime-kpi-tile maritime-kpi-tile--${kpi.accent}`}>
|
|
<div className="maritime-kpi-tile__icon">{kpi.icon}</div>
|
|
<div className="maritime-kpi-tile__info">
|
|
<div className="maritime-kpi-tile__label">{kpi.label}</div>
|
|
<div className="maritime-kpi-tile__value">
|
|
{kpi.value}
|
|
{kpi.unit && <small>{kpi.unit}</small>}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
))}
|
|
</div>
|
|
);
|
|
};
|
|
|
|
export default MaritimeKpiStrip;
|