Commit 12b2a98ada32376d1ed3244c3c55fd2d0123865e
Merge branch 'task/center' into 'main_dev'
fix: 修复任务中心JSON编辑器触发验证 See merge request yunteng/thingskit-front!896
Showing
2 changed files
with
13 additions
and
10 deletions
| ... | ... | @@ -2,7 +2,7 @@ |
| 2 | 2 | import { BasicForm, useForm } from '/@/components/Form'; |
| 3 | 3 | import { BasicModal, useModalInner } from '/@/components/Modal'; |
| 4 | 4 | import { formSchemas } from './config'; |
| 5 | - import { ref } from 'vue'; | |
| 5 | + import { nextTick, ref } from 'vue'; | |
| 6 | 6 | import { composeData, parseData } from './util'; |
| 7 | 7 | import { createTask, updateTask } from '/@/api/task'; |
| 8 | 8 | import { ModalParamsType } from '/#/utils'; |
| ... | ... | @@ -33,7 +33,10 @@ |
| 33 | 33 | modalMode.value = mode; |
| 34 | 34 | dataSource.value = record; |
| 35 | 35 | formMode.value = mode; |
| 36 | - resetFields(); | |
| 36 | + resetFields().then(async () => { | |
| 37 | + await nextTick(); | |
| 38 | + clearValidate(); | |
| 39 | + }); | |
| 37 | 40 | if (record && mode === DataActionModeEnum.UPDATE) { |
| 38 | 41 | const res = parseData(record); |
| 39 | 42 | setFieldsValue({ ...res }); |
| ... | ... | @@ -41,13 +44,14 @@ |
| 41 | 44 | } |
| 42 | 45 | ); |
| 43 | 46 | |
| 44 | - const [registerForm, { getFieldsValue, validate, setFieldsValue, resetFields }] = useForm({ | |
| 45 | - schemas: formSchemas, | |
| 46 | - showActionButtonGroup: false, | |
| 47 | - layout: 'inline', | |
| 48 | - baseColProps: { span: 24 }, | |
| 49 | - labelWidth: 140, | |
| 50 | - }); | |
| 47 | + const [registerForm, { getFieldsValue, validate, setFieldsValue, resetFields, clearValidate }] = | |
| 48 | + useForm({ | |
| 49 | + schemas: formSchemas, | |
| 50 | + showActionButtonGroup: false, | |
| 51 | + layout: 'inline', | |
| 52 | + baseColProps: { span: 24 }, | |
| 53 | + labelWidth: 140, | |
| 54 | + }); | |
| 51 | 55 | |
| 52 | 56 | const loading = ref(false); |
| 53 | 57 | const { createMessage } = useMessage(); | ... | ... |
| ... | ... | @@ -124,7 +124,6 @@ export const parseData = (result: TaskRecordType): Required<FormValueType> => { |
| 124 | 124 | TaskRecordType['executeTarget'] |
| 125 | 125 | >; |
| 126 | 126 | const { type: executeTimeType, period, periodType, time, pollUnit } = executeTime; |
| 127 | - console.log(pushWay === PushWayEnum.MQTT ? JSON.stringify(rpcCommand, null, 2) : rpcCommand); | |
| 128 | 127 | return { |
| 129 | 128 | name, |
| 130 | 129 | targetType, | ... | ... |