diff --git a/src/api/mapEdit.ts b/src/api/mapEdit.ts
new file mode 100644
index 0000000..cea2d22
--- /dev/null
+++ b/src/api/mapEdit.ts
@@ -0,0 +1,31 @@
+
+import request from './request';
+
+export function saveSiteMapInfo(data) {
+ return request({
+ url: `/system/siteMapInfo/save`,
+ method: 'post',
+ data,
+ });
+}
+
+//返回休息区
+
+export function backToRestPointCommand(data) {
+ return request({
+ url: `/iot/deviceTask/backToRestPoint`,
+ method: 'post',
+ data,
+ });
+}
+
+/// 下发区域绑定任务/iot/deviceTask/createRegionDefaultTask
+
+export function createRegionDefaultTask(data) {
+ return request({
+ url: `/iot/deviceTask/createRegionDefaultTask`,
+ method: 'post',
+ data,
+ });
+}
+
diff --git a/src/api/stationManage/index.ts b/src/api/stationManage/index.ts
index 9f30f97..341256a 100644
--- a/src/api/stationManage/index.ts
+++ b/src/api/stationManage/index.ts
@@ -49,6 +49,17 @@ export function getStationRegions(params) {
});
}
+//根据场站获取地图配置
+
+export function getSiteMapInfo(params) {
+ return request({
+ url: '/system/siteMapInfo/selectBySiteId',
+ method: 'get',
+ params
+
+ });
+}
+
//新增分区
export function saveRegion(data) {
return request({
diff --git a/src/components/Map.jsx b/src/components/Map.jsx
index 6815049..4f995c3 100644
--- a/src/components/Map.jsx
+++ b/src/components/Map.jsx
@@ -1,4 +1,4 @@
-import React, { useEffect, useRef, useState, useMemo, useImperativeHandle, forwardRef, useCallback } from 'react';
+import React, { useEffect, useRef, useState, useMemo, useImperativeHandle, forwardRef, useCallback, useLayoutEffect } from 'react';
import carImg from '../assets/images/carplane.png';
import inspectImg from "../assets/images/inspectCar.png"
import planeImg from '../assets/images/planeicon.png';
@@ -10,6 +10,8 @@ import iotImg from '../assets/images/iot.png';
import envConfig from '../../env';
import { TracePoint, TPAction, TPMode } from '../lib/TracePoint/tracePoint';
import { useTranslation } from 'react-i18next';
+import { useSelector } from 'react-redux';
+import { getSiteMapInfo, getStationRegions } from '../api/stationManage';
const CYAN_ALARM_COLOR = new window.Cesium.Color(
@@ -27,7 +29,7 @@ const CYAN_GLOW_COLOR = new window.Cesium.Color(
);
window.Cesium.Ion.defaultAccessToken = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiJmNjk0NjI1MC0wZGYyLTQ1YzItYjJmZi0wY2M5ODEwODllYzIiLCJpZCI6Mzk3MTQxLCJpYXQiOjE3NzI1MjkwMjV9.U6qmakhDgXJVXwLFyWzSxAUOFZRrDkIsRUPP6CCdnKg";
-const CesiumMap = React.forwardRef(({ ifClear, ifClearPlanLine, ifClearNavLine, finishPoint, drawRealTime, realtimePosition, realtimeType, pathPoints = [], devices = [], onCameraClick, focusLocation, points = [], markedPoints = [], onPathChange, from, onClearDraw, onMarkPoint, routeMode = '', polyPoints, mapLayer }, ref) => {
+const CesiumMap = React.forwardRef(({ ifClear, ifClearPlanLine, ifClearNavLine, finishPoint, drawRealTime, realtimePosition, realtimeType, pathPoints = [], devices = [], onCameraClick, focusLocation, points = [], markedPoints = [], onPathChange, from, onClearDraw, onMarkPoint, routeMode = '', polyPoints, mapLayer, activeType, overlayRefreshKey = 0, focusOverlay = null }, ref) => {
const containerRef = useRef(null);
const viewerRef = useRef(null);
const tooltipRef = useRef(null);
@@ -41,10 +43,20 @@ const CesiumMap = React.forwardRef(({ ifClear, ifClearPlanLine, ifClearNavLine,
const navLineRef = useRef(null); // 完成点实时轨迹
const markedPointsRef = useRef([]); // 标记点实体
const markedLineRef = useRef(null); // 标记点连线实体
+ const lastMarkedPointsRef = useRef([]); // 上次渲染的标记点数据,用于增量更新
const onMarkPointRef = useRef(onMarkPoint); // 总是指向最新的 onMarkPoint,避免闭包滞后
const onCameraClickRef = useRef(onCameraClick); // 同样处理,避免闭包滞后
const { t } = useTranslation();
+ // 场站已配置的返航点 / 分区叠加显示
+ const stationId = useSelector((state) => state?.station?.stationId || state?.station?.currentStation?.id);
+ const [stationOverlay, setStationOverlay] = useState({ returnPoints: [], regions: [] });
+ const stationOverlayIdsRef = useRef([]);
+ const returnPointPinUrlRef = useRef(null);
+ // 被点击聚焦的返航点 id / 图例高亮类型
+ const [highlightReturnPointId, setHighlightReturnPointId] = useState('');
+ const [legendHighlight, setLegendHighlight] = useState('');
+
const realtimeEntityRef = useRef(null);
const realtimeLineRef = useRef(null);
@@ -679,63 +691,94 @@ const CesiumMap = React.forwardRef(({ ifClear, ifClearPlanLine, ifClearNavLine,
}
}, [points]);
- // 渲染标记点 + 连线(唯一系统,避免重复标记)
+ // 渲染标记点 + 连线(增量更新:只增删改真正变化的点)
const drawMarkedPoints = (points) => {
const viewer = viewerRef.current;
if (!viewer) return;
- // 先清空之前的标记点与连线
- markedPointsRef.current.forEach(id => {
- viewer.entities.removeById(id);
- });
- markedPointsRef.current = [];
+ const newPoints = points || [];
+ const prevPoints = lastMarkedPointsRef.current || [];
- if (markedLineRef.current) {
- try {
- viewer.entities.remove(markedLineRef.current);
- } catch (e) { }
- markedLineRef.current = null;
+ const nextIds = new Set(newPoints.map((p, i) => `marked-point-${p.id ?? i}`));
+
+ // 1) 删除不在新列表中的旧 entity
+ markedPointsRef.current = markedPointsRef.current.filter(id => {
+ if (!nextIds.has(id)) {
+ viewer.entities.removeById(id);
+ return false;
+ }
+ return true;
+ });
+
+ // 2) 新增或更新标记点 entity
+ newPoints.forEach((p, i) => {
+ const id = `marked-point-${p.id ?? i}`;
+ const entity = viewer.entities.getById(id);
+ const position = window.Cesium.Cartesian3.fromDegrees(Number(p.lon), Number(p.lat));
+ const labelText = `${i + 1}`;
+
+ if (entity) {
+ // 只更新位置和 label,避免销毁重建
+ entity.position = position;
+ if (entity.label) entity.label.text = labelText;
+ } else {
+ viewer.entities.add({
+ id,
+ position,
+ point: {
+ color: window.Cesium.Color.GREEN,
+ pixelSize: 15,
+ disableDepthTestDistance: Number.POSITIVE_INFINITY,
+ },
+ label: {
+ text: labelText,
+ font: '14px sans-serif',
+ pixelOffset: new window.Cesium.Cartesian2(0, -20),
+ fillColor: window.Cesium.Color.WHITE,
+ outlineColor: window.Cesium.Color.BLACK,
+ outlineWidth: 2,
+ style: window.Cesium.LabelStyle.FILL_AND_OUTLINE,
+ }
+ });
+ markedPointsRef.current.push(id);
+ }
+ });
+
+ // 3) 连线:只有坐标/数量真正变化时才重建
+ if (activeType !== "routeGen") {
+ viewer.scene.requestRender();
+ return;
+ }
+ const lineChanged = newPoints.length !== prevPoints.length ||
+ newPoints.some((p, i) => {
+ const pp = prevPoints[i];
+ return !pp || Number(pp.lon) !== Number(p.lon) || Number(pp.lat) !== Number(p.lat);
+ });
+
+ if (lineChanged) {
+ if (markedLineRef.current) {
+ try { viewer.entities.remove(markedLineRef.current); } catch (e) { }
+ markedLineRef.current = null;
+ }
+ if (newPoints.length >= 2) {
+ const linePositions = newPoints.map(p =>
+ window.Cesium.Cartesian3.fromDegrees(Number(p.lon), Number(p.lat))
+ );
+ markedLineRef.current = viewer.entities.add({
+ polyline: {
+ positions: linePositions,
+ width: 4,
+ material: window.Cesium.Color.SKYBLUE,
+ clampToGround: true,
+ }
+ });
+ }
}
- if (!points || points.length === 0) return;
+ lastMarkedPointsRef.current = newPoints.map(p => ({ ...p }));
- // 先绘制连线:有 2 个及以上打点才连线
- if (points.length >= 2) {
- const linePositions = points.map(p =>
- window.Cesium.Cartesian3.fromDegrees(Number(p.lon), Number(p.lat))
- );
- markedLineRef.current = viewer.entities.add({
- polyline: {
- positions: linePositions,
- width: 4,
- material: window.Cesium.Color.SKYBLUE,
- clampToGround: true,
- }
- });
- }
-
- points.forEach((p, i) => {
- const id = `marked-point-${i}`;
- viewer.entities.add({
- id,
- position: window.Cesium.Cartesian3.fromDegrees(p.lon, p.lat),
- point: {
- color: window.Cesium.Color.GREEN,
- pixelSize: 15,
- disableDepthTestDistance: Number.POSITIVE_INFINITY,
- },
- label: {
- text: `${i + 1}`,
- font: '14px sans-serif',
- pixelOffset: new window.Cesium.Cartesian2(0, -20),
- fillColor: window.Cesium.Color.WHITE,
- outlineColor: window.Cesium.Color.BLACK,
- outlineWidth: 2,
- style: window.Cesium.LabelStyle.FILL_AND_OUTLINE,
- }
- });
- markedPointsRef.current.push(id);
- });
+ // 强制 Cesium 立即渲染(requestRenderMode=true 时必须手动触发)
+ viewer.scene.requestRender();
};
useEffect(() => {
@@ -834,6 +877,25 @@ const CesiumMap = React.forwardRef(({ ifClear, ifClearPlanLine, ifClearNavLine,
}
}
+ // 返航点悬浮提示:显示别名与该返航点绑定的机器
+ function showReturnPointTooltip(tooltip, position, point) {
+ if (!tooltip) return;
+ tooltip.style.display = "block";
+ tooltip.style.left = position.x + 12 + "px";
+ tooltip.style.top = position.y + 12 + "px";
+ tooltip.style.whiteSpace = "nowrap";
+
+ const boundDevice = devices.find(d => d?.serialNumber === point.bindDeviceId);
+ const deviceLabel = point.bindDeviceId
+ ? (boundDevice?.deviceAlias || boundDevice?.deviceName || point.bindDeviceId)
+ : t('devices.mapEditor.unbound');
+
+ tooltip.innerHTML = `
+
📍 ${point.alias || '-'}
+ 🤖 ${deviceLabel}
+ `;
+ }
+
function fetchPublishedLayers() {
const baseUrl = envConfig.geoserver_url;
//const baseUrl = 'https://gis.caasrobot.com/geoserver';
@@ -1271,6 +1333,163 @@ const CesiumMap = React.forwardRef(({ ifClear, ifClearPlanLine, ifClearNavLine,
flyToLayer(mapLayer, envConfig.geoserver_url, 100);
}, [mapLayer]);
+ // 拉取当前场站已配置的返航点与分区
+ useEffect(() => {
+ if (!stationId) {
+ setStationOverlay({ returnPoints: [], regions: [] });
+ return;
+ }
+ let cancelled = false;
+ getSiteMapInfo({ siteId: stationId })
+ .then((res) => {
+ if (cancelled) return;
+ const pts = res?.code === 200 ? (res?.data?.restPoints || []) : [];
+ setStationOverlay(prev => ({ ...prev, returnPoints: Array.isArray(pts) ? pts : [] }));
+ })
+ .catch(() => { });
+ getStationRegions({ siteId: stationId })
+ .then((res) => {
+ if (cancelled) return;
+ const list = res?.code === 200 ? (res?.data || res?.rows || []) : [];
+ setStationOverlay(prev => ({ ...prev, regions: Array.isArray(list) ? list : [] }));
+ })
+ .catch(() => { });
+ return () => { cancelled = true; };
+ }, [stationId, overlayRefreshKey]);
+
+ // 在地图上叠加显示:返航点用标志图标,分区用小框
+ useEffect(() => {
+ const viewer = viewerRef.current;
+ const Cesium = window.Cesium;
+ if (!viewer || !Cesium) return;
+
+ // 清理上一次叠加实体
+ stationOverlayIdsRef.current.forEach(id => viewer.entities.removeById(id));
+ stationOverlayIdsRef.current = [];
+
+ // 返航点标志图标(PinBuilder 生成,失败则退化为圆点)
+ if (!returnPointPinUrlRef.current && Cesium.PinBuilder) {
+ try {
+ returnPointPinUrlRef.current = Cesium.PinBuilder.fromColor(Cesium.Color.fromCssColorString('#165DFF'), 36).toDataURL();
+ } catch (e) { /* ignore */ }
+ }
+ (stationOverlay.returnPoints || []).forEach((pt, idx) => {
+ const lon = Number(pt?.position?.lng ?? pt?.lng);
+ const lat = Number(pt?.position?.lat ?? pt?.lat);
+ if (!isFinite(lon) || !isFinite(lat) || lon === 0 || lat === 0) return;
+ const id = `station-return-point-${idx}`;
+ const isHighlighted = id === highlightReturnPointId;
+ viewer.entities.add({
+ id,
+ returnPointData: {
+ alias: pt?.alias || '',
+ bindDeviceId: pt?.bindDeviceId || '',
+ },
+ position: Cesium.Cartesian3.fromDegrees(lon, lat, 0),
+ ...(returnPointPinUrlRef.current
+ ? {
+ billboard: {
+ image: returnPointPinUrlRef.current,
+ width: isHighlighted ? 36 : 24,
+ height: isHighlighted ? 48 : 32,
+ verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
+ disableDepthTestDistance: Number.POSITIVE_INFINITY,
+ }
+ }
+ : {
+ point: {
+ pixelSize: isHighlighted ? 16 : 10,
+ color: Cesium.Color.fromCssColorString(isHighlighted ? '#FA8C16' : '#165DFF'),
+ disableDepthTestDistance: Number.POSITIVE_INFINITY,
+ }
+ }),
+ label: pt?.alias ? {
+ text: pt.alias,
+ font: 'bold 12px sans-serif',
+ fillColor: Cesium.Color.WHITE,
+ showBackground: true,
+ backgroundColor: Cesium.Color.fromCssColorString(isHighlighted ? '#FA8C16' : '#165DFF').withAlpha(0.8),
+ pixelOffset: new Cesium.Cartesian2(0, isHighlighted ? -48 : -34),
+ disableDepthTestDistance: Number.POSITIVE_INFINITY,
+ } : undefined,
+ });
+ stationOverlayIdsRef.current.push(id);
+ });
+
+ // 分区:用小框(多边形)显示
+ (stationOverlay.regions || []).forEach((region, idx) => {
+ const scope = Array.isArray(region?.scope) ? region.scope : [];
+ const positions = scope
+ .map(p => {
+ const lon = Number(p?.lng ?? p?.lon);
+ const lat = Number(p?.lat);
+ if (!isFinite(lon) || !isFinite(lat) || lon === 0 || lat === 0) return null;
+ return Cesium.Cartesian3.fromDegrees(lon, lat, 0);
+ })
+ .filter(Boolean);
+ if (positions.length < 3) return;
+ const id = `station-region-${region?.id ?? idx}`;
+ viewer.entities.add({
+ id,
+ polygon: {
+ hierarchy: positions,
+ material: Cesium.Color.fromCssColorString('#13C2C2').withAlpha(0.18),
+ outline: true,
+ outlineColor: Cesium.Color.fromCssColorString('#13C2C2').withAlpha(0.9),
+ height: 0,
+ clampToGround: true,
+ },
+ label: region?.regionName ? {
+ text: region.regionName,
+ font: '12px sans-serif',
+ fillColor: Cesium.Color.WHITE,
+ showBackground: true,
+ backgroundColor: Cesium.Color.fromCssColorString('#13C2C2').withAlpha(0.8),
+ disableDepthTestDistance: Number.POSITIVE_INFINITY,
+ } : undefined,
+ });
+ stationOverlayIdsRef.current.push(id);
+ });
+
+ viewer.scene.requestRender();
+ }, [stationOverlay, highlightReturnPointId]);
+
+ // 点击已配置列表:定位到对应返航点/分区;返航点额外高亮
+ useEffect(() => {
+ const viewer = viewerRef.current;
+ const Cesium = window.Cesium;
+ if (!viewer || !Cesium || !focusOverlay) return;
+
+ if (focusOverlay.type === 'returnPoint') {
+ const pt = (stationOverlay.returnPoints || [])[focusOverlay.index];
+ const lon = Number(pt?.position?.lng ?? pt?.lng);
+ const lat = Number(pt?.position?.lat ?? pt?.lat);
+ if (!isFinite(lon) || !isFinite(lat) || lon === 0 || lat === 0) return;
+ setLegendHighlight('returnPoint');
+ setHighlightReturnPointId(`station-return-point-${focusOverlay.index}`);
+ viewer.camera.flyTo({
+ destination: Cesium.Cartesian3.fromDegrees(lon, lat, 500),
+ duration: 0.8,
+ });
+ } else if (focusOverlay.type === 'region') {
+ const region = (stationOverlay.regions || []).find(r => String(r.id) === String(focusOverlay.id));
+ const scope = Array.isArray(region?.scope) ? region.scope : [];
+ const lons = scope.map(p => Number(p?.lng ?? p?.lon)).filter(n => isFinite(n) && n !== 0);
+ const lats = scope.map(p => Number(p?.lat)).filter(n => isFinite(n) && n !== 0);
+ if (!lons.length || !lats.length) return;
+ setLegendHighlight('region');
+ setHighlightReturnPointId('');
+ viewer.camera.flyTo({
+ destination: Cesium.Rectangle.fromDegrees(
+ Math.min(...lons), Math.min(...lats), Math.max(...lons), Math.max(...lats)
+ ),
+ duration: 0.8,
+ });
+ }
+ }, [focusOverlay, stationOverlay]);
+
+
+
useEffect(() => {
// 如果有 realtimePosition,不显示 focusEntity
@@ -1960,10 +2179,13 @@ const CesiumMap = React.forwardRef(({ ifClear, ifClearPlanLine, ifClearNavLine,
handler.setInputAction((movement) => {
const picked = viewer.scene.pick(movement.endPosition);
+ const pickedReturnPoint = (window.Cesium.defined(picked) && picked.id?.returnPointData) ? picked.id.returnPointData : null;
const pickedRobot = (window.Cesium.defined(picked) && picked.id?.properties?.robot) ? picked.id.properties.robot.getValue() : null;
- // ✅ 只有拾取到设备实体,才显示tooltip,空白区域直接隐藏
- if (pickedRobot) {
+ // 返航点优先显示「别名 + 绑定机器」,设备显示设备信息,空白区域隐藏
+ if (pickedReturnPoint) {
+ showReturnPointTooltip(tooltipRef.current, movement.endPosition, pickedReturnPoint);
+ } else if (pickedRobot) {
const { lon, lat } = getCursorLngLat(viewer, movement.endPosition);
showCoordinateTooltip(tooltipRef.current, movement.endPosition, t, lon, lat, pickedRobot);
} else {
@@ -2000,11 +2222,11 @@ const CesiumMap = React.forwardRef(({ ifClear, ifClearPlanLine, ifClearNavLine,
}
}
}
- console.log('点击地图,拾取到设备', robot);
if (robot) {
onCameraClickRef.current?.(robot);
}
- if (from !== "deviceStatus")
+ const _allowedFrom = ["mapEditor"];
+ if (!_allowedFrom.includes(from))
return;
const cartesian = viewer.camera.pickEllipsoid(movement.position, viewer.scene.globe.ellipsoid);
if (!cartesian) return;
@@ -2596,6 +2818,66 @@ const CesiumMap = React.forwardRef(({ ifClear, ifClearPlanLine, ifClearNavLine,
whiteSpace: "nowrap",
}}
/>
+ {/* 图例:返航点 / 分区 */}
+ {(stationOverlay.returnPoints.length > 0 || stationOverlay.regions.length > 0) && (
+
+
{t('devices.mapEditor.legend')}
+
+
+ {t('devices.mapEditor.returnPoint')}
+
+
+
+ {t('devices.mapEditor.restArea')}
+
+
+ )}
);
diff --git a/src/components/devices/DeviceStatusPage.tsx b/src/components/devices/DeviceStatusPage.tsx
index 105cf57..902d03a 100644
--- a/src/components/devices/DeviceStatusPage.tsx
+++ b/src/components/devices/DeviceStatusPage.tsx
@@ -154,6 +154,7 @@ import { useUnitFormatter } from '@/lib/units';
import { PauseOutlined, PlayCircleOutlined } from '@ant-design/icons';
import { useTranslation } from 'react-i18next';
+import { backToRestPointCommand } from '@/api/mapEdit';
@@ -1498,19 +1499,19 @@ export default function DeviceStatusPage() {
// 无控制权限时:不发送消息,且只发起一次权限申请(避免手柄/方向盘高频更新刷屏)
- //if (!isControlled) {
+ if (!isControlled) {
- // //if (!hasRequestedControlRef.current && !connecting) {
+ //if (!hasRequestedControlRef.current && !connecting) {
- // // hasRequestedControlRef.current = true;
+ // hasRequestedControlRef.current = true;
- // // handleControlModal();
+ // handleControlModal();
- // //}
+ //}
- // return;
+ return;
- //}
+ }
console.log('Gamepad state updated:', state);
@@ -1658,6 +1659,22 @@ export default function DeviceStatusPage() {
return Number(val).toFixed(2);
};
+ const handleAutoBack = () => {
+ const payload = {
+ deviceId: selectedSn,
+
+
+
+ orgId: currentStation?.orgId,
+
+ siteId: stationId,
+
+ }
+ backToRestPointCommand(payload).then(res => { }).catch(err => {
+
+ console.error('返回休息点失败', err);
+ })
+ }
@@ -1920,9 +1937,9 @@ export default function DeviceStatusPage() {
/**
-
+
* 修改handleComplete:计算完成后 return路径对象;失败返回null
-
+
*/
const handleComplete = async () => {
@@ -2159,7 +2176,7 @@ export default function DeviceStatusPage() {
{/* 页面顶部按钮区域 */}
- {!isUAV && (
+ {/*{!isUAV && (
*/}
-
- ID: {route.id}
+ {t('devices.rtMode')}: {route.mode == "coverage" ? t('devices.coverageMode') : t('devices.singleMode')}
+
+
- {/* 删除按钮 */}
-
- }
- onClick={(e) => {
- e.stopPropagation();
- setSelectedPathWork(route);
- // 替换为你的删除处理函数
- handleDeleteRoute(route);
- }}
- />
-
(routeList || []).filter(route => route.mode == 'single_point'),
+ [routeList]
+ );
+
+ const handleSaveReturnTask = () => {
+ // TODO: 返航任务保存接口待接入,暂时打印
+ console.log('新建返航任务', { route: returnRoute, device: returnDevice });
+ };
+
// ====================== 周/月选择 ======================
const weekDays = [
{ label: t('devices.wdSun'), value: 'SUNDAY' },
@@ -2170,144 +2175,208 @@ const NewTaskModal = ({ isOpen, onClose, robots, selectedPathWork, handlGetTaskL
>
- {/* 任务名称 */}
-
-
- setFormData({ ...formData, planName: e.target.value })}
- placeholder={t('devices.inputTaskName')}
- />
-
+ {/*
*/}
- {/* 执行路线 */}
-
-
-
-
-
- {/* 选择设备 */}
-
-
-
-
-
- {/* 重复计划 */}
-
-
-
-
-
- {/* 周选择 */}
- {formData.repeatPlan === 'WEEK' && (
-
- {weekDays.map(day => (
- handleToggleDay(day.value)}
- size="small"
- shape="circle"
- >
- {day.label}
-
- ))}
-
- )}
-
- {/* 月选择 */}
- {formData.repeatPlan === 'MONTH' && (
-
- {monthDays.map(day => (
- handleToggleMonthDay(day)}
- size="small"
- >
- {day}
-
- ))}
-
- )}
-
- {/* 按天:选择日期 */}
- {formData.repeatPlan === 'DAY' && (
+ {activeTab === 'scheduled' ? (
<>
-
-
+
+ setFormData({ ...formData, planName: e.target.value })}
+ placeholder={t('devices.inputTaskName')}
+ />
+
+
+ {/* 执行路线 */}
+
+
+
+
+
+ {/* 选择设备 */}
+
+
+
+
+
+ {/* 重复计划 */}
+
+
+
+
+
+ {/* 周选择 */}
+ {formData.repeatPlan === 'WEEK' && (
+
+ {weekDays.map(day => (
+ handleToggleDay(day.value)}
+ size="small"
+ shape="circle"
+ >
+ {day.label}
+
+ ))}
+
+ )}
+
+ {/* 月选择 */}
+ {formData.repeatPlan === 'MONTH' && (
+
+ {monthDays.map(day => (
+ handleToggleMonthDay(day)}
+ size="small"
+ >
+ {day}
+
+ ))}
+
+ )}
+
+ {/* 按天:选择日期 */}
+ {formData.repeatPlan === 'DAY' && (
+ <>
+
+
+ >
+ )}
+
+ {/* 时间 */}
+
+
+
+ {/* 执行周期 */}
+
+
+
>
+ ) : (
+
+ {/* 预设路径列表 */}
+
+
+
+ {singleRouteList.length === 0 ? (
+
+ ) : (
+ singleRouteList.map(route => {
+ const selected = returnRoute?.id === route.id;
+ return (
+
setReturnRoute(route)}
+ className={`flex items-center gap-3 p-3 rounded-lg border cursor-pointer transition-colors ${selected ? 'border-blue-500 bg-blue-50' : 'border-gray-200 hover:border-blue-300'}`}
+ >
+
+ {route.imgUrl ? (
+

+ ) : (
+
+ )}
+
+
{route.workName || route.name}
+ {selected &&
}
+
+ );
+ })
+ )}
+
+
+
+ {/* 选择机器 */}
+
+
+
+
)}
- {/* 时间 */}
-
-
-
- {/* 执行周期 */}
-
-
-
{/* 底部按钮 */}
{t('common.cancel')}
- {t('devices.saveTask')}
+ {t('devices.saveTask')}
diff --git a/src/locales/en/index.ts b/src/locales/en/index.ts
index 362f49d..3e83100 100644
--- a/src/locales/en/index.ts
+++ b/src/locales/en/index.ts
@@ -378,7 +378,6 @@
rtkFixed: 'RTK Fixed',
networkLatency: 'Network Latency',
waterRiskWarning: 'Warning: Water accumulation risk in Area B, avoid it',
- presetRoutes: 'Preset Routes',
all: 'All',
stop: 'Stop',
currentTask: 'Current Task',
@@ -450,6 +449,10 @@
selectExecDate: 'Select date',
execTime: 'Execution Time',
saveTask: 'Save Task',
+ scheduledTaskTab: 'Scheduled Task',
+ returnTaskTab: 'Return Task',
+ presetRoutes: 'Preset Routes',
+ noReturnRoute: 'No single-task routes available',
abMode: 'ab Mode',
activatedTime: 'Activated Time',
aiAction1: 'ai Action1',
@@ -779,6 +782,8 @@
optionalEmpty: 'Optional Empty',
otherWebControlling: 'Other Web Controlling',
platformRequestControl: "{{platform}} platformRequestControl",
+ coverageMode: 'coverageMode',
+ singleMode: 'singleMode',
outDock: 'Out Dock',
outdoor: 'Outdoor',
@@ -898,7 +903,49 @@
handleSbus: 'SBUS',
handleCustom: 'Custom',
},
- turnSpeed: 'Turn Speed',
+
+ mapEditor: {
+ returnPoint: 'Return Point',
+ legend: 'Legend',
+ unbound: 'Unbound',
+ duplicateBindDevice: 'Duplicate Bind Device',
+ restArea: 'Region',
+ region: 'Region',
+ routeGen: 'Route Planning',
+ toolPoint: 'Click',
+ toolBox: 'Box',
+ routeTip: 'Click on map to drop points in order',
+ undo: 'Undo',
+ clearAll: 'Clear All',
+ mapClickHint: 'Click on map to add a marker',
+ routeClickHint: 'Click on map to add route points in order',
+ pointCount: 'Points',
+ routeGenTitle: 'Route Planning',
+ routeName: 'Route Name',
+ routeNamePlaceholder: 'Enter route name',
+ routeType: 'Route Type',
+ typeMowing: 'Mowing Task',
+ typeInspection: 'Inspection Task',
+ typeOther: 'Other',
+ remark: 'Remark',
+ remarkPlaceholder: 'Optional',
+ selectRobot: 'Select Robot',
+ pointSelect: 'Point Select',
+ selectRobotFirst: 'Please select a robot first',
+ robotPosNotReady: 'Robot real-time position is not ready, please wait',
+ unbind: 'Unbound',
+ returnPointList: 'Return Point List',
+ restAreaList: 'Region List',
+ regionList: 'Region List',
+ routePoints: 'Route Points',
+ pointEmptyHint: 'No markers yet. Click on map to add.',
+ routeEmptyHint: 'No route points yet. Click on map to add in order.',
+ save: 'Save',
+ saveSuccess: 'Saved successfully',
+ mapEditorTitle: 'Map Editor',
+ fillName: 'Please enter route name',
+ needAtLeast2Points: 'At least 2 points required',
+ }, turnSpeed: 'Turn Speed',
realtimeVideoMonitor: 'Realtime Video Monitor',
rechargeBtn: 'Recharge Btn',
rechargeCommandSent: 'Recharge Command Sent',
@@ -3888,3 +3935,7 @@
};
export default en;
+
+
+
+
diff --git a/src/locales/zh/index.ts b/src/locales/zh/index.ts
index dc37658..5ce0062 100644
--- a/src/locales/zh/index.ts
+++ b/src/locales/zh/index.ts
@@ -466,6 +466,9 @@ const zh = {
selectExecDate: '选择执行日期',
execTime: '执行时间',
saveTask: '保存任务',
+ scheduledTaskTab: '定时任务',
+ returnTaskTab: '返航任务',
+ noReturnRoute: '暂无单次任务路径',
abMode: '自定义模式',
saveFail: '保存失败',
@@ -541,6 +544,8 @@ const zh = {
countUnit: '数量单位',
coverClosed: '已关闭',
coverOpen: '打开',
+ coverageMode: '覆盖模式',
+ singleMode: '单点模式',
coverageEquipment: '覆盖设备',
coverageValue: '{{types}}/{{units}}',
createSuccess: '创建成功',
@@ -1496,6 +1501,73 @@ const zh = {
handleCustom: '自定义',
},
+ mapEditor: {
+ returnPoint: '返航点',
+ restArea: '分区',
+ legend: '图例',
+ unbound: '未绑定',
+ region: '分区',
+ routeGen: '路径生成',
+ toolPoint: '点选',
+ toolBox: '框选',
+ routeTip: '点击地图依次打点生成路径',
+ undo: '撤销',
+ clearAll: '清空',
+ mapClickHint: '点击地图添加标记点',
+ routeClickHint: '点击地图依次打点生成路径',
+ pointCount: '点数',
+ routeGenTitle: '路径生成',
+ routeName: '路径名称',
+ routeNamePlaceholder: '请输入路径名称',
+ routeType: '路径规划类型',
+ typeMowing: '割草任务',
+ typeInspection: '巡检任务',
+ typeOther: '其他类型',
+ remark: '备注',
+ remarkPlaceholder: '选填',
+ selectRobot: '选择机器人',
+ pointSelect: '点选',
+ selectRobotFirst: '请先选择机器人',
+ robotPosNotReady: '机器人实时位置尚未获取,请稍候',
+ unbind: '未绑定',
+ returnPointList: '返航点列表',
+ restAreaList: '分区列表',
+ regionList: '分区列表',
+ routePoints: '路径点',
+ pointEmptyHint: '暂无标记点,请在地图上点击添加',
+ routeEmptyHint: '暂无路径点,请在地图上依次点击打点',
+ duplicateBindDevice: '重复绑定设备',
+ bindUpdateSuccess: '绑定设备已更新',
+
+ save: '保存',
+ saveSuccess: '保存成功',
+ mapEditorTitle: '地图编辑',
+ fillName: '请填写路径名称',
+ needAtLeast2Points: '路径至少需要 2 个点',
+ // 已配置列表
+ configuredReturnPoints: '已配置返航点',
+ configuredRegions: '已配置分区',
+ noConfiguredReturnPoints: '暂无已配置返航点',
+ noConfiguredRegions: '暂无已配置分区',
+ unnamed: '未命名',
+ regionCode: '分区编码',
+ scopeCount: '范围点数',
+ mode: '模式',
+ noPresetRoutes: '暂无预设路径',
+ confirmDeleteRoute: '确定删除该预设路径?',
+ // 分区保存 Modal
+ saveRegion: '保存分区',
+ editRegion: '编辑分区',
+ regionName: '分区名称',
+ regionNamePlaceholder: '请输入分区名称',
+ regionNameRequired: '请填写分区名称',
+ regionCodePlaceholder: '请输入分区编码(选填)',
+ defaultRoute: '默认线路',
+ selectRoutePlaceholder: '请选择默认线路',
+ bindRoutes: '绑定线路',
+ selectRoutesPlaceholder: '请选择绑定的预设路径',
+ currentScopePoints: '当前区域范围点数',
+ },
},
video: {
onlineVideo: '在线视频',
@@ -3947,3 +4019,6 @@ const zh = {
};
export default zh;
+
+
+
diff --git a/src/router/routes.tsx b/src/router/routes.tsx
index 4432a14..877b63b 100644
--- a/src/router/routes.tsx
+++ b/src/router/routes.tsx
@@ -1,4 +1,4 @@
-import React, { lazy, Suspense } from 'react';
+import React, { lazy, Suspense } from 'react';
import type { RouteObject } from 'react-router-dom';
import { useTranslation } from 'react-i18next';
@@ -30,6 +30,7 @@ const Profile = lazy(() => import('../pages/Profile'));
const DeviceStatus = lazy(() => import('../components/devices/DeviceStatusPage'));
const WayLineTask = lazy(() => import('../components/devices/WayLinePage'));
const RobotTask = lazy(() => import('../components/devices/RobotTaskPage'));
+const MapEditorPage = lazy(() => import('../components/devices/MapEditorPage'));
const DevicesOverview = lazy(() => import('../components/devices/DeviceOverviewPage'));
const BasicSettings = lazy(() => import('../components/SystemSetting/BasicSettings'));
@@ -124,6 +125,10 @@ export const routes: RouteObject[] = [
path: 'devices/robotTask',
element: withSuspense(RobotTask)
},
+ {
+ path: 'devices/mapEdit',
+ element: withSuspense(MapEditorPage)
+ },
{
path: 'video',
element: withSuspense(Video)