diff --git a/src/api/device.ts b/src/api/device.ts
index 75e4cdf..8f68ab5 100644
--- a/src/api/device.ts
+++ b/src/api/device.ts
@@ -337,7 +337,7 @@ export function getDeviceTastPool(data) {
//获取历史任务
export function getSiteDeviceTaskHistory(data) {
return request({
- url: `/iot/deviceTas/getSiteDeviceTaskHistory`,
+ url: `/iot/deviceTask/getSiteDeviceTaskHistory`,
method: 'post',
data
diff --git a/src/components/devices/RobotTaskPage.tsx b/src/components/devices/RobotTaskPage.tsx
index c7d38ff..cc10e6c 100644
--- a/src/components/devices/RobotTaskPage.tsx
+++ b/src/components/devices/RobotTaskPage.tsx
@@ -310,7 +310,13 @@ export default function RobotTaskPage() {
const res = await getDeviceTastPool(params);
if (res.code === 200) {
- setTaskPoolList(res.rows || []);
+ const list = res.rows || [];
+ list.sort((a, b) => {
+ const aEmpty = !a.planId;
+ const bEmpty = !b.planId;
+ return aEmpty ? -1 : bEmpty ? 1 : 0;
+ });
+ setTaskPoolList(list);
}
} catch (err) {
console.error('获取任务池失败:', err);
@@ -339,7 +345,7 @@ export default function RobotTaskPage() {
const res = await getSiteDeviceTaskHistory(params);
if (res.code === 200) {
- setTaskHistoryList(res.data || []);
+ setTaskHistoryList(res.rows || []);
}
} catch (err) {
console.error('获取历史任务失败:', err);
@@ -628,42 +634,43 @@ export default function RobotTaskPage() {
// 历史任务表格列
const taskHistoryColumns = [
- {
- title: '任务名称',
- dataIndex: 'planName',
- width: 160,
- ellipsis: true,
- },
+
{
title: '设备',
dataIndex: 'deviceId',
- width: 150,
+ width: 250,
},
{
title: '状态',
- dataIndex: 'taskStaus',
+ dataIndex: 'taskStausTranslate',
width: 100,
- render: (status, record) => {
- const statusMap = {
- 'FINISH': { color: 'success', text: '执行成功' },
- 'FAILED': { color: 'error', text: '执行失败' },
- 'CANCELLED': { color: 'default', text: '已取消' }
- };
- const item = statusMap[status] || { color: 'default', text: '未知' };
- return {item.text};
- }
+ render: (text, record) => {
+ const status = record.taskStaus; // 原始状态值
+ let color = 'default';
+
+ if (status === 'NEW') color = 'default';
+ else if (status === 'EXECUTING') color = 'processing';
+ else if (status === 'PAUSE') color = 'warning';
+ else if (status === 'FINISH') color = 'success';
+ else if (status === 'FAILED') color = 'error';
+
+ return {text};
+ },
+
},
{
title: '开始时间',
dataIndex: 'startTime',
width: 170,
- render: t => t ? dayjs(t).format('YYYY-MM-DD HH:mm:ss') : '-'
},
{
title: '结束时间',
dataIndex: 'finishTime',
width: 170,
- render: t => t ? dayjs(t).format('YYYY-MM-DD HH:mm:ss') : '-'
+ }, {
+ title: '创建时间',
+ dataIndex: 'createTime',
+ width: 170,
}
];
@@ -1008,7 +1015,7 @@ export default function RobotTaskPage() {
columns={taskHistoryColumns}
dataSource={taskHistoryList}
pagination={false}
- scroll={{ x: 800 }}
+ scroll={{ x: 800, y: 150 }}
/>
>
)}