Commit 12e44f3e137e20a9574ad94264c29671c1281d06

Authored by fengtao
Committed by xp.Huang
1 parent 5a4cd84d

feat: 新增视频通道同步功能,联调通道同步接口完成和加上相关权限标识key

@@ -21,6 +21,7 @@ enum CameraManagerApi { @@ -21,6 +21,7 @@ enum CameraManagerApi {
21 STREAMING_PLAY_GET_URL = '/video/url', 21 STREAMING_PLAY_GET_URL = '/video/url',
22 VIDEO_CONTROL_STOP = '/video/control/stop/', 22 VIDEO_CONTROL_STOP = '/video/control/stop/',
23 CAMERA_ADDGPT_API_URL = '/video/add/gbt28181', 23 CAMERA_ADDGPT_API_URL = '/video/add/gbt28181',
  24 + VIDEO_CONTROL_SYNC = '/video/control/sync/',
24 } 25 }
25 26
26 export const cameraPage = (params: CameraQueryParam) => { 27 export const cameraPage = (params: CameraQueryParam) => {
@@ -144,3 +145,10 @@ export const createGPTPostApi = (data: Recordable) => { @@ -144,3 +145,10 @@ export const createGPTPostApi = (data: Recordable) => {
144 data, 145 data,
145 }); 146 });
146 }; 147 };
  148 +
  149 +//云台控制 通道同步
  150 +export const syncVideoApiGet = (deviceId: string) => {
  151 + return defHttp.get({
  152 + url: `${CameraManagerApi.VIDEO_CONTROL_SYNC}${deviceId}`,
  153 + });
  154 +};
@@ -6,6 +6,13 @@ import { withInstall } from '/@/utils/index'; @@ -6,6 +6,13 @@ import { withInstall } from '/@/utils/index';
6 import VideoPlay from './video.vue'; 6 import VideoPlay from './video.vue';
7 export const Video = withInstall(VideoPlay); 7 export const Video = withInstall(VideoPlay);
8 8
  9 +//视频通道权限标识枚举
  10 +export enum GBT28181_DEVICE_PERMISSION_ENUM {
  11 + PLAY_SYNC = 'api:yt:video:control:play', //视频点播/预览和摄像头通道同步
  12 + STOP = 'api:yt:video:control:stop', //停止点播
  13 + CONTROL = 'api:yt:video:control:control', //云台控制
  14 +}
  15 +
9 enum ChannelStatusEnum { 16 enum ChannelStatusEnum {
10 ONLINE = 'ONLINE', 17 ONLINE = 'ONLINE',
11 } 18 }
@@ -3,6 +3,11 @@ @@ -3,6 +3,11 @@
3 class="bg-neutral-100 dark:text-gray-300 dark:bg-dark-700 p-4" 3 class="bg-neutral-100 dark:text-gray-300 dark:bg-dark-700 p-4"
4 @register="registerTable" 4 @register="registerTable"
5 > 5 >
  6 + <template #toolbar>
  7 + <Authority :value="GBT28181_DEVICE_PERMISSION_ENUM.PLAY_SYNC">
  8 + <a-button type="primary" @click="handleSyncPlay">通道同步</a-button>
  9 + </Authority>
  10 + </template>
6 <template #hasAudio="{ record }"> 11 <template #hasAudio="{ record }">
7 <Switch 12 <Switch
8 :checked="record.status === 1" 13 :checked="record.status === 1"
@@ -17,25 +22,26 @@ @@ -17,25 +22,26 @@
17 :actions="[ 22 :actions="[
18 { 23 {
19 label: '播放', 24 label: '播放',
20 - auth: 'api:yt:sceneLinkage:get', 25 + auth: GBT28181_DEVICE_PERMISSION_ENUM.PLAY_SYNC,
21 icon: 'ant-design:play-circle-outlined', 26 icon: 'ant-design:play-circle-outlined',
22 onClick: handlePlay.bind(null, record), 27 onClick: handlePlay.bind(null, record),
23 }, 28 },
24 { 29 {
25 - label: '停止点播',  
26 - auth: 'api:yt:sceneLinkage:get', 30 + label: '停止',
  31 + auth: GBT28181_DEVICE_PERMISSION_ENUM.STOP,
27 icon: 'ant-design:pause-outlined', 32 icon: 'ant-design:pause-outlined',
28 onClick: handleStopPlay.bind(null, record), 33 onClick: handleStopPlay.bind(null, record),
  34 + ifShow: !!record?.streamId, //通道号存在则显示停止点播按钮
29 }, 35 },
30 ]" 36 ]"
31 /> 37 />
32 </template> 38 </template>
33 </BasicTable> 39 </BasicTable>
34 - <VideoModal @register="registerModal" /> 40 + <VideoModal @register="registerModal" @reloadTable="reload()" />
35 </template> 41 </template>
36 42
37 <script lang="ts" setup> 43 <script lang="ts" setup>
38 - import { configColumns, searchFormSchema } from './config'; 44 + import { configColumns, searchFormSchema, GBT28181_DEVICE_PERMISSION_ENUM } from './config';
39 import { BasicTable, useTable, TableAction } from '/@/components/Table'; 45 import { BasicTable, useTable, TableAction } from '/@/components/Table';
40 import { Switch } from 'ant-design-vue'; 46 import { Switch } from 'ant-design-vue';
41 import { DeviceRecord } from '/@/api/device/model/deviceModel'; 47 import { DeviceRecord } from '/@/api/device/model/deviceModel';
@@ -43,7 +49,8 @@ @@ -43,7 +49,8 @@
43 import { useModal } from '/@/components/Modal'; 49 import { useModal } from '/@/components/Modal';
44 import { useMessage } from '/@/hooks/web/useMessage'; 50 import { useMessage } from '/@/hooks/web/useMessage';
45 import { getVideoChannelList } from '/@/api/device/videoChannel'; 51 import { getVideoChannelList } from '/@/api/device/videoChannel';
46 - import { stopOnDemandVideoApiGet } from '/@/api/camera/cameraManager'; 52 + import { stopOnDemandVideoApiGet, syncVideoApiGet } from '/@/api/camera/cameraManager';
  53 + import { Authority } from '/@/components/Authority';
47 54
48 const props = defineProps<{ deviceDetail: DeviceRecord }>(); 55 const props = defineProps<{ deviceDetail: DeviceRecord }>();
49 56
@@ -96,7 +103,15 @@ @@ -96,7 +103,15 @@
96 if (!record) return; 103 if (!record) return;
97 const { deviceId, channelId } = record; 104 const { deviceId, channelId } = record;
98 if (await stopOnDemandVideoApiGet(deviceId, channelId)) { 105 if (await stopOnDemandVideoApiGet(deviceId, channelId)) {
99 - createMessage.success('已停止点播'); 106 + createMessage.success('已停止');
  107 + }
  108 + };
  109 +
  110 + //通道同步
  111 + const handleSyncPlay = async () => {
  112 + if (await syncVideoApiGet(props.deviceDetail.tbDeviceId)) {
  113 + createMessage.success('已同步');
  114 + reload();
100 } 115 }
101 }; 116 };
102 </script> 117 </script>
@@ -36,6 +36,8 @@ @@ -36,6 +36,8 @@
36 import { AccessMode } from '/@/views/camera/manage/config.data'; 36 import { AccessMode } from '/@/views/camera/manage/config.data';
37 import { getStreamingPlayUrl } from '/@/api/camera/cameraManager'; 37 import { getStreamingPlayUrl } from '/@/api/camera/cameraManager';
38 38
  39 + const emit = defineEmits(['reloadTable', 'register']);
  40 +
39 const heightNum = ref(800); 41 const heightNum = ref(800);
40 const showVideo = ref(false); 42 const showVideo = ref(false);
41 43
@@ -91,6 +93,7 @@ @@ -91,6 +93,7 @@
91 const handleCancel = () => { 93 const handleCancel = () => {
92 showVideo.value = false; 94 showVideo.value = false;
93 withToken.value = false; 95 withToken.value = false;
  96 + emit('reloadTable');
94 }; 97 };
95 </script> 98 </script>
96 99