Commit ec080c8c04dbf33dbc2f786faa29899549af8b7c
1 parent
948d1987
fix:DEFECT-621 DEFECT-622 DEFECT-613 修复时间段显示为一样的时间 设备未填入属性提示修改 编辑报表配置,先设置自定义周期,再…
…编辑为固定周期,时间周期和间隔时间回显为0,并且可以编辑成功
Showing
2 changed files
with
31 additions
and
1 deletions
@@ -13,6 +13,7 @@ | @@ -13,6 +13,7 @@ | ||
13 | <BasicForm @register="registerForm"> | 13 | <BasicForm @register="registerForm"> |
14 | <template #devices="{ model, field }"> | 14 | <template #devices="{ model, field }"> |
15 | <p style="display: none">{{ field }}</p> | 15 | <p style="display: none">{{ field }}</p> |
16 | + <p>{{ queryModeFunc(model['queryMode']) }}</p> | ||
16 | <p>{{ orgFunc(model['organizationId']) }}</p> | 17 | <p>{{ orgFunc(model['organizationId']) }}</p> |
17 | <Select | 18 | <Select |
18 | placeholder="请选择设备" | 19 | placeholder="请选择设备" |
@@ -81,9 +82,23 @@ | @@ -81,9 +82,23 @@ | ||
81 | let editResData: any = reactive({}); | 82 | let editResData: any = reactive({}); |
82 | const editDeviceAttr: any = ref([]); | 83 | const editDeviceAttr: any = ref([]); |
83 | const orgFuncId = ref(''); | 84 | const orgFuncId = ref(''); |
85 | + const queryModeStr = ref(''); | ||
84 | const orgFunc = (e) => { | 86 | const orgFunc = (e) => { |
85 | orgFuncId.value = e; | 87 | orgFuncId.value = e; |
86 | }; | 88 | }; |
89 | + const queryModeFunc = (e) => { | ||
90 | + queryModeStr.value = e; | ||
91 | + }; | ||
92 | + watch( | ||
93 | + () => queryModeStr.value, | ||
94 | + (newValue: string) => { | ||
95 | + if (newValue == 'latest') { | ||
96 | + setFieldsValue({ startTs: 1000 }); | ||
97 | + setFieldsValue({ interval: 1000 }); | ||
98 | + } else { | ||
99 | + } | ||
100 | + } | ||
101 | + ); | ||
87 | watch( | 102 | watch( |
88 | () => orgFuncId.value, | 103 | () => orgFuncId.value, |
89 | async (newValue: string) => { | 104 | async (newValue: string) => { |
@@ -335,15 +350,25 @@ | @@ -335,15 +350,25 @@ | ||
335 | const values = await validate(); | 350 | const values = await validate(); |
336 | if (!values) return; | 351 | if (!values) return; |
337 | getFormValueFunc(); | 352 | getFormValueFunc(); |
353 | + let hasAttr = false; | ||
338 | if (!unref(isUpdate)) { | 354 | if (!unref(isUpdate)) { |
339 | if (getAttrDevice.value.length === 0) { | 355 | if (getAttrDevice.value.length === 0) { |
340 | return createMessage.error('请选择设备及其属性'); | 356 | return createMessage.error('请选择设备及其属性'); |
357 | + } else { | ||
358 | + getAttrDevice.value.forEach((f: any) => { | ||
359 | + if (f.attributes == undefined) hasAttr = true; | ||
360 | + }); | ||
341 | } | 361 | } |
342 | } else { | 362 | } else { |
343 | if (getAttrDevice.value.length === 0) { | 363 | if (getAttrDevice.value.length === 0) { |
344 | return createMessage.error('请选择设备及其属性'); | 364 | return createMessage.error('请选择设备及其属性'); |
365 | + } else { | ||
366 | + getAttrDevice.value.forEach((f: any) => { | ||
367 | + if (f.attributes == undefined) hasAttr = true; | ||
368 | + }); | ||
345 | } | 369 | } |
346 | } | 370 | } |
371 | + if (hasAttr) return createMessage.error('请选择设备属性'); | ||
347 | if (values.executeWay == 0) { | 372 | if (values.executeWay == 0) { |
348 | executeContent = null; | 373 | executeContent = null; |
349 | } else { | 374 | } else { |
@@ -368,6 +393,11 @@ | @@ -368,6 +393,11 @@ | ||
368 | }, | 393 | }, |
369 | queryMode: values?.queryMode === 'latest' ? 0 : 1, | 394 | queryMode: values?.queryMode === 'latest' ? 0 : 1, |
370 | }; | 395 | }; |
396 | + if (queryCondition.queryMode === 1) { | ||
397 | + if (queryCondition.startTs == queryCondition.endTs) { | ||
398 | + return createMessage.error('自定义周期时间不能选择一样'); | ||
399 | + } | ||
400 | + } | ||
371 | 401 | ||
372 | delete values.devices; | 402 | delete values.devices; |
373 | delete values.agg; | 403 | delete values.agg; |
@@ -407,13 +407,13 @@ export const formSchema: QFormSchema[] = [ | @@ -407,13 +407,13 @@ export const formSchema: QFormSchema[] = [ | ||
407 | componentProps({ formActionType }) { | 407 | componentProps({ formActionType }) { |
408 | const { setFieldsValue } = formActionType; | 408 | const { setFieldsValue } = formActionType; |
409 | return { | 409 | return { |
410 | - getPopupContainer: () => document.body, | ||
411 | placeholder: '请选择查询周期', | 410 | placeholder: '请选择查询周期', |
412 | options: [ | 411 | options: [ |
413 | { label: '固定周期', value: QueryWay.LATEST }, | 412 | { label: '固定周期', value: QueryWay.LATEST }, |
414 | { label: '自定义周期', value: QueryWay.TIME_PERIOD }, | 413 | { label: '自定义周期', value: QueryWay.TIME_PERIOD }, |
415 | ], | 414 | ], |
416 | onChange(value) { | 415 | onChange(value) { |
416 | + console.log(value) | ||
417 | value === QueryWay.LATEST | 417 | value === QueryWay.LATEST |
418 | ? setFieldsValue({ | 418 | ? setFieldsValue({ |
419 | [SchemaFiled.DATE_RANGE]: [], | 419 | [SchemaFiled.DATE_RANGE]: [], |