Browse Source

fix Alert instance form not init bug (#9258)

3.0.0/version-upgrade
Devosend 3 years ago committed by GitHub
parent
commit
fa56751a56
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 12
      dolphinscheduler-ui-next/src/components/form/use-form.ts
  2. 2
      dolphinscheduler-ui-next/src/views/security/alarm-instance-manage/use-form.ts

12
dolphinscheduler-ui-next/src/components/form/use-form.ts

@ -26,6 +26,17 @@ export function useForm() {
await state.formRef.validate(...args)
}
const resetValues = (initialValues: { [field: string]: any }) => {
const modelKeys = Object.keys(state.formRef.model)
for (const key of modelKeys) {
if (!Object.keys(initialValues).includes(key)) {
delete state.formRef.model[key]
}
}
setValues(initialValues)
}
const setValues = (initialValues: { [field: string]: any }) => {
for (const [key, value] of Object.entries(initialValues)) {
state.formRef.model[key] = value
@ -45,6 +56,7 @@ export function useForm() {
validate,
setValues,
getValues,
resetValues,
restoreValidation
}
}

2
dolphinscheduler-ui-next/src/views/security/alarm-instance-manage/use-form.ts

@ -96,7 +96,7 @@ export function useForm() {
}
const resetForm = () => {
state.detailFormRef.setValues({ ...initialValues })
state.detailFormRef.resetValues({ ...initialValues })
state.json = []
}

Loading…
Cancel
Save