和算法测试成功第一步 状态界面看到经纬度信息和保存可以成功
This commit is contained in:
@@ -5,7 +5,8 @@ import {
|
||||
Modal, InputNumber,
|
||||
TimePicker,
|
||||
Popconfirm,
|
||||
App
|
||||
App,
|
||||
Radio
|
||||
} from 'antd';
|
||||
import {
|
||||
PlusOutlined, ImportOutlined, NodeIndexOutlined,
|
||||
@@ -35,6 +36,7 @@ import {
|
||||
getSiteDeviceTaskHistory,
|
||||
getRouteByTask,
|
||||
deleteRoute,
|
||||
getTaskPath,
|
||||
} from '../../api/device';
|
||||
import dayjs from 'dayjs';
|
||||
import DraggableBox from '../Draggable';
|
||||
@@ -116,6 +118,8 @@ export default function RobotTaskPage() {
|
||||
robot: null,
|
||||
dateRange: null,
|
||||
});
|
||||
// 取消任务模式 normal普通取消 force强制取消
|
||||
const [cancelMode, setCancelMode] = useState<'normal' | 'force'>('normal');
|
||||
|
||||
|
||||
|
||||
@@ -244,7 +248,7 @@ export default function RobotTaskPage() {
|
||||
useEffect(() => {
|
||||
const controller = new DeviceController(userInfo, messageApi);
|
||||
|
||||
controller.onDeviceInfoUpdate = setRobotRealtimePosition;
|
||||
controller.onLocationInfoUpdate = setRobotRealtimePosition;
|
||||
controller.onIsFinished = handleFinish;
|
||||
controller.handleArrivedPoint = handleFinishEdPoint;
|
||||
|
||||
@@ -394,22 +398,14 @@ export default function RobotTaskPage() {
|
||||
// 调用接口获取路线详情
|
||||
const fetchRouteDetail = async () => {
|
||||
try {
|
||||
const res = await getSingleRouteList({ id: selectedPathWork.id });
|
||||
const res = await getTaskPath({ taskId: selectedPathWork.id })
|
||||
//const res = await getSingleRouteList({ id: selectedPathWork.id });
|
||||
if (res?.code === 200 && res?.data) {
|
||||
let pathPoints = [];
|
||||
let outerPoints = [];
|
||||
let method = '';//0弓子 2 回子
|
||||
|
||||
try {
|
||||
// 尝试解析 JSON
|
||||
if (res.data.jsonData) {
|
||||
const data = typeof res.data.jsonData === 'string'
|
||||
? JSON.parse(res.data.jsonData)
|
||||
: res.data.jsonData;
|
||||
pathPoints = data?.path || [];
|
||||
outerPoints = data?.outer || [];
|
||||
method = data?.planModel;
|
||||
|
||||
}
|
||||
pathPoints = res.data || [];
|
||||
} catch (err) {
|
||||
console.error('解析路线数据失败:', err);
|
||||
}
|
||||
@@ -417,15 +413,9 @@ export default function RobotTaskPage() {
|
||||
if (pathPoints.length === 0) {
|
||||
utils.message.warning(t('devices.route2'));
|
||||
}
|
||||
//if (outerPoints.length === 0 && method == 2) {
|
||||
// utils.message.warning(t('devices.route2'));
|
||||
//}
|
||||
//if (method == 0) {
|
||||
setPoints(pathPoints);
|
||||
//} else {
|
||||
// setPoints(outerPoints);
|
||||
|
||||
//}
|
||||
setPoints(pathPoints);
|
||||
|
||||
} else {
|
||||
setPoints([]);
|
||||
}
|
||||
@@ -653,13 +643,14 @@ export default function RobotTaskPage() {
|
||||
};
|
||||
|
||||
// 取消任务
|
||||
const handleCancelTask = async (task) => {
|
||||
const handleCancelTask = async (task, mode) => {
|
||||
try {
|
||||
const params = {
|
||||
taskId: task.id,
|
||||
//deviceId: task.deviceId,
|
||||
siteId: stationId,
|
||||
orgId: task.orgId,
|
||||
forceCancel: mode === 'force' ? true : false,
|
||||
};
|
||||
const res = await cancelRoute(params);
|
||||
if (res.code === 200 && res.data == true) {
|
||||
@@ -832,15 +823,17 @@ export default function RobotTaskPage() {
|
||||
dataIndex: 'taskStaus',
|
||||
width: 100,
|
||||
render: (status, record) => {
|
||||
console.log('status', status, record);
|
||||
const statusMap = {
|
||||
'NEW': { color: 'default', text: t('devices.statusNew') },
|
||||
'EXECUTING': { color: 'processing', text: t('workOrder.inProgress') },
|
||||
'PAUSE': { color: 'warning', text: t('devices.statusPaused') },
|
||||
'FINISH': { color: 'success', text: t('devices.statusFinished') },
|
||||
'FAILED': { color: 'error', text: t('devices.statusFailed') }
|
||||
'FAILED': { color: 'error', text: t('devices.statusFailed') },
|
||||
"CANCELING": { color: 'warning', text: t('devices.statusCanceling') },
|
||||
};
|
||||
const item = statusMap[status] || { color: 'default', text: record.taskStausTranslate || t('constants.locationUnknown') };
|
||||
return <Tag color={item.color}>{item.text}</Tag>;
|
||||
return <Tag color={item.color}>{record.taskStausTranslate}</Tag>;
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -889,7 +882,8 @@ export default function RobotTaskPage() {
|
||||
'EXECUTING': { color: 'processing', text: t('workOrder.inProgress') },
|
||||
'PAUSE': { color: 'warning', text: t('devices.statusPaused') },
|
||||
'FINISH': { color: 'success', text: t('devices.statusFinished') },
|
||||
'FAILED': { color: 'error', text: t('devices.statusFailed') }
|
||||
'FAILED': { color: 'error', text: t('devices.statusFailed') },
|
||||
"CANCELING": { color: 'warning', text: t('devices.statusCanceling') },
|
||||
};
|
||||
const item = statusMap[status] || { color: 'default', text: t('constants.locationUnknown') };
|
||||
return <Tag color={item.color}>{item.text}</Tag>;
|
||||
@@ -909,27 +903,46 @@ export default function RobotTaskPage() {
|
||||
|
||||
<>
|
||||
{/*{record.taskStaus === 'NEW' && (*/}
|
||||
<Popconfirm
|
||||
title={t('devices.confirmCancelTask')}
|
||||
onConfirm={() => handleCancelTask(record)}
|
||||
okText={t('common.ok')} cancelText={t('common.cancel')}
|
||||
>
|
||||
<Button type="text" size="small" danger icon={<CloseOutlined />} onClick={(e) => e.stopPropagation()}>
|
||||
{t('common.cancel')}
|
||||
</Button>
|
||||
</Popconfirm>
|
||||
<Popconfirm
|
||||
title={t('devices.confirmCancelTask')}
|
||||
description={
|
||||
<Radio.Group
|
||||
value={cancelMode}
|
||||
onChange={(e) => setCancelMode(e.target.value)}
|
||||
style={{ marginTop: 8 }}
|
||||
>
|
||||
<Space direction="vertical">
|
||||
<Radio value="normal">{t('devices.normalCancel')}</Radio>
|
||||
<Radio value="force">{t('devices.forceCancel')}</Radio>
|
||||
</Space>
|
||||
</Radio.Group>
|
||||
}
|
||||
onConfirm={() => handleCancelTask(record, cancelMode)}
|
||||
okText={t('common.ok')}
|
||||
cancelText={t('common.cancel')}
|
||||
>
|
||||
<Button
|
||||
type="text"
|
||||
size="small"
|
||||
danger
|
||||
icon={<CloseOutlined />}
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
>
|
||||
{t('common.cancel')}
|
||||
</Button>
|
||||
</Popconfirm>
|
||||
{/*//)}*/}
|
||||
|
||||
{/*{record.taskStaus === 'EXECUTING' && (*/}
|
||||
<Popconfirm
|
||||
title={t('devices.confirmPauseTask')}
|
||||
onConfirm={() => handlePauseTask(record)}
|
||||
okText={t('common.ok')} cancelText={t('common.cancel')}
|
||||
>
|
||||
<Button type="text" size="small" style={{ color: '#FF9500' }} onClick={(e) => e.stopPropagation()}>
|
||||
{t('video.pause')}
|
||||
</Button>
|
||||
</Popconfirm>
|
||||
<Popconfirm
|
||||
title={t('devices.confirmPauseTask')}
|
||||
onConfirm={() => handlePauseTask(record)}
|
||||
okText={t('common.ok')} cancelText={t('common.cancel')}
|
||||
>
|
||||
<Button type="text" size="small" style={{ color: '#FF9500' }} onClick={(e) => e.stopPropagation()}>
|
||||
{t('video.pause')}
|
||||
</Button>
|
||||
</Popconfirm>
|
||||
{/*)}/*/}
|
||||
|
||||
{record.taskStaus === 'PAUSE' && (
|
||||
|
||||
Reference in New Issue
Block a user