config.data.ts
3.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
import { PlayProtocol } from '../manage/config.data';
import type { StreamingMediaModel } from '/@/api/camera/model/cameraModel';
import { BasicColumn, FormSchema } from '/@/components/Table';
export interface DrawerParams {
createFlag: boolean;
record?: StreamingMediaModel;
}
export const streamingMediaTypeMapping = {
0: '海康ISC平台',
};
export const streamingMediaSSLMapping = {
0: 'http',
1: 'https',
};
export const formatSecret = (string: string) => {
if (string.length < 6) {
return string;
} else {
const reg = /(^\S{2}).*(\S{4}$)/;
const prefix = string.match(reg)?.at(1);
const suffix = string.match(reg)?.at(2);
return `${prefix}${''.padStart(string.length - 6, '*')}${suffix}`;
}
};
export const columnSchema: BasicColumn[] = [
{
title: '平台地址',
dataIndex: 'host',
width: 80,
},
{
title: '用户Key',
dataIndex: 'appKey',
width: 80,
},
{
title: '用户密钥',
dataIndex: 'appSecret',
width: 80,
format(text) {
return formatSecret(text);
},
},
{
title: '平台类型',
dataIndex: 'type',
width: 80,
slots: { customRender: 'type' },
},
{
title: '部署环境',
dataIndex: 'ssl',
width: 80,
slots: { customRender: 'ssl' },
},
];
export const formSchema: FormSchema[] = [
{
field: 'host',
label: '平台地址',
component: 'Input',
colProps: { span: 8 },
},
];
export const formDetailSchema: FormSchema[] = [
{
label: '平台类型',
field: 'type',
component: 'Select',
rules: [{ required: true, message: '平台类型为必填项', type: 'number' }],
componentProps: {
options: [{ label: '海康ISC平台', value: 0 }],
placeholder: '请输入选择平台类型',
},
},
{
label: '部署环境',
field: 'ssl',
component: 'RadioGroup',
rules: [{ required: true, message: '流媒体部署环境为必填项', type: 'number' }],
defaultValue: PlayProtocol.HTTP,
componentProps: {
defaultValue: PlayProtocol.HTTP,
options: [
{ label: 'http', value: PlayProtocol.HTTP },
{ label: 'https', value: PlayProtocol.HTTPS },
],
},
},
{
label: '平台地址',
field: 'host',
component: 'Input',
helpMessage: ['平台IP + 端口'],
rules: [{ required: true, message: '平台地址为必填项' }],
componentProps: {
maxLength: 36,
placeholder: '请输入平台地址',
},
},
{
label: '用户Key',
field: 'appKey',
component: 'Input',
rules: [{ required: true, message: '用户Key为必填项' }],
componentProps: {
maxLength: 36,
placeholder: '请输入用户Key',
},
},
{
label: '用户密钥',
field: 'appSecret',
component: 'Input',
rules: [
{ required: true, message: '用户密钥为必填项' },
{ required: true, min: 20, message: '用户密钥不能少于20位字符' },
],
componentProps: {
maxLength: 36,
placeholder: '请输入用户密钥',
},
},
];