模拟障碍物 继续作业 连续作业 初始化
This commit is contained in:
@@ -456,23 +456,7 @@ export default function DeviceStatusPage() {
|
||||
|
||||
|
||||
|
||||
// 开关切换回调
|
||||
|
||||
const handleChange = (checked: boolean) => {
|
||||
|
||||
setIsLoopMode(checked);
|
||||
|
||||
if (checked) {
|
||||
|
||||
console.log('当前作业方式:回字');
|
||||
|
||||
} else {
|
||||
|
||||
console.log('当前作业方式:单点');
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -1016,32 +1000,33 @@ export default function DeviceStatusPage() {
|
||||
|
||||
}, [device, wsDeviceInfo, isUAV, locationInfo]);
|
||||
|
||||
// 统一在线状态判断:优先实时数据,兜底接口数据
|
||||
const isDeviceOnline = useMemo(() => {
|
||||
// 1. 优先检查实时数据源(WebSocket 推送的 wsDeviceInfo / locationInfo)
|
||||
const hasWsData = wsDeviceInfo && Object.keys(wsDeviceInfo).length > 0;
|
||||
const hasLocData = locationInfo && Object.keys(locationInfo).length > 0;
|
||||
|
||||
if (hasWsData || hasLocData) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// 2. 检查 runningStatus 里是否有有效经纬度或实时状态字段
|
||||
const runningLon = runningStatus?.longitude;
|
||||
const runningLat = runningStatus?.latitude;
|
||||
const hasValidCoords = runningLon !== undefined && runningLon !== null && runningLon !== 0
|
||||
&& runningLat !== undefined && runningLat !== null && runningLat !== 0;
|
||||
|
||||
const hasFeStatus = runningStatus?.feStatus !== 3;
|
||||
const hasStatusField = runningStatus?.status !== 0;
|
||||
|
||||
if (hasValidCoords || hasFeStatus || hasStatusField) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// 3. 兜底用接口返回的 onlineStatus
|
||||
return device?.onlineStatus === 1;
|
||||
}, [device, wsDeviceInfo, locationInfo, runningStatus]);
|
||||
// 统一在线状态判断:优先实时数据,兜底接口数据
|
||||
const isDeviceOnline = useMemo(() => {
|
||||
// 1. 优先检查实时数据源(WebSocket 推送的 wsDeviceInfo / locationInfo)
|
||||
const hasWsData = wsDeviceInfo && Object.keys(wsDeviceInfo).length > 0;
|
||||
const hasLocData = locationInfo && Object.keys(locationInfo).length > 0;
|
||||
|
||||
if (hasWsData || hasLocData) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
//// 2. 检查 runningStatus 里是否有有效经纬度或实时状态字段
|
||||
//const runningLon = runningStatus?.longitude;
|
||||
//const runningLat = runningStatus?.latitude;
|
||||
//const hasValidCoords = runningLon !== undefined && runningLon !== null && runningLon !== 0
|
||||
// && runningLat !== undefined && runningLat !== null && runningLat !== 0;
|
||||
|
||||
//const hasFeStatus = runningStatus?.feStatus !== 3;
|
||||
//const hasStatusField = runningStatus?.status !== 0;
|
||||
|
||||
//if (hasValidCoords || hasFeStatus || hasStatusField) {
|
||||
// return true;
|
||||
//}
|
||||
|
||||
// 3. 兜底用接口返回的 onlineStatus
|
||||
return device?.onlineStatus == 1;
|
||||
}, [device, wsDeviceInfo, locationInfo,]);
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user