Commit 91b4280625da8780d48ef9c373ef0905ccb0e4e1
1 parent
3e976837
fix: vben form bug
Showing
1 changed file
with
3 additions
and
2 deletions
yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue3_vben/views/form.vue.vm
| @@ -19,10 +19,10 @@ const { createMessage } = useMessage() | @@ -19,10 +19,10 @@ const { createMessage } = useMessage() | ||
| 19 | const emit = defineEmits(['success', 'register']) | 19 | const emit = defineEmits(['success', 'register']) |
| 20 | const isUpdate = ref(true) | 20 | const isUpdate = ref(true) |
| 21 | 21 | ||
| 22 | -const [registerForm, { setFieldsValue, resetFields, validate }] = useForm({ | 22 | +const [registerForm, { setFieldsValue, resetFields, resetSchema, validate }] = useForm({ |
| 23 | labelWidth: 120, | 23 | labelWidth: 120, |
| 24 | baseColProps: { span: 24 }, | 24 | baseColProps: { span: 24 }, |
| 25 | - schemas: isUpdate? updateFormSchema : createFormSchema, | 25 | + schemas: createFormSchema, |
| 26 | showActionButtonGroup: false, | 26 | showActionButtonGroup: false, |
| 27 | actionColOptions: { span: 23 } | 27 | actionColOptions: { span: 23 } |
| 28 | }) | 28 | }) |
| @@ -32,6 +32,7 @@ const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data | @@ -32,6 +32,7 @@ const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data | ||
| 32 | setModalProps({ confirmLoading: false }) | 32 | setModalProps({ confirmLoading: false }) |
| 33 | isUpdate.value = !!data?.isUpdate | 33 | isUpdate.value = !!data?.isUpdate |
| 34 | if (unref(isUpdate)) { | 34 | if (unref(isUpdate)) { |
| 35 | + resetSchema(updateFormSchema) | ||
| 35 | const res = await get${simpleClassName}(data.record.id) | 36 | const res = await get${simpleClassName}(data.record.id) |
| 36 | setFieldsValue({ ...res }) | 37 | setFieldsValue({ ...res }) |
| 37 | } | 38 | } |