Showing
4 changed files
with
72 additions
and
12 deletions
@@ -25,11 +25,28 @@ | @@ -25,11 +25,28 @@ | ||
25 | </div> | 25 | </div> |
26 | </Upload> | 26 | </Upload> |
27 | </template> | 27 | </template> |
28 | + <template #videoPlatformIdSlot="{ model, field }"> | ||
29 | + <a-select | ||
30 | + placeholder="请选择流媒体配置" | ||
31 | + v-model:value="model[field]" | ||
32 | + :options="streamConfigOptions.map((item) => ({ value: item.value, label: item.label }))" | ||
33 | + > | ||
34 | + <template #dropdownRender="{ menuNode: menu }"> | ||
35 | + <v-nodes :vnodes="menu" /> | ||
36 | + <a-divider style="margin: 4px 0" /> | ||
37 | + <div @click="handleOpenStreamConfig" style="padding: 4px 8px; cursor: pointer"> | ||
38 | + <plus-outlined /> | ||
39 | + 新增流媒体配置 | ||
40 | + </div> | ||
41 | + </template> | ||
42 | + </a-select> | ||
43 | + </template> | ||
28 | </BasicForm> | 44 | </BasicForm> |
29 | </BasicDrawer> | 45 | </BasicDrawer> |
46 | + <SteramingDrawer @register="registerSteramingDrawer" @success="handleSuccess" /> | ||
30 | </template> | 47 | </template> |
31 | <script lang="ts"> | 48 | <script lang="ts"> |
32 | - import { defineComponent, ref, computed, unref, nextTick } from 'vue'; | 49 | + import { defineComponent, ref, computed, unref, nextTick, onMounted } from 'vue'; |
33 | import { BasicForm, useForm } from '/@/components/Form'; | 50 | import { BasicForm, useForm } from '/@/components/Form'; |
34 | import { formSchema } from './config.data'; | 51 | import { formSchema } from './config.data'; |
35 | import { BasicDrawer, useDrawerInner } from '/@/components/Drawer'; | 52 | import { BasicDrawer, useDrawerInner } from '/@/components/Drawer'; |
@@ -39,14 +56,27 @@ | @@ -39,14 +56,27 @@ | ||
39 | import { PlusOutlined, LoadingOutlined } from '@ant-design/icons-vue'; | 56 | import { PlusOutlined, LoadingOutlined } from '@ant-design/icons-vue'; |
40 | import { upload } from '/@/api/oss/ossFileUploader'; | 57 | import { upload } from '/@/api/oss/ossFileUploader'; |
41 | import { FileItem } from '/@/components/Upload/src/typing'; | 58 | import { FileItem } from '/@/components/Upload/src/typing'; |
59 | + import { getStreamingMediaList } from '/@/api/camera/cameraManager'; | ||
60 | + import SteramingDrawer from '../streaming/SteramingDrawer.vue'; | ||
61 | + import { useDrawer } from '/@/components/Drawer'; | ||
42 | 62 | ||
43 | export default defineComponent({ | 63 | export default defineComponent({ |
44 | name: 'ContactDrawer', | 64 | name: 'ContactDrawer', |
45 | - components: { BasicDrawer, BasicForm, Upload, PlusOutlined, LoadingOutlined }, | 65 | + components: { |
66 | + BasicDrawer, | ||
67 | + BasicForm, | ||
68 | + Upload, | ||
69 | + PlusOutlined, | ||
70 | + LoadingOutlined, | ||
71 | + SteramingDrawer, | ||
72 | + VNodes: (_, { attrs }) => { | ||
73 | + return attrs.vnodes; | ||
74 | + }, | ||
75 | + }, | ||
46 | emits: ['success', 'register'], | 76 | emits: ['success', 'register'], |
47 | setup(_, { emit }) { | 77 | setup(_, { emit }) { |
48 | const loading = ref(false); | 78 | const loading = ref(false); |
49 | - | 79 | + const streamConfigOptions: any = ref([]); |
50 | const isUpdate = ref(true); | 80 | const isUpdate = ref(true); |
51 | const editId = ref(''); | 81 | const editId = ref(''); |
52 | const [registerForm, { validate, setFieldsValue, resetFields }] = useForm({ | 82 | const [registerForm, { validate, setFieldsValue, resetFields }] = useForm({ |
@@ -54,7 +84,32 @@ | @@ -54,7 +84,32 @@ | ||
54 | schemas: formSchema, | 84 | schemas: formSchema, |
55 | showActionButtonGroup: false, | 85 | showActionButtonGroup: false, |
56 | }); | 86 | }); |
87 | + onMounted(async () => { | ||
88 | + const res = await getStreamingMediaList({}); | ||
89 | + streamConfigOptions.value = res.map((m) => { | ||
90 | + return { | ||
91 | + label: m.host, | ||
92 | + value: m.id, | ||
93 | + }; | ||
94 | + }); | ||
95 | + }); | ||
96 | + const [registerSteramingDrawer, { openDrawer }] = useDrawer(); | ||
57 | 97 | ||
98 | + const handleOpenStreamConfig = () => { | ||
99 | + openDrawer(true, { | ||
100 | + createFlag: true, | ||
101 | + }); | ||
102 | + }; | ||
103 | + async function handleSuccess() { | ||
104 | + const res = await getStreamingMediaList({}); | ||
105 | + if (res) { | ||
106 | + streamConfigOptions.value = res.map((m) => { | ||
107 | + return { label: m.host, value: m.id }; | ||
108 | + }); | ||
109 | + } else { | ||
110 | + streamConfigOptions.value = []; | ||
111 | + } | ||
112 | + } | ||
58 | const [registerDrawer, { setDrawerProps, closeDrawer }] = useDrawerInner(async (data) => { | 113 | const [registerDrawer, { setDrawerProps, closeDrawer }] = useDrawerInner(async (data) => { |
59 | await resetFields(); | 114 | await resetFields(); |
60 | setDrawerProps({ confirmLoading: false }); | 115 | setDrawerProps({ confirmLoading: false }); |
@@ -136,6 +191,10 @@ | @@ -136,6 +191,10 @@ | ||
136 | beforeUpload, | 191 | beforeUpload, |
137 | tenantLogo, | 192 | tenantLogo, |
138 | loading, | 193 | loading, |
194 | + streamConfigOptions, | ||
195 | + registerSteramingDrawer, | ||
196 | + handleOpenStreamConfig, | ||
197 | + handleSuccess, | ||
139 | }; | 198 | }; |
140 | }, | 199 | }, |
141 | }); | 200 | }); |
@@ -4,7 +4,6 @@ import { copyTransFun } from '/@/utils/fnUtils'; | @@ -4,7 +4,6 @@ import { copyTransFun } from '/@/utils/fnUtils'; | ||
4 | import type { FormSchema as QFormSchema } from '/@/components/Form/index'; | 4 | import type { FormSchema as QFormSchema } from '/@/components/Form/index'; |
5 | 5 | ||
6 | import { CameraVideoUrl, CameraMaxLength, MediaTypeValidate } from '/@/utils/rules'; | 6 | import { CameraVideoUrl, CameraMaxLength, MediaTypeValidate } from '/@/utils/rules'; |
7 | -import { getStreamingMediaList } from '/@/api/camera/cameraManager'; | ||
8 | import { h } from 'vue'; | 7 | import { h } from 'vue'; |
9 | import SnHelpMessage from './SnHelpMessage.vue'; | 8 | import SnHelpMessage from './SnHelpMessage.vue'; |
10 | export enum AccessMode { | 9 | export enum AccessMode { |
@@ -190,15 +189,13 @@ export const formSchema: QFormSchema[] = [ | @@ -190,15 +189,13 @@ export const formSchema: QFormSchema[] = [ | ||
190 | { | 189 | { |
191 | field: 'videoPlatformId', | 190 | field: 'videoPlatformId', |
192 | label: '流媒体配置', | 191 | label: '流媒体配置', |
193 | - component: 'ApiSelect', | 192 | + component: 'Select', |
194 | ifShow({ values }) { | 193 | ifShow({ values }) { |
195 | return values.accessMode === AccessMode.Streaming; | 194 | return values.accessMode === AccessMode.Streaming; |
196 | }, | 195 | }, |
196 | + slot: 'videoPlatformIdSlot', | ||
197 | componentProps: { | 197 | componentProps: { |
198 | placeholder: '请选择流媒体配置', | 198 | placeholder: '请选择流媒体配置', |
199 | - api: getStreamingMediaList, | ||
200 | - labelField: 'host', | ||
201 | - valueField: 'id', | ||
202 | }, | 199 | }, |
203 | }, | 200 | }, |
204 | { | 201 | { |
@@ -9,7 +9,7 @@ | @@ -9,7 +9,7 @@ | ||
9 | import { useMessage } from '/@/hooks/web/useMessage'; | 9 | import { useMessage } from '/@/hooks/web/useMessage'; |
10 | import { PlayProtocol } from '../manage/config.data'; | 10 | import { PlayProtocol } from '../manage/config.data'; |
11 | 11 | ||
12 | - const emit = defineEmits(['success','register']); | 12 | + const emit = defineEmits(['success', 'register']); |
13 | 13 | ||
14 | const createFlag = ref(false); | 14 | const createFlag = ref(false); |
15 | 15 | ||
@@ -23,7 +23,7 @@ | @@ -23,7 +23,7 @@ | ||
23 | showActionButtonGroup: false, | 23 | showActionButtonGroup: false, |
24 | }); | 24 | }); |
25 | 25 | ||
26 | - const [registerDrawer, { setDrawerProps }] = useDrawerInner((data: DrawerParams) => { | 26 | + const [registerDrawer, { setDrawerProps, closeDrawer }] = useDrawerInner((data: DrawerParams) => { |
27 | createFlag.value = data.createFlag; | 27 | createFlag.value = data.createFlag; |
28 | if (!unref(createFlag)) { | 28 | if (!unref(createFlag)) { |
29 | id = data.record!.id; | 29 | id = data.record!.id; |
@@ -48,6 +48,7 @@ | @@ -48,6 +48,7 @@ | ||
48 | const { createMessage } = useMessage(); | 48 | const { createMessage } = useMessage(); |
49 | createMessage.success(message); | 49 | createMessage.success(message); |
50 | emit('success'); | 50 | emit('success'); |
51 | + closeDrawer(); | ||
51 | } catch (e) { | 52 | } catch (e) { |
52 | } finally { | 53 | } finally { |
53 | setDrawerProps({ | 54 | setDrawerProps({ |
@@ -185,6 +185,7 @@ export const formSchema: QFormSchema[] = [ | @@ -185,6 +185,7 @@ export const formSchema: QFormSchema[] = [ | ||
185 | { | 185 | { |
186 | field: 'executeWay', | 186 | field: 'executeWay', |
187 | component: 'RadioGroup', | 187 | component: 'RadioGroup', |
188 | + helpMessage: [''], | ||
188 | label: '执行方式', | 189 | label: '执行方式', |
189 | colProps: { | 190 | colProps: { |
190 | span: 24, | 191 | span: 24, |
@@ -225,6 +226,8 @@ export const formSchema: QFormSchema[] = [ | @@ -225,6 +226,8 @@ export const formSchema: QFormSchema[] = [ | ||
225 | }); | 226 | }); |
226 | } else { | 227 | } else { |
227 | setFieldsValue({ queryMode: QueryWay.LATEST }); | 228 | setFieldsValue({ queryMode: QueryWay.LATEST }); |
229 | + setFieldsValue({ startTs: 5000 }); | ||
230 | + setFieldsValue({ interval: 1000 }); | ||
228 | dataCompareOpions = [{ label: '固定周期', value: QueryWay.LATEST }]; | 231 | dataCompareOpions = [{ label: '固定周期', value: QueryWay.LATEST }]; |
229 | updateSchema({ | 232 | updateSchema({ |
230 | defaultValue: QueryWay.LATEST, | 233 | defaultValue: QueryWay.LATEST, |
@@ -437,7 +440,7 @@ export const formSchema: QFormSchema[] = [ | @@ -437,7 +440,7 @@ export const formSchema: QFormSchema[] = [ | ||
437 | }, | 440 | }, |
438 | { | 441 | { |
439 | field: SchemaFiled.START_TS, | 442 | field: SchemaFiled.START_TS, |
440 | - label: '时间周期', | 443 | + label: '最近时间', |
441 | component: 'Select', | 444 | component: 'Select', |
442 | required: true, | 445 | required: true, |
443 | ifShow({ values }) { | 446 | ifShow({ values }) { |
@@ -447,7 +450,7 @@ export const formSchema: QFormSchema[] = [ | @@ -447,7 +450,7 @@ export const formSchema: QFormSchema[] = [ | ||
447 | const { setFieldsValue } = formActionType; | 450 | const { setFieldsValue } = formActionType; |
448 | return { | 451 | return { |
449 | defaultValue: 1000, | 452 | defaultValue: 1000, |
450 | - placeholder: '请选择时间周期', | 453 | + placeholder: '请选择近期时间', |
451 | options: intervalOption, | 454 | options: intervalOption, |
452 | onChange() { | 455 | onChange() { |
453 | setFieldsValue({ [SchemaFiled.INTERVAL]: null }); | 456 | setFieldsValue({ [SchemaFiled.INTERVAL]: null }); |