Commit 5466c54f27bc2debb6a26f024f5ee821c00a2ab2

Authored by xp.Huang
2 parents 1365217c e63e2b2e

Merge branch 'feat/camera-manage' into 'main_dev'

Feat/camera manage

See merge request yunteng/thingskit-front!1143
... ... @@ -40,7 +40,7 @@
40 40 <script lang="ts">
41 41 import { defineComponent, ref, computed, unref, nextTick, onMounted } from 'vue';
42 42 import { BasicForm, useForm } from '/@/components/Form';
43   - import { formSchema } from './config.data';
  43 + import { AccessMode, formSchema, VideoPlatformEnum } from './config.data';
44 44 import { BasicDrawer, useDrawerInner } from '/@/components/Drawer';
45 45 import { createOrEditCameraManage } from '/@/api/camera/cameraManager';
46 46 import { useMessage } from '/@/hooks/web/useMessage';
... ... @@ -106,14 +106,23 @@
106 106 isUpdate.value = !!data?.isUpdate;
107 107 if (unref(isUpdate)) {
108 108 await nextTick();
  109 + const { record } = data || {};
109 110 editId.value = data.record.id;
  111 +
110 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 126 } else {
118 127 editId.value = '';
119 128 }
... ... @@ -138,6 +147,14 @@
138 147 }
139 148 let saveMessage = '添加成功';
140 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 158 await createOrEditCameraManage(values);
142 159 closeDrawer();
143 160 emit('success');
... ...
... ... @@ -48,6 +48,14 @@ export enum MediaType {
48 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 60 export const columns: BasicColumn[] = [
53 61 {
... ... @@ -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 122 export const formSchema: QFormSchema[] = [
... ... @@ -228,7 +238,7 @@ export const formSchema: QFormSchema[] = [
228 238 label: '流媒体平台',
229 239 component: 'ApiRadioGroup',
230 240 required: true,
231   - defaultValue: videTypeNum.SCI,
  241 + defaultValue: VideoPlatformEnum.SCI,
232 242 ifShow: ({ values }) => values.accessMode === AccessMode.Streaming,
233 243 componentProps: {
234 244 api: async (params) => {
... ... @@ -261,7 +271,8 @@ export const formSchema: QFormSchema[] = [
261 271 defaultValue: StreamType.MASTER,
262 272 ifShow({ values }) {
263 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 278 componentProps: {
... ... @@ -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 311 field: 'playProtocol',
279 312 label: '播放协议',
280 313 component: 'RadioGroup',
281   - defaultValue: PlayProtocol.HTTP,
  314 + defaultValue: PlayProtocol.HTTPS,
282 315 ifShow({ values }) {
283 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 321 helpMessage: ['平台使用https的hls协议,需联系海康开放平台专家支持。'],
288 322 componentProps: {
289 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 332 rules: [...CameraVideoUrl, { required: true, message: '摄像头编号是必填项' }],
302 333 ifShow({ values }) {
303 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 339 componentProps: {
... ... @@ -315,7 +347,8 @@ export const formSchema: QFormSchema[] = [
315 347 rules: [...CameraVideoUrl, { required: true, message: '摄像头编号是必填项' }],
316 348 ifShow({ values }) {
317 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 354 componentProps: {
... ...
1   -import { PlayProtocol } from '../manage/config.data';
  1 +import { PlayProtocol, VideoPlatformEnum } from '../manage/config.data';
2 2 import type { StreamingMediaModel } from '/@/api/camera/model/cameraModel';
3 3 import { findDictItemByCode } from '/@/api/system/dict';
4 4 import { DictEnum } from '/@/enums/dictEnum';
... ... @@ -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 78 export const formDetailSchema: FormSchema[] = [
84 79 {
85 80 label: '平台类型',
... ... @@ -102,15 +97,12 @@ export const formDetailSchema: FormSchema[] = [
102 97 label: '部署环境',
103 98 field: 'ssl',
104 99 component: 'RadioGroup',
105   - ifShow: ({ model }) => model.type !== videTypeNum.Fluorite,
  100 + ifShow: ({ model }) => model.type !== VideoPlatformEnum.FLUORITE,
106 101 rules: [{ required: true, message: '流媒体部署环境为必填项', type: 'number' }],
107   - defaultValue: PlayProtocol.HTTP,
  102 + defaultValue: PlayProtocol.HTTPS,
108 103 componentProps: {
109 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 {
... ...