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 cf3e99760..ea2c0bf8c 100644 --- a/apps/web-antd/src/views/aiot/device/roi/index.vue +++ b/apps/web-antd/src/views/aiot/device/roi/index.vue @@ -47,6 +47,7 @@ const router = useRouter(); // ==================== 摄像头选择 ==================== const cameraCode = ref(''); +const currentCamera = ref(null); const showCameraSelector = ref(false); const cameraOptions = ref< @@ -74,6 +75,8 @@ onMounted(async () => { const q = route.query; if (q.cameraCode) { cameraCode.value = String(q.cameraCode); + // 加载摄像头信息以获取应用名 + await loadCurrentCamera(); await buildSnapUrl(); loadRois(); } else { @@ -84,6 +87,19 @@ onMounted(async () => { // ==================== 摄像头加载与选择 ==================== +async function loadCurrentCamera() { + try { + const res = await getCameraList({ page: 1, count: 200 }); + const list = res.list || []; + const camera = list.find((c: AiotDeviceApi.Camera) => c.cameraCode === cameraCode.value); + if (camera) { + currentCamera.value = camera; + } + } catch { + console.error('加载摄像头信息失败'); + } +} + async function loadCameraOptions() { cameraLoading.value = true; try { @@ -91,7 +107,7 @@ async function loadCameraOptions() { const list = res.list || []; cameraOptions.value = list.map((cam: AiotDeviceApi.Camera) => ({ value: cam.cameraCode || '', - label: `${cam.cameraCode || cam.stream}${cam.srcUrl ? ` (${cam.srcUrl})` : ''}`, + label: `${cam.app || cam.stream}${cam.srcUrl ? ` (${cam.srcUrl})` : ''}`, camera: cam, })); } catch { @@ -105,6 +121,7 @@ async function onCameraSelected(val: string) { const opt = cameraOptions.value.find((o) => o.value === val); if (opt) { cameraCode.value = val; + currentCamera.value = opt.camera; showCameraSelector.value = false; await buildSnapUrl(); loadRois(); @@ -280,7 +297,7 @@ function handlePush() {