Quellcode durchsuchen

feat(rts): 国标设备

wangxiao vor 2 Jahren
Ursprung
Commit
c81d1fa090

+ 26 - 0
src/api/rts/stream.ts

@@ -179,3 +179,29 @@ export const getMonitorTrack = (params: {time: string, streamPath: string}) => {
     params
   })
 }
+
+/** 国标设备 */
+export const getGB28181Device = () => {
+  return request<RTS.GB2881.Detail[]>({
+    url: '/gb28181/api/list',
+    method: 'GET'
+  })
+}
+
+/** 国标设备录像 */
+export const getGB28181Record = (params: {id: string, channel: string, startTime:string, endTime:string}) => {
+  return request<RTS.GB2881.Record[]>({
+    url: '/gb28181/api/records',
+    method: 'GET',
+    params
+  })
+}
+
+/** 国标设备录像 */
+export const controlGB28181 = (params: {id: string, channel: string, ptzcmd:string}) => {
+  return request<string>({
+    url: '/gb28181/api/control',
+    method: 'GET',
+    params
+  })
+}

+ 13 - 1
src/controller/rts/rts.ts

@@ -1,4 +1,4 @@
-import { closeStream, createRtmpPull, createRtmpPush, createRtspPull, createRtspPush, getConfig, getPullList, getPushList, getRecording, getRecordList, getStreams, getSummary, playRecord, postConfig, postRecord, stopPull, stopPush, stopRecord, updateConfig } from '@/api/rts/stream'
+import { closeStream, createRtmpPull, createRtmpPush, createRtspPull, createRtspPush, getConfig, getPullList, getPushList, getRecording, getRecordList, getStreams, getSummary, playRecord, postConfig, postRecord, stopPull, stopPush, stopRecord, updateConfig, controlGB28181, getGB28181Device, getGB28181Record } from '@/api/rts/stream'
 import { message } from 'ant-design-vue'
 
 export class RtsController {
@@ -96,4 +96,16 @@ export class RtsController {
   static async summary () {
     return await getSummary()
   }
+
+  static async listGB28181 () {
+    return await getGB28181Device()
+  }
+
+  static async getGB28181Record (params: {id: string, channel: string, startTime:string, endTime:string}) {
+    return await getGB28181Record(params)
+  }
+
+  static async controlGB28181 (params: {id: string, channel: string, ptzcmd:string}) {
+    return await controlGB28181(params)
+  }
 }

+ 0 - 2
src/pages/Iot/device/index.vue

@@ -271,8 +271,6 @@ const getDevicePage = async () => {
 }
 
 const getDeviceStatistics = async () => {
-  console.log('223')
-
   const data = await DeviceContriller.statistics({ modelId: state.modelId })
   state.deviceCount = data as any
 }

+ 135 - 0
src/pages/rts/gb28181/index.vue

@@ -0,0 +1,135 @@
+<template>
+    <a-card>
+        <a-table
+        style="margin-top: 20px;"
+        :columns="columns"
+        :data-source="state.dataSource"
+        :loading="state.loading"
+        >
+        <template #bodyCell="{column, record}">
+        <template v-if="column.key === 'action'">
+            <a-space>
+              <a @click="goGB28181Records(record.id)">查看录像</a>
+              <a @click="openModal(record.id)" >控制</a>
+            </a-space>
+          </template>
+      </template>
+        </a-table>
+    </a-card>
+    <a-modal
+    title="控制设备"
+    :visible="state.controlVisible"
+    ok-text="确定"
+    cancel-text="取消"
+    @cancel="closeModel"
+    @ok="controlGB28181Device"
+  >
+   <a-form :label-col="{span: 4}" :wrapper-col="{span: 14}">
+    <a-form-item label="通道" v-bind="controlParamsState.channel">
+      <a-input v-model:value="controlParamsState.channel"  />
+    </a-form-item>
+    <a-form-item label="命令"  v-bind="controlParamsState.ptzcmd">
+      <a-input v-model:value="controlParamsState.ptzcmd"  />
+    </a-form-item>
+   </a-form>
+  </a-modal>
+</template>
+<script lang="ts" setup >
+import { RtsController } from '@/controller/rts'
+import { onMounted, reactive } from 'vue'
+
+const columns = [
+  {
+    title: 'ID',
+    dataIndex: 'ID'
+  },
+  {
+    title: '名称',
+    dataIndex: 'Name'
+  },
+  {
+    title: '制造商',
+    dataIndex: 'Manufacturer'
+  },
+  {
+    title: '注册时间',
+    dataIndex: 'RegisterTime'
+  },
+  {
+    title: '状态',
+    dataIndex: 'Status'
+  },
+  {
+    title: '网络地址',
+    dataIndex: 'NetAddr'
+  },
+  {
+    title: 'Owner',
+    dataIndex: 'Owner'
+  },
+  {
+    title: 'gps时间',
+    dataIndex: 'GpsTime'
+  },
+  {
+    title: '经度',
+    dataIndex: 'Longitude'
+  },
+  {
+    title: '纬度',
+    dataIndex: 'Latitude'
+  },
+  {
+    title: '操作',
+    dataIndex: 'action',
+    key: 'action'
+  }
+]
+const controlParamsState = reactive({
+  id: '',
+  channel: '',
+  ptzcmd: ''
+})
+
+const state = reactive<{
+  dataSource: RTS.GB2881.Detail[]
+  loading: boolean
+  controlVisible: boolean
+  detail: Partial<RTS.GB2881.Detail>
+}>({
+  loading: false,
+  controlVisible: false,
+  detail: {},
+  dataSource: []
+})
+
+const getGB28181List = async () => {
+  const { data } = await RtsController.listGB28181()
+  state.dataSource = data
+}
+
+const goGB28181Records = async (id :string) => {
+  router.push({ path: '/gb28181/record', query: { id } })
+}
+
+const controlGB28181Device = async () => {
+  const { data } = await RtsController.controlGB28181(controlParamsState)
+  console.log(data)
+}
+
+onMounted(() => {
+  getGB28181List()
+})
+
+const openModal = (id:string) => {
+  state.controlVisible = true
+  controlParamsState.id = id
+}
+
+const closeModel = () => {
+  state.controlVisible = false
+}
+</script>
+
+<style lang="less" scoped >
+</style>

+ 93 - 0
src/pages/rts/gb28181/record.vue

@@ -0,0 +1,93 @@
+<template>
+  <a-card>
+    <a-row>
+      <a-space>
+        <a-col>
+          <a-range-picker v-model:value="time" :format="['DD/MM/YYYY', 'DD/MM/YYYY']"  />
+        </a-col>
+        <a-col>
+          <a-button type="primary" @click="getTrackTaskList">搜索</a-button>
+        </a-col>
+      </a-space>
+    </a-row>
+    <a-table
+        style="margin-top: 20px;"
+        :columns="columns"
+        :data-source="state.dataSource"
+        :loading="state.loading"
+    ></a-table>
+  </a-card>
+</template>
+
+<script lang="ts" setup >
+import { RtsController } from '@/controller/rts'
+import { onMounted, reactive } from 'vue'
+import { useRoute } from 'vue-router'
+const route = useRoute()
+const deviceId = route.query.id as string
+
+const columns = [
+  {
+    title: '设备id',
+    dataIndex: 'DeviceID'
+  },
+  {
+    title: '名称',
+    dataIndex: 'Name'
+  },
+  {
+    title: '文件地址',
+    dataIndex: 'FilePath'
+  },
+  {
+    title: '地址',
+    dataIndex: 'Address'
+  },
+  {
+    title: '开始时间',
+    dataIndex: 'StartTime'
+  },
+  {
+    title: '结束时间',
+    dataIndex: 'EndTime'
+  },
+  {
+    title: 'Secrecy',
+    dataIndex: 'Secrecy'
+  },
+  {
+    title: 'gps时间',
+    dataIndex: 'Type'
+  }
+]
+
+const state = reactive<{
+  dataSource: RTS.GB2881.Record[]
+  loading: boolean
+  visible: boolean
+  deviceId: string
+  detail: Partial<RTS.GB2881.Record>
+}>({
+  loading: false,
+  visible: false,
+  detail: {},
+  deviceId: deviceId,
+  dataSource: []
+})
+
+const queryParamsState = reactive({
+  id: deviceId,
+  channel: '',
+  startTime: '',
+  endTime: ''
+})
+
+const getGB28181Record = async () => {
+  const { data } = await RtsController.listGB28181(queryParamsState)
+  state.dataSource = data
+}
+
+</script>
+
+<style lang="less" scoped >
+</style>

+ 19 - 0
src/router/index.ts

@@ -222,6 +222,25 @@ export const routes: Array<ROUTER.RoutesProps> = [
         icon: 'FileAddOutlined',
         component: () => import('@/pages/rts/record/index.vue')
       },
+      {
+        path: '/gb28181',
+        name: '国标设备',
+        icon: 'CameraOutlined',
+        redirect: '/gb28181/index',
+        children: [
+          {
+            path: '/gb28181/index',
+            name: '所有国标设备',
+            component: () => import('@/pages/rts/gb28181/index.vue')
+          },
+          {
+            path: '/gb28181/record',
+            name: '设备录像',
+            hidden: true,
+            component: () => import('@/pages/rts/gb28181/record.vue')
+          }
+        ]
+      },
       {
         path: '/protocol',
         name: '协议配置',

+ 27 - 0
src/type/rts.d.ts

@@ -69,4 +69,31 @@ declare namespace RTS {
 
   type protocol = 'RTSP' | 'RTMP' | 'HLS' | 'HDL' | 'GB28181'
 
+  namespace GB2881 {
+    interface Detail {
+      'ID': string,
+      'Name': string, // 名称
+      'Manufacturer': string, // 制造商
+      'Model': string, // 模式
+      'Owner': string, // 所有者
+      'RegisterTime': string, // 注册时间
+      'ReConnectCount': string, // 重联次数
+      'Status': string,
+      'NetAddr': string, // 网络地址
+      'GpsTime': string, // gps 时间
+      'Longitude':string, // 经度
+      'Latitude':string, // 纬度
+    }
+    interface Record {
+      'DeviceID': string,
+      'Name': string, // 名称
+      'FilePath': string, // 文件地址
+      'Address': string, // 地址
+      'Owner': string, // 所有者
+      'StartTime': string, // 注册时间
+      'EndTime': string, // 重联次数
+      'Secrecy': string,
+      'Type': string // 网络地址
+    }
+  }
 }