From 22e69b79ae8282228b72c5c1540e59bd5acbbdb0 Mon Sep 17 00:00:00 2001 From: lixiaolong <702156524@qq.com> Date: Wed, 5 Aug 2026 11:51:31 +0800 Subject: [PATCH] =?UTF-8?q?feat(inspection):=20=E6=9B=B4=E6=96=B0=E5=9C=B0?= =?UTF-8?q?=E5=9B=BE=E9=A1=B5=E9=9D=A2=E6=9C=BA=E5=99=A8=E4=BA=BA=E9=80=89?= =?UTF-8?q?=E6=8B=A9=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 优化机器人下拉选择器,添加过滤和加载状态显示 - 新增连接AGV设备的机器人筛选逻辑 - 集成机器人设备API获取AGV设备信息 - 改进机器人列表数据显示格式,显示设备ID - 添加加载状态指示器提升用户体验 - 修复机器人数据获取逻辑确保仅显示已连接AGV的机器人 --- src/views/inspection/map/index.vue | 41 ++++++++++++++++++++++-------- 1 file changed, 30 insertions(+), 11 deletions(-) diff --git a/src/views/inspection/map/index.vue b/src/views/inspection/map/index.vue index 2576ca7..d8fec87 100644 --- a/src/views/inspection/map/index.vue +++ b/src/views/inspection/map/index.vue @@ -52,7 +52,8 @@ - @@ -88,7 +89,7 @@ import { useContainerHeight } from "@/hooks/tableHeight"; import { addMap, updateMap, deleteMap, getMapList } from "../../../api/inspection/map"; -import { getRobotList, getMapByRobot, getMapJson } from "../../../api/inspection/robot"; +import { getRobotList, getMapByRobot, getMapJson, getRobotDevicesByRobotId } from "../../../api/inspection/robot"; import { onMounted } from "vue"; import { @@ -202,6 +203,7 @@ function resetQuery() { /** 新增按钮操作 */ function handleAdd() { + getRobotArr(); open.value = true; isNew.value = true; title.value = "添加地图"; @@ -212,6 +214,7 @@ function handleAdd() { /** 修改按钮操作 */ function handleUpdate(row) { + getRobotArr(); form.value = { ...row }; isNew.value = false; open.value = true; @@ -518,17 +521,33 @@ function renderFrame(timestamp) { const robotList = ref([]) const mapList = ref([]) +const robotLoading = ref(false) -const getRobotArr = () => { - getRobotList({ +const getRobotArr = async () => { + robotLoading.value = true + try { + const response = await getRobotList({ pageNum: 1, pageSize: 10000, - }).then((response) => { - robotList.value = response.rows.map(item => ({ - label: item.robotName, - value: item.id - })); - }); + connectStatus: '1' + }) + const candidates = (response.rows || []).filter(item => item.robotId) + const resolved = await Promise.allSettled(candidates.map(async item => { + const deviceResponse = await getRobotDevicesByRobotId(item.robotId, { deviceKind: 1 }) + const agvDevices = Array.isArray(deviceResponse.data) ? deviceResponse.data : [] + if (!agvDevices.length) return null + const deviceIds = agvDevices.map(device => device.deviceId).join(' / ') + return { + label: `${item.robotName || item.robotId} (${item.robotId}) · AGV: ${deviceIds}`, + value: item.id + } + })) + robotList.value = resolved + .filter(result => result.status === 'fulfilled' && result.value) + .map(result => result.value) + } finally { + robotLoading.value = false + } } const getMapArr = async (robotId) => { @@ -577,4 +596,4 @@ onMounted(() => { height: 300px; border: 1px solid #ccc; } - \ No newline at end of file +