From e4b3a91dd21b8bd512eb76768aec965f7641e53f Mon Sep 17 00:00:00 2001 From: yueliuli <1628111725@qq.com> Date: Wed, 22 Apr 2026 17:56:30 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E9=9A=90=E6=82=A3=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E3=80=81=E9=9A=90=E6=82=A3=E6=A3=80=E6=9F=A5=E9=A1=B5?= =?UTF-8?q?=E3=80=81=E9=9A=90=E6=82=A3=E7=BB=93=E6=9E=9C=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 隐患列表 - 移除物体标签 - 重大隐患时编号标签为危险色 - 一般隐患时编号标签为主题色 隐患检查页 - 接入视频文件列表刷新api - 更新表单提交逻辑 隐患结果页 - 完善视频路径获取接口(临时版,自动拼接为本机地址) --- src/components/hazard_inspect/ItemList.vue | 19 +++++++- src/composables/api.ts | 2 +- .../nav/hazardCheck/HazardCheckResult.vue | 33 +++++++------ src/pages/nav/hazardCheck/index.vue | 47 +++++++++++++++---- 4 files changed, 75 insertions(+), 26 deletions(-) diff --git a/src/components/hazard_inspect/ItemList.vue b/src/components/hazard_inspect/ItemList.vue index ac2be16..9bee426 100644 --- a/src/components/hazard_inspect/ItemList.vue +++ b/src/components/hazard_inspect/ItemList.vue @@ -36,7 +36,24 @@ function handleItemClick(item: string, index: number) { + + + + {{ index + 1 }} + + + {{ index + 1 }} + +
+ + {{ (item as number[])[1] }} + + + + + + diff --git a/src/composables/api.ts b/src/composables/api.ts index 7771674..3464878 100644 --- a/src/composables/api.ts +++ b/src/composables/api.ts @@ -17,6 +17,6 @@ export async function runApi(funcName: string, params: Record) { catch (error) { // 捕获异常,打印错误信息 console.error('接口调用失败:', error) - throw error + return 'error' } } diff --git a/src/pages/nav/hazardCheck/HazardCheckResult.vue b/src/pages/nav/hazardCheck/HazardCheckResult.vue index 8484793..9e9f3f0 100644 --- a/src/pages/nav/hazardCheck/HazardCheckResult.vue +++ b/src/pages/nav/hazardCheck/HazardCheckResult.vue @@ -2,7 +2,7 @@ import { computed, onMounted, ref } from 'vue' import { useRouter } from 'vue-router' -// import { runApi } from '~/composables/api' +import { runApi } from '~/composables/api' interface HazardItem { 隐患编号: string @@ -19,7 +19,8 @@ interface HazardItem { } interface DataFormat { - 隐患列表: [number, string, string][] + 隐患列表: [number, string][] + // 隐患列表: [number, string, string][] 隐患范围字典: Record 隐患数据: HazardItem[] } @@ -134,7 +135,7 @@ function getData() { data.value.隐患列表 = (objects || []).map((obj: any) => { return [ obj.level, - resultData.value?.class_list?.[obj.class_id] || '', + // resultData.value?.class_list?.[obj.class_id] || '', tag?.[obj.tag_id] || '', ] }) @@ -241,17 +242,21 @@ onMounted(() => { // 从路由参数中获取数据 const vidFile = router.currentRoute.value.query.vid_file as string if (vidFile) { - // runApi('/get_vidUrl', { - // vid_file: vidFile, - // }).then((res) => { - // // console.log('接口调用成功,返回数据:', res) - // // vidUrl.value = res[0] - // vidUrl.value = 'http://localhost:8086/santai5_h264.mp4' - // console.log('完整视频路径:', vidUrl.value) - // }) - // 测试用视频路径 - vidUrl.value = 'http://localhost:8086/santai5_h264.mp4' - // console.log('完整视频路径:', vidUrl.value) + runApi('/get_full_vid_path', { + vid_file: vidFile, + }).then((res) => { + // console.log('接口调用成功,返回数据:', res) + vidUrl.value = (res as string[])[0] + + // 截取文件名 + const fileName = vidUrl.value.split('\\').pop() || '' + // 去掉文件扩展名 + const fileNameNoExt = fileName.split('.')[0] + // 文件扩展名 + const fileExt = fileName.split('.')[1] + // 临时拼接视频路径 + vidUrl.value = `http://localhost:8086/${fileNameNoExt}_h264.${fileExt}` + }) // runApi('/run', { // vid_file: vidFile, diff --git a/src/pages/nav/hazardCheck/index.vue b/src/pages/nav/hazardCheck/index.vue index d0921c7..17f073c 100644 --- a/src/pages/nav/hazardCheck/index.vue +++ b/src/pages/nav/hazardCheck/index.vue @@ -1,6 +1,6 @@