Showing
1 changed file
with
6 additions
and
4 deletions
@@ -10,7 +10,7 @@ | @@ -10,7 +10,7 @@ | ||
10 | </div> | 10 | </div> |
11 | </template> | 11 | </template> |
12 | <script lang="ts"> | 12 | <script lang="ts"> |
13 | - import { defineComponent, ref } from 'vue'; | 13 | + import { defineComponent, nextTick, ref } from 'vue'; |
14 | import { BasicForm, useForm } from '/@/components/Form'; | 14 | import { BasicForm, useForm } from '/@/components/Form'; |
15 | import { CommandFieldsEnum, CommandSchemas, CommandType, ValueType } from '../../config/data'; | 15 | import { CommandFieldsEnum, CommandSchemas, CommandType, ValueType } from '../../config/data'; |
16 | import { commandIssuanceApi } from '/@/api/device/deviceManager'; | 16 | import { commandIssuanceApi } from '/@/api/device/deviceManager'; |
@@ -35,7 +35,7 @@ | @@ -35,7 +35,7 @@ | ||
35 | const { createMessage } = useMessage(); | 35 | const { createMessage } = useMessage(); |
36 | const loading = ref(false); | 36 | const loading = ref(false); |
37 | 37 | ||
38 | - const [registerForm, { getFieldsValue, validate, resetFields }] = useForm({ | 38 | + const [registerForm, { getFieldsValue, validate, resetFields, clearValidate }] = useForm({ |
39 | labelWidth: 120, | 39 | labelWidth: 120, |
40 | schemas: CommandSchemas( | 40 | schemas: CommandSchemas( |
41 | props.deviceDetail.deviceProfile.transportType as TransportTypeEnum, | 41 | props.deviceDetail.deviceProfile.transportType as TransportTypeEnum, |
@@ -47,8 +47,10 @@ | @@ -47,8 +47,10 @@ | ||
47 | showResetButton: false, | 47 | showResetButton: false, |
48 | }); | 48 | }); |
49 | 49 | ||
50 | - const handleCancel = () => { | ||
51 | - resetFields(); | 50 | + const handleCancel = async () => { |
51 | + await resetFields(); | ||
52 | + await nextTick(); | ||
53 | + await clearValidate(); | ||
52 | }; | 54 | }; |
53 | 55 | ||
54 | const handleOk = async () => { | 56 | const handleOk = async () => { |