优化 map中实时车悬浮的提醒框子,优化已完成任务提醒哪个设备 优化页面 设备类型显示 和 在线状态显示 预设路线分组显示 优化路径规划中的问题
This commit is contained in:
@@ -21,6 +21,26 @@ import type { ViewStats } from './WayLineView';
|
||||
const { Text, Title } = Typography;
|
||||
const { RangePicker } = DatePicker;
|
||||
|
||||
|
||||
// 预设路径按模式分组(覆盖 / 单点 / 预定义),用于任务下发时区分展示
|
||||
const ROUTE_MODE_GROUPS = [
|
||||
{ key: 'coverage', labelKey: 'devices.coverageMode', match: (m) => m === 'coverage' || m === 'coverage_area', color: '#13b879' },
|
||||
{ key: 'single_point', labelKey: 'devices.singleMode', match: (m) => m === 'single_point', color: '#1677ff' },
|
||||
{ key: 'predefined_path', labelKey: 'devices.predefinedPathMode', match: (m) => m === 'predefined_path', color: '#fa8c16' },
|
||||
];
|
||||
|
||||
const groupRoutesByMode = (routes, t) => {
|
||||
const groups = ROUTE_MODE_GROUPS.map((g) => ({ ...g, label: t(g.labelKey), items: [] }));
|
||||
const others = { key: 'other', label: t('devices.otherMode'), color: '#8c8c8c', items: [] };
|
||||
(routes || []).forEach((r) => {
|
||||
const g = groups.find((x) => x.match(r.mode));
|
||||
if (g) g.items.push(r);
|
||||
else others.items.push(r);
|
||||
});
|
||||
return [...groups, others].filter((g) => g.items.length > 0);
|
||||
};
|
||||
|
||||
|
||||
export function TaskPlanningView({ selectedMachineSn, embedded = false, onStatsChange }: { selectedMachineSn?: string; embedded?: boolean; onStatsChange?: (stats: ViewStats) => void }) {
|
||||
const { t } = useTranslation();
|
||||
const { userInfo } = useSelector((state: RootState) => state.user);
|
||||
@@ -208,7 +228,7 @@ export function TaskPlanningView({ selectedMachineSn, embedded = false, onStatsC
|
||||
console.log('任务完成回调', data);
|
||||
setExecute(false);
|
||||
setShowVideo(false); // 任务完成关闭视频
|
||||
utils.message.success(t('devices.fixed2TaskSuspended2Fixed2CompletedFixed2'));
|
||||
utils.message.success(t('devices.fixed2TaskSuspended2Fixed2CompletedFixed2', { deviceId: data.deviceId }));
|
||||
|
||||
setClearNavLine(clearNavLine + 1);
|
||||
setSelectedRobotForExecute(null);
|
||||
@@ -1012,7 +1032,16 @@ export function TaskPlanningView({ selectedMachineSn, embedded = false, onStatsC
|
||||
{
|
||||
title: t('devices.device'),
|
||||
dataIndex: 'deviceId',
|
||||
width: 100,
|
||||
render: (_, record) => {
|
||||
return record.deviceAlias ? record.deviceAlias : record.deviceId;
|
||||
}
|
||||
},
|
||||
{
|
||||
title: t('systemSetting.s6'),
|
||||
dataIndex: 'deviceId',
|
||||
width: 180,
|
||||
|
||||
},
|
||||
{
|
||||
title: t('devices.workName'),
|
||||
@@ -1123,7 +1152,16 @@ export function TaskPlanningView({ selectedMachineSn, embedded = false, onStatsC
|
||||
{
|
||||
title: t('devices.device'),
|
||||
dataIndex: 'deviceId',
|
||||
width: 100,
|
||||
render: (_, record) => {
|
||||
return record.deviceAlias ? record.deviceAlias : record.deviceId;
|
||||
}
|
||||
},
|
||||
{
|
||||
title: t('systemSetting.s6'),
|
||||
dataIndex: 'deviceId',
|
||||
width: 220,
|
||||
|
||||
},
|
||||
{
|
||||
title: t('devices.workName'),
|
||||
@@ -1661,13 +1699,16 @@ export function TaskPlanningView({ selectedMachineSn, embedded = false, onStatsC
|
||||
polyPoints,
|
||||
routeMode,
|
||||
realtimePosition,
|
||||
realtimeDevice: targetRobot,
|
||||
realtimeType: 'robot',
|
||||
ifClearNavLine: clearNavLine,
|
||||
ifClearPlanLine: clearPlanLine,
|
||||
focusOverlay,
|
||||
focusLocation,
|
||||
detectReportInfo,
|
||||
execute
|
||||
}}
|
||||
onSave={() => fetchRouteList()}
|
||||
/>
|
||||
|
||||
{/* 机器人状态悬浮面板 - 绝对定位左上角 */}
|
||||
@@ -2183,49 +2224,60 @@ export function TaskPlanningView({ selectedMachineSn, embedded = false, onStatsC
|
||||
{(!routeList || routeList.length === 0) ? (
|
||||
<Empty image={Empty.PRESENTED_IMAGE_SIMPLE} />
|
||||
) : (
|
||||
<div style={{ display: 'flex', flexWrap: 'wrap', gap: 8, maxHeight: 250, overflowY: "auto", }}>
|
||||
{routeList.map(route => {
|
||||
const checked = dispatchRouteIds.includes(route.id);
|
||||
<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 }}>
|
||||
<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 }}>
|
||||
{group.items.map(route => {
|
||||
const checked = dispatchRouteIds.includes(route.id);
|
||||
|
||||
return (
|
||||
<Tag.CheckableTag
|
||||
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] : []);
|
||||
return (
|
||||
<Tag.CheckableTag
|
||||
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) {
|
||||
// 选择下发路径时,取消上方任务规划的选中
|
||||
setEditorType(null);
|
||||
flyToRoute(route.id);
|
||||
}
|
||||
}}
|
||||
>
|
||||
<span
|
||||
style={{
|
||||
color: '#344054',
|
||||
display: 'inline-block',
|
||||
}}
|
||||
>
|
||||
{route.workName || route.name}
|
||||
</span>
|
||||
</Tag.CheckableTag>
|
||||
);
|
||||
})}
|
||||
if (nextChecked) {
|
||||
// 选择下发路径时,取消上方任务规划的选中
|
||||
setEditorType(null);
|
||||
flyToRoute(route.id);
|
||||
}
|
||||
}}
|
||||
>
|
||||
<span
|
||||
style={{
|
||||
color: '#344054',
|
||||
display: 'inline-block',
|
||||
}}
|
||||
>
|
||||
{route.workName || route.name}
|
||||
</span>
|
||||
</Tag.CheckableTag>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
@@ -2412,109 +2464,120 @@ export function TaskPlanningView({ selectedMachineSn, embedded = false, onStatsC
|
||||
</div>
|
||||
|
||||
{/* 路线选择卡片 */}
|
||||
<div
|
||||
style={{
|
||||
display: 'grid',
|
||||
gridTemplateColumns: 'repeat(4, minmax(0, 1fr))',
|
||||
gap: 8,
|
||||
width: '100%',
|
||||
}}
|
||||
>
|
||||
{regionAvailableRoutes.map((route, index) => {
|
||||
const checked = dispatchRouteIds.includes(route.id);
|
||||
|
||||
const regionColors = [
|
||||
'#1677ff',
|
||||
'#13b879',
|
||||
'#fa8c16',
|
||||
'#a33cff',
|
||||
];
|
||||
|
||||
const color = regionColors[index % regionColors.length];
|
||||
|
||||
return (
|
||||
<Tag.CheckableTag
|
||||
key={route.id}
|
||||
checked={checked}
|
||||
onChange={nextChecked => {
|
||||
setDispatchRouteIds(prev =>
|
||||
nextChecked
|
||||
? [...prev, route.id]
|
||||
: prev.filter(id => id !== route.id)
|
||||
);
|
||||
|
||||
if (nextChecked) {
|
||||
// 选择下发路径时,取消上方任务规划的选中
|
||||
setEditorType(null);
|
||||
flyToRoute(route.id);
|
||||
}
|
||||
}}
|
||||
<div style={{ display: 'flex', flexDirection: 'column', gap: 10, width: '100%' }}>
|
||||
{groupRoutesByMode(regionAvailableRoutes, t).map(group => (
|
||||
<div key={group.key}>
|
||||
<div style={{ fontSize: 12, fontWeight: 600, color: group.color, marginBottom: 6, 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',
|
||||
alignItems: 'center',
|
||||
gap: 5,
|
||||
display: 'grid',
|
||||
gridTemplateColumns: 'repeat(4, minmax(0, 1fr))',
|
||||
gap: 8,
|
||||
width: '100%',
|
||||
minWidth: 0,
|
||||
height: 40,
|
||||
boxSizing: 'border-box',
|
||||
margin: 0,
|
||||
padding: '0 8px',
|
||||
color: '#344054',
|
||||
background: '#fff',
|
||||
border: '1px solid #dce5f2',
|
||||
borderRadius: 4,
|
||||
fontSize: 12,
|
||||
lineHeight: 'normal',
|
||||
cursor: 'pointer',
|
||||
overflow: 'hidden',
|
||||
}}
|
||||
>
|
||||
{/* 自定义复选框 */}
|
||||
<span
|
||||
style={{
|
||||
display: 'inline-flex',
|
||||
flex: '0 0 12px',
|
||||
width: 12,
|
||||
height: 12,
|
||||
boxSizing: 'border-box',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
border: `1px solid ${checked ? color : '#cbd5e1'}`,
|
||||
borderRadius: 3,
|
||||
background: checked ? color : '#fff',
|
||||
color: '#fff',
|
||||
fontSize: 10,
|
||||
fontWeight: 700,
|
||||
}}
|
||||
>
|
||||
{checked ? '✓' : ''}
|
||||
</span>
|
||||
{group.items.map((route, index) => {
|
||||
const checked = dispatchRouteIds.includes(route.id);
|
||||
|
||||
{/* 路线定位图标 */}
|
||||
<EnvironmentFilled
|
||||
style={{
|
||||
flex: '0 0 auto',
|
||||
color,
|
||||
fontSize: 13,
|
||||
}}
|
||||
/>
|
||||
const regionColors = [
|
||||
'#1677ff',
|
||||
'#13b879',
|
||||
'#fa8c16',
|
||||
'#a33cff',
|
||||
];
|
||||
|
||||
{/* 路线名称 */}
|
||||
<span
|
||||
style={{
|
||||
flex: 1,
|
||||
minWidth: 0,
|
||||
overflow: 'hidden',
|
||||
textOverflow: 'ellipsis',
|
||||
whiteSpace: 'nowrap',
|
||||
color: '#344054',
|
||||
}}
|
||||
>
|
||||
{route.workName || route.name}
|
||||
</span>
|
||||
</Tag.CheckableTag>
|
||||
);
|
||||
})}
|
||||
const color = regionColors[index % regionColors.length];
|
||||
|
||||
return (
|
||||
<Tag.CheckableTag
|
||||
key={route.id}
|
||||
checked={checked}
|
||||
onChange={nextChecked => {
|
||||
setDispatchRouteIds(prev =>
|
||||
nextChecked
|
||||
? [...prev, route.id]
|
||||
: prev.filter(id => id !== route.id)
|
||||
);
|
||||
|
||||
if (nextChecked) {
|
||||
// 选择下发路径时,取消上方任务规划的选中
|
||||
setEditorType(null);
|
||||
flyToRoute(route.id);
|
||||
}
|
||||
}}
|
||||
style={{
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
gap: 5,
|
||||
width: '100%',
|
||||
minWidth: 0,
|
||||
height: 40,
|
||||
boxSizing: 'border-box',
|
||||
margin: 0,
|
||||
padding: '0 8px',
|
||||
color: '#344054',
|
||||
background: '#fff',
|
||||
border: '1px solid #dce5f2',
|
||||
borderRadius: 4,
|
||||
fontSize: 12,
|
||||
lineHeight: 'normal',
|
||||
cursor: 'pointer',
|
||||
overflow: 'hidden',
|
||||
}}
|
||||
>
|
||||
{/* 自定义复选框 */}
|
||||
<span
|
||||
style={{
|
||||
display: 'inline-flex',
|
||||
flex: '0 0 12px',
|
||||
width: 12,
|
||||
height: 12,
|
||||
boxSizing: 'border-box',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
border: `1px solid ${checked ? color : '#cbd5e1'}`,
|
||||
borderRadius: 3,
|
||||
background: checked ? color : '#fff',
|
||||
color: '#fff',
|
||||
fontSize: 10,
|
||||
fontWeight: 700,
|
||||
}}
|
||||
>
|
||||
{checked ? '✓' : ''}
|
||||
</span>
|
||||
|
||||
{/* 路线定位图标 */}
|
||||
<EnvironmentFilled
|
||||
style={{
|
||||
flex: '0 0 auto',
|
||||
color,
|
||||
fontSize: 13,
|
||||
}}
|
||||
/>
|
||||
|
||||
{/* 路线名称 */}
|
||||
<span
|
||||
style={{
|
||||
flex: 1,
|
||||
minWidth: 0,
|
||||
overflow: 'hidden',
|
||||
textOverflow: 'ellipsis',
|
||||
whiteSpace: 'nowrap',
|
||||
color: '#344054',
|
||||
}}
|
||||
>
|
||||
{route.workName || route.name}
|
||||
</span>
|
||||
</Tag.CheckableTag>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user