Commit 33c45f885b8ed17a3c667d3b62ad1978ef3ad48d
Committed by
xp.Huang
1 parent
dcd11373
perf: 调整设备里的视频通道,由原先的关闭弹窗调用停止点播接口,调整为点击按钮停止
Showing
5 changed files
with
65 additions
and
13 deletions
@@ -43,8 +43,8 @@ | @@ -43,8 +43,8 @@ | ||
43 | /> | 43 | /> |
44 | </template> | 44 | </template> |
45 | <template #accessMode="{ record }"> | 45 | <template #accessMode="{ record }"> |
46 | - <Tag :color="record.accessMode === AccessMode.ManuallyEnter ? 'cyan' : 'blue'">{{ | ||
47 | - record.accessMode === AccessMode.ManuallyEnter ? '手动输入' : '流媒体获取' | 46 | + <Tag :color="computedAccessMode(record, 'color')">{{ |
47 | + computedAccessMode(record, 'text') | ||
48 | }}</Tag> | 48 | }}</Tag> |
49 | </template> | 49 | </template> |
50 | <template #action="{ record }"> | 50 | <template #action="{ record }"> |
@@ -87,7 +87,7 @@ | @@ -87,7 +87,7 @@ | ||
87 | </template> | 87 | </template> |
88 | 88 | ||
89 | <script lang="ts"> | 89 | <script lang="ts"> |
90 | - import { defineComponent, reactive, nextTick } from 'vue'; | 90 | + import { defineComponent, reactive, nextTick, computed } from 'vue'; |
91 | import { BasicTable, useTable, TableAction, TableImg } from '/@/components/Table'; | 91 | import { BasicTable, useTable, TableAction, TableImg } from '/@/components/Table'; |
92 | import { PageWrapper } from '/@/components/Page'; | 92 | import { PageWrapper } from '/@/components/Page'; |
93 | import { useDrawer } from '/@/components/Drawer'; | 93 | import { useDrawer } from '/@/components/Drawer'; |
@@ -102,6 +102,7 @@ | @@ -102,6 +102,7 @@ | ||
102 | PageMode, | 102 | PageMode, |
103 | CameraPermission, | 103 | CameraPermission, |
104 | VideoPlatformEnum, | 104 | VideoPlatformEnum, |
105 | + accessModeConfig, | ||
105 | } from './config.data'; | 106 | } from './config.data'; |
106 | import VideoPreviewModal from './DialogPreviewVideo.vue'; | 107 | import VideoPreviewModal from './DialogPreviewVideo.vue'; |
107 | import { useModal } from '/@/components/Modal'; | 108 | import { useModal } from '/@/components/Modal'; |
@@ -231,6 +232,14 @@ | @@ -231,6 +232,14 @@ | ||
231 | 232 | ||
232 | const handleGBTSuccess = () => reload(); | 233 | const handleGBTSuccess = () => reload(); |
233 | 234 | ||
235 | + const computedAccessMode = computed(() => (record, mode) => { | ||
236 | + const findAccessMode = accessModeConfig.find( | ||
237 | + (findItem) => findItem.key === record.accessMode | ||
238 | + ); | ||
239 | + if (mode === 'text') return findAccessMode?.text; | ||
240 | + return findAccessMode?.color; | ||
241 | + }); | ||
242 | + | ||
234 | return { | 243 | return { |
235 | searchInfo, | 244 | searchInfo, |
236 | hasBatchDelete, | 245 | hasBatchDelete, |
@@ -250,6 +259,7 @@ | @@ -250,6 +259,7 @@ | ||
250 | handleOpenGBTDrawer, | 259 | handleOpenGBTDrawer, |
251 | registerGBTDrawer, | 260 | registerGBTDrawer, |
252 | handleGBTSuccess, | 261 | handleGBTSuccess, |
262 | + computedAccessMode, | ||
253 | }; | 263 | }; |
254 | }, | 264 | }, |
255 | }); | 265 | }); |
@@ -99,6 +99,18 @@ | @@ -99,6 +99,18 @@ | ||
99 | return record; | 99 | return record; |
100 | }); | 100 | }); |
101 | 101 | ||
102 | + //验证视频通道号 | ||
103 | + const validateChannelNos = (gptDeviceDTOS) => { | ||
104 | + gptDeviceDTOS.some((deviceDTO) => { | ||
105 | + const channelNo = deviceDTO['channelNos']; | ||
106 | + const ChannelNoRegexp = /^\d{1,20}$/; | ||
107 | + if (!ChannelNoRegexp.test(channelNo)) { | ||
108 | + createMessage.error('输入内容只能是数字,且不能超过20位'); | ||
109 | + throw Error('输入内容只能是数字,且不能超过20位'); | ||
110 | + } | ||
111 | + }); | ||
112 | + }; | ||
113 | + | ||
102 | const handleSubmit = async () => { | 114 | const handleSubmit = async () => { |
103 | try { | 115 | try { |
104 | setDrawerProps({ confirmLoading: true }); | 116 | setDrawerProps({ confirmLoading: true }); |
@@ -107,6 +119,7 @@ | @@ -107,6 +119,7 @@ | ||
107 | const gptDeviceDTOS = selectDeviceRef.value?.getDeviceChannels(); | 119 | const gptDeviceDTOS = selectDeviceRef.value?.getDeviceChannels(); |
108 | if (Array.isArray(gptDeviceDTOS) && gptDeviceDTOS.length == 0) | 120 | if (Array.isArray(gptDeviceDTOS) && gptDeviceDTOS.length == 0) |
109 | return createMessage.error('请填写设备通道号'); | 121 | return createMessage.error('请填写设备通道号'); |
122 | + validateChannelNos(gptDeviceDTOS); | ||
110 | const mergeValues = { | 123 | const mergeValues = { |
111 | ...values, | 124 | ...values, |
112 | accessMode: 2, | 125 | accessMode: 2, |
@@ -77,6 +77,26 @@ export enum ArticulationEnumNameType { | @@ -77,6 +77,26 @@ export enum ArticulationEnumNameType { | ||
77 | HIGH_DEFINITION = '高清', | 77 | HIGH_DEFINITION = '高清', |
78 | SMOOTH = '流畅', | 78 | SMOOTH = '流畅', |
79 | } | 79 | } |
80 | + | ||
81 | +//获取方式文字和Tag颜色配置 | ||
82 | +export const accessModeConfig = [ | ||
83 | + { | ||
84 | + key: AccessMode.ManuallyEnter, | ||
85 | + text: '手动输入', | ||
86 | + color: 'cyan', | ||
87 | + }, | ||
88 | + { | ||
89 | + key: AccessMode.Streaming, | ||
90 | + text: '流媒体获取', | ||
91 | + color: 'blue', | ||
92 | + }, | ||
93 | + { | ||
94 | + key: AccessMode.GBT28181, | ||
95 | + text: 'GBT28181', | ||
96 | + color: 'orange', | ||
97 | + }, | ||
98 | +]; | ||
99 | + | ||
80 | // 表格列数据 | 100 | // 表格列数据 |
81 | export const columns: BasicColumn[] = [ | 101 | export const columns: BasicColumn[] = [ |
82 | { | 102 | { |
@@ -21,6 +21,12 @@ | @@ -21,6 +21,12 @@ | ||
21 | icon: 'ant-design:play-circle-outlined', | 21 | icon: 'ant-design:play-circle-outlined', |
22 | onClick: handlePlay.bind(null, record), | 22 | onClick: handlePlay.bind(null, record), |
23 | }, | 23 | }, |
24 | + { | ||
25 | + label: '停止点播', | ||
26 | + auth: 'api:yt:sceneLinkage:get', | ||
27 | + icon: 'ant-design:pause-outlined', | ||
28 | + onClick: handleStopPlay.bind(null, record), | ||
29 | + }, | ||
24 | ]" | 30 | ]" |
25 | /> | 31 | /> |
26 | </template> | 32 | </template> |
@@ -37,9 +43,12 @@ | @@ -37,9 +43,12 @@ | ||
37 | import { useModal } from '/@/components/Modal'; | 43 | import { useModal } from '/@/components/Modal'; |
38 | import { useMessage } from '/@/hooks/web/useMessage'; | 44 | import { useMessage } from '/@/hooks/web/useMessage'; |
39 | import { getVideoChannelList } from '/@/api/device/videoChannel'; | 45 | import { getVideoChannelList } from '/@/api/device/videoChannel'; |
46 | + import { stopOnDemandVideoApiGet } from '/@/api/camera/cameraManager'; | ||
40 | 47 | ||
41 | const props = defineProps<{ deviceDetail: DeviceRecord }>(); | 48 | const props = defineProps<{ deviceDetail: DeviceRecord }>(); |
42 | 49 | ||
50 | + const { createMessage } = useMessage(); | ||
51 | + | ||
43 | const [registerModal, { openModal }] = useModal(); | 52 | const [registerModal, { openModal }] = useModal(); |
44 | 53 | ||
45 | const [registerTable, { setProps, setSelectedRowKeys, reload }] = useTable({ | 54 | const [registerTable, { setProps, setSelectedRowKeys, reload }] = useTable({ |
@@ -64,7 +73,6 @@ | @@ -64,7 +73,6 @@ | ||
64 | }); | 73 | }); |
65 | setSelectedRowKeys([]); | 74 | setSelectedRowKeys([]); |
66 | const newStatus = checked ? 1 : 0; | 75 | const newStatus = checked ? 1 : 0; |
67 | - const { createMessage } = useMessage(); | ||
68 | try { | 76 | try { |
69 | if (newStatus) createMessage.success('开启成功'); | 77 | if (newStatus) createMessage.success('开启成功'); |
70 | else createMessage.success('关闭成功'); | 78 | else createMessage.success('关闭成功'); |
@@ -82,4 +90,13 @@ | @@ -82,4 +90,13 @@ | ||
82 | ifShowGBT: true, | 90 | ifShowGBT: true, |
83 | }); | 91 | }); |
84 | }; | 92 | }; |
93 | + | ||
94 | + //停止点播 | ||
95 | + const handleStopPlay = async (record: Recordable) => { | ||
96 | + if (!record) return; | ||
97 | + const { deviceId, channelId } = record; | ||
98 | + if (await stopOnDemandVideoApiGet(deviceId, channelId)) { | ||
99 | + createMessage.success('已停止点播'); | ||
100 | + } | ||
101 | + }; | ||
85 | </script> | 102 | </script> |
@@ -20,7 +20,7 @@ | @@ -20,7 +20,7 @@ | ||
20 | } from '@ant-design/icons-vue'; | 20 | } from '@ant-design/icons-vue'; |
21 | import { Button } from 'ant-design-vue'; | 21 | import { Button } from 'ant-design-vue'; |
22 | import { nextTick } from 'vue'; | 22 | import { nextTick } from 'vue'; |
23 | - import { controlling, stopOnDemandVideoApiGet } from '/@/api/camera/cameraManager'; | 23 | + import { controlling } from '/@/api/camera/cameraManager'; |
24 | import { setVideoControl } from '/@/api/device/videoChannel'; | 24 | import { setVideoControl } from '/@/api/device/videoChannel'; |
25 | 25 | ||
26 | const { prefixCls } = useDesign('basic-video-play'); | 26 | const { prefixCls } = useDesign('basic-video-play'); |
@@ -171,16 +171,8 @@ | @@ -171,16 +171,8 @@ | ||
171 | unref(videoPlayInstance)?.dispose(); | 171 | unref(videoPlayInstance)?.dispose(); |
172 | videoPlayInstance.value = null; | 172 | videoPlayInstance.value = null; |
173 | emit('onUnmounted'); | 173 | emit('onUnmounted'); |
174 | - stopOnDemandVideo(); | ||
175 | }); | 174 | }); |
176 | 175 | ||
177 | - // 停止点播视频 | ||
178 | - const stopOnDemandVideo = async () => { | ||
179 | - if (!unref(getGBT)) return; | ||
180 | - const { tbDeviceId, channelId } = props.GBTOption; | ||
181 | - await stopOnDemandVideoApiGet(tbDeviceId, channelId); | ||
182 | - }; | ||
183 | - | ||
184 | defineExpose({ | 176 | defineExpose({ |
185 | reloadPlayer: init, | 177 | reloadPlayer: init, |
186 | getInstance: () => unref(videoPlayInstance), | 178 | getInstance: () => unref(videoPlayInstance), |