路径规划打点完成 点击任务获取 路径轨迹
This commit is contained in:
@@ -57,6 +57,7 @@ import dayjs from 'dayjs';
|
||||
import { MowerAllView } from './MowerAllView';
|
||||
import { useMqtt } from '@/hooks/useMqtt';
|
||||
import envConfig from '../../../env';
|
||||
import { dataUrlToFile } from '@/lib/utils.ts';
|
||||
const { RangePicker } = DatePicker;
|
||||
|
||||
const { Text } = Typography;
|
||||
@@ -565,8 +566,8 @@ export default function DeviceStatusPage({
|
||||
return;
|
||||
}
|
||||
const newPoint = {
|
||||
lon: realtimePosition.lon,
|
||||
lat: realtimePosition.lat,
|
||||
lon: Number(realtimePosition.lon),
|
||||
lat: Number(realtimePosition.lat),
|
||||
};
|
||||
setMarkedPoints([...markedPoints, newPoint]);
|
||||
messageApi.success(`已标记第 ${markedPoints.length + 1} 个点`);
|
||||
@@ -619,10 +620,22 @@ export default function DeviceStatusPage({
|
||||
const result = await response.json();
|
||||
|
||||
if (result) {
|
||||
setPoints(result?.data?.points);
|
||||
const path = result?.data?.path?.map(p => {
|
||||
return {
|
||||
lng: p.lon,
|
||||
lat: p.lat
|
||||
}
|
||||
})
|
||||
setPoints(path);
|
||||
setSavePath({
|
||||
path: result?.data?.path, // 存储返回的路径结果
|
||||
outer: requestParams?.outer?.position,
|
||||
path: path, // 存储返回的路径结果
|
||||
outer: requestParams?.outer?.position?.map(p => {
|
||||
return {
|
||||
lng: p.lon,
|
||||
lat: p.lat
|
||||
}
|
||||
}
|
||||
),
|
||||
planModel: 0,
|
||||
});
|
||||
setCompleteFlag(true);
|
||||
@@ -665,18 +678,29 @@ export default function DeviceStatusPage({
|
||||
// 3. 添加文件
|
||||
if (screenshotDataUrl) {
|
||||
// 将 dataUrl 转换为 Blob
|
||||
const response = await fetch(screenshotDataUrl);
|
||||
const blob = await response.blob();
|
||||
formData.append('file', blob, 'screenshot.jpg');
|
||||
const file = dataUrlToFile(screenshotDataUrl, "screenshot.jpg");
|
||||
console.log("blob", file)
|
||||
|
||||
|
||||
if (file instanceof File) {
|
||||
formData.append('file', file);
|
||||
}
|
||||
}
|
||||
|
||||
// 4. 添加 workRecord
|
||||
const workRecord = {
|
||||
workName: plotName,
|
||||
siteId: stationId,
|
||||
jsonData: JSON.stringify(savePath),
|
||||
jsonData: savePath,
|
||||
};
|
||||
formData.append('workRecord', JSON.stringify(workRecord));
|
||||
formData.append(
|
||||
"workRecord",
|
||||
new Blob([JSON.stringify(workRecord)], {
|
||||
type: "application/json"
|
||||
})
|
||||
);
|
||||
|
||||
//formData.append('workRecord', JSON.stringify(workRecord));
|
||||
|
||||
// 5. 调用保存接口
|
||||
const res = await addRoute(formData);
|
||||
|
||||
@@ -1008,11 +1008,11 @@ export default function RobotTaskPage() {
|
||||
<Space size={4} wrap> {/* Space开启自动换行,小屏按钮自动折行 */}
|
||||
<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={<PlusOutlined />} style={{ borderRadius: 4 }}>新增</Button>
|
||||
<Button size="small" icon={<ImportOutlined />} style={{ borderRadius: 4 }}>导入</Button>
|
||||
<Button size="small" icon={<NodeIndexOutlined />} style={{ borderRadius: 4 }}>优化</Button>
|
||||
<Button size="small" icon={<SaveOutlined />} style={{ borderRadius: 4 }}>保存</Button>
|
||||
<Button size="small" icon={<Maximize2 size={12} />} />
|
||||
<Button size="small" icon={<SaveOutlined />} style={{ borderRadius: 4 }}>保存</Button>*/}
|
||||
{/*<Button size="small" icon={<Maximize2 size={12} />} />*/}
|
||||
</Space>
|
||||
}
|
||||
bordered={false}
|
||||
@@ -1635,7 +1635,7 @@ export default function RobotTaskPage() {
|
||||
title={`机器人全景视频 - ${executingRobot.deviceAlias || executingRobot.serialNumber}`}
|
||||
onClose={() => setShowVideo(false)}
|
||||
>
|
||||
<div style={{ height: 'clamp(300px, 30vw, 600px)', overflow: 'hidden' }}>
|
||||
<div style={{ height: 'clamp(300px, 30vw, 600px)', }}>
|
||||
<MowerAllView
|
||||
serialNumber={executingRobot.serialNumber}
|
||||
robotVideo={robotVideo}
|
||||
|
||||
Reference in New Issue
Block a user