Commit f2aa60eb0f9414ae19664f91669a1e345d649534
Merge branch 'ww' into 'main'
fix: DEFECT-578 reset form is invalid && close modal not clean echarts instance See merge request huang/yun-teng-iot-front!271
Showing
2 changed files
with
18 additions
and
12 deletions
... | ... | @@ -84,7 +84,6 @@ export const defaultSchemas: FormSchema[] = [ |
84 | 84 | return { |
85 | 85 | showTime: true, |
86 | 86 | onCalendarChange(value: Moment[]) { |
87 | - console.log('enter '); | |
88 | 87 | dates = value; |
89 | 88 | }, |
90 | 89 | disabledDate(current: Moment) { |
... | ... | @@ -108,7 +107,7 @@ export const defaultSchemas: FormSchema[] = [ |
108 | 107 | field: SchemaFiled.AGG, |
109 | 108 | label: '数据聚合功能', |
110 | 109 | component: 'Select', |
111 | - defaultValue: AggregateDataEnum.NONE, | |
110 | + // defaultValue: AggregateDataEnum.NONE, | |
112 | 111 | componentProps: { |
113 | 112 | getPopupContainer: () => document.body, |
114 | 113 | options: [ |
... | ... | @@ -128,12 +127,14 @@ export const defaultSchemas: FormSchema[] = [ |
128 | 127 | ifShow({ values }) { |
129 | 128 | return values[SchemaFiled.AGG] !== AggregateDataEnum.NONE; |
130 | 129 | }, |
131 | - componentProps({ formModel }) { | |
130 | + componentProps({ formModel, formActionType }) { | |
132 | 131 | const options = |
133 | 132 | formModel[SchemaFiled.WAY] === QueryWay.LATEST |
134 | 133 | ? getPacketIntervalByValue(formModel[SchemaFiled.START_TS]) |
135 | 134 | : getPacketIntervalByRange(formModel[SchemaFiled.DATE_RANGE]); |
136 | - | |
135 | + if (formModel[SchemaFiled.AGG] !== AggregateDataEnum.NONE) { | |
136 | + formActionType.setFieldsValue({ [SchemaFiled.LIMIT]: null }); | |
137 | + } | |
137 | 138 | return { |
138 | 139 | options, |
139 | 140 | }; |
... | ... | @@ -143,13 +144,15 @@ export const defaultSchemas: FormSchema[] = [ |
143 | 144 | field: SchemaFiled.LIMIT, |
144 | 145 | label: '最大值', |
145 | 146 | component: 'InputNumber', |
146 | - defaultValue: 7, | |
147 | + // defaultValue: 7, | |
147 | 148 | ifShow({ values }) { |
148 | 149 | return values[SchemaFiled.AGG] === AggregateDataEnum.NONE; |
149 | 150 | }, |
150 | - componentProps: { | |
151 | - max: 50000, | |
152 | - min: 7, | |
151 | + componentProps() { | |
152 | + return { | |
153 | + max: 50000, | |
154 | + min: 7, | |
155 | + }; | |
153 | 156 | }, |
154 | 157 | }, |
155 | 158 | ]; | ... | ... |
... | ... | @@ -55,7 +55,7 @@ |
55 | 55 | import { formSchema, columns } from './config.data'; |
56 | 56 | import { BasicTable, useTable } from '/@/components/Table'; |
57 | 57 | import { devicePage } from '/@/api/alarm/contact/alarmContact'; |
58 | - import { Tag, Empty, message } from 'ant-design-vue'; | |
58 | + import { Tag, Empty } from 'ant-design-vue'; | |
59 | 59 | import { DeviceState } from '/@/api/device/model/deviceModel'; |
60 | 60 | import { BAI_DU_MAP_URL } from '/@/utils/fnUtils'; |
61 | 61 | import { useModal, BasicModal } from '/@/components/Modal'; |
... | ... | @@ -80,7 +80,7 @@ |
80 | 80 | import { selectDeviceAttrSchema, eChartOptions } from './config.data'; |
81 | 81 | import { defaultSchemas } from './cpns/TimePeriodForm/config'; |
82 | 82 | import { QueryWay, SchemaFiled, AggregateDataEnum } from './cpns/TimePeriodForm/config'; |
83 | - import { formatToDateTime } from '/@/utils/dateUtil'; | |
83 | + import { dateUtil } from '/@/utils/dateUtil'; | |
84 | 84 | export default defineComponent({ |
85 | 85 | name: 'BaiduMap', |
86 | 86 | components: { |
... | ... | @@ -108,7 +108,7 @@ |
108 | 108 | const wrapRef = ref<HTMLDivElement | null>(null); |
109 | 109 | const chartRef = ref<HTMLDivElement | null>(null); |
110 | 110 | const deviceAttrs = ref<string[]>([]); |
111 | - const { setOptions } = useECharts(chartRef as Ref<HTMLDivElement>); | |
111 | + const { setOptions, getInstance } = useECharts(chartRef as Ref<HTMLDivElement>); | |
112 | 112 | const isNull = ref(true); |
113 | 113 | const { toPromise } = useScript({ src: BAI_DU_MAP_URL }); |
114 | 114 | const [registerDetailDrawer, { openDrawer }] = useDrawer(); |
... | ... | @@ -299,6 +299,8 @@ |
299 | 299 | |
300 | 300 | method.setFieldsValue({ |
301 | 301 | [SchemaFiled.START_TS]: 1 * 24 * 60 * 60 * 1000, |
302 | + [SchemaFiled.LIMIT]: 7, | |
303 | + [SchemaFiled.AGG]: AggregateDataEnum.NONE, | |
302 | 304 | }); |
303 | 305 | |
304 | 306 | if (!hasDeviceAttr()) return; |
... | ... | @@ -335,7 +337,7 @@ |
335 | 337 | for (const key in data) { |
336 | 338 | for (const item1 of data[key]) { |
337 | 339 | let { ts, value } = item1; |
338 | - const time = formatToDateTime(ts); | |
340 | + const time = dateUtil(ts).format('YYYY-MM-DD HH:mm:ss'); | |
339 | 341 | value = Number(value).toFixed(2); |
340 | 342 | dataArray.push([time, value, key]); |
341 | 343 | } |
... | ... | @@ -361,6 +363,7 @@ |
361 | 363 | [SchemaFiled.LIMIT]: 7, |
362 | 364 | [SchemaFiled.AGG]: AggregateDataEnum.NONE, |
363 | 365 | }); |
366 | + getInstance()?.clear(); | |
364 | 367 | }; |
365 | 368 | |
366 | 369 | onMounted(() => { | ... | ... |