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,7 +84,6 @@ export const defaultSchemas: FormSchema[] = [ | ||
84 | return { | 84 | return { |
85 | showTime: true, | 85 | showTime: true, |
86 | onCalendarChange(value: Moment[]) { | 86 | onCalendarChange(value: Moment[]) { |
87 | - console.log('enter '); | ||
88 | dates = value; | 87 | dates = value; |
89 | }, | 88 | }, |
90 | disabledDate(current: Moment) { | 89 | disabledDate(current: Moment) { |
@@ -108,7 +107,7 @@ export const defaultSchemas: FormSchema[] = [ | @@ -108,7 +107,7 @@ export const defaultSchemas: FormSchema[] = [ | ||
108 | field: SchemaFiled.AGG, | 107 | field: SchemaFiled.AGG, |
109 | label: '数据聚合功能', | 108 | label: '数据聚合功能', |
110 | component: 'Select', | 109 | component: 'Select', |
111 | - defaultValue: AggregateDataEnum.NONE, | 110 | + // defaultValue: AggregateDataEnum.NONE, |
112 | componentProps: { | 111 | componentProps: { |
113 | getPopupContainer: () => document.body, | 112 | getPopupContainer: () => document.body, |
114 | options: [ | 113 | options: [ |
@@ -128,12 +127,14 @@ export const defaultSchemas: FormSchema[] = [ | @@ -128,12 +127,14 @@ export const defaultSchemas: FormSchema[] = [ | ||
128 | ifShow({ values }) { | 127 | ifShow({ values }) { |
129 | return values[SchemaFiled.AGG] !== AggregateDataEnum.NONE; | 128 | return values[SchemaFiled.AGG] !== AggregateDataEnum.NONE; |
130 | }, | 129 | }, |
131 | - componentProps({ formModel }) { | 130 | + componentProps({ formModel, formActionType }) { |
132 | const options = | 131 | const options = |
133 | formModel[SchemaFiled.WAY] === QueryWay.LATEST | 132 | formModel[SchemaFiled.WAY] === QueryWay.LATEST |
134 | ? getPacketIntervalByValue(formModel[SchemaFiled.START_TS]) | 133 | ? getPacketIntervalByValue(formModel[SchemaFiled.START_TS]) |
135 | : getPacketIntervalByRange(formModel[SchemaFiled.DATE_RANGE]); | 134 | : getPacketIntervalByRange(formModel[SchemaFiled.DATE_RANGE]); |
136 | - | 135 | + if (formModel[SchemaFiled.AGG] !== AggregateDataEnum.NONE) { |
136 | + formActionType.setFieldsValue({ [SchemaFiled.LIMIT]: null }); | ||
137 | + } | ||
137 | return { | 138 | return { |
138 | options, | 139 | options, |
139 | }; | 140 | }; |
@@ -143,13 +144,15 @@ export const defaultSchemas: FormSchema[] = [ | @@ -143,13 +144,15 @@ export const defaultSchemas: FormSchema[] = [ | ||
143 | field: SchemaFiled.LIMIT, | 144 | field: SchemaFiled.LIMIT, |
144 | label: '最大值', | 145 | label: '最大值', |
145 | component: 'InputNumber', | 146 | component: 'InputNumber', |
146 | - defaultValue: 7, | 147 | + // defaultValue: 7, |
147 | ifShow({ values }) { | 148 | ifShow({ values }) { |
148 | return values[SchemaFiled.AGG] === AggregateDataEnum.NONE; | 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,7 +55,7 @@ | ||
55 | import { formSchema, columns } from './config.data'; | 55 | import { formSchema, columns } from './config.data'; |
56 | import { BasicTable, useTable } from '/@/components/Table'; | 56 | import { BasicTable, useTable } from '/@/components/Table'; |
57 | import { devicePage } from '/@/api/alarm/contact/alarmContact'; | 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 | import { DeviceState } from '/@/api/device/model/deviceModel'; | 59 | import { DeviceState } from '/@/api/device/model/deviceModel'; |
60 | import { BAI_DU_MAP_URL } from '/@/utils/fnUtils'; | 60 | import { BAI_DU_MAP_URL } from '/@/utils/fnUtils'; |
61 | import { useModal, BasicModal } from '/@/components/Modal'; | 61 | import { useModal, BasicModal } from '/@/components/Modal'; |
@@ -80,7 +80,7 @@ | @@ -80,7 +80,7 @@ | ||
80 | import { selectDeviceAttrSchema, eChartOptions } from './config.data'; | 80 | import { selectDeviceAttrSchema, eChartOptions } from './config.data'; |
81 | import { defaultSchemas } from './cpns/TimePeriodForm/config'; | 81 | import { defaultSchemas } from './cpns/TimePeriodForm/config'; |
82 | import { QueryWay, SchemaFiled, AggregateDataEnum } from './cpns/TimePeriodForm/config'; | 82 | import { QueryWay, SchemaFiled, AggregateDataEnum } from './cpns/TimePeriodForm/config'; |
83 | - import { formatToDateTime } from '/@/utils/dateUtil'; | 83 | + import { dateUtil } from '/@/utils/dateUtil'; |
84 | export default defineComponent({ | 84 | export default defineComponent({ |
85 | name: 'BaiduMap', | 85 | name: 'BaiduMap', |
86 | components: { | 86 | components: { |
@@ -108,7 +108,7 @@ | @@ -108,7 +108,7 @@ | ||
108 | const wrapRef = ref<HTMLDivElement | null>(null); | 108 | const wrapRef = ref<HTMLDivElement | null>(null); |
109 | const chartRef = ref<HTMLDivElement | null>(null); | 109 | const chartRef = ref<HTMLDivElement | null>(null); |
110 | const deviceAttrs = ref<string[]>([]); | 110 | const deviceAttrs = ref<string[]>([]); |
111 | - const { setOptions } = useECharts(chartRef as Ref<HTMLDivElement>); | 111 | + const { setOptions, getInstance } = useECharts(chartRef as Ref<HTMLDivElement>); |
112 | const isNull = ref(true); | 112 | const isNull = ref(true); |
113 | const { toPromise } = useScript({ src: BAI_DU_MAP_URL }); | 113 | const { toPromise } = useScript({ src: BAI_DU_MAP_URL }); |
114 | const [registerDetailDrawer, { openDrawer }] = useDrawer(); | 114 | const [registerDetailDrawer, { openDrawer }] = useDrawer(); |
@@ -299,6 +299,8 @@ | @@ -299,6 +299,8 @@ | ||
299 | 299 | ||
300 | method.setFieldsValue({ | 300 | method.setFieldsValue({ |
301 | [SchemaFiled.START_TS]: 1 * 24 * 60 * 60 * 1000, | 301 | [SchemaFiled.START_TS]: 1 * 24 * 60 * 60 * 1000, |
302 | + [SchemaFiled.LIMIT]: 7, | ||
303 | + [SchemaFiled.AGG]: AggregateDataEnum.NONE, | ||
302 | }); | 304 | }); |
303 | 305 | ||
304 | if (!hasDeviceAttr()) return; | 306 | if (!hasDeviceAttr()) return; |
@@ -335,7 +337,7 @@ | @@ -335,7 +337,7 @@ | ||
335 | for (const key in data) { | 337 | for (const key in data) { |
336 | for (const item1 of data[key]) { | 338 | for (const item1 of data[key]) { |
337 | let { ts, value } = item1; | 339 | let { ts, value } = item1; |
338 | - const time = formatToDateTime(ts); | 340 | + const time = dateUtil(ts).format('YYYY-MM-DD HH:mm:ss'); |
339 | value = Number(value).toFixed(2); | 341 | value = Number(value).toFixed(2); |
340 | dataArray.push([time, value, key]); | 342 | dataArray.push([time, value, key]); |
341 | } | 343 | } |
@@ -361,6 +363,7 @@ | @@ -361,6 +363,7 @@ | ||
361 | [SchemaFiled.LIMIT]: 7, | 363 | [SchemaFiled.LIMIT]: 7, |
362 | [SchemaFiled.AGG]: AggregateDataEnum.NONE, | 364 | [SchemaFiled.AGG]: AggregateDataEnum.NONE, |
363 | }); | 365 | }); |
366 | + getInstance()?.clear(); | ||
364 | }; | 367 | }; |
365 | 368 | ||
366 | onMounted(() => { | 369 | onMounted(() => { |