第一版

This commit is contained in:
renna 2025-06-09 16:44:34 +08:00
parent f615b15783
commit 4f66210e77
2 changed files with 47 additions and 14 deletions

View File

@ -127,6 +127,14 @@ export const robotApi = {
url: '/api/v1/events/getEtypeNameList', url: '/api/v1/events/getEtypeNameList',
method: 'get', method: 'get',
}) })
},
// 获取机器人任务列表
getRobotTaskList: (params) => {
return service({
url: '/api/v1/events/robotTask',
method: 'get',
params
})
} }
} }

View File

@ -287,17 +287,17 @@ const envData = ref([
]); ]);
// //
const tasks = ref([ // const tasks = ref([
{ area: "A区设备巡检任务", time: "2025-05-01 12:30:50", status: "已完成", type: "completed" }, // { area: "A", time: "2025-05-01 12:30:50", status: "", type: "completed" },
{ area: "B区监控压力巡检", time: "2025-05-01 12:30:00", status: "进行中", type: "running" }, // { area: "B", time: "2025-05-01 12:30:00", status: "", type: "running" },
{ area: "C区监控管压任务", time: "2025-05-01 12:30:50", status: "进行中", type: "running" }, // { area: "C", time: "2025-05-01 12:30:50", status: "", type: "running" },
{ area: "A区设备巡检任务", time: "2025-05-01 12:30:00", status: "已完成", type: "completed" }, // { area: "A", time: "2025-05-01 12:30:00", status: "", type: "completed" },
{ area: "A区设备巡检任务", time: "2025-05-01 12:30:50", status: "已完成", type: "completed" }, // { area: "A", time: "2025-05-01 12:30:50", status: "", type: "completed" },
{ area: "B区监控压力巡检", time: "2025-05-01 12:30:00", status: "进行中", type: "running" }, // { area: "B", time: "2025-05-01 12:30:00", status: "", type: "running" },
{ area: "C区监控管压任务", time: "2025-05-01 12:30:50", status: "进行中", type: "running" }, // { area: "C", time: "2025-05-01 12:30:50", status: "", type: "running" },
{ area: "A区设备巡检任务", time: "2025-05-01 12:30:00", status: "已完成", type: "completed" }, // { area: "A", time: "2025-05-01 12:30:00", status: "", type: "completed" },
{ area: "D区待执行任务", time: "2025-05-02 09:00:00", status: "待执行", type: "pending" }, // { area: "D", time: "2025-05-02 09:00:00", status: "", type: "pending" },
]); // ]);
const taskCount = computed(() => tasks.value.length); const taskCount = computed(() => tasks.value.length);
// //
@ -307,7 +307,31 @@ const taskCount = computed(() => tasks.value.length);
// { title: "", image: "./img/pic3.png", active: false }, // { title: "", image: "./img/pic3.png", active: false },
// { title: "", image: "./img/pic4.png", active: false } // { title: "", image: "./img/pic4.png", active: false }
// ]); // ]);
const tasks = ref([]);
//
const fetchTasks = async (robotId) => {
try {
const res = await robotApi.getRobotTaskList({ robotId: robotId});
if (res.code === 200 && Array.isArray(res.data)) {
//
tasks.value = res.data.map(item => ({
area: item.taskName || '',
time: item.times || '',
status: item.status === '0' ? '待执行' : '执行中',
type: item.status === '0' ? 'pending' : 'running'
}));
console.log("--------------------------------",tasks.value);
} else {
tasks.value = [];
}
} catch (error) {
tasks.value = [];
}
};
// //
const handleFullscreen = () => { const handleFullscreen = () => {
console.log("全屏显示"); console.log("全屏显示");
@ -1759,6 +1783,7 @@ const handleWebSocketMessage = (data) => {
getDutyInfo(data.robotId); getDutyInfo(data.robotId);
// //
debouncedGetRobotDetail(data.robotId); debouncedGetRobotDetail(data.robotId);
fetchTasks(robotInfo.value.robotId);
} }
} }
@ -1939,7 +1964,6 @@ const eventTypeOptions = ref(['全部告警']);
// //
onMounted(async () => { onMounted(async () => {
// ... existing code ...
try { try {
// //
const res = await robotApi.getEventTypes(); const res = await robotApi.getEventTypes();
@ -1949,7 +1973,7 @@ onMounted(async () => {
} catch (e) { } catch (e) {
console.error('获取告警类型失败', e); console.error('获取告警类型失败', e);
} }
// ... existing code ...
}); });
</script> </script>
@ -2314,6 +2338,7 @@ onMounted(async () => {
flex-direction: column; flex-direction: column;
gap: 15px; gap: 15px;
position: relative; position: relative;
} }
.camera-title { .camera-title {
font-size: 14px; font-size: 14px;