f封装完成点 无人机和 机器人 地图清空实时轨迹和清空规划轨迹
This commit is contained in:
@@ -31,6 +31,7 @@ import {
|
||||
CameraOutlined,
|
||||
ThunderboltOutlined,
|
||||
EnvironmentOutlined,
|
||||
DeleteOutlined,
|
||||
} from '@ant-design/icons';
|
||||
|
||||
import {
|
||||
@@ -299,6 +300,8 @@ export default function DeviceStatusPage({
|
||||
const [mowerView, setMowerView] = useState('front');
|
||||
const [uavState, setUavState] = useState<any>(null);
|
||||
const [points, setPoints] = useState([]);
|
||||
const [clearNavLine, setClearNavLine] = useState(0);
|
||||
const [clearPlanLine, setClearPlanLine] = useState(0);
|
||||
const timerRef = useRef<any>(null);
|
||||
|
||||
const runningStatus = useMemo(() => {
|
||||
@@ -606,6 +609,19 @@ export default function DeviceStatusPage({
|
||||
实时视频监控
|
||||
</>
|
||||
}
|
||||
//extra={
|
||||
// <Button
|
||||
// size="small"
|
||||
// onClick={() => {
|
||||
// // 取当前选中设备编号,执行设备切换/刷新逻辑
|
||||
// const currentSn = device?.device_sn || device?.serialNumber;
|
||||
// console.log('currentSn', currentSn);
|
||||
// onDeviceChange?.(currentSn);
|
||||
// }}
|
||||
// >
|
||||
// 刷新
|
||||
// </Button>
|
||||
//}
|
||||
bordered={false}
|
||||
style={{ borderRadius: 12, marginBottom: 8 }}
|
||||
bodyStyle={{ padding: 12 }}
|
||||
@@ -729,6 +745,31 @@ export default function DeviceStatusPage({
|
||||
位置态势图
|
||||
</>
|
||||
}
|
||||
extra={
|
||||
<Space size={4}>
|
||||
<Button
|
||||
size="small"
|
||||
type="primary"
|
||||
icon={<DeleteOutlined />}
|
||||
onClick={() => {
|
||||
setClearNavLine((v) => v + 1);
|
||||
}}
|
||||
>
|
||||
清空实时轨迹
|
||||
</Button>
|
||||
<Button
|
||||
size="small"
|
||||
danger
|
||||
icon={<DeleteOutlined />}
|
||||
onClick={() => {
|
||||
setPoints([]);
|
||||
setClearPlanLine((v) => v + 1);
|
||||
}}
|
||||
>
|
||||
清空规划航线
|
||||
</Button>
|
||||
</Space>
|
||||
}
|
||||
bordered={false}
|
||||
style={{ borderRadius: 12 }}
|
||||
bodyStyle={{
|
||||
@@ -742,6 +783,8 @@ export default function DeviceStatusPage({
|
||||
realtimePosition={realtimePosition}
|
||||
realtimeType={realtimeType}
|
||||
drawRealTime={true}
|
||||
ifClearNavLine={clearNavLine}
|
||||
ifClearPlanLine={clearPlanLine}
|
||||
/>
|
||||
</Card>
|
||||
</Col>
|
||||
|
||||
@@ -51,6 +51,7 @@ export default function RobotTaskPage() {
|
||||
const [robotRealtimePosition, setRobotRealtimePosition] = useState(null);
|
||||
const [execute, setExecute] = useState(false); // 是否执行任务
|
||||
const [taskList, setTaskList] = useState([]);
|
||||
const [arrivedPoint, setArrivedPoint] = useState(null);//完成点
|
||||
|
||||
|
||||
// 设备数据
|
||||
@@ -59,6 +60,8 @@ export default function RobotTaskPage() {
|
||||
|
||||
const [focusLocation, setFocusLocation] = useState(null);
|
||||
const [points, setPoints] = useState([]);
|
||||
const [clearNavLine, setClearNavLine] = useState(0);
|
||||
const [clearPlanLine, setClearPlanLine] = useState(0);
|
||||
|
||||
const [routeSearch, setRouteSearch] = useState('');
|
||||
const [routeList, setRouteList] = useState([]);
|
||||
@@ -115,12 +118,18 @@ export default function RobotTaskPage() {
|
||||
if (controllerRef.current) {
|
||||
controllerRef.current.destroy?.();
|
||||
}
|
||||
controllerRef.current = null;
|
||||
setSelectedRobotForExecute(null);
|
||||
setSelectedRouteForExecute(null);
|
||||
fetchTaskList();
|
||||
fetchTaskHistoryList();
|
||||
fetchTaskPoolList();
|
||||
|
||||
|
||||
}
|
||||
const handleFinishEdPoint = (point) => {
|
||||
console.log('到达完成点11111111111', point);
|
||||
setArrivedPoint(point);
|
||||
}
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
@@ -128,6 +137,7 @@ export default function RobotTaskPage() {
|
||||
|
||||
controller.onDeviceInfoUpdate = setRobotRealtimePosition;
|
||||
controller.onIsFinished = handleFinish;
|
||||
controller.handleArrivedPoint = handleFinishEdPoint;
|
||||
controller.init();
|
||||
|
||||
|
||||
@@ -154,7 +164,7 @@ export default function RobotTaskPage() {
|
||||
if (robotRealtimePosition && execute) {
|
||||
let warningMsg = '';
|
||||
|
||||
if (robotRealtimePosition?.controlMode != "3") {
|
||||
if (robotRealtimePosition?.controlMode == "1") {
|
||||
warningMsg = `请切换到远程模式 ${robotRealtimePosition?.controlMode}`;
|
||||
} else if (robotRealtimePosition?.qual != "4") {
|
||||
warningMsg = '定位未固定';
|
||||
@@ -316,7 +326,7 @@ export default function RobotTaskPage() {
|
||||
message.error('请选择执行设备');
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
try {
|
||||
const params = {
|
||||
@@ -438,7 +448,6 @@ export default function RobotTaskPage() {
|
||||
if (controllerRef.current) {
|
||||
controllerRef.current.destroy?.();
|
||||
}
|
||||
controllerRef.current = null;
|
||||
setSelectedRobotForExecute(null);
|
||||
setSelectedRouteForExecute(null);
|
||||
} else {
|
||||
@@ -888,10 +897,10 @@ export default function RobotTaskPage() {
|
||||
{/* 控制模式 */}
|
||||
<span>
|
||||
控制模式:{robotRealtimePosition?.controlMode}
|
||||
{robotRealtimePosition?.controlMode == '3' ? (
|
||||
<span style={{ color: '#9eff9e' }}>远程</span>
|
||||
{robotRealtimePosition?.controlMode == '1' ? (
|
||||
<span style={{ color: '#9eff9e' }}>本地</span>
|
||||
) : (
|
||||
<span style={{ color: '#ff6f6f' }}>本地</span>
|
||||
<span style={{ color: '#ff6f6f' }}>远程</span>
|
||||
)}
|
||||
</span>
|
||||
|
||||
@@ -918,14 +927,7 @@ export default function RobotTaskPage() {
|
||||
)}
|
||||
</div>}
|
||||
size="small"
|
||||
extra={
|
||||
<Space size={4}>
|
||||
<Button size="small" icon={<PlusOutlined />} style={{ borderRadius: 4 }}>新增路线</Button>
|
||||
<Button size="small" icon={<ImportOutlined />} style={{ borderRadius: 4 }}>导入</Button>
|
||||
<Button size="small" icon={<SaveOutlined />} style={{ borderRadius: 4 }}>保存</Button>
|
||||
<Button size="small" icon={<Maximize2 size={12} />} />
|
||||
</Space>
|
||||
}
|
||||
|
||||
bordered={false}
|
||||
bodyStyle={{ padding: 0, position: 'relative' }}
|
||||
style={{ ...cardStyle, marginBottom: 10 }}
|
||||
@@ -939,6 +941,9 @@ export default function RobotTaskPage() {
|
||||
realtimeType="robot"
|
||||
from="device-control"
|
||||
drawRealTime={execute}
|
||||
finishPoint={arrivedPoint}
|
||||
ifClearNavLine={clearNavLine}
|
||||
ifClearPlanLine={clearPlanLine}
|
||||
/>
|
||||
</div>
|
||||
</Card>
|
||||
@@ -1108,7 +1113,7 @@ export default function RobotTaskPage() {
|
||||
{activeTab === 'history' && (
|
||||
<>
|
||||
<div style={{ marginBottom: 8, display: 'flex', gap: 8, alignItems: 'center' }}>
|
||||
<RangePicker
|
||||
{/*<RangePicker
|
||||
size="small"
|
||||
format="YYYY-MM-DD HH:mm:ss"
|
||||
placeholder={['开始时间', '结束时间']}
|
||||
@@ -1117,7 +1122,7 @@ export default function RobotTaskPage() {
|
||||
setHistoryFilterForm(prev => ({ ...prev, dateRange: dates }));
|
||||
}}
|
||||
showTime
|
||||
/>
|
||||
/>*/}
|
||||
<Select
|
||||
style={{ width: 120 }}
|
||||
size="small"
|
||||
@@ -1126,7 +1131,7 @@ export default function RobotTaskPage() {
|
||||
options={[
|
||||
{ label: '执行成功', value: 'FINISH' },
|
||||
{ label: '执行失败', value: 'FAILED' },
|
||||
{ label: '已取消', value: 'CANCELLED' },
|
||||
{ label: '已取消', value: 'CANCELED' },
|
||||
]}
|
||||
value={historyFilterForm.taskStatus}
|
||||
onChange={(val) => {
|
||||
@@ -1134,7 +1139,7 @@ export default function RobotTaskPage() {
|
||||
}}
|
||||
/>
|
||||
<Select
|
||||
style={{ width: 140 }}
|
||||
style={{ width: 340 }}
|
||||
size="small"
|
||||
placeholder="全部机器人"
|
||||
allowClear
|
||||
|
||||
@@ -10,7 +10,8 @@ import {
|
||||
BranchesOutlined, CloudOutlined, ThunderboltOutlined, CheckCircleOutlined,
|
||||
InfoCircleOutlined, ClockCircleOutlined,
|
||||
SettingOutlined, WarningOutlined, ArrowRightOutlined,
|
||||
SearchOutlined, MoreOutlined, AimOutlined, PlayCircleOutlined
|
||||
SearchOutlined, MoreOutlined, AimOutlined, PlayCircleOutlined,
|
||||
DeleteOutlined
|
||||
} from '@ant-design/icons';
|
||||
import {
|
||||
Plane, Navigation, Wind, Thermometer, Droplets, Satellite,
|
||||
@@ -52,6 +53,8 @@ export default function WayLinePage({ onRefresh }) {
|
||||
const [taskList, setTaskList] = useState([]);
|
||||
const [persistentDroneData, setPersistentDroneData] = useState(null); // 持久化无人机数据
|
||||
const [persistentHostData, setPersistentHostData] = useState(null); // 持久化机场数据
|
||||
const [clearNavLine, setClearNavLine] = useState(0);
|
||||
const [clearPlanLine, setClearPlanLine] = useState(0);
|
||||
|
||||
// 获取数据
|
||||
const fetchAllData = async () => {
|
||||
@@ -540,6 +543,7 @@ export default function WayLinePage({ onRefresh }) {
|
||||
fetchWaylineList();
|
||||
}, [])
|
||||
|
||||
|
||||
// 初始化默认设备
|
||||
useEffect(() => {
|
||||
if (planedevices?.length) {
|
||||
@@ -851,6 +855,29 @@ export default function WayLinePage({ onRefresh }) {
|
||||
size="small"
|
||||
extra={
|
||||
<Space size={4}>
|
||||
<Button
|
||||
size="small"
|
||||
icon={<DeleteOutlined />}
|
||||
type="primary"
|
||||
style={{ borderRadius: 4 }}
|
||||
onClick={() => {
|
||||
setClearNavLine((v) => v + 1);
|
||||
}}
|
||||
>
|
||||
清空实时轨迹
|
||||
</Button>
|
||||
<Button
|
||||
size="small"
|
||||
icon={<DeleteOutlined />}
|
||||
danger
|
||||
style={{ borderRadius: 4 }}
|
||||
onClick={() => {
|
||||
setPoints([]);
|
||||
setClearPlanLine((v) => v + 1);
|
||||
}}
|
||||
>
|
||||
清空规划航线
|
||||
</Button>
|
||||
<Button size="small" icon={<PlusOutlined />} style={{ borderRadius: 4 }}>新增</Button>
|
||||
<Button size="small" icon={<ImportOutlined />} style={{ borderRadius: 4 }}>导入</Button>
|
||||
<Button size="small" icon={<NodeIndexOutlined />} style={{ borderRadius: 4 }}>优化</Button>
|
||||
@@ -864,7 +891,7 @@ export default function WayLinePage({ onRefresh }) {
|
||||
>
|
||||
<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} drawRealTime={true}
|
||||
points={points} focusLocation={focusLocation} from="device-control" realtimeType='plane' />
|
||||
points={points} focusLocation={focusLocation} from="device-control" realtimeType='plane' ifClearNavLine={clearNavLine} ifClearPlanLine={clearPlanLine} />
|
||||
<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={{ display: 'flex', alignItems: 'center', gap: 8 }}><span style={{ width: 14, height: 2, background: '#165DFF' }}></span> 无人机航线</div>
|
||||
|
||||
@@ -37,6 +37,7 @@ export default class DeviceController {
|
||||
this.onRequestControlStatusChange = null;
|
||||
this.onPermissionRequest = null;
|
||||
this.onIsFinished = null;
|
||||
this.handleArrivedPoint = null;
|
||||
|
||||
this.handleWsMessage = this.handleWsMessage.bind(this);
|
||||
this.handleWsStatus = this.handleWsStatus.bind(this);
|
||||
@@ -128,7 +129,7 @@ export default class DeviceController {
|
||||
this.unSubStatus?.();
|
||||
this.release();
|
||||
|
||||
wsManager.close();
|
||||
//wsManager.close();
|
||||
this.connectedDeviceSn = null;
|
||||
|
||||
}
|
||||
@@ -157,7 +158,7 @@ export default class DeviceController {
|
||||
this.isControlled = false;
|
||||
this.onControlStatusChange?.(false);
|
||||
|
||||
wsManager.close();
|
||||
//wsManager.close();
|
||||
|
||||
try {
|
||||
const res = await getControlRight({
|
||||
@@ -270,7 +271,6 @@ export default class DeviceController {
|
||||
}
|
||||
|
||||
case 'switchResult': {
|
||||
console.log('🔌 控制结果111111111111111:', msg);
|
||||
|
||||
this.clearControlTimeout();
|
||||
this.isRequestControl = false;
|
||||
@@ -288,13 +288,22 @@ export default class DeviceController {
|
||||
break;
|
||||
}
|
||||
case "device_task_change": {
|
||||
if (msg.deviceId != this.connectedDeviceSn) return;
|
||||
this.onIsFinished?.(true);
|
||||
console.log('🔌 控制结果任务变更,', msg);
|
||||
|
||||
}
|
||||
//完成点
|
||||
case "device_task_arrive_point": {
|
||||
if (msg.deviceId != this.connectedDeviceSn) return;
|
||||
|
||||
this.handleArrivedPoint?.(msg.entity);
|
||||
console.log('🔌 到达完成点,', msg);
|
||||
|
||||
}
|
||||
|
||||
|
||||
case 'switchPermission': {
|
||||
console.log('🔌 控制结果111111111111111222222222:', msg);
|
||||
const platform = (msg.platform || '').toLowerCase();
|
||||
if (!platform || platform === 'null') return;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user