Commit 5466c54f27bc2debb6a26f024f5ee821c00a2ab2
Merge branch 'feat/camera-manage' into 'main_dev'
Feat/camera manage See merge request yunteng/thingskit-front!1143
Showing
3 changed files
with
74 additions
and
32 deletions
@@ -40,7 +40,7 @@ | @@ -40,7 +40,7 @@ | ||
40 | <script lang="ts"> | 40 | <script lang="ts"> |
41 | import { defineComponent, ref, computed, unref, nextTick, onMounted } from 'vue'; | 41 | import { defineComponent, ref, computed, unref, nextTick, onMounted } from 'vue'; |
42 | import { BasicForm, useForm } from '/@/components/Form'; | 42 | import { BasicForm, useForm } from '/@/components/Form'; |
43 | - import { formSchema } from './config.data'; | 43 | + import { AccessMode, formSchema, VideoPlatformEnum } from './config.data'; |
44 | import { BasicDrawer, useDrawerInner } from '/@/components/Drawer'; | 44 | import { BasicDrawer, useDrawerInner } from '/@/components/Drawer'; |
45 | import { createOrEditCameraManage } from '/@/api/camera/cameraManager'; | 45 | import { createOrEditCameraManage } from '/@/api/camera/cameraManager'; |
46 | import { useMessage } from '/@/hooks/web/useMessage'; | 46 | import { useMessage } from '/@/hooks/web/useMessage'; |
@@ -106,14 +106,23 @@ | @@ -106,14 +106,23 @@ | ||
106 | isUpdate.value = !!data?.isUpdate; | 106 | isUpdate.value = !!data?.isUpdate; |
107 | if (unref(isUpdate)) { | 107 | if (unref(isUpdate)) { |
108 | await nextTick(); | 108 | await nextTick(); |
109 | + const { record } = data || {}; | ||
109 | editId.value = data.record.id; | 110 | editId.value = data.record.id; |
111 | + | ||
110 | if (data.record.avatar) { | 112 | if (data.record.avatar) { |
111 | - setFieldsValue({ | ||
112 | - avatar: [{ uid: buildUUID(), name: 'name', url: data.record.avatar } as FileItem], | 113 | + Object.assign(record, { |
114 | + avatar: [{ uid: buildUUID(), name: 'name', url: record.avatar } as FileItem], | ||
113 | }); | 115 | }); |
114 | } | 116 | } |
115 | - const { ...params } = data.record; | ||
116 | - await setFieldsValue({ ...params, videoType: params.videoPlatformDTO?.type }); | 117 | + |
118 | + if ( | ||
119 | + record?.accessMode === AccessMode.Streaming && | ||
120 | + record.videoPlatformDTO?.type === VideoPlatformEnum.FLUORITE | ||
121 | + ) { | ||
122 | + Object.assign(record, { articulation: record.streamType }); | ||
123 | + } | ||
124 | + | ||
125 | + setFieldsValue({ ...record, videoType: record.videoPlatformDTO?.type }); | ||
117 | } else { | 126 | } else { |
118 | editId.value = ''; | 127 | editId.value = ''; |
119 | } | 128 | } |
@@ -138,6 +147,14 @@ | @@ -138,6 +147,14 @@ | ||
138 | } | 147 | } |
139 | let saveMessage = '添加成功'; | 148 | let saveMessage = '添加成功'; |
140 | let updateMessage = '修改成功'; | 149 | let updateMessage = '修改成功'; |
150 | + | ||
151 | + if ( | ||
152 | + values?.accessMode === AccessMode.Streaming && | ||
153 | + values.videoType === VideoPlatformEnum.FLUORITE | ||
154 | + ) { | ||
155 | + values.streamType = values.articulation; | ||
156 | + } | ||
157 | + | ||
141 | await createOrEditCameraManage(values); | 158 | await createOrEditCameraManage(values); |
142 | closeDrawer(); | 159 | closeDrawer(); |
143 | emit('success'); | 160 | emit('success'); |
@@ -48,6 +48,14 @@ export enum MediaType { | @@ -48,6 +48,14 @@ export enum MediaType { | ||
48 | M3U8 = 'm3u8', | 48 | M3U8 = 'm3u8', |
49 | } | 49 | } |
50 | 50 | ||
51 | +export enum ArticulationEnumType { | ||
52 | + HIGH_DEFINITION = 1, | ||
53 | + SMOOTH = 2, | ||
54 | +} | ||
55 | +export enum ArticulationEnumNameType { | ||
56 | + HIGH_DEFINITION = '高清', | ||
57 | + SMOOTH = '流畅', | ||
58 | +} | ||
51 | // 表格列数据 | 59 | // 表格列数据 |
52 | export const columns: BasicColumn[] = [ | 60 | export const columns: BasicColumn[] = [ |
53 | { | 61 | { |
@@ -103,10 +111,12 @@ export const searchFormSchema: FormSchema[] = [ | @@ -103,10 +111,12 @@ export const searchFormSchema: FormSchema[] = [ | ||
103 | }, | 111 | }, |
104 | ]; | 112 | ]; |
105 | 113 | ||
106 | -const videTypeNum = { | ||
107 | - SCI: 0, | ||
108 | - FLUORITE: 1, | ||
109 | -}; | 114 | +export enum VideoPlatformEnum { |
115 | + // 海康 | ||
116 | + SCI = 0, | ||
117 | + // 萤石云 | ||
118 | + FLUORITE = 1, | ||
119 | +} | ||
110 | 120 | ||
111 | // 弹框配置项 | 121 | // 弹框配置项 |
112 | export const formSchema: QFormSchema[] = [ | 122 | export const formSchema: QFormSchema[] = [ |
@@ -228,7 +238,7 @@ export const formSchema: QFormSchema[] = [ | @@ -228,7 +238,7 @@ export const formSchema: QFormSchema[] = [ | ||
228 | label: '流媒体平台', | 238 | label: '流媒体平台', |
229 | component: 'ApiRadioGroup', | 239 | component: 'ApiRadioGroup', |
230 | required: true, | 240 | required: true, |
231 | - defaultValue: videTypeNum.SCI, | 241 | + defaultValue: VideoPlatformEnum.SCI, |
232 | ifShow: ({ values }) => values.accessMode === AccessMode.Streaming, | 242 | ifShow: ({ values }) => values.accessMode === AccessMode.Streaming, |
233 | componentProps: { | 243 | componentProps: { |
234 | api: async (params) => { | 244 | api: async (params) => { |
@@ -261,7 +271,8 @@ export const formSchema: QFormSchema[] = [ | @@ -261,7 +271,8 @@ export const formSchema: QFormSchema[] = [ | ||
261 | defaultValue: StreamType.MASTER, | 271 | defaultValue: StreamType.MASTER, |
262 | ifShow({ values }) { | 272 | ifShow({ values }) { |
263 | return ( | 273 | return ( |
264 | - values.accessMode === AccessMode.Streaming && values.videoType !== videTypeNum.FLUORITE | 274 | + values.accessMode === AccessMode.Streaming && |
275 | + values.videoType !== VideoPlatformEnum.FLUORITE | ||
265 | ); | 276 | ); |
266 | }, | 277 | }, |
267 | componentProps: { | 278 | componentProps: { |
@@ -275,23 +286,43 @@ export const formSchema: QFormSchema[] = [ | @@ -275,23 +286,43 @@ export const formSchema: QFormSchema[] = [ | ||
275 | }, | 286 | }, |
276 | }, | 287 | }, |
277 | { | 288 | { |
289 | + field: 'articulation', | ||
290 | + label: '清晰度', | ||
291 | + component: 'RadioGroup', | ||
292 | + defaultValue: ArticulationEnumType.HIGH_DEFINITION, | ||
293 | + ifShow: ({ model }) => | ||
294 | + model.accessMode === AccessMode.Streaming && model.videoType === VideoPlatformEnum.FLUORITE, | ||
295 | + componentProps: () => { | ||
296 | + return { | ||
297 | + options: [ | ||
298 | + { | ||
299 | + label: ArticulationEnumNameType.HIGH_DEFINITION, | ||
300 | + value: ArticulationEnumType.HIGH_DEFINITION, | ||
301 | + }, | ||
302 | + { | ||
303 | + label: ArticulationEnumNameType.SMOOTH, | ||
304 | + value: ArticulationEnumType.SMOOTH, | ||
305 | + }, | ||
306 | + ], | ||
307 | + }; | ||
308 | + }, | ||
309 | + }, | ||
310 | + { | ||
278 | field: 'playProtocol', | 311 | field: 'playProtocol', |
279 | label: '播放协议', | 312 | label: '播放协议', |
280 | component: 'RadioGroup', | 313 | component: 'RadioGroup', |
281 | - defaultValue: PlayProtocol.HTTP, | 314 | + defaultValue: PlayProtocol.HTTPS, |
282 | ifShow({ values }) { | 315 | ifShow({ values }) { |
283 | return ( | 316 | return ( |
284 | - values.accessMode === AccessMode.Streaming && values.videoType !== videTypeNum.FLUORITE | 317 | + values.accessMode === AccessMode.Streaming && |
318 | + values.videoType !== VideoPlatformEnum.FLUORITE | ||
285 | ); | 319 | ); |
286 | }, | 320 | }, |
287 | helpMessage: ['平台使用https的hls协议,需联系海康开放平台专家支持。'], | 321 | helpMessage: ['平台使用https的hls协议,需联系海康开放平台专家支持。'], |
288 | componentProps: { | 322 | componentProps: { |
289 | placeholder: '请选择播放协议', | 323 | placeholder: '请选择播放协议', |
290 | - defaultValue: PlayProtocol.HTTP, | ||
291 | - options: [ | ||
292 | - { label: 'http', value: PlayProtocol.HTTP }, | ||
293 | - { label: 'https', value: PlayProtocol.HTTPS }, | ||
294 | - ], | 324 | + defaultValue: PlayProtocol.HTTPS, |
325 | + options: [{ label: 'https', value: PlayProtocol.HTTPS }], | ||
295 | }, | 326 | }, |
296 | }, | 327 | }, |
297 | { | 328 | { |
@@ -301,7 +332,8 @@ export const formSchema: QFormSchema[] = [ | @@ -301,7 +332,8 @@ export const formSchema: QFormSchema[] = [ | ||
301 | rules: [...CameraVideoUrl, { required: true, message: '摄像头编号是必填项' }], | 332 | rules: [...CameraVideoUrl, { required: true, message: '摄像头编号是必填项' }], |
302 | ifShow({ values }) { | 333 | ifShow({ values }) { |
303 | return ( | 334 | return ( |
304 | - values.accessMode === AccessMode.Streaming && values.videoType !== videTypeNum.FLUORITE | 335 | + values.accessMode === AccessMode.Streaming && |
336 | + values.videoType !== VideoPlatformEnum.FLUORITE | ||
305 | ); | 337 | ); |
306 | }, | 338 | }, |
307 | componentProps: { | 339 | componentProps: { |
@@ -315,7 +347,8 @@ export const formSchema: QFormSchema[] = [ | @@ -315,7 +347,8 @@ export const formSchema: QFormSchema[] = [ | ||
315 | rules: [...CameraVideoUrl, { required: true, message: '摄像头编号是必填项' }], | 347 | rules: [...CameraVideoUrl, { required: true, message: '摄像头编号是必填项' }], |
316 | ifShow({ values }) { | 348 | ifShow({ values }) { |
317 | return ( | 349 | return ( |
318 | - values.accessMode === AccessMode.Streaming && values.videoType === videTypeNum.FLUORITE | 350 | + values.accessMode === AccessMode.Streaming && |
351 | + values.videoType === VideoPlatformEnum.FLUORITE | ||
319 | ); | 352 | ); |
320 | }, | 353 | }, |
321 | componentProps: { | 354 | componentProps: { |
1 | -import { PlayProtocol } from '../manage/config.data'; | 1 | +import { PlayProtocol, VideoPlatformEnum } from '../manage/config.data'; |
2 | import type { StreamingMediaModel } from '/@/api/camera/model/cameraModel'; | 2 | import type { StreamingMediaModel } from '/@/api/camera/model/cameraModel'; |
3 | import { findDictItemByCode } from '/@/api/system/dict'; | 3 | import { findDictItemByCode } from '/@/api/system/dict'; |
4 | import { DictEnum } from '/@/enums/dictEnum'; | 4 | import { DictEnum } from '/@/enums/dictEnum'; |
@@ -75,11 +75,6 @@ export const formSchema: FormSchema[] = [ | @@ -75,11 +75,6 @@ export const formSchema: FormSchema[] = [ | ||
75 | }, | 75 | }, |
76 | ]; | 76 | ]; |
77 | 77 | ||
78 | -const videTypeNum = { | ||
79 | - ISC: 0, | ||
80 | - Fluorite: 1, | ||
81 | -}; | ||
82 | - | ||
83 | export const formDetailSchema: FormSchema[] = [ | 78 | export const formDetailSchema: FormSchema[] = [ |
84 | { | 79 | { |
85 | label: '平台类型', | 80 | label: '平台类型', |
@@ -102,15 +97,12 @@ export const formDetailSchema: FormSchema[] = [ | @@ -102,15 +97,12 @@ export const formDetailSchema: FormSchema[] = [ | ||
102 | label: '部署环境', | 97 | label: '部署环境', |
103 | field: 'ssl', | 98 | field: 'ssl', |
104 | component: 'RadioGroup', | 99 | component: 'RadioGroup', |
105 | - ifShow: ({ model }) => model.type !== videTypeNum.Fluorite, | 100 | + ifShow: ({ model }) => model.type !== VideoPlatformEnum.FLUORITE, |
106 | rules: [{ required: true, message: '流媒体部署环境为必填项', type: 'number' }], | 101 | rules: [{ required: true, message: '流媒体部署环境为必填项', type: 'number' }], |
107 | - defaultValue: PlayProtocol.HTTP, | 102 | + defaultValue: PlayProtocol.HTTPS, |
108 | componentProps: { | 103 | componentProps: { |
109 | defaultValue: PlayProtocol.HTTP, | 104 | defaultValue: PlayProtocol.HTTP, |
110 | - options: [ | ||
111 | - { label: 'http', value: PlayProtocol.HTTP }, | ||
112 | - { label: 'https', value: PlayProtocol.HTTPS }, | ||
113 | - ], | 105 | + options: [{ label: 'https', value: PlayProtocol.HTTPS }], |
114 | }, | 106 | }, |
115 | }, | 107 | }, |
116 | { | 108 | { |