根据不同账号 显示的首页优化 规划界面 悬浮显示 状态信息 全局急停状态统一 割刀 根据新方案对接 两个状态 任务路线 显示为 抽拉式一行一个 xbox组件优化数据发送,重构数据

This commit is contained in:
mmc
2026-11-14 18:23:27 +08:00
parent f057e0b72c
commit 831e1086d3
12 changed files with 566 additions and 382 deletions

View File

@@ -1,5 +1,5 @@
import React, { useState, useEffect, useRef, useMemo } from 'react';
import { Row, Col, Card, Button, Space, Table, Tag, Typography, Badge, Tabs, Input, Switch, Tooltip, Timeline, Select, message, DatePicker, TimePicker, Popconfirm, App, Radio, Empty } from 'antd';
import { Row, Col, Card, Button, Space, Table, Tag, Typography, Badge, Tabs, Input, Switch, Tooltip, Timeline, Select, message, DatePicker, TimePicker, Popconfirm, App, Radio, Empty, Collapse } from 'antd';
import { PlusOutlined, ImportOutlined, NodeIndexOutlined, SaveOutlined, DeleteOutlined, CloseOutlined, ReloadOutlined, ExclamationCircleOutlined, EnvironmentOutlined, EnvironmentFilled } from '@ant-design/icons';
import { Car, Navigation, MapPinned, Route, Satellite, LayoutGrid, CheckCircle2, AlertCircle, TrendingUp, Maximize2 } from 'lucide-react';
import TaskTypeRadio from '../taskRadio/taskRadio';
@@ -80,6 +80,8 @@ export function TaskPlanningView({ selectedMachineSn, embedded = false, onStatsC
const [routeSearch, setRouteSearch] = useState('');
const [routeList, setRouteList] = useState([]);
// 任务下发:按模式分组的路线(折叠面板使用)
const dispatchRouteGroups = useMemo(() => groupRoutesByMode(routeList, t), [routeList, t]);
const [consecutiveLoading, setConsecutiveLoading] = useState(false);
// 执行任务弹窗
@@ -212,18 +214,6 @@ export function TaskPlanningView({ selectedMachineSn, embedded = false, onStatsC
const controllerRef = useRef<DeviceController | null>(null);
const isFirstConnect = useRef(true);
const mapRef = useRef(null);
const fixStatusMap: Record<string, string> = {
'no_fix': t('devices.noFix'),
'single': t('devices.single'),
'dgnss': t('devices.dgnss'),
'ins': t('devices.ins'),
'rtk_fixed': t('devices.rtkFixed'),
'rtk_float': t('devices.rtkFloat'),
'single_no_heading': t('devices.singleNoHeading'),
'dgnss_no_heading': t('devices.dgnssNoHeading'),
'rtk_fixed_no_heading': t('devices.rtkFixedNoHeading'),
'rtk_float_no_heading': t('devices.rtkFloatNoHeading'),
}
const handleFinish = (data) => {
@@ -1739,8 +1729,8 @@ export function TaskPlanningView({ selectedMachineSn, embedded = false, onStatsC
points,
polyPoints,
routeMode,
realtimePosition,
realtimeDevice: targetRobot ? { ...targetRobot, color: robotMapColor } : targetRobot,
realtimePosition: robotRealtimePosition ? realtimePosition : null,
realtimeDevice: targetRobot ? { ...targetRobot, ...(robotRealtimePosition || {}), color: robotMapColor } : targetRobot,
deviceColor: robotMapColor,
realtimeType: 'robot',
ifClearNavLine: clearNavLine,
@@ -1754,7 +1744,7 @@ export function TaskPlanningView({ selectedMachineSn, embedded = false, onStatsC
onSave={() => fetchRouteList()}
/>
{/* 机器人状态悬浮面板 - 绝对定位左上角 */}
{/* 机器人操作面板(状态信息改为鼠标悬浮机器时在地图上显示) */}
{execute && executingRobot && (
<div
style={{
@@ -1820,7 +1810,7 @@ export function TaskPlanningView({ selectedMachineSn, embedded = false, onStatsC
})()}
</span>
<span>
{/*<span>
{t('devices.systemMode')}
{(() => {
const mode = robotRealtimePosition?.sm || robotRealtimePosition?.sm;
@@ -1850,16 +1840,13 @@ export function TaskPlanningView({ selectedMachineSn, embedded = false, onStatsC
</span>
);
})()}
</span>
</span>*/}
<span>
{t('devices.location')}
{robotRealtimePosition?.fix_status ? fixStatusMap[robotRealtimePosition?.fix_status] : t('constants.locationUnknown')}
</span>
{/* 视频开关 */}
<span style={{ display: 'flex', alignItems: 'center', gap: 6 }}>
@@ -2301,61 +2288,61 @@ export function TaskPlanningView({ selectedMachineSn, embedded = false, onStatsC
{(!routeList || routeList.length === 0) ? (
<Empty image={Empty.PRESENTED_IMAGE_SIMPLE} />
) : (
<div style={{ display: 'flex', flexDirection: 'column', gap: 10, maxHeight: 280, overflowY: 'auto' }}>
{groupRoutesByMode(routeList, t).map(group => (
<div key={group.key}>
<div style={{ fontSize: 12, fontWeight: 600, color: group.color, marginBottom: 6, display: 'flex', alignItems: 'center', gap: 6 }}>
<Collapse
size="small"
ghost
defaultActiveKey={dispatchRouteGroups.map(g => g.key)}
style={{ maxHeight: 280, overflowY: 'auto' }}
items={dispatchRouteGroups.map(group => ({
key: group.key,
label: (
<div style={{ fontSize: 12, fontWeight: 600, color: group.color, display: 'flex', alignItems: 'center', gap: 6 }}>
<span style={{ display: 'inline-block', width: 6, height: 6, borderRadius: '50%', background: group.color }} />
{group.label}
<span style={{ color: '#999', fontWeight: 400, fontSize: 11 }}>({group.items.length})</span>
</div>
<div style={{ display: 'flex', flexWrap: 'wrap', gap: 8 }}>
),
children: (
<div style={{ display: 'flex', flexDirection: 'column', gap: 6 }}>
{group.items.map(route => {
const checked = dispatchRouteIds.includes(route.id);
return (
<Tag.CheckableTag
<div
key={route.id}
checked={checked}
style={{
display: 'inline-flex',
alignItems: 'center',
border: `1px solid ${checked ? '#1677ff' : '#dce5f2'}`,
background: checked ? '#f0f7ff' : '#fff',
color: '#344054',
borderRadius: 4,
padding: '3px 12px',
margin: 0,
fontSize: 12,
lineHeight: '20px',
whiteSpace: 'nowrap',
}}
onChange={nextChecked => {
// 按路线下发:单选
setDispatchRouteIds(nextChecked ? [route.id] : []);
if (nextChecked) {
// 选择下发路径时,取消上方任务规划的选中
onClick={() => {
// 按路线下发:单选,一行一个;再次点击可取消
setDispatchRouteIds(checked ? [] : [route.id]);
if (!checked) {
setEditorType(null);
flyToRoute(route.id);
}
}}
style={{
display: 'flex',
alignItems: 'center',
gap: 8,
width: '100%',
boxSizing: 'border-box',
padding: '6px 10px',
borderRadius: 6,
cursor: 'pointer',
border: `1px solid ${checked ? '#1677ff' : '#e5e6eb'}`,
background: checked ? '#f0f7ff' : '#fff',
fontSize: 12,
color: '#344054',
transition: 'all .15s',
}}
>
<span
style={{
color: '#344054',
display: 'inline-block',
}}
>
{route.workName || route.name}
</span>
</Tag.CheckableTag>
<span style={{ width: 6, height: 6, borderRadius: '50%', background: group.color, flex: '0 0 auto' }} />
<span style={{ flex: 1, overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }}>{route.workName || route.name}</span>
{checked && <span style={{ color: '#1677ff', fontWeight: 700 }}>✓</span>}
</div>
);
})}
</div>
</div>
))}
</div>
)
}))}
/>
)}
</div>
)}