Commit b64b293ce8f441ecc4c27dd873c548ac8e35a452
1 parent
4733b038
fix:DEFECT-631 编辑先选择设备时,未填属性,显示请输入设备属性,然后把设备属性叉了后,再点击确认,抛提示错误
Showing
2 changed files
with
48 additions
and
32 deletions
... | ... | @@ -15,6 +15,7 @@ |
15 | 15 | <p style="display: none">{{ field }}</p> |
16 | 16 | <p>{{ queryModeFunc(model['queryMode']) }}</p> |
17 | 17 | <p>{{ orgFunc(model['organizationId']) }}</p> |
18 | + <p>{{ dataTypeFunc(model['dataType']) }}</p> | |
18 | 19 | <Select |
19 | 20 | placeholder="请选择设备" |
20 | 21 | v-model:value="selectDevice" |
... | ... | @@ -83,12 +84,25 @@ |
83 | 84 | const editDeviceAttr: any = ref([]); |
84 | 85 | const orgFuncId = ref(''); |
85 | 86 | const queryModeStr = ref(''); |
87 | + const dataTypeStr = ref(0); | |
86 | 88 | const orgFunc = (e) => { |
87 | 89 | orgFuncId.value = e; |
88 | 90 | }; |
89 | 91 | const queryModeFunc = (e) => { |
90 | 92 | queryModeStr.value = e; |
91 | 93 | }; |
94 | + const dataTypeFunc = (e) => { | |
95 | + dataTypeStr.value = e; | |
96 | + }; | |
97 | + watch( | |
98 | + () => dataTypeStr.value, | |
99 | + (newValue) => { | |
100 | + if (newValue == 0) { | |
101 | + setFieldsValue({ limit: 200 }); | |
102 | + } else { | |
103 | + } | |
104 | + } | |
105 | + ); | |
92 | 106 | watch( |
93 | 107 | () => queryModeStr.value, |
94 | 108 | (newValue: string) => { |
... | ... | @@ -207,7 +221,7 @@ |
207 | 221 | endTs: editResData.data.queryCondition?.endTs, |
208 | 222 | way: editResData.data?.way, |
209 | 223 | queryMode: editResData.data.queryCondition?.queryMode === 0 ? 'latest' : 'timePeriod', |
210 | - cronTime: editResData.data?.executeContent | |
224 | + cronTime: editResData.data?.executeContent, | |
211 | 225 | }); |
212 | 226 | const endTsTime = editResData.data.queryCondition?.endTs; |
213 | 227 | const startTsTime = editResData.data.queryCondition?.startTs; |
... | ... | @@ -357,7 +371,7 @@ |
357 | 371 | return createMessage.error('请选择设备及其属性'); |
358 | 372 | } else { |
359 | 373 | getAttrDevice.value.forEach((f: any) => { |
360 | - if (f.attributes == undefined) hasAttr = true; | |
374 | + if (f.attributes == undefined || f.attributes.length == 0) hasAttr = true; | |
361 | 375 | }); |
362 | 376 | } |
363 | 377 | } else { |
... | ... | @@ -365,7 +379,7 @@ |
365 | 379 | return createMessage.error('请选择设备及其属性'); |
366 | 380 | } else { |
367 | 381 | getAttrDevice.value.forEach((f: any) => { |
368 | - if (f.attributes == undefined) hasAttr = true; | |
382 | + if (f.attributes == undefined || f.attributes.length == 0) hasAttr = true; | |
369 | 383 | }); |
370 | 384 | } |
371 | 385 | } |
... | ... | @@ -379,8 +393,9 @@ |
379 | 393 | startTs.value = moment().subtract(values.startTs, 'ms').valueOf(); |
380 | 394 | endTs.value = Date.now(); |
381 | 395 | } else { |
382 | - startTs.value = moment(values.startTs).valueOf(); | |
383 | - endTs.value = moment(values.endTs).valueOf(); | |
396 | + const fT = JSON.parse(JSON.stringify(values.dataRange)); | |
397 | + startTs.value = moment(fT[0]).valueOf(); | |
398 | + endTs.value = moment(fT[1]).valueOf(); | |
384 | 399 | } |
385 | 400 | queryCondition = { |
386 | 401 | agg: values.agg, |
... | ... | @@ -394,12 +409,6 @@ |
394 | 409 | }, |
395 | 410 | queryMode: values?.queryMode === 'latest' ? 0 : 1, |
396 | 411 | }; |
397 | - if (queryCondition.queryMode === 1) { | |
398 | - if (queryCondition.startTs == queryCondition.endTs) { | |
399 | - return createMessage.error('自定义周期时间不能选择一样'); | |
400 | - } | |
401 | - } | |
402 | - | |
403 | 412 | delete values.devices; |
404 | 413 | delete values.agg; |
405 | 414 | delete values.interval; | ... | ... |
... | ... | @@ -433,28 +433,35 @@ export const formSchema: QFormSchema[] = [ |
433 | 433 | ifShow({ values }) { |
434 | 434 | return values[SchemaFiled.WAY] === QueryWay.TIME_PERIOD && !isFixedTime(values.executeWay); |
435 | 435 | }, |
436 | - componentProps({ formActionType }) { | |
437 | - const { setFieldsValue } = formActionType; | |
438 | - let dates: Moment[] = []; | |
439 | - return { | |
440 | - placeholder: ['请选择开始时间', '请选择结束时间'], | |
441 | - showTime: true, | |
442 | - onCalendarChange(value: Moment[]) { | |
443 | - dates = value; | |
444 | - }, | |
445 | - disabledDate(current: Moment) { | |
446 | - if (!dates || dates.length === 0 || !current) { | |
447 | - return false; | |
448 | - } | |
449 | - const diffDate = current.diff(dates[0], 'years', true); | |
450 | - return Math.abs(diffDate) > 1; | |
451 | - }, | |
452 | - onChange() { | |
453 | - dates = []; | |
454 | - setFieldsValue({ [SchemaFiled.INTERVAL]: null }); | |
455 | - }, | |
456 | - }; | |
436 | + componentProps: { | |
437 | + showTime: { | |
438 | + defaultValue: [moment('00:00:00', 'HH:mm:ss'), moment('23:59:59', 'HH:mm:ss')], | |
439 | + }, | |
457 | 440 | }, |
441 | + // componentProps({ formActionType }) { | |
442 | + // const { setFieldsValue } = formActionType; | |
443 | + // let dates: Moment[] = []; | |
444 | + // return { | |
445 | + // placeholder: ['请选择开始时间', '请选择结束时间'], | |
446 | + // showTime: { | |
447 | + // defaultValue: [moment('00:00:00', 'HH:mm:ss'), moment('23:59:59', 'HH:mm:ss')], | |
448 | + // }, | |
449 | + // // onCalendarChange(value: Moment[]) { | |
450 | + // // dates = value; | |
451 | + // // }, | |
452 | + // // disabledDate(current: Moment) { | |
453 | + // // if (!dates || dates.length === 0 || !current) { | |
454 | + // // return false; | |
455 | + // // } | |
456 | + // // const diffDate = current.diff(dates[0], 'years', true); | |
457 | + // // return Math.abs(diffDate) > 1; | |
458 | + // // }, | |
459 | + // onChange() { | |
460 | + // dates = []; | |
461 | + // setFieldsValue({ [SchemaFiled.INTERVAL]: null }); | |
462 | + // }, | |
463 | + // }; | |
464 | + // }, | |
458 | 465 | colProps: { |
459 | 466 | span: 10, |
460 | 467 | }, | ... | ... |