diff --git a/src/components/devices/RobotTaskPage.tsx b/src/components/devices/RobotTaskPage.tsx
new file mode 100644
index 0000000..f69467a
--- /dev/null
+++ b/src/components/devices/RobotTaskPage.tsx
@@ -0,0 +1,378 @@
+import React, { useState, useEffect, useRef } from 'react';
+import {
+ Row, Col, Card, Button, Space, Table, Tag, Typography, Progress, Badge,
+ Tabs, Input, Switch, Divider, Tooltip, Timeline, Select, message, DatePicker,
+ Modal, InputNumber
+} from 'antd';
+import {
+ PlusOutlined, ImportOutlined, NodeIndexOutlined,
+ SaveOutlined, FullscreenOutlined, EnvironmentOutlined,
+ BranchesOutlined, CloudOutlined, ThunderboltOutlined, CheckCircleOutlined,
+ InfoCircleOutlined, ClockCircleOutlined,
+ SettingOutlined, WarningOutlined, ArrowRightOutlined,
+ SearchOutlined, MoreOutlined, AimOutlined, PlayCircleOutlined
+} from '@ant-design/icons';
+import {
+ Car, Navigation, Wind, Thermometer, Droplets, Satellite,
+ LayoutGrid, Clock, CheckCircle2, AlertCircle, Zap, Waves,
+ Calendar, User, TrendingUp, Maximize2, Play, Square, X, MapPin, RotateCw
+} from 'lucide-react';
+import {
+ getWorkList, saveDeviceTask, getDeviceTask
+} from '../../api/api';
+import dayjs from 'dayjs';
+import utils from '../../lib/utils';
+import CesiumMap from '../Map';
+import { fix2, getVal } from '../../lib/utils';
+
+const { Text, Title } = Typography;
+const { RangePicker } = DatePicker;
+
+export default function RobotTaskPage({ devices, onRefresh }) {
+ const fontSmall = 'clamp(10px, 0.7vw, 11px)';
+ const fontNormal = 'clamp(12px, 0.75vw, 13px)';
+ const fontTitle = 'clamp(14px, 0.85vw, 16px)';
+ const fontLarge = 'clamp(18px, 1.1vw, 24px)';
+
+ const cardStyle = { borderRadius: 12, border: 'none', boxShadow: '0 2px 12px rgba(0,0,0,0.04)' };
+
+ // 任务列表 独立筛选状态
+ const [listRobot, setListRobot] = useState(null);
+ const [listDateRange, setListDateRange] = useState(null);
+ const [taskList, setTaskList] = useState([]);
+
+ // 工作看板 独立筛选状态
+ const [boardRobot, setBoardRobot] = useState(null);
+ const [boardDateRange, setBoardDateRange] = useState(null);
+ const [boardTaskList, setBoardTaskList] = useState([]);
+
+ const [selectedRoute, setSelectedRoute] = useState(null);
+ const [focusLocation, setFocusLocation] = useState(null);
+ const [points, setPoints] = useState([]);
+ const [loading, setLoading] = useState(false);
+ const [createTaskModal, setCreateTaskModal] = useState(false);
+ const [routeSearch, setRouteSearch] = useState('');
+ const [routeList, setRouteList] = useState([]);
+
+ // 获取任务列表数据
+ const getListTask = async () => {
+ if (!devices?.length) return;
+ try {
+ const userId = JSON.parse(localStorage.getItem("userInfo") || '{}')?.userId;
+ const res = await getWorkList({ userId });
+ if (res.code === 200) {
+ setTaskList(res.data || []);
+ }
+ } catch (err) {
+ message.error('任务列表数据获取失败');
+ }
+ };
+
+ // 获取路线列表
+ const fetchRouteList = async () => {
+ // 这里假设有一个获取机器人路线的接口,或者从现有任务中提取
+ setRouteList([
+ { id: 1, name: '区域 A 巡检路线', points: 12, length: '1.2km' },
+ { id: 2, name: 'B 阵列除草路线', points: 24, length: '2.5km' },
+ { id: 3, name: '边界防护路线', points: 8, length: '0.8km' },
+ ]);
+ };
+
+ useEffect(() => {
+ getListTask();
+ fetchRouteList();
+ }, []);
+
+ useEffect(() => {
+ if (devices?.length) {
+ setListRobot(devices[0]);
+ setBoardRobot(null);
+ }
+ }, [devices]);
+
+ const taskColumns = [
+ { title: '任务名称', dataIndex: 'workName', width: 200, ellipsis: true, fixed: "left" },
+ { title: '设备名称', dataIndex: 'deviceName', width: 140 },
+ { title: '执行人', dataIndex: 'userName', width: 100 },
+ {
+ title: '执行时间', dataIndex: 'createTime', width: 170,
+ render: t => t ? dayjs(t).format('YYYY-MM-DD HH:mm:ss') : '-'
+ },
+ {
+ title: '状态', dataIndex: 'status', width: 100,
+ render: (s) => {s === 'success' ? '完成' : '执行中'}
+ }
+ ];
+
+ const handleRowClick = (record) => {
+ // 定位到机器人位置或显示轨迹
+ if (record.longitude && record.latitude) {
+ setFocusLocation({
+ lon: record.longitude,
+ lat: record.latitude,
+ type: 'robot',
+ name: record.deviceName
+ });
+ }
+ };
+
+ const groupBoardData = () => {
+ const waitList = taskList.filter(item => item.status !== 'success');
+ const runList = taskList.filter(item => item.status === 'executing');
+ const finishList = taskList.filter(item => item.status === 'success');
+ return { waitList, runList, finishList };
+ };
+ const { waitList, runList, finishList } = groupBoardData();
+
+ const topCards = [
+ { title: '今日机器人计划', value: taskList.length, unit: '条', desc: '进行中', icon: , color: '#165DFF' },
+ { title: '作业中机器人', value: runList.length, unit: '台', desc: '作业中', icon: , color: '#165DFF' },
+ { title: '累计作业里程', value: '12.5', unit: 'km', trend: '较昨日 +1.2', trendColor: '#00B42A', icon: , color: '#722ED1' },
+ { title: '任务完成率', value: taskList.length ? Math.round((finishList.length / taskList.length) * 100) : 0, unit: '%', trend: '较昨日 +5%', trendColor: '#00B42A', icon: , color: '#00B42A' },
+ { title: '异常告警', value: '2', unit: '次', trend: '较昨日 -1', trendColor: '#00B42A', icon: , color: '#F53F3F' },
+ { title: '在线率', value: '98', unit: '%', desc: '良好', icon: , color: '#165DFF' },
+ ];
+
+ return (
+
+
+ {topCards.map((item, index) => (
+
+
+
+
+ {React.cloneElement(item.icon as React.ReactElement, { size: 18 })}
+
+
+
{item.title}
+
+ {item.value}
+ {item.unit}
+
+
+ {item.trend || item.desc}
+
+
+
+
+
+ ))}
+
+
+
+
+ 机器人路径规划与监控}
+ size="small"
+ extra={
+
+ } style={{ borderRadius: 4 }}>新增路线
+ } style={{ borderRadius: 4 }}>导入
+ } style={{ borderRadius: 4 }}>保存
+ } />
+
+ }
+ bordered={false}
+ bodyStyle={{ padding: 0, position: 'relative' }}
+ style={{ ...cardStyle, marginBottom: 10 }}
+ >
+
+
+
+
+
+
+ 机器人任务列表
+
+
+
+
+ }
+ size="small"
+ bordered={false}
+ bodyStyle={{ padding: 0, display: 'flex', flexDirection: 'column', height: "calc(100% - 40px)", overflow: "auto" }}
+ style={{ ...cardStyle, maxHeight: "250px", flex: 1, marginBottom: 0 }}
+ >
+ ({
+ onClick: () => handleRowClick(record),
+ style: { cursor: 'pointer' }
+ })}
+ />
+
+
+
+
+ 作业编排建议}
+ bordered={false}
+ bodyStyle={{ padding: '12px 16px' }}
+ style={{ ...cardStyle, marginBottom: 8 }}
+ >
+
+
+ RBT-01 开始除草任务
+ 预计耗时 2 小时,当前进度 45%
+
+
+ RBT-02 预定巡检任务
+ 待审批,建议执行区域 C
+
+
+ 设备例行维护
+ 所有割草机返回充电站
+
+
+
+
+
+ 设备环境与状态}
+ bordered={false}
+ bodyStyle={{ padding: '16px' }}
+ style={{ ...cardStyle, flex: 1 }}
+ >
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
注意:区域 B 存在积水风险,建议避开
+
+
+
+
+
+
+
+
+ 预设路线
+ setRouteSearch(e.target.value)}
+ />
+
+ }
+ bordered={false}
+ bodyStyle={{ padding: '12px', height: 400, overflow: 'auto' }}
+ style={cardStyle}
+ >
+
+ {routeList.map(route => (
+
e.currentTarget.style.borderColor = '#165DFF'}
+ onMouseLeave={e => e.currentTarget.style.borderColor = 'transparent'}
+ >
+
{route.name}
+
+ 航点: {route.points}
+ 长度: {route.length}
+
+
}>执行路线
+
+ ))}
+
+
+
+
+ 任务看板}
+ bordered={false}
+ bodyStyle={{ padding: '12px' }}
+ style={{ ...cardStyle, height: '100%' }}
+ >
+
+
+
+
+ {waitList.slice(0, 3).map((item, idx) => (
+
+ {item.workName}
+ 设备: {item.deviceName}
+
+ ))}
+
+
+
+
+
+ {runList.map((item, idx) => (
+
+ {item.workName}
+ 正在执行...
+
+ ))}
+
+
+
+
+
+ {finishList.slice(0, 3).map((item, idx) => (
+
+ {item.workName}
+ 已完成
+
+ ))}
+
+
+
+
+
+
+
+ );
+}
diff --git a/src/pages/Devices.tsx b/src/pages/Devices.tsx
index 908284e..6c87001 100644
--- a/src/pages/Devices.tsx
+++ b/src/pages/Devices.tsx
@@ -1,12 +1,13 @@
import React, { useState, useEffect } from 'react';
import { Layout, Typography, Menu, Tabs } from 'antd';
-import { AimOutlined, AppstoreOutlined, SettingOutlined } from '@ant-design/icons';
+import { AimOutlined, AppstoreOutlined, SettingOutlined, BranchesOutlined } from '@ant-design/icons';
import DeviceOverviewPage from '../components/devices/DeviceOverviewPage';
import DeviceStatusPage from '../components/devices/DeviceStatusPage';
import { getSiteDevice, getSiteUAVList } from '../api/device';
import { useSelector } from 'react-redux';
import { RootState } from '../store';
import WayLinePage from '../components/devices/WayLinePage';
+import RobotTaskPage from '../components/devices/RobotTaskPage';
const { Header, Content } = Layout;
const { Text } = Typography;
@@ -25,6 +26,7 @@ export default function DeviceIndexPage() {
{ key: 'overview', label: '装备总览', icon: },
{ key: 'status', label: '设备状态', icon: },
{ key: 'wayLineTask', label: '航线任务', icon: },
+ { key: 'robotTask', label: '机器人任务', icon: },
];
// 👇 核心:给无人机补全 lastRunningStatus + type: 'plane'
@@ -102,6 +104,7 @@ export default function DeviceIndexPage() {
/>;
}
if (activeTab === 'wayLineTask') return ;
+ if (activeTab === 'robotTask') return ;
return null;
};