页面显示定位质量等数据,接收到结束信号并显示机器人下发任务 执行 暂停恢复成功 控制地图是否绘制实时轨迹
This commit is contained in:
10
env.js
10
env.js
@@ -14,12 +14,18 @@ const envConfig = {
|
|||||||
WS_URL: 'ws://192.168.2.59:9002/ws/',
|
WS_URL: 'ws://192.168.2.59:9002/ws/',
|
||||||
mqtt_url: "ws://192.168.2.59:8083/mqtt",
|
mqtt_url: "ws://192.168.2.59:8083/mqtt",
|
||||||
geoserver_url: "http://192.168.2.59:7000/geoserver"
|
geoserver_url: "http://192.168.2.59:7000/geoserver"
|
||||||
|
|
||||||
|
//baseURL: 'http://1.95.137.212:8081',//http://192.168.2.56:8081
|
||||||
|
////baseURL: 'https://serviceri.satabot.com',
|
||||||
|
//WS_URL: 'ws://1.95.137.212:9002/ws/',
|
||||||
|
//mqtt_url: "ws://1.95.137.212:59021/mqtt",
|
||||||
|
//geoserver_url: "http://1.95.137.212:59018/geoserver"
|
||||||
},
|
},
|
||||||
[ENV.PROD]: {
|
[ENV.PROD]: {
|
||||||
//baseURL: 'https://pvcloudservice.satabot.com',
|
//baseURL: 'https://pvcloudservice.satabot.com',
|
||||||
baseURL: 'http://1.95.137.212:59015',//http://192.168.2.56:8081
|
baseURL: 'http://1.95.137.212:8081',//http://192.168.2.56:8081
|
||||||
//baseURL: 'https://serviceri.satabot.com',
|
//baseURL: 'https://serviceri.satabot.com',
|
||||||
WS_URL: 'ws://1.95.137.212:59017/ws/',
|
WS_URL: 'ws://1.95.137.212:9001/ws/',
|
||||||
mqtt_url: "ws://1.95.137.212:59021/mqtt",
|
mqtt_url: "ws://1.95.137.212:59021/mqtt",
|
||||||
geoserver_url: "http://1.95.137.212:59018/geoserver"
|
geoserver_url: "http://1.95.137.212:59018/geoserver"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ const CYAN_GLOW_COLOR = new window.Cesium.Color(
|
|||||||
);
|
);
|
||||||
window.Cesium.Ion.defaultAccessToken = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiJmNjk0NjI1MC0wZGYyLTQ1YzItYjJmZi0wY2M5ODEwODllYzIiLCJpZCI6Mzk3MTQxLCJpYXQiOjE3NzI1MjkwMjV9.U6qmakhDgXJVXwLFyWzSxAUOFZRrDkIsRUPP6CCdnKg";
|
window.Cesium.Ion.defaultAccessToken = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiJmNjk0NjI1MC0wZGYyLTQ1YzItYjJmZi0wY2M5ODEwODllYzIiLCJpZCI6Mzk3MTQxLCJpYXQiOjE3NzI1MjkwMjV9.U6qmakhDgXJVXwLFyWzSxAUOFZRrDkIsRUPP6CCdnKg";
|
||||||
|
|
||||||
export default function CesiumMap({ realtimePosition, realtimeType, pathPoints = [], devices = [], onCameraClick, focusLocation, points = [], onPathChange, from, onClearDraw }) {
|
export default function CesiumMap({ drawRealTime, realtimePosition, realtimeType, pathPoints = [], devices = [], onCameraClick, focusLocation, points = [], onPathChange, from, onClearDraw }) {
|
||||||
const containerRef = useRef(null);
|
const containerRef = useRef(null);
|
||||||
const viewerRef = useRef(null);
|
const viewerRef = useRef(null);
|
||||||
const tooltipRef = useRef(null);
|
const tooltipRef = useRef(null);
|
||||||
@@ -1222,6 +1222,15 @@ export default function CesiumMap({ realtimePosition, realtimeType, pathPoints =
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!drawRealTime) {
|
||||||
|
if (realtimeLineEntityRef.current) {
|
||||||
|
viewer.entities.remove(realtimeLineEntityRef.current);
|
||||||
|
realtimeLineEntityRef.current = null;
|
||||||
|
}
|
||||||
|
// 轨迹点数组也清空
|
||||||
|
realtimeCartesianRef.current = [];
|
||||||
|
}
|
||||||
|
|
||||||
// ====================================
|
// ====================================
|
||||||
// 情况2:有实时数据 -> 隐藏 focusEntity
|
// 情况2:有实时数据 -> 隐藏 focusEntity
|
||||||
// ====================================
|
// ====================================
|
||||||
@@ -1263,7 +1272,7 @@ export default function CesiumMap({ realtimePosition, realtimeType, pathPoints =
|
|||||||
|
|
||||||
const dist = Math.sqrt(dx * dx + dy * dy);
|
const dist = Math.sqrt(dx * dx + dy * dy);
|
||||||
|
|
||||||
if (dist < 0.00001) {
|
if (dist < 0.0000001) {
|
||||||
shouldAdd = false;
|
shouldAdd = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1283,9 +1292,9 @@ export default function CesiumMap({ realtimePosition, realtimeType, pathPoints =
|
|||||||
// 限制轨迹长度(防止内存爆)
|
// 限制轨迹长度(防止内存爆)
|
||||||
// ====================================
|
// ====================================
|
||||||
|
|
||||||
if (realtimeCartesianRef.current.length > 2000) {
|
//if (realtimeCartesianRef.current.length > 2000) {
|
||||||
realtimeCartesianRef.current.shift();
|
// realtimeCartesianRef.current.shift();
|
||||||
}
|
//}
|
||||||
|
|
||||||
// ====================================
|
// ====================================
|
||||||
// 第一次进入 realtime -> 隐藏所有设备
|
// 第一次进入 realtime -> 隐藏所有设备
|
||||||
@@ -1360,6 +1369,7 @@ export default function CesiumMap({ realtimePosition, realtimeType, pathPoints =
|
|||||||
const callbackPositions = new Cesium.CallbackProperty(() => {
|
const callbackPositions = new Cesium.CallbackProperty(() => {
|
||||||
return realtimeCartesianRef.current;
|
return realtimeCartesianRef.current;
|
||||||
}, false);
|
}, false);
|
||||||
|
if (!drawRealTime) return;
|
||||||
|
|
||||||
realtimeLineEntityRef.current = viewer.entities.add({
|
realtimeLineEntityRef.current = viewer.entities.add({
|
||||||
|
|
||||||
@@ -1396,7 +1406,7 @@ export default function CesiumMap({ realtimePosition, realtimeType, pathPoints =
|
|||||||
destination: Cesium.Cartesian3.fromDegrees(
|
destination: Cesium.Cartesian3.fromDegrees(
|
||||||
lon,
|
lon,
|
||||||
lat,
|
lat,
|
||||||
1200
|
30
|
||||||
),
|
),
|
||||||
|
|
||||||
orientation: {
|
orientation: {
|
||||||
|
|||||||
@@ -348,7 +348,7 @@ export default function DeviceStatusPage({
|
|||||||
return {
|
return {
|
||||||
lon: robotLon,
|
lon: robotLon,
|
||||||
lat: robotLat,
|
lat: robotLat,
|
||||||
heading: runningStatus.yaw || wsDeviceInfo.yaw || 0,
|
//heading: runningStatus.yaw || wsDeviceInfo.yaw || 0,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -565,7 +565,7 @@ export default function DeviceStatusPage({
|
|||||||
<Text strong>选择设备:</Text>
|
<Text strong>选择设备:</Text>
|
||||||
|
|
||||||
<Select
|
<Select
|
||||||
style={{ width: 280 }}
|
style={{ width: 380 }}
|
||||||
value={device?.device_sn || device?.serialNumber}
|
value={device?.device_sn || device?.serialNumber}
|
||||||
onChange={(val) => onDeviceChange?.(val)}
|
onChange={(val) => onDeviceChange?.(val)}
|
||||||
showSearch
|
showSearch
|
||||||
@@ -741,6 +741,7 @@ export default function DeviceStatusPage({
|
|||||||
points={points}
|
points={points}
|
||||||
realtimePosition={realtimePosition}
|
realtimePosition={realtimePosition}
|
||||||
realtimeType={realtimeType}
|
realtimeType={realtimeType}
|
||||||
|
drawRealTime={true}
|
||||||
/>
|
/>
|
||||||
</Card>
|
</Card>
|
||||||
</Col>
|
</Col>
|
||||||
@@ -839,6 +840,25 @@ export default function DeviceStatusPage({
|
|||||||
<Descriptions.Item label="左电机温度"><Text>{fix2(runningStatus?.leftMotorTemp)} ℃</Text></Descriptions.Item>
|
<Descriptions.Item label="左电机温度"><Text>{fix2(runningStatus?.leftMotorTemp)} ℃</Text></Descriptions.Item>
|
||||||
<Descriptions.Item label="右电机温度"><Text>{fix2(runningStatus?.rightMotorTemp)} ℃</Text></Descriptions.Item>
|
<Descriptions.Item label="右电机温度"><Text>{fix2(runningStatus?.rightMotorTemp)} ℃</Text></Descriptions.Item>
|
||||||
<Descriptions.Item label="主控温度"><Text>{fix2(runningStatus?.chipTemp)} ℃</Text></Descriptions.Item>
|
<Descriptions.Item label="主控温度"><Text>{fix2(runningStatus?.chipTemp)} ℃</Text></Descriptions.Item>
|
||||||
|
<Descriptions.Item label="航向角状态"><Text>{(runningStatus?.headingStatus == 1 ? "已初始化" : "未初始化")}</Text></Descriptions.Item>
|
||||||
|
<Descriptions.Item label="控制模式"><Text>{(runningStatus?.controlMode == 1 ? "本地模式" : runningStatus?.controlMode == 3 ? "远程模式" : "控制模式2")}</Text></Descriptions.Item>
|
||||||
|
|
||||||
|
|
||||||
|
<Descriptions.Item label="定位质量">
|
||||||
|
<Text>
|
||||||
|
{runningStatus?.qual == 0
|
||||||
|
? '无效'
|
||||||
|
: runningStatus?.qual == 1
|
||||||
|
? 'GPS 单点定位'
|
||||||
|
: runningStatus?.qual == 2
|
||||||
|
? 'DGPS 伪距差分或 SBAS'
|
||||||
|
: runningStatus?.qual == 4
|
||||||
|
? 'RTK 固定解'
|
||||||
|
: runningStatus?.qual == 5
|
||||||
|
? 'RTK 浮点解'
|
||||||
|
: '未知'}
|
||||||
|
</Text>
|
||||||
|
</Descriptions.Item>
|
||||||
<Descriptions.Item label="卫星数量">
|
<Descriptions.Item label="卫星数量">
|
||||||
<Badge showZero count={runningStatus?.satelliteCnt || 0} style={{ backgroundColor: '#52c41a' }} />
|
<Badge showZero count={runningStatus?.satelliteCnt || 0} style={{ backgroundColor: '#52c41a' }} />
|
||||||
</Descriptions.Item>
|
</Descriptions.Item>
|
||||||
|
|||||||
@@ -10,7 +10,8 @@ import {
|
|||||||
PlusOutlined, ImportOutlined, NodeIndexOutlined,
|
PlusOutlined, ImportOutlined, NodeIndexOutlined,
|
||||||
SaveOutlined, PlayCircleOutlined, EyeOutlined,
|
SaveOutlined, PlayCircleOutlined, EyeOutlined,
|
||||||
DeleteOutlined,
|
DeleteOutlined,
|
||||||
CloseOutlined
|
CloseOutlined,
|
||||||
|
ReloadOutlined
|
||||||
} from '@ant-design/icons';
|
} from '@ant-design/icons';
|
||||||
import {
|
import {
|
||||||
Car, Navigation, Wind, Thermometer, Droplets, Satellite,
|
Car, Navigation, Wind, Thermometer, Droplets, Satellite,
|
||||||
@@ -31,7 +32,7 @@ import {
|
|||||||
getSiteDeviceTaskHistory,
|
getSiteDeviceTaskHistory,
|
||||||
} from '../../api/device';
|
} from '../../api/device';
|
||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
import utils from '../../lib/utils';
|
import utils, { getLocationQuality } from '../../lib/utils';
|
||||||
import CesiumMap from '../Map';
|
import CesiumMap from '../Map';
|
||||||
import { fix2, getVal } from '../../lib/utils';
|
import { fix2, getVal } from '../../lib/utils';
|
||||||
import { useSelector } from 'react-redux';
|
import { useSelector } from 'react-redux';
|
||||||
@@ -46,41 +47,12 @@ export default function RobotTaskPage() {
|
|||||||
const { userInfo } = useSelector((state: RootState) => state.user);
|
const { userInfo } = useSelector((state: RootState) => state.user);
|
||||||
const { stationId } = useSelector((state: RootState) => state.station);
|
const { stationId } = useSelector((state: RootState) => state.station);
|
||||||
const [excuteStatus, setExcuteStatus] = useState("stop"); //"stop" "running" "pause"
|
const [excuteStatus, setExcuteStatus] = useState("stop"); //"stop" "running" "pause"
|
||||||
|
// 机器人实时位置
|
||||||
const fontSmall = 'clamp(10px, 0.7vw, 11px)';
|
const [robotRealtimePosition, setRobotRealtimePosition] = useState(null);
|
||||||
const fontNormal = 'clamp(12px, 0.75vw, 13px)';
|
const [execute, setExecute] = useState(false); // 是否执行任务
|
||||||
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)' };
|
|
||||||
|
|
||||||
// 任务列表 独立筛选状态
|
|
||||||
// 统一用 form 管理筛选条件
|
|
||||||
const [filterForm, setFilterForm] = useState({
|
|
||||||
dateRange: null, // 时间范围
|
|
||||||
taskStatus: null, // 任务状态
|
|
||||||
robot: null // 机器人设备
|
|
||||||
});
|
|
||||||
const [messageApi, contextHolder] = message.useMessage();
|
|
||||||
const controllerRef = useRef<DeviceController | null>(null);
|
|
||||||
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
const controller = new DeviceController(userInfo, messageApi);
|
|
||||||
controller.init();
|
|
||||||
|
|
||||||
controllerRef.current = controller;
|
|
||||||
return () => {
|
|
||||||
if (controllerRef.current) {
|
|
||||||
controllerRef.current.destroy?.();
|
|
||||||
}
|
|
||||||
controllerRef.current = null;
|
|
||||||
};
|
|
||||||
|
|
||||||
}, [])
|
|
||||||
|
|
||||||
const [taskList, setTaskList] = useState([]);
|
const [taskList, setTaskList] = useState([]);
|
||||||
|
|
||||||
|
|
||||||
// 设备数据
|
// 设备数据
|
||||||
const [devices, setDevices] = useState([]);
|
const [devices, setDevices] = useState([]);
|
||||||
|
|
||||||
@@ -96,8 +68,7 @@ export default function RobotTaskPage() {
|
|||||||
const [selectedRouteForExecute, setSelectedRouteForExecute] = useState(null);
|
const [selectedRouteForExecute, setSelectedRouteForExecute] = useState(null);
|
||||||
const [selectedRobotForExecute, setSelectedRobotForExecute] = useState(null);
|
const [selectedRobotForExecute, setSelectedRobotForExecute] = useState(null);
|
||||||
|
|
||||||
// 机器人实时位置
|
|
||||||
const [robotRealtimePosition, setRobotRealtimePosition] = useState(null);
|
|
||||||
// 当前执行任务的机器人
|
// 当前执行任务的机器人
|
||||||
const [executingRobot, setExecutingRobot] = useState(null);
|
const [executingRobot, setExecutingRobot] = useState(null);
|
||||||
|
|
||||||
@@ -122,6 +93,84 @@ export default function RobotTaskPage() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
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)' };
|
||||||
|
|
||||||
|
// 任务列表 独立筛选状态
|
||||||
|
// 统一用 form 管理筛选条件
|
||||||
|
const [filterForm, setFilterForm] = useState({
|
||||||
|
dateRange: null, // 时间范围
|
||||||
|
taskStatus: null, // 任务状态
|
||||||
|
robot: null // 机器人设备
|
||||||
|
});
|
||||||
|
const [messageApi, contextHolder] = message.useMessage();
|
||||||
|
const controllerRef = useRef<DeviceController | null>(null);
|
||||||
|
const handleFinish = (data) => {
|
||||||
|
setExecute(false);
|
||||||
|
utils.message.success('任务已完成');
|
||||||
|
if (controllerRef.current) {
|
||||||
|
controllerRef.current.destroy?.();
|
||||||
|
}
|
||||||
|
controllerRef.current = null;
|
||||||
|
setSelectedRobotForExecute(null);
|
||||||
|
setSelectedRouteForExecute(null);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const controller = new DeviceController(userInfo, messageApi);
|
||||||
|
|
||||||
|
controller.onDeviceInfoUpdate = setRobotRealtimePosition;
|
||||||
|
controller.onIsFinished = handleFinish;
|
||||||
|
controller.init();
|
||||||
|
|
||||||
|
|
||||||
|
controllerRef.current = controller;
|
||||||
|
return () => {
|
||||||
|
if (controllerRef.current) {
|
||||||
|
controllerRef.current.destroy?.();
|
||||||
|
}
|
||||||
|
controllerRef.current = null;
|
||||||
|
};
|
||||||
|
|
||||||
|
}, [])
|
||||||
|
|
||||||
|
|
||||||
|
const realtimePosition = useMemo(() => {
|
||||||
|
const data = {
|
||||||
|
lon: robotRealtimePosition?.longitude || 0,
|
||||||
|
lat: robotRealtimePosition?.latitude || 0,
|
||||||
|
//heading: robotRealtimePosition?.yaw || 0,
|
||||||
|
}
|
||||||
|
return data;
|
||||||
|
}, [robotRealtimePosition])
|
||||||
|
useEffect(() => {
|
||||||
|
if (robotRealtimePosition && execute) {
|
||||||
|
let warningMsg = '';
|
||||||
|
|
||||||
|
if (robotRealtimePosition?.controlMode != "3") {
|
||||||
|
warningMsg = `请切换到远程模式 ${robotRealtimePosition?.controlMode}`;
|
||||||
|
} else if (robotRealtimePosition?.qual != "4") {
|
||||||
|
warningMsg = '定位未固定';
|
||||||
|
} else if (robotRealtimePosition?.headingStatus != "1") {
|
||||||
|
warningMsg = '请先初始化航向角';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (warningMsg) {
|
||||||
|
utils.message.destroy();
|
||||||
|
|
||||||
|
utils.message.warning(warningMsg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, [robotRealtimePosition, execute])
|
||||||
|
|
||||||
|
|
||||||
// 获取数据
|
// 获取数据
|
||||||
const fetchAllData = async () => {
|
const fetchAllData = async () => {
|
||||||
if (!stationId) return;
|
if (!stationId) return;
|
||||||
@@ -146,7 +195,10 @@ export default function RobotTaskPage() {
|
|||||||
// 获取任务列表数据
|
// 获取任务列表数据
|
||||||
const fetchTaskList = async () => {
|
const fetchTaskList = async () => {
|
||||||
try {
|
try {
|
||||||
const params = { siteId: String(stationId) };
|
const params = {
|
||||||
|
siteId: String(stationId), pageNum: 1,
|
||||||
|
pageSize: 99999999
|
||||||
|
};
|
||||||
|
|
||||||
// 时间范围
|
// 时间范围
|
||||||
if (filterForm.dateRange && filterForm.dateRange.length === 2) {
|
if (filterForm.dateRange && filterForm.dateRange.length === 2) {
|
||||||
@@ -264,6 +316,7 @@ export default function RobotTaskPage() {
|
|||||||
message.error('请选择执行设备');
|
message.error('请选择执行设备');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const params = {
|
const params = {
|
||||||
@@ -276,6 +329,7 @@ export default function RobotTaskPage() {
|
|||||||
const res = await excuetRoute(params);
|
const res = await excuetRoute(params);
|
||||||
|
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
|
setExecute(true);
|
||||||
utils.message.success('任务执行成功');
|
utils.message.success('任务执行成功');
|
||||||
setExecuteModalVisible(false);
|
setExecuteModalVisible(false);
|
||||||
setExecutingRobot(selectedRobotForExecute);
|
setExecutingRobot(selectedRobotForExecute);
|
||||||
@@ -284,9 +338,13 @@ export default function RobotTaskPage() {
|
|||||||
fetchTaskHistoryList();
|
fetchTaskHistoryList();
|
||||||
controllerRef.current?.connectDevice(selectedRobotForExecute);
|
controllerRef.current?.connectDevice(selectedRobotForExecute);
|
||||||
} else {
|
} else {
|
||||||
|
setExecute(false);
|
||||||
|
|
||||||
utils.message.error(res.msg || '任务执行失败');
|
utils.message.error(res.msg || '任务执行失败');
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
setExecute(false);
|
||||||
|
|
||||||
console.error('执行任务失败:', err);
|
console.error('执行任务失败:', err);
|
||||||
utils.message.error('任务执行异常');
|
utils.message.error('任务执行异常');
|
||||||
}
|
}
|
||||||
@@ -304,6 +362,8 @@ export default function RobotTaskPage() {
|
|||||||
userId: userInfo?.userId,
|
userId: userInfo?.userId,
|
||||||
siteId: stationId,
|
siteId: stationId,
|
||||||
orgId: userInfo?.orgId,
|
orgId: userInfo?.orgId,
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 99999999
|
||||||
};
|
};
|
||||||
if (poolFilterForm.taskStatus) {
|
if (poolFilterForm.taskStatus) {
|
||||||
params.taskStaus = poolFilterForm.taskStatus;
|
params.taskStaus = poolFilterForm.taskStatus;
|
||||||
@@ -335,9 +395,10 @@ export default function RobotTaskPage() {
|
|||||||
if (!stationId) return;
|
if (!stationId) return;
|
||||||
try {
|
try {
|
||||||
const params = {
|
const params = {
|
||||||
userId: userInfo?.userId,
|
|
||||||
siteId: stationId,
|
siteId: stationId,
|
||||||
orgId: userInfo?.orgId,
|
orgId: userInfo?.orgId,
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 99999999
|
||||||
};
|
};
|
||||||
if (historyFilterForm.taskStatus) {
|
if (historyFilterForm.taskStatus) {
|
||||||
params.taskStaus = historyFilterForm.taskStatus;
|
params.taskStaus = historyFilterForm.taskStatus;
|
||||||
@@ -369,12 +430,19 @@ export default function RobotTaskPage() {
|
|||||||
orgId: task.orgId,
|
orgId: task.orgId,
|
||||||
};
|
};
|
||||||
const res = await cancelRoute(params);
|
const res = await cancelRoute(params);
|
||||||
if (res.code === 200) {
|
if (res.code === 200 && res.data == true) {
|
||||||
utils.message.success('任务已取消');
|
utils.message.success('任务已取消');
|
||||||
fetchTaskPoolList();
|
fetchTaskPoolList();
|
||||||
fetchTaskHistoryList();
|
fetchTaskHistoryList();
|
||||||
|
setExecute(false);
|
||||||
|
if (controllerRef.current) {
|
||||||
|
controllerRef.current.destroy?.();
|
||||||
|
}
|
||||||
|
controllerRef.current = null;
|
||||||
|
setSelectedRobotForExecute(null);
|
||||||
|
setSelectedRouteForExecute(null);
|
||||||
} else {
|
} else {
|
||||||
utils.message.error(res.msg || '取消失败');
|
utils.message.error('任务取消失败');
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('取消任务失败:', err);
|
console.error('取消任务失败:', err);
|
||||||
@@ -608,25 +676,25 @@ export default function RobotTaskPage() {
|
|||||||
<Space size="small">
|
<Space size="small">
|
||||||
|
|
||||||
<>
|
<>
|
||||||
{record.taskStaus === 'NEW' && (
|
{/*{record.taskStaus === 'NEW' && (*/}
|
||||||
<Popconfirm
|
<Popconfirm
|
||||||
title="确定要取消该任务吗?"
|
title="确定要取消该任务吗?"
|
||||||
onConfirm={() => handleCancelTask(record)}
|
onConfirm={() => handleCancelTask(record)}
|
||||||
okText="确定" cancelText="取消"
|
okText="确定" cancelText="取消"
|
||||||
>
|
>
|
||||||
<Button type="text" size="small" danger icon={<CloseOutlined />}>取消</Button>
|
<Button type="text" size="small" danger icon={<CloseOutlined />}>取消</Button>
|
||||||
</Popconfirm>
|
</Popconfirm>
|
||||||
)}
|
{/*//)}*/}
|
||||||
|
|
||||||
{record.taskStaus === 'EXECUTING' && (
|
{/*{record.taskStaus === 'EXECUTING' && (*/}
|
||||||
<Popconfirm
|
<Popconfirm
|
||||||
title="确定要暂停该任务吗?"
|
title="确定要暂停该任务吗?"
|
||||||
onConfirm={() => handlePauseTask(record)}
|
onConfirm={() => handlePauseTask(record)}
|
||||||
okText="确定" cancelText="取消"
|
okText="确定" cancelText="取消"
|
||||||
>
|
>
|
||||||
<Button type="text" size="small">暂停</Button>
|
<Button type="text" size="small" style={{ color: '#FF9500' }}>暂停</Button>
|
||||||
</Popconfirm>
|
</Popconfirm>
|
||||||
)}
|
{/*)}/*/}
|
||||||
|
|
||||||
{record.taskStaus === 'PAUSE' && (
|
{record.taskStaus === 'PAUSE' && (
|
||||||
<Popconfirm
|
<Popconfirm
|
||||||
@@ -634,7 +702,7 @@ export default function RobotTaskPage() {
|
|||||||
onConfirm={() => handleRecoverTask(record)}
|
onConfirm={() => handleRecoverTask(record)}
|
||||||
okText="确定" cancelText="取消"
|
okText="确定" cancelText="取消"
|
||||||
>
|
>
|
||||||
<Button type="text" size="small">恢复</Button>
|
<Button type="text" size="small" style={{ color: '#00B42A' }}>恢复</Button>
|
||||||
</Popconfirm>
|
</Popconfirm>
|
||||||
)}
|
)}
|
||||||
</>
|
</>
|
||||||
@@ -794,7 +862,61 @@ export default function RobotTaskPage() {
|
|||||||
<Row gutter={10} style={{ marginBottom: 10 }}>
|
<Row gutter={10} style={{ marginBottom: 10 }}>
|
||||||
<Col xs={24} xl={14} style={{ display: "flex", flexDirection: "column" }}>
|
<Col xs={24} xl={14} style={{ display: "flex", flexDirection: "column" }}>
|
||||||
<Card
|
<Card
|
||||||
title={<span style={{ fontSize: fontNormal, fontWeight: 700 }}>机器人路径规划与监控</span>}
|
title={<div style={{ display: 'flex', alignItems: 'center', gap: '12px', flexWrap: 'wrap' }}>
|
||||||
|
<span style={{ fontSize: fontNormal, fontWeight: 700 }}>
|
||||||
|
机器人路径规划与监控
|
||||||
|
</span>
|
||||||
|
|
||||||
|
{/* 执行后显示机器信息 + 状态 */}
|
||||||
|
{execute && executingRobot && (
|
||||||
|
<div
|
||||||
|
style={{
|
||||||
|
display: 'inline-flex',
|
||||||
|
alignItems: 'center',
|
||||||
|
gap: '8px',
|
||||||
|
fontSize: '12px',
|
||||||
|
color: '#fff',
|
||||||
|
background: '#165DFF',
|
||||||
|
padding: '2px 8px',
|
||||||
|
borderRadius: '4px',
|
||||||
|
whiteSpace: 'nowrap'
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{/* 机器名称 */}
|
||||||
|
<span>{executingRobot.deviceAlias || executingRobot.serialNumber}</span>
|
||||||
|
|
||||||
|
{/* 控制模式 */}
|
||||||
|
<span>
|
||||||
|
控制模式:{robotRealtimePosition?.controlMode}
|
||||||
|
{robotRealtimePosition?.controlMode == '3' ? (
|
||||||
|
<span style={{ color: '#9eff9e' }}>远程</span>
|
||||||
|
) : (
|
||||||
|
<span style={{ color: '#ff6f6f' }}>本地</span>
|
||||||
|
)}
|
||||||
|
</span>
|
||||||
|
|
||||||
|
{/* 航向初始化 */}
|
||||||
|
<span>
|
||||||
|
航向:
|
||||||
|
{robotRealtimePosition?.headingStatus == '1' ? (
|
||||||
|
<span style={{ color: '#9eff9e' }}>已初始化</span>
|
||||||
|
) : (
|
||||||
|
<span style={{ color: '#ff6f6f' }}>未初始化</span>
|
||||||
|
)}
|
||||||
|
</span>
|
||||||
|
|
||||||
|
{/* 定位质量 */}
|
||||||
|
<span>
|
||||||
|
定位:
|
||||||
|
{(() => {
|
||||||
|
const qual = robotRealtimePosition?.qual;
|
||||||
|
const info = getLocationQuality(qual);
|
||||||
|
return <span style={{ color: info.color }}>{info.text}</span>;
|
||||||
|
})()}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>}
|
||||||
size="small"
|
size="small"
|
||||||
extra={
|
extra={
|
||||||
<Space size={4}>
|
<Space size={4}>
|
||||||
@@ -813,9 +935,10 @@ export default function RobotTaskPage() {
|
|||||||
devices={devices}
|
devices={devices}
|
||||||
points={points}
|
points={points}
|
||||||
focusLocation={focusLocation}
|
focusLocation={focusLocation}
|
||||||
realtimePosition={robotRealtimePosition}
|
realtimePosition={realtimePosition}
|
||||||
realtimeType="robot"
|
realtimeType="robot"
|
||||||
from="device-control"
|
from="device-control"
|
||||||
|
drawRealTime={execute}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</Card>
|
</Card>
|
||||||
@@ -826,6 +949,7 @@ export default function RobotTaskPage() {
|
|||||||
bordered={false}
|
bordered={false}
|
||||||
bodyStyle={{ padding: 0, display: 'flex', flexDirection: 'column', height: "calc(100%)", overflow: "auto" }}
|
bodyStyle={{ padding: 0, display: 'flex', flexDirection: 'column', height: "calc(100%)", overflow: "auto" }}
|
||||||
style={{ ...cardStyle, maxHeight: "300px", flex: 1, marginBottom: 0 }}
|
style={{ ...cardStyle, maxHeight: "300px", flex: 1, marginBottom: 0 }}
|
||||||
|
|
||||||
>
|
>
|
||||||
<Tabs
|
<Tabs
|
||||||
activeKey={activeTab}
|
activeKey={activeTab}
|
||||||
@@ -847,12 +971,20 @@ export default function RobotTaskPage() {
|
|||||||
}
|
}
|
||||||
]}
|
]}
|
||||||
tabBarExtraContent={
|
tabBarExtraContent={
|
||||||
<Tooltip title="创建任务">
|
<Space size={8}>
|
||||||
<PlusOutlined
|
<Button size="small" icon={<ReloadOutlined />} onClick={() => {
|
||||||
style={{ cursor: 'pointer', color: '#165DFF', fontSize: 14 }}
|
fetchTaskList();
|
||||||
onClick={() => setIsTaskModalOpen(true)}
|
fetchTaskPoolList();
|
||||||
/>
|
fetchTaskHistoryList();
|
||||||
</Tooltip>
|
}} />
|
||||||
|
<Tooltip title="创建任务">
|
||||||
|
<PlusOutlined
|
||||||
|
style={{ cursor: 'pointer', color: '#165DFF', fontSize: 14 }}
|
||||||
|
onClick={() => setIsTaskModalOpen(true)}
|
||||||
|
/>
|
||||||
|
</Tooltip>
|
||||||
|
</Space>
|
||||||
|
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
|||||||
@@ -786,7 +786,7 @@ export default function WayLinePage({ onRefresh }) {
|
|||||||
// 任务状态更新逻辑
|
// 任务状态更新逻辑
|
||||||
const updateTaskStatus = async (taskId: string, status: string) => {
|
const updateTaskStatus = async (taskId: string, status: string) => {
|
||||||
if (!taskId) {
|
if (!taskId) {
|
||||||
utils.message.warning('请先选择航线任务');
|
utils.message.warning('请先选择任务');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
@@ -863,7 +863,7 @@ export default function WayLinePage({ onRefresh }) {
|
|||||||
style={{ ...cardStyle, marginBottom: 10 }}
|
style={{ ...cardStyle, marginBottom: 10 }}
|
||||||
>
|
>
|
||||||
<div style={{ width: '100%', height: 420, background: '#e8f3ff url(https://picsum.photos/seed/solar_map_v2/1600/1000) center/cover', position: 'relative' }}>
|
<div style={{ width: '100%', height: 420, background: '#e8f3ff url(https://picsum.photos/seed/solar_map_v2/1600/1000) center/cover', position: 'relative' }}>
|
||||||
<CesiumMap realtimePosition={realtimePosition}
|
<CesiumMap realtimePosition={realtimePosition} drawRealTime={true}
|
||||||
points={points} focusLocation={focusLocation} from="device-control" realtimeType='plane' />
|
points={points} focusLocation={focusLocation} from="device-control" realtimeType='plane' />
|
||||||
<div style={{ position: 'absolute', top: 16, left: 16, background: 'rgba(255,255,255,0.92)', backdropFilter: 'blur(8px)', padding: '14px 16px', borderRadius: 10, width: 150, boxShadow: '0 4px 12px rgba(0,0,0,0.1)' }}>
|
<div style={{ position: 'absolute', top: 16, left: 16, background: 'rgba(255,255,255,0.92)', backdropFilter: 'blur(8px)', padding: '14px 16px', borderRadius: 10, width: 150, boxShadow: '0 4px 12px rgba(0,0,0,0.1)' }}>
|
||||||
<div style={{ fontSize: fontSmall, display: 'flex', flexDirection: 'column', gap: 10 }}>
|
<div style={{ fontSize: fontSmall, display: 'flex', flexDirection: 'column', gap: 10 }}>
|
||||||
@@ -1070,16 +1070,18 @@ export default function WayLinePage({ onRefresh }) {
|
|||||||
type="primary"
|
type="primary"
|
||||||
icon={<Play size={16} />}
|
icon={<Play size={16} />}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
if (selectedTask?.status === 'suspended') {
|
//if (selectedTask?.status === 'suspended') {
|
||||||
updateTaskStatus(selectedTask?.uuid, 'restored');
|
updateTaskStatus(selectedTask?.uuid, 'restored');
|
||||||
} else {
|
//}
|
||||||
updateTaskStatus(selectedTask?.uuid, 'executing');
|
//else {
|
||||||
}
|
// updateTaskStatus(selectedTask?.uuid, 'executing');
|
||||||
|
//}
|
||||||
}}
|
}}
|
||||||
loading={loading}
|
loading={loading}
|
||||||
style={{ background: '#165DFF', height: 28, borderRadius: 18, fontWeight: 600, display: 'inline-flex', alignItems: 'center', gap: 4 }}
|
style={{ background: '#165DFF', height: 28, borderRadius: 18, fontWeight: 600, display: 'inline-flex', alignItems: 'center', gap: 4 }}
|
||||||
>
|
>
|
||||||
{selectedTask?.status === 'suspended' ? '继续任务' : '执行任务'}
|
恢复任务
|
||||||
|
{/*{selectedTask?.status === 'suspended' ? '继续任务' : '执行任务'}*/}
|
||||||
</Button>
|
</Button>
|
||||||
)}
|
)}
|
||||||
<Button
|
<Button
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ export default class DeviceController {
|
|||||||
this.onHasControlRightChange = null;
|
this.onHasControlRightChange = null;
|
||||||
this.onRequestControlStatusChange = null;
|
this.onRequestControlStatusChange = null;
|
||||||
this.onPermissionRequest = null;
|
this.onPermissionRequest = null;
|
||||||
|
this.onIsFinished = null;
|
||||||
|
|
||||||
this.handleWsMessage = this.handleWsMessage.bind(this);
|
this.handleWsMessage = this.handleWsMessage.bind(this);
|
||||||
this.handleWsStatus = this.handleWsStatus.bind(this);
|
this.handleWsStatus = this.handleWsStatus.bind(this);
|
||||||
@@ -226,6 +227,8 @@ export default class DeviceController {
|
|||||||
this.onRequestControlStatusChange?.(false);
|
this.onRequestControlStatusChange?.(false);
|
||||||
this.messageApi.destroy('control');
|
this.messageApi.destroy('control');
|
||||||
this.messageApi.error('控制请求超时');
|
this.messageApi.error('控制请求超时');
|
||||||
|
this.clearControlTimeout();
|
||||||
|
|
||||||
}, 20000);
|
}, 20000);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -284,6 +287,11 @@ export default class DeviceController {
|
|||||||
this.messageApi.success({ key: 'control', content: '控制成功' });
|
this.messageApi.success({ key: 'control', content: '控制成功' });
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case "device_task_change": {
|
||||||
|
this.onIsFinished?.(true);
|
||||||
|
console.log('🔌 控制结果任务变更,', msg);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
case 'switchPermission': {
|
case 'switchPermission': {
|
||||||
console.log('🔌 控制结果111111111111111222222222:', msg);
|
console.log('🔌 控制结果111111111111111222222222:', msg);
|
||||||
|
|||||||
@@ -39,6 +39,17 @@ export function cn(...inputs: ClassValue[]) {
|
|||||||
return twMerge(clsx(inputs));
|
return twMerge(clsx(inputs));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const getLocationQuality = (value) => {
|
||||||
|
const map = {
|
||||||
|
0: { text: '无效', color: '#ff4d4f' },
|
||||||
|
1: { text: 'GPS 单点定位', color: '#999' },
|
||||||
|
2: { text: 'DGPS 伪距差分/SBAS', color: '#1890ff' },
|
||||||
|
4: { text: 'RTK 固定解', color: '#52c41a' }, // 最优
|
||||||
|
5: { text: 'RTK 浮点解', color: '#faad14' },
|
||||||
|
};
|
||||||
|
return map[value] || { text: '未知', color: '#999' };
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
export function getToken() {
|
export function getToken() {
|
||||||
return Cookies.get(TokenKey)
|
return Cookies.get(TokenKey)
|
||||||
|
|||||||
Reference in New Issue
Block a user