Commit 7fd02e45b66ab3a3130e92e210b5d638a726fc27
Merge branch 'ft_local_dev' into 'main'
fix:修改Teambition上的问题 See merge request huang/yun-teng-iot-front!423
Showing
14 changed files
with
165 additions
and
49 deletions
... | ... | @@ -25,11 +25,28 @@ |
25 | 25 | </div> |
26 | 26 | </Upload> |
27 | 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 | 44 | </BasicForm> |
29 | 45 | </BasicDrawer> |
46 | + <SteramingDrawer @register="registerSteramingDrawer" @success="handleSuccess" /> | |
30 | 47 | </template> |
31 | 48 | <script lang="ts"> |
32 | - import { defineComponent, ref, computed, unref, nextTick } from 'vue'; | |
49 | + import { defineComponent, ref, computed, unref, nextTick, onMounted } from 'vue'; | |
33 | 50 | import { BasicForm, useForm } from '/@/components/Form'; |
34 | 51 | import { formSchema } from './config.data'; |
35 | 52 | import { BasicDrawer, useDrawerInner } from '/@/components/Drawer'; |
... | ... | @@ -39,14 +56,27 @@ |
39 | 56 | import { PlusOutlined, LoadingOutlined } from '@ant-design/icons-vue'; |
40 | 57 | import { upload } from '/@/api/oss/ossFileUploader'; |
41 | 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 | 63 | export default defineComponent({ |
44 | 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 | 76 | emits: ['success', 'register'], |
47 | 77 | setup(_, { emit }) { |
48 | 78 | const loading = ref(false); |
49 | - | |
79 | + const streamConfigOptions: any = ref([]); | |
50 | 80 | const isUpdate = ref(true); |
51 | 81 | const editId = ref(''); |
52 | 82 | const [registerForm, { validate, setFieldsValue, resetFields }] = useForm({ |
... | ... | @@ -54,7 +84,32 @@ |
54 | 84 | schemas: formSchema, |
55 | 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 | 113 | const [registerDrawer, { setDrawerProps, closeDrawer }] = useDrawerInner(async (data) => { |
59 | 114 | await resetFields(); |
60 | 115 | setDrawerProps({ confirmLoading: false }); |
... | ... | @@ -136,6 +191,10 @@ |
136 | 191 | beforeUpload, |
137 | 192 | tenantLogo, |
138 | 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 | 4 | import type { FormSchema as QFormSchema } from '/@/components/Form/index'; |
5 | 5 | |
6 | 6 | import { CameraVideoUrl, CameraMaxLength, MediaTypeValidate } from '/@/utils/rules'; |
7 | -import { getStreamingMediaList } from '/@/api/camera/cameraManager'; | |
8 | 7 | import { h } from 'vue'; |
9 | 8 | import SnHelpMessage from './SnHelpMessage.vue'; |
10 | 9 | export enum AccessMode { |
... | ... | @@ -154,6 +153,7 @@ export const formSchema: QFormSchema[] = [ |
154 | 153 | return values.accessMode === AccessMode.ManuallyEnter; |
155 | 154 | }, |
156 | 155 | componentProps: { |
156 | + maxLength: 36, | |
157 | 157 | placeholder: '请输入视频厂家', |
158 | 158 | }, |
159 | 159 | }, |
... | ... | @@ -167,6 +167,7 @@ export const formSchema: QFormSchema[] = [ |
167 | 167 | return values.accessMode === AccessMode.ManuallyEnter; |
168 | 168 | }, |
169 | 169 | componentProps: { |
170 | + maxLength: 36, | |
170 | 171 | placeholder: '请输入摄像头编号', |
171 | 172 | }, |
172 | 173 | }, |
... | ... | @@ -188,15 +189,13 @@ export const formSchema: QFormSchema[] = [ |
188 | 189 | { |
189 | 190 | field: 'videoPlatformId', |
190 | 191 | label: '流媒体配置', |
191 | - component: 'ApiSelect', | |
192 | + component: 'Select', | |
192 | 193 | ifShow({ values }) { |
193 | 194 | return values.accessMode === AccessMode.Streaming; |
194 | 195 | }, |
196 | + slot: 'videoPlatformIdSlot', | |
195 | 197 | componentProps: { |
196 | 198 | placeholder: '请选择流媒体配置', |
197 | - api: getStreamingMediaList, | |
198 | - labelField: 'host', | |
199 | - valueField: 'id', | |
200 | 199 | }, |
201 | 200 | }, |
202 | 201 | { | ... | ... |
... | ... | @@ -9,7 +9,7 @@ |
9 | 9 | import { useMessage } from '/@/hooks/web/useMessage'; |
10 | 10 | import { PlayProtocol } from '../manage/config.data'; |
11 | 11 | |
12 | - const emit = defineEmits(['success','register']); | |
12 | + const emit = defineEmits(['success', 'register']); | |
13 | 13 | |
14 | 14 | const createFlag = ref(false); |
15 | 15 | |
... | ... | @@ -23,7 +23,7 @@ |
23 | 23 | showActionButtonGroup: false, |
24 | 24 | }); |
25 | 25 | |
26 | - const [registerDrawer, { setDrawerProps }] = useDrawerInner((data: DrawerParams) => { | |
26 | + const [registerDrawer, { setDrawerProps, closeDrawer }] = useDrawerInner((data: DrawerParams) => { | |
27 | 27 | createFlag.value = data.createFlag; |
28 | 28 | if (!unref(createFlag)) { |
29 | 29 | id = data.record!.id; |
... | ... | @@ -48,6 +48,7 @@ |
48 | 48 | const { createMessage } = useMessage(); |
49 | 49 | createMessage.success(message); |
50 | 50 | emit('success'); |
51 | + closeDrawer(); | |
51 | 52 | } catch (e) { |
52 | 53 | } finally { |
53 | 54 | setDrawerProps({ | ... | ... |
... | ... | @@ -101,6 +101,7 @@ export const formDetailSchema: FormSchema[] = [ |
101 | 101 | helpMessage: ['平台IP + 端口'], |
102 | 102 | rules: [{ required: true, message: '平台地址为必填项' }], |
103 | 103 | componentProps: { |
104 | + maxLength: 36, | |
104 | 105 | placeholder: '请输入平台地址', |
105 | 106 | }, |
106 | 107 | }, |
... | ... | @@ -110,6 +111,7 @@ export const formDetailSchema: FormSchema[] = [ |
110 | 111 | component: 'Input', |
111 | 112 | rules: [{ required: true, message: '用户Key为必填项' }], |
112 | 113 | componentProps: { |
114 | + maxLength: 36, | |
113 | 115 | placeholder: '请输入用户Key', |
114 | 116 | }, |
115 | 117 | }, |
... | ... | @@ -122,6 +124,7 @@ export const formDetailSchema: FormSchema[] = [ |
122 | 124 | { required: true, min: 20, message: '用户密钥不能少于20位字符' }, |
123 | 125 | ], |
124 | 126 | componentProps: { |
127 | + maxLength: 36, | |
125 | 128 | placeholder: '请输入用户密钥', |
126 | 129 | }, |
127 | 130 | }, | ... | ... |
... | ... | @@ -87,7 +87,7 @@ export const formSchema: FormSchema[] = [ |
87 | 87 | component: 'Input', |
88 | 88 | componentProps: { |
89 | 89 | placeholder: '请输入标题', |
90 | - maxLength: 200, | |
90 | + maxLength: 36, | |
91 | 91 | }, |
92 | 92 | }, |
93 | 93 | { |
... | ... | @@ -96,6 +96,9 @@ export const formSchema: FormSchema[] = [ |
96 | 96 | colProps: { span: 24 }, |
97 | 97 | label: '通知内容', |
98 | 98 | required: true, |
99 | + componentProps: { | |
100 | + maxLength: 255, | |
101 | + }, | |
99 | 102 | render: ({ model, field }) => { |
100 | 103 | return h(Tinymce, { |
101 | 104 | value: model[field], | ... | ... |
... | ... | @@ -59,6 +59,7 @@ export const formSchema: FormSchema[] = [ |
59 | 59 | const { setFieldsValue } = formActionType; |
60 | 60 | return { |
61 | 61 | placeholder: '请输入标题', |
62 | + maxLength: 36, | |
62 | 63 | onChange: (value: Event) => { |
63 | 64 | setFieldsValue({ |
64 | 65 | [PackageField.VERSION_TAG]: getVersionTag( |
... | ... | @@ -79,6 +80,7 @@ export const formSchema: FormSchema[] = [ |
79 | 80 | const { setFieldsValue } = formActionType; |
80 | 81 | return { |
81 | 82 | placeholder: '请输入版本', |
83 | + maxLength: 36, | |
82 | 84 | onChange: (value: Event) => { |
83 | 85 | setFieldsValue({ |
84 | 86 | [PackageField.VERSION_TAG]: getVersionTag( |
... | ... | @@ -97,6 +99,7 @@ export const formSchema: FormSchema[] = [ |
97 | 99 | helpMessage: ['自定义标签应与您设备报告的软件包版本相匹配'], |
98 | 100 | componentProps: () => { |
99 | 101 | return { |
102 | + maxLength: 36, | |
100 | 103 | placeholder: '请输入版本标签', |
101 | 104 | }; |
102 | 105 | }, |
... | ... | @@ -191,6 +194,7 @@ export const formSchema: FormSchema[] = [ |
191 | 194 | }, |
192 | 195 | rules: [{ required: true, message: '外部URL为必填项' }], |
193 | 196 | componentProps: { |
197 | + maxLength: 36, | |
194 | 198 | placeholder: '请输入外部URL', |
195 | 199 | }, |
196 | 200 | }, |
... | ... | @@ -238,6 +242,7 @@ export const formSchema: FormSchema[] = [ |
238 | 242 | }, |
239 | 243 | helpMessage: ['如果校验和为空,会自动生成'], |
240 | 244 | componentProps: { |
245 | + maxLength: 36, | |
241 | 246 | placeholder: '请输入校验和', |
242 | 247 | }, |
243 | 248 | }, |
... | ... | @@ -246,6 +251,7 @@ export const formSchema: FormSchema[] = [ |
246 | 251 | label: '描述', |
247 | 252 | component: 'InputTextArea', |
248 | 253 | componentProps: { |
254 | + maxLength: 255, | |
249 | 255 | placeholder: '请输入描述', |
250 | 256 | }, |
251 | 257 | }, | ... | ... |
... | ... | @@ -30,6 +30,7 @@ export enum SchemaFiled { |
30 | 30 | ORDER_BY = 'orderBy', |
31 | 31 | } |
32 | 32 | export const organizationId = ref(''); |
33 | + | |
33 | 34 | // 表格配置 |
34 | 35 | export const columns: BasicColumn[] = [ |
35 | 36 | { |
... | ... | @@ -147,7 +148,7 @@ export const formSchema: QFormSchema[] = [ |
147 | 148 | required: true, |
148 | 149 | component: 'Input', |
149 | 150 | componentProps: { |
150 | - maxLength: 255, | |
151 | + maxLength: 64, | |
151 | 152 | placeholder: '请输入报表名称', |
152 | 153 | }, |
153 | 154 | }, |
... | ... | @@ -185,6 +186,11 @@ export const formSchema: QFormSchema[] = [ |
185 | 186 | { |
186 | 187 | field: 'executeWay', |
187 | 188 | component: 'RadioGroup', |
189 | + helpMessage: [ | |
190 | + `立即执行,在创建完报表配置后,启用配置即执行。 | |
191 | + 定时执行,用户定义执行时间,启用后, | |
192 | + 在满足执行时间条件后,自动执行。`, | |
193 | + ], | |
188 | 194 | label: '执行方式', |
189 | 195 | colProps: { |
190 | 196 | span: 24, |
... | ... | @@ -225,6 +231,8 @@ export const formSchema: QFormSchema[] = [ |
225 | 231 | }); |
226 | 232 | } else { |
227 | 233 | setFieldsValue({ queryMode: QueryWay.LATEST }); |
234 | + setFieldsValue({ startTs: 5000 }); | |
235 | + setFieldsValue({ interval: 1000 }); | |
228 | 236 | dataCompareOpions = [{ label: '固定周期', value: QueryWay.LATEST }]; |
229 | 237 | updateSchema({ |
230 | 238 | defaultValue: QueryWay.LATEST, |
... | ... | @@ -437,7 +445,7 @@ export const formSchema: QFormSchema[] = [ |
437 | 445 | }, |
438 | 446 | { |
439 | 447 | field: SchemaFiled.START_TS, |
440 | - label: '时间周期', | |
448 | + label: '最近时间', | |
441 | 449 | component: 'Select', |
442 | 450 | required: true, |
443 | 451 | ifShow({ values }) { |
... | ... | @@ -447,7 +455,7 @@ export const formSchema: QFormSchema[] = [ |
447 | 455 | const { setFieldsValue } = formActionType; |
448 | 456 | return { |
449 | 457 | defaultValue: 1000, |
450 | - placeholder: '请选择时间周期', | |
458 | + placeholder: '请选择近期时间', | |
451 | 459 | options: intervalOption, |
452 | 460 | onChange() { |
453 | 461 | setFieldsValue({ [SchemaFiled.INTERVAL]: null }); | ... | ... |
... | ... | @@ -39,11 +39,11 @@ |
39 | 39 | </Select> |
40 | 40 | </div> |
41 | 41 | <div> |
42 | - <Empty v-show="notFoundData" /> | |
42 | + <Empty v-show="item.emptyFlag" /> | |
43 | 43 | <div |
44 | - v-show="!notFoundData" | |
44 | + v-show="!item.emptyFlag" | |
45 | 45 | :id="`chart-${item.device}`" |
46 | - :style="{ height, width }" | |
46 | + style="width: 100%; height: 400px" | |
47 | 47 | ></div> |
48 | 48 | </div> |
49 | 49 | </div> |
... | ... | @@ -86,7 +86,7 @@ |
86 | 86 | let currentRecord: ExecuteReportRecord = {} as unknown as ExecuteReportRecord; |
87 | 87 | |
88 | 88 | const chartInstance = ref< |
89 | - { device: string; name: string; attributes: string[]; active?: string }[] | |
89 | + { device: string; name: string; attributes: string[]; active?: string; emptyFlag?: boolean }[] | |
90 | 90 | >([]); |
91 | 91 | |
92 | 92 | const notFoundData = ref(false); |
... | ... | @@ -257,6 +257,15 @@ |
257 | 257 | try { |
258 | 258 | loading.value = true; |
259 | 259 | const result = await exportViewChartApi(device, sendParams); |
260 | + chartInstance.value.forEach((f) => { | |
261 | + if (f.device === device) { | |
262 | + if (Object.keys(result).length === 0) { | |
263 | + f.emptyFlag = true; | |
264 | + } else { | |
265 | + f.emptyFlag = false; | |
266 | + } | |
267 | + } | |
268 | + }); | |
260 | 269 | validateHasData(result); |
261 | 270 | const { xAxisData, series } = getChartsOption(result as unknown as ResponsData); |
262 | 271 | ... | ... |
... | ... | @@ -279,19 +279,28 @@ export const trigger_condition_schema: FormSchema[] = [ |
279 | 279 | component: 'ApiSelect', |
280 | 280 | componentProps: ({ formModel }) => { |
281 | 281 | const deviceProfileId = formModel['deviceProfileId']; |
282 | - if (unref(organizationId)) { | |
283 | - return { | |
284 | - placeholder: '请选择设备', | |
285 | - mode: 'multiple', | |
286 | - api: byOrganizationIdGetMasterDevice, | |
287 | - params: { | |
288 | - organizationId: unref(organizationId), | |
289 | - deviceProfileId, | |
290 | - }, | |
291 | - labelField: 'name', | |
292 | - valueField: 'tbDeviceId', | |
293 | - }; | |
294 | - } | |
282 | + return { | |
283 | + mode: 'multiple', | |
284 | + api: async () => { | |
285 | + if (unref(organizationId)) { | |
286 | + try { | |
287 | + const data = await byOrganizationIdGetMasterDevice({ | |
288 | + organizationId: unref(organizationId), | |
289 | + deviceProfileId, | |
290 | + }); | |
291 | + if (data) | |
292 | + return data.map((item) => ({ | |
293 | + ...item, | |
294 | + label: item.alias || item.name, | |
295 | + value: item.tbDeviceId, | |
296 | + })); | |
297 | + } catch (error) {} | |
298 | + } | |
299 | + return []; | |
300 | + }, | |
301 | + placeholder: '请选择设备', | |
302 | + getPopupContainer: () => document.body, | |
303 | + }; | |
295 | 304 | }, |
296 | 305 | ifShow: ({ values }) => isPart(values.device), |
297 | 306 | colProps: { span: 6 }, |
... | ... | @@ -473,19 +482,28 @@ export const actionSchema: FormSchema[] = [ |
473 | 482 | component: 'ApiSelect', |
474 | 483 | componentProps: ({ formModel }) => { |
475 | 484 | const deviceProfileId = formModel['deviceProfileId']; |
476 | - if (unref(organizationId)) { | |
477 | - return { | |
478 | - placeholder: '请选择设备', | |
479 | - mode: 'multiple', | |
480 | - api: byOrganizationIdGetMasterDevice, | |
481 | - params: { | |
482 | - organizationId: unref(organizationId), | |
483 | - deviceProfileId, | |
484 | - }, | |
485 | - labelField: 'name', | |
486 | - valueField: 'tbDeviceId', | |
487 | - }; | |
488 | - } | |
485 | + return { | |
486 | + mode: 'multiple', | |
487 | + api: async () => { | |
488 | + if (unref(organizationId)) { | |
489 | + try { | |
490 | + const data = await byOrganizationIdGetMasterDevice({ | |
491 | + organizationId: unref(organizationId), | |
492 | + deviceProfileId, | |
493 | + }); | |
494 | + if (data) | |
495 | + return data.map((item) => ({ | |
496 | + ...item, | |
497 | + label: item.alias || item.name, | |
498 | + value: item.tbDeviceId, | |
499 | + })); | |
500 | + } catch (error) {} | |
501 | + } | |
502 | + return []; | |
503 | + }, | |
504 | + placeholder: '请选择设备', | |
505 | + getPopupContainer: () => document.body, | |
506 | + }; | |
489 | 507 | }, |
490 | 508 | ifShow: ({ values }) => isPart(values.device) && isDeviceOut(values.outTarget), |
491 | 509 | colProps: { span: 6 }, | ... | ... |
... | ... | @@ -65,12 +65,14 @@ |
65 | 65 | v-if="ifAdd" |
66 | 66 | v-model:value="scriptForm.description" |
67 | 67 | placeholder="请输入备注" |
68 | + :maxlength="255" | |
68 | 69 | /> |
69 | 70 | <a-textarea |
70 | 71 | :rows="3" |
71 | 72 | v-else |
72 | 73 | v-model:value="scriptForm.output" |
73 | 74 | placeholder="输出参数为服务端返回的内容" |
75 | + :maxlength="255" | |
74 | 76 | /> |
75 | 77 | </a-form-item> |
76 | 78 | </a-form> |
... | ... | @@ -109,7 +111,7 @@ |
109 | 111 | typeOptions: [], |
110 | 112 | originalOptions: [], |
111 | 113 | }); |
112 | - const { typeOptions, originalOptions } = toRefs(reportTypeOptions); | |
114 | + const { originalOptions, typeOptions } = toRefs(reportTypeOptions); | |
113 | 115 | const { createMessage } = useMessage(); |
114 | 116 | const { clipboardRef, copiedRef } = useCopyToClipboard(); |
115 | 117 | const aceEditor = ref(); |
... | ... | @@ -149,7 +151,7 @@ |
149 | 151 | }); |
150 | 152 | aceEditor.value.setValue(); |
151 | 153 | beautify(aceEditor.value.session); |
152 | - scriptForm.convertJs = aceEditor.value.getValue(); | |
154 | + // scriptForm.convertJs = aceEditor.value.getValue(); | |
153 | 155 | }; |
154 | 156 | const handleCopy = () => { |
155 | 157 | const valueRef = aceEditor.value.getValue(); |
... | ... | @@ -184,6 +186,10 @@ |
184 | 186 | const trimParams = scriptForm.params.replace(/\s*/g, ''); |
185 | 187 | Reflect.set(value, 'params', trimParams); |
186 | 188 | } |
189 | + if (scriptForm.convertJs.length > 1000) { | |
190 | + createMessage.error('脚本内容长度不能大于1000'); | |
191 | + throw '脚本内容长度不能大于1000'; | |
192 | + } | |
187 | 193 | return { |
188 | 194 | ...value, |
189 | 195 | ...{ convertJs: props.ifAdd ? scriptForm.convertJs : null }, | ... | ... |
... | ... | @@ -224,6 +224,10 @@ export const accountFormSchema: FormSchema[] = [ |
224 | 224 | label: '备注', |
225 | 225 | component: 'InputTextArea', |
226 | 226 | colProps: { span: 24 }, |
227 | + componentProps: { | |
228 | + maxLength: 255, | |
229 | + placeholder: '请输入备注', | |
230 | + }, | |
227 | 231 | }, |
228 | 232 | { |
229 | 233 | field: 'organizationIds', | ... | ... |