From c3e84e287a41e03cafbac088203cb60eaed539df Mon Sep 17 00:00:00 2001
From: houzhongjian <houzhongyi@126.com>
Date: 星期四, 31 十月 2024 10:30:25 +0800
Subject: [PATCH] 摄像头管理增加抓图方式字段

---
 src/views/data/dev/camera/camera.vue                            |   10 ++++++++--
 src/layout/components/Menu/src/components/useRenderMenuItem.tsx |    1 -
 src/utils/dict.ts                                               |    1 +
 src/views/data/dev/camera/CameraForm.vue                        |   25 +++++++++++++++++++------
 4 files changed, 28 insertions(+), 9 deletions(-)

diff --git a/src/layout/components/Menu/src/components/useRenderMenuItem.tsx b/src/layout/components/Menu/src/components/useRenderMenuItem.tsx
index 301313f..4cdc109 100644
--- a/src/layout/components/Menu/src/components/useRenderMenuItem.tsx
+++ b/src/layout/components/Menu/src/components/useRenderMenuItem.tsx
@@ -16,7 +16,6 @@
           const meta = v.meta ?? {}
           const { oneShowingChild, onlyOneChild } = hasOneShowingChild(v.children, v)
           const fullPath = isUrl(v.path) ? v.path : pathResolve(parentPath, v.path) // getAllParentPath<AppRouteRecordRaw>(allRouters, v.path).join('/')
-
           if (
             oneShowingChild &&
             (!onlyOneChild?.children || onlyOneChild?.noShowingChildren) &&
diff --git a/src/utils/dict.ts b/src/utils/dict.ts
index a9b5c62..c2403d5 100644
--- a/src/utils/dict.ts
+++ b/src/utils/dict.ts
@@ -182,4 +182,5 @@
   VALUETYPE = 'value_type',
   NVR_ONLINE_STATUS = 'nvr_online_status',
   CAMERA_BRAND = 'camera_brand',
+  CAPTURE_TYPE = 'capture_type',
 }
diff --git a/src/views/data/dev/camera/CameraForm.vue b/src/views/data/dev/camera/CameraForm.vue
index d41a825..8794006 100644
--- a/src/views/data/dev/camera/CameraForm.vue
+++ b/src/views/data/dev/camera/CameraForm.vue
@@ -13,6 +13,18 @@
             <el-input v-model="formData.code" placeholder="请输入编码" />
           </el-form-item>
         </el-col>
+        <el-col :span="12">
+          <el-form-item label="抓图方式">
+            <el-select v-model="formData.captureType" placeholder="请选择">
+              <el-option
+                v-for="dict in getStrDictOptions(DICT_TYPE.CAPTURE_TYPE)"
+                :key="dict.value"
+                :label="dict.label"
+                :value="dict.value"
+              />
+            </el-select>
+          </el-form-item>
+        </el-col>
       </el-row>
       <el-row>
         <el-col :span="12">
@@ -43,6 +55,7 @@
 </template>
 <script lang="ts" setup>
 import * as CameraApi from '@/api/data/dev/camera'
+import {DICT_TYPE, getIntDictOptions, getStrDictOptions} from "@/utils/dict";
 
 defineOptions({ name: 'CameraForm' })
 
@@ -57,12 +70,14 @@
   id: undefined,
   nvrId: '',
   code: undefined,
+  captureType: '',
   channel: undefined,
   location: undefined,
   remark: undefined
 })
 const formRules = reactive({
   code: [{ required: true, message: '编码不能为空', trigger: 'blur' }],
+  captureType: [{ required: true, message: '抓图方式不能为空', trigger: 'blur' }],
   channel: [{ required: true, message: '通道不能为空', trigger: 'blur' }],
   location: [{ required: true, message: '监控区域不能为空', trigger: 'blur' }]
 })
@@ -120,13 +135,11 @@
 const resetForm = () => {
   formData.value = {
     id: undefined,
-    brand: undefined,
+    nvrId: '',
     code: undefined,
-    name: undefined,
-    ip: undefined,
-    port: undefined,
-    username: undefined,
-    password: undefined,
+    captureType: '',
+    channel: undefined,
+    location: undefined,
     remark: undefined
   }
   formRef.value?.resetFields()
diff --git a/src/views/data/dev/camera/camera.vue b/src/views/data/dev/camera/camera.vue
index 69dcfcb..1807a30 100644
--- a/src/views/data/dev/camera/camera.vue
+++ b/src/views/data/dev/camera/camera.vue
@@ -54,8 +54,13 @@
 
   <!-- 列表 -->
     <el-table v-loading="loading" :data="list">
-      <el-table-column label="编码" align="center" prop="code" />
-      <el-table-column label="通道" align="center" prop="channel" />
+      <el-table-column label="编码" align="center" prop="code" width="80" />
+      <el-table-column label="抓图方式" align="center" prop="captureType" width="80">
+        <template #default="scope">
+          <dict-tag :type="DICT_TYPE.CAPTURE_TYPE" :value="scope.row.captureType" />
+        </template>
+      </el-table-column>
+      <el-table-column label="通道" align="center" prop="channel" width="80"  />
       <el-table-column label="监控区域" align="center" prop="location" />
       <el-table-column label="备注" align="center" prop="remark" width="200" />
       <el-table-column label="操作" align="center" min-width="110" fixed="right">
@@ -96,6 +101,7 @@
 import download from '@/utils/download'
 import * as CameraApi from '@/api/data/dev/camera'
 import CameraForm from './CameraForm.vue'
+import {DICT_TYPE} from "@/utils/dict";
 
 defineOptions({name: 'Camera'})
 

--
Gitblit v1.9.3