Commit 60fdab9bbc62c487fcc5ff7a2ee5560eefe37a50

Authored by fengtao
2 parents 40e125c2 b26a6b14

Merge branch 'main' into f-dev

... ... @@ -31,7 +31,7 @@
31 31 <script lang="ts">
32 32 import { defineComponent, ref, computed, unref, nextTick } from 'vue';
33 33 import { BasicForm, useForm } from '/@/components/Form';
34   - import { formSchema, manuallyEnter, streamingMediaAcquire } from './config.data';
  34 + import { formSchema } from './config.data';
35 35 import { BasicDrawer, useDrawerInner } from '/@/components/Drawer';
36 36 import { createOrEditCameraManage } from '/@/api/camera/cameraManager';
37 37 import { message, Upload } from 'ant-design-vue';
... ... @@ -49,10 +49,7 @@
49 49
50 50 const isUpdate = ref(true);
51 51 const editId = ref('');
52   - const [
53   - registerForm,
54   - { validate, setFieldsValue, resetFields, removeSchemaByFiled, appendSchemaByField },
55   - ] = useForm({
  52 + const [registerForm, { validate, setFieldsValue, resetFields }] = useForm({
56 53 labelWidth: 120,
57 54 schemas: formSchema,
58 55 showActionButtonGroup: false,
... ... @@ -64,19 +61,6 @@
64 61 isUpdate.value = !!data?.isUpdate;
65 62 if (unref(isUpdate)) {
66 63 await nextTick();
67   - removeSchemaByFiled([
68   - 'videoPlatformId',
69   - 'streamType',
70   - 'playProtocol',
71   - 'sn',
72   - 'brand',
73   - 'videoUrl',
74   - ]);
75   - if (data.record.accessMode === 0) {
76   - manuallyEnter.forEach((schema) => appendSchemaByField(schema, undefined));
77   - } else {
78   - streamingMediaAcquire.forEach((schema) => appendSchemaByField(schema, undefined));
79   - }
80 64 editId.value = data.record.id;
81 65 tenantLogo.value = data.record?.avatar;
82 66 await setFieldsValue(data.record);
... ... @@ -97,7 +81,7 @@
97 81 const response = await upload(formData);
98 82 if (response.fileStaticUri) {
99 83 tenantLogo.value = response.fileStaticUri;
100   - loading.value = true;
  84 + loading.value = false;
101 85 }
102 86 }
103 87 }
... ...
... ... @@ -6,7 +6,7 @@
6 6 import snStep3 from '/@/assets/images/sn-step3.png';
7 7 const imgList: string[] = [snStep1, snStep2, snStep3];
8 8 function handlePreview() {
9   - createImgPreview({ imageList: imgList });
  9 + createImgPreview({ imageList: imgList, defaultWidth: 1000 });
10 10 }
11 11 </script>
12 12
... ...
... ... @@ -52,6 +52,12 @@ export const columns: BasicColumn[] = [
52 52 width: 160,
53 53 },
54 54 {
  55 + title: '接受方式',
  56 + dataIndex: 'accessMode',
  57 + width: 160,
  58 + slots: { customRender: 'accessMode' },
  59 + },
  60 + {
55 61 title: '创建时间',
56 62 dataIndex: 'createTime',
57 63 width: 180,
... ... @@ -77,14 +83,70 @@ export const searchFormSchema: FormSchema[] = [
77 83 },
78 84 ];
79 85
80   -/**
81   - * @description 手动输入
82   - */
83   -export const manuallyEnter: FormSchema[] = [
  86 +// 弹框配置项
  87 +export const formSchema: QFormSchema[] = [
  88 + {
  89 + field: 'avatar',
  90 + label: '视频封面',
  91 + slot: 'iconSelect',
  92 + component: 'Input',
  93 + },
  94 + {
  95 + field: 'name',
  96 + label: '视频名字',
  97 + required: true,
  98 + component: 'Input',
  99 + componentProps: {
  100 + placeholder: '请输入视频名字',
  101 + maxLength: 30,
  102 + },
  103 + rules: [...CameraMaxLength, { required: true, message: '视频名是必填项' }],
  104 + },
  105 + {
  106 + field: 'organizationId',
  107 + label: '所属组织',
  108 + required: true,
  109 + component: 'ApiTreeSelect',
  110 + componentProps: {
  111 + api: async () => {
  112 + const data = await getOrganizationList();
  113 + copyTransFun(data as any as any[]);
  114 + return data;
  115 + },
  116 + },
  117 + },
  118 + {
  119 + label: '视频流获取方式',
  120 + field: 'accessMode',
  121 + component: 'RadioGroup',
  122 + rules: [{ required: true, message: '视频流获取方式为必选项', type: 'number' }],
  123 + defaultValue: AccessMode.ManuallyEnter,
  124 + componentProps({ formActionType }) {
  125 + return {
  126 + defaultValue: AccessMode.ManuallyEnter,
  127 + placeholder: '请选择视频流获取方式',
  128 + options: [
  129 + { label: '手动输入', value: AccessMode.ManuallyEnter },
  130 + { label: '流媒体获取', value: AccessMode.Streaming },
  131 + ],
  132 + onChange() {
  133 + formActionType.setFieldsValue({
  134 + brand: null,
  135 + sn: null,
  136 + videoUrl: null,
  137 + videoPlatformId: null,
  138 + });
  139 + },
  140 + };
  141 + },
  142 + },
84 143 {
85 144 field: 'brand',
86 145 label: '视频厂家',
87 146 component: 'Input',
  147 + ifShow({ values }) {
  148 + return values.accessMode === AccessMode.ManuallyEnter;
  149 + },
88 150 componentProps: {
89 151 placeholder: '请输入视频厂家',
90 152 },
... ... @@ -95,6 +157,9 @@ export const manuallyEnter: FormSchema[] = [
95 157 required: true,
96 158 component: 'Input',
97 159 rules: [...CameraVideoUrl, { required: true, message: '摄像头编号是必填项' }],
  160 + ifShow({ values }) {
  161 + return values.accessMode === AccessMode.ManuallyEnter;
  162 + },
98 163 componentProps: {
99 164 placeholder: '请输入摄像头编号',
100 165 },
... ... @@ -104,22 +169,23 @@ export const manuallyEnter: FormSchema[] = [
104 169 label: '视频流',
105 170 required: true,
106 171 component: 'Input',
  172 + ifShow({ values }) {
  173 + return values.accessMode === AccessMode.ManuallyEnter;
  174 + },
107 175 componentProps: {
108 176 placeholder: '请输入视频流',
109 177 maxLength: 255,
110 178 },
111 179 rules: [...CameraVideoUrl, { required: true, message: '视频流是必填项' }],
112 180 },
113   -];
114 181
115   -/**
116   - * @description 流媒体获取
117   - */
118   -export const streamingMediaAcquire: FormSchema[] = [
119 182 {
120 183 field: 'videoPlatformId',
121 184 label: '流媒体配置',
122 185 component: 'ApiSelect',
  186 + ifShow({ values }) {
  187 + return values.accessMode === AccessMode.Streaming;
  188 + },
123 189 componentProps: {
124 190 placeholder: '请选择流媒体配置',
125 191 api: getStreamingMediaList,
... ... @@ -132,6 +198,9 @@ export const streamingMediaAcquire: FormSchema[] = [
132 198 label: '码流',
133 199 component: 'RadioGroup',
134 200 defaultValue: StreamType.MASTER,
  201 + ifShow({ values }) {
  202 + return values.accessMode === AccessMode.Streaming;
  203 + },
135 204 componentProps: {
136 205 placeholder: '请选择码流',
137 206 defaultValue: StreamType.MASTER,
... ... @@ -147,6 +216,10 @@ export const streamingMediaAcquire: FormSchema[] = [
147 216 label: '播放协议',
148 217 component: 'RadioGroup',
149 218 defaultValue: PlayProtocol.HTTP,
  219 + ifShow({ values }) {
  220 + return values.accessMode === AccessMode.Streaming;
  221 + },
  222 + helpMessage: ['平台使用https的hls协议,需联系海康开放平台专家支持。'],
150 223 componentProps: {
151 224 placeholder: '请选择播放协议',
152 225 defaultValue: PlayProtocol.HTTP,
... ... @@ -161,87 +234,11 @@ export const streamingMediaAcquire: FormSchema[] = [
161 234 label: h(SnHelpMessage) as any,
162 235 component: 'Input',
163 236 rules: [...CameraVideoUrl, { required: true, message: '摄像头编号是必填项' }],
164   - componentProps: {
165   - placeholder: '请输入监控点编号',
  237 + ifShow({ values }) {
  238 + return values.accessMode === AccessMode.Streaming;
166 239 },
167   - },
168   -];
169   -
170   -// 弹框配置项
171   -export const formSchema: QFormSchema[] = [
172   - {
173   - field: 'avatar',
174   - label: '视频封面',
175   - slot: 'iconSelect',
176   - component: 'Input',
177   - },
178   - {
179   - field: 'name',
180   - label: '视频名字',
181   - required: true,
182   - component: 'Input',
183 240 componentProps: {
184   - placeholder: '请输入视频名字',
185   - maxLength: 30,
186   - },
187   - rules: [...CameraMaxLength, { required: true, message: '视频名是必填项' }],
188   - },
189   - {
190   - field: 'organizationId',
191   - label: '所属组织',
192   - required: true,
193   - component: 'ApiTreeSelect',
194   - componentProps: {
195   - api: async () => {
196   - const data = await getOrganizationList();
197   - copyTransFun(data as any as any[]);
198   - return data;
199   - },
200   - },
201   - },
202   - {
203   - label: '视频流获取方式',
204   - field: 'accessMode',
205   - component: 'RadioGroup',
206   - rules: [{ required: true, message: '视频流获取方式为必选项', type: 'number' }],
207   - defaultValue: AccessMode.ManuallyEnter,
208   - componentProps({ formActionType }) {
209   - return {
210   - defaultValue: AccessMode.ManuallyEnter,
211   - placeholder: '请选择视频流获取方式',
212   - options: [
213   - { label: '手动输入', value: AccessMode.ManuallyEnter },
214   - { label: '流媒体获取', value: AccessMode.Streaming },
215   - ],
216   - onChange(event: { target: { value: number } }) {
217   - formActionType.removeSchemaByFiled([
218   - 'videoPlatformId',
219   - 'streamType',
220   - 'playProtocol',
221   - 'sn',
222   - 'brand',
223   - 'videoUrl',
224   - ]);
225   - const {
226   - target: { value },
227   - } = event;
228   - if (value === AccessMode.ManuallyEnter) {
229   - manuallyEnter.forEach((schema) =>
230   - formActionType.appendSchemaByField(schema, undefined)
231   - );
232   - } else {
233   - streamingMediaAcquire.forEach((schema) =>
234   - formActionType.appendSchemaByField(schema, undefined)
235   - );
236   -
237   - formActionType.setFieldsValue({
238   - streamType: StreamType.MASTER,
239   - playProtocol: PlayProtocol.HTTP,
240   - });
241   - }
242   - },
243   - };
  241 + placeholder: '请输入监控点编号',
244 242 },
245 243 },
246   - ...manuallyEnter,
247 244 ];
... ...
... ... @@ -38,6 +38,15 @@
38 38 "
39 39 />
40 40 </template>
  41 + <template #accessMode="{ record }">
  42 + <span>{{
  43 + record.accessMode === AccessMode.ManuallyEnter
  44 + ? '手动输入'
  45 + : record.accessMode === AccessMode.Streaming
  46 + ? '流媒体获取'
  47 + : ''
  48 + }}</span>
  49 + </template>
41 50 <template #action="{ record }">
42 51 <TableAction
43 52 :actions="[
... ... @@ -81,7 +90,7 @@
81 90 import CameraDrawer from './CameraDrawer.vue';
82 91 import { useResetOrganizationTree, OrganizationIdTree } from '/@/views/common/organizationIdTree';
83 92 import { cameraPage, deleteCameraManage } from '/@/api/camera/cameraManager';
84   - import { searchFormSchema, columns } from './config.data';
  93 + import { searchFormSchema, columns, AccessMode } from './config.data';
85 94 import VideoPreviewModal from './DialogPreviewVideo.vue';
86 95 import { useModal } from '/@/components/Modal';
87 96 import { Authority } from '/@/components/Authority';
... ... @@ -181,6 +190,7 @@
181 190 organizationIdTreeRef,
182 191 handleViewVideo,
183 192 registerModal,
  193 + AccessMode,
184 194 };
185 195 },
186 196 });
... ...
... ... @@ -7,6 +7,7 @@
7 7 import { createOrUpdateStreamingMediaRecord } from '/@/api/camera/cameraManager';
8 8 import { StreamingMediaModel } from '/@/api/camera/model/cameraModel';
9 9 import { useMessage } from '/@/hooks/web/useMessage';
  10 + import { PlayProtocol } from '../manage/config.data';
10 11
11 12 const emit = defineEmits({
12 13 success: null,
... ... @@ -30,6 +31,7 @@
30 31 id = data.record!.id;
31 32 setFieldsValue(data.record);
32 33 } else {
  34 + setFieldsValue({ ssl: PlayProtocol.HTTP });
33 35 resetFields();
34 36 }
35 37 });
... ...
... ... @@ -18,18 +18,6 @@ export const streamingMediaSSLMapping = {
18 18
19 19 export const columnSchema: BasicColumn[] = [
20 20 {
21   - title: '平台类型',
22   - dataIndex: 'type',
23   - width: 80,
24   - slots: { customRender: 'type' },
25   - },
26   - {
27   - title: '部署环境',
28   - dataIndex: 'ssl',
29   - width: 80,
30   - slots: { customRender: 'ssl' },
31   - },
32   - {
33 21 title: '平台地址',
34 22 dataIndex: 'host',
35 23 width: 80,
... ... @@ -44,6 +32,18 @@ export const columnSchema: BasicColumn[] = [
44 32 dataIndex: 'appSecret',
45 33 width: 80,
46 34 },
  35 + {
  36 + title: '平台类型',
  37 + dataIndex: 'type',
  38 + width: 80,
  39 + slots: { customRender: 'type' },
  40 + },
  41 + {
  42 + title: '部署环境',
  43 + dataIndex: 'ssl',
  44 + width: 80,
  45 + slots: { customRender: 'ssl' },
  46 + },
47 47 ];
48 48
49 49 export const formSchema: FormSchema[] = [
... ... @@ -71,7 +71,9 @@ export const formDetailSchema: FormSchema[] = [
71 71 field: 'ssl',
72 72 component: 'RadioGroup',
73 73 rules: [{ required: true, message: '流媒体部署环境为必填项', type: 'number' }],
  74 + defaultValue: PlayProtocol.HTTP,
74 75 componentProps: {
  76 + defaultValue: PlayProtocol.HTTP,
75 77 options: [
76 78 { label: 'http', value: PlayProtocol.HTTP },
77 79 { label: 'https', value: PlayProtocol.HTTPS },
... ...