diff --git a/apps/web-antd/src/api/aiot/edge/index.ts b/apps/web-antd/src/api/aiot/edge/index.ts index 39cf9843c..3abc1091d 100644 --- a/apps/web-antd/src/api/aiot/edge/index.ts +++ b/apps/web-antd/src/api/aiot/edge/index.ts @@ -1,6 +1,6 @@ import type { PageParam, PageResult } from '@vben/request'; -import { requestClient } from '#/api/request'; +import { wvpRequestClient } from '#/api/aiot/request'; export namespace AiotEdgeApi { /** 边缘设备 VO */ @@ -34,22 +34,23 @@ export namespace AiotEdgeApi { /** 分页查询边缘设备列表 */ export function getDevicePage(params: PageParam) { - return requestClient.get>( - '/aiot/edge/device/page', + return wvpRequestClient.get>( + '/api/ai/device/page', { params }, ); } /** 获取设备详情 */ -export function getDevice(id: string) { - return requestClient.get( - `/aiot/edge/device/get?id=${id}`, +export function getDevice(deviceId: string) { + return wvpRequestClient.get( + '/api/ai/device/get', + { params: { deviceId } }, ); } /** 获取设备统计 */ export function getDeviceStatistics() { - return requestClient.get( - '/aiot/edge/device/statistics', + return wvpRequestClient.get( + '/api/ai/device/statistics', ); } diff --git a/apps/web-antd/src/views/aiot/device/roi/index.vue b/apps/web-antd/src/views/aiot/device/roi/index.vue index 4bd7713b2..e5dd122a0 100644 --- a/apps/web-antd/src/views/aiot/device/roi/index.vue +++ b/apps/web-antd/src/views/aiot/device/roi/index.vue @@ -35,6 +35,7 @@ import { pushConfig, saveRoi, } from '#/api/aiot/device'; +import { wvpRequestClient } from '#/api/aiot/request'; import RoiAlgorithmBind from './components/RoiAlgorithmBind.vue'; import RoiCanvas from './components/RoiCanvas.vue'; @@ -64,6 +65,17 @@ const selectedRoiId = ref(null); const selectedRoiBindings = ref([]); const snapUrl = ref(''); +const edgeDevices = ref>([]); + +async function loadEdgeDevices() { + try { + const list = await wvpRequestClient.get>('/api/ai/device/list'); + edgeDevices.value = (list as any) || []; + } catch { + edgeDevices.value = [{ deviceId: 'edge' }]; + } +} + const selectedRoi = computed(() => { if (!selectedRoiId.value) return null; return roiList.value.find((r) => r.roiId === selectedRoiId.value) || null; @@ -72,6 +84,7 @@ const selectedRoi = computed(() => { // ==================== 初始化 ==================== onMounted(async () => { + loadEdgeDevices(); const q = route.query; if (q.cameraCode) { cameraCode.value = String(q.cameraCode); @@ -187,7 +200,7 @@ async function onRoiDrawn(data: { coordinates: string; roi_type: string }) { priority: 0, enabled: 1, description: '', - deviceId: 'edge', // 默认关联边缘设备 + deviceId: edgeDevices.value[0]?.deviceId || 'edge', // 默认关联边缘设备 }; try { await saveRoi(newRoi); @@ -416,11 +429,12 @@ function handlePush() { placeholder="选择边缘设备" @change="updateRoiData(selectedRoi!)" > - edge-001(默认) - + + {{ dev.deviceId }} +
- 关联的边缘推理节点,默认 edge-001 + 关联的边缘推理节点