Ver código fonte

feat: aibox接口

lvkun 2 anos atrás
pai
commit
356de73c42

+ 6 - 3
config/proxy.ts

@@ -6,17 +6,20 @@
 module.exports = {
   dev: {
     '/user': {
-      target: 'http://120.223.238.91:8888',
+      // target: 'http://120.223.238.91:8888',
+      target: 'http://124.222.113.37:9999',
       changeOrigin: true,
       pathRewrite: { '^/user': '' }
     },
     '/cvss': {
-      target: 'http://120.223.238.91:6666',
+      // target: 'http://120.223.238.91:6666',
+      target: 'http://124.222.113.37:8080',
       changeOrigin: true,
       pathRewrite: { '^/cvss': '' }
     },
     '/iot': {
-      target: 'http://120.223.238.91:8888',
+      // target: 'http://120.223.238.91:8888',
+      target: 'http://124.222.113.37:8888',
       changeOrigin: true,
       pathRewrite: { '^/iot': '' }
     },

+ 22 - 0
src/api/cvs/aibox.ts

@@ -71,3 +71,25 @@ export const reboot = (clientId: string) => {
     method: 'POST'
   })
 }
+
+export const getAiBoxEvent = (params: {devId: string, eventType: CVS.AiBox.eventType, start: string, end: string}) => {
+  return request<CVS.AiBox.Event[]>({
+    url: '/aiBox/event',
+    method: 'GET',
+    params
+  })
+}
+
+export const getAiBoxForward = () => {
+  return request<CVS.AiBox.Forward[]>({
+    url: '/aiBox/event/forward',
+    method: 'GET'
+  })
+}
+
+// export const addAiBoxForward = () => {
+//   return request<CVS.AiBox.Forward[]>({
+//     url: '/aiBox/event/forward',
+//     method: 'POST'
+//   })
+// }

+ 18 - 1
src/controller/cvs/aiboxController.ts

@@ -1,7 +1,20 @@
-import { dimensionAiBox, getAiBoxList, getAiBoxPage, getStream, getSys, getTaskByClientId, reboot, refreshStream, refreshSys, refreshTask } from '@/api/cvs/aibox'
+import { dimensionAiBox, getAiBoxEvent, getAiBoxList, getAiBoxPage, getStream, getSys, getTaskByClientId, reboot, refreshStream, refreshSys, refreshTask } from '@/api/cvs/aibox'
 import { message } from 'ant-design-vue'
 
 export class AiboxController {
+  static eventType: {EventType: CVS.AiBox.eventType, EventName: string}[] = [
+    { EventType: 0, EventName: '人脸识别' },
+    { EventType: 1, EventName: '人流统计' },
+    { EventType: 2, EventName: '明烟明火' },
+    { EventType: 3, EventName: '抽烟打电话' },
+    { EventType: 4, EventName: '口罩检测' },
+    { EventType: 5, EventName: '安全帽检测' },
+    { EventType: 6, EventName: '越线监测' },
+    { EventType: 7, EventName: '区域围栏' },
+    { EventType: 8, EventName: '反光衣检测' },
+    { EventType: 9, EventName: '电动车检测' }
+  ]
+
   static async page (params: COMMON.API.QueryParams & {name?: string, state: 'OFFLINE' | 'ONLINE'}) {
     return await getAiBoxPage(params)
   }
@@ -55,4 +68,8 @@ export class AiboxController {
     const { code, msg } = await reboot(clientId)
     code === 200 ? message.success('重启成功') : message.error(msg)
   }
+
+  static async event (params: {devId: string, eventType: CVS.AiBox.eventType, start: string, end: string}) {
+    return await getAiBoxEvent(params)
+  }
 }

+ 1 - 1
src/layout/layout.vue

@@ -3,7 +3,7 @@
       <a-layout >
 
         <SiderBar />
-        <span>
+        <span style="width: 100%;" >
           <Navbar />
           <div class="content" id="content"  >
             <RouterTravel />

+ 8 - 0
src/pages/cvs/ai/forward.vue

@@ -0,0 +1,8 @@
+<template>
+<a-card title="事件转发" >
+</a-card>
+</template>
+<script lang='ts' setup >
+</script>
+<style lang='less' scoped >
+</style>

+ 9 - 0
src/pages/cvs/ai/manage.vue

@@ -0,0 +1,9 @@
+
+<template>
+<a-card title="事件管理" >
+</a-card>
+</template>
+<script lang='ts' setup >
+</script>
+<style lang='less' scoped >
+</style>

+ 12 - 0
src/router/index.ts

@@ -405,6 +405,18 @@ const cvs = {
           name: '设备视频',
           icon: '',
           component: () => import('@/pages/cvs/edge/video.vue')
+        },
+        {
+          path: '/cvs/ai/manage',
+          name: 'AI事件管理',
+          icon: '',
+          component: () => import('@/pages/cvs/ai/manage.vue')
+        },
+        {
+          path: '/cvs/ai/forward',
+          name: 'AI事件转发',
+          icon: '',
+          component: () => import('@/pages/cvs/ai/forward.vue')
         }
       ]
     },

+ 36 - 0
src/type/cvs.d.ts

@@ -175,6 +175,42 @@ declare namespace CVS {
       'devID': string
     }
 
+    type eventType = 0 | 1 | 2 | 3 | 4 | 5 |6 |7 |8 | 9
+
+    interface Event {
+      'saveTs': number,
+      'DevID': string,
+      'EventType': eventType,
+      'EventName': string,
+      'Data': {
+        'CameraID': string,
+        'CameraName': string,
+        'TaskName': string,
+        'TriggerTime': string,
+        'BkgPic': string,
+        'WarnPic': string,
+        'RecordType': string,
+        'EnterSum': string,
+        'ExitSum': string
+      }
+    }
+
+    interface Forward {
+      'createAt': number,
+      'updateAt': null,
+      'id': number,
+      'forwardType': 'HTTP' | 'KAFKA', // 转发类型 HTTP KAFKA
+      'forwardConfig': { // 转发配置
+        'forwardType': string,
+        'endpointUrl': null,
+        'requestMethod': string,
+        'requestHeaders': {
+          'Accept': string
+        },
+        'defaultTimeout': number
+      }
+    }
+
   }
 
   namespace Nodes {