lvkun996 2 anni fa
parent
commit
10d38106a1

+ 3 - 12
src/controller/cvs/spaceController.ts

@@ -97,10 +97,7 @@ export class SpaceController {
       recordFormat: 'FLV' | 'TS' | 'MP4' | 'RAW'
     }
   ) {
-    const { code, data } = await getDeviceRecordById(params)
-    if (code === 200) {
-      return data
-    }
+    return await getDeviceRecordById(params)
   }
 
   static async deviceThumbById (
@@ -110,10 +107,7 @@ export class SpaceController {
       endTs?: number
     }
   ) {
-    const { code, data } = await getDeviceThumbById(params)
-    if (code === 200) {
-      return data
-    }
+    return await getDeviceThumbById(params)
   }
 
   static async deviceAiRetById (
@@ -124,9 +118,6 @@ export class SpaceController {
       aiId?: string
     }
   ) {
-    const { code, data } = await getDeviceAiRetById(params)
-    if (code === 200) {
-      return data
-    }
+    return await getDeviceAiRetById(params)
   }
 }

+ 1 - 1
src/directives/index.ts

@@ -32,7 +32,7 @@ export const keyboard: Directive = {
 
 }
 
-export const copy = {
+export const copy: Directive = {
   mounted (el: HTMLElement, binding: DirectiveBinding) {
     el.addEventListener('click', () => {
       const inputValue = document.createElement('input')

+ 98 - 13
src/pages/cvs/video/device.vue

@@ -90,26 +90,37 @@
     @tabChange="key => onTabChange(key)"
   >
     <table-pro
-      :service="deviceActionMap.get(activeTabKey)"
+      :service="deviceActionMap.get(activeTabKey)?.get"
       :serviceParams="deviceActionParams"
+      :columns="deviceActionMap.get(activeTabKey)?.column"
       :hiddenMeunKeys="['add']"
     >
-      <a-range-picker v-model:value="deviceActionParams.times" />
-      <a-select  v-model:value="deviceActionParams.recordFormat" >
-        <a-select-options v-for="item in SpaceController.recordFormat" :key="item" :value="item" >
-          {{item}}
-        </a-select-options>
-      </a-select>
+      <template #search >
+        <a-space>
+          <a-range-picker v-model:value="deviceActionParams.times" />
+          <a-select  v-model:value="deviceActionParams.recordFormat" >
+            <a-select-options v-for="item in SpaceController.recordFormat" :key="item" :value="item" >
+              {{item}}
+            </a-select-options>
+          </a-select>
+          <a-button type="primary" @click="search">搜索</a-button>
+        </a-space>
+      </template>
+      <template #render="{column, record}" >
+        <template v-if="column.key === 'recordStartTs'" >{{dayjs(record.recordStartTs).format('YYYY/MM/DD HH:mm:ss')}}</template>
+        <template v-if="column.key === 'recordEndTs'" >{{dayjs(record.recordEndTs).format('YYYY/MM/DD HH:mm:ss')}}</template>
+      </template>
     </table-pro>
   </a-card>
 </modal-pro>
 </template>
 <script lang='ts' setup >
 import { InputTsx } from '@/components/MicroComponents/index'
-import { reactive, onMounted, nextTick, ref, getCurrentInstance } from 'vue'
+import { reactive, onMounted, nextTick, ref, getCurrentInstance, watch } from 'vue'
 import { Form } from 'ant-design-vue'
 import { SpaceController } from '@/controller'
 import { useRoute } from 'vue-router'
+import dayjs from 'dayjs'
 
 const columns = [
   {
@@ -160,10 +171,69 @@ const deviceTabs = [
   { key: 'ai', tab: 'AI分析' }
 ]
 
+const recordColumn = [
+  {
+    title: '录制格式',
+    dataIndex: 'recordFormat',
+    key: 'recordFormat'
+  },
+  {
+    title: '录制开始时间',
+    dataIndex: 'recordStartTs',
+    key: 'recordStartTs'
+  },
+  {
+    title: '录制结束时间',
+    dataIndex: 'recordEndTs',
+    key: 'recordEndTs'
+  },
+  {
+    title: '可播放地址',
+    dataIndex: 'recordUrl',
+    key: 'recordUrl'
+  }
+]
+
+const thumbColumn = [
+  {
+    title: '截图地址',
+    dataIndex: 'thumbUrl',
+    key: 'thumbUrl'
+  },
+  {
+    title: '截图时间',
+    dataIndex: 'thumbTs',
+    key: 'thumbTs'
+  }
+]
+
+const aiColumn = [
+  {
+    title: '算子模型id',
+    dataIndex: 'aiId',
+    key: 'aiId'
+  },
+  {
+    title: '类型',
+    dataIndex: 'aiRetType',
+    key: 'aiRetType'
+  },
+  {
+    title: '结果地址',
+    dataIndex: 'aiRetUrl',
+    key: 'aiRetUrl'
+  },
+  {
+    title: '时间',
+    dataIndex: 'aiTs',
+    key: 'aiTs'
+  }
+]
+
 const deviceActionMap = new Map([
-  ['record', { get: SpaceController.deviceRecordById }],
-  ['thumb', { get: SpaceController.deviceThumbById }],
-  ['ai', { get: SpaceController.deviceAiRetById }]
+  ['record', { get: SpaceController.deviceRecordById, column: recordColumn }],
+  ['thumb', { get: SpaceController.deviceThumbById, column: thumbColumn }],
+  ['ai', { get: SpaceController.deviceAiRetById, column: aiColumn }]
 ])
 
 const state = reactive<{
@@ -178,9 +248,20 @@ const state = reactive<{
 
 const deviceActionParams = reactive({
   times: [],
-  recordFormat: ''
+  startTs: '',
+  endTs: '',
+  recordFormat: '',
+  deviceId: ''
 })
 
+watch(
+  () => deviceActionParams.times,
+  () => {
+    deviceActionParams.startTs = dayjs(deviceActionParams.times[0]).unix() as unknown as string
+    deviceActionParams.endTs = dayjs(deviceActionParams.times[0]).unix() as unknown as string
+  }
+)
+
 const deviceState = reactive({
   spaceId: undefined,
   deviceName: '',
@@ -200,7 +281,10 @@ const { resetFields, validate, validateInfos } = useForm(deviceState, {
   stream: [{ required: true, message: '请填写stream名称' }]
 })
 
-const onTabChange = (key: 'record' | 'thumb' | 'ai') => activeTabKey.value = key
+const onTabChange = (key: 'record' | 'thumb' | 'ai') => {
+  activeTabKey.value = key
+  tableProDom.value.reload()
+}
 
 const ok = () => {
   validate().then(async () => {
@@ -214,6 +298,7 @@ const ok = () => {
 const recordParty = async (record: CVS.device) => {
   state.activeVisible = true
   resetFields({ ...record })
+  deviceActionParams.deviceId = record.deviceId as unknown as string
   activeTabKey.value = 'record'
   // const data = await SpaceController.deviceRecordById({ deviceId: record.deviceId, page: 1, pageSize: 10, recordFormat: 'FLV' })
 }