|
@@ -2,11 +2,12 @@ import { connect, useRequest } from 'umi'
|
|
|
import { useEffect } from 'react'
|
|
|
import { Button, Drawer, message } from 'antd'
|
|
|
import { addProject, updateProject } from '@/services/api/project'
|
|
|
+import { delay } from '@/utils/util'
|
|
|
import FormRender, { useForm } from 'form-render'
|
|
|
import { BaseMenuEnum } from '@/pages/Schema/Base'
|
|
|
import type { SchemaBaseModelState } from '@/pages/Schema/Base/model'
|
|
|
import type { ConnectProps } from 'umi'
|
|
|
-import { delay } from '@/utils/util'
|
|
|
+import type { ProjectModelState } from '../../model'
|
|
|
|
|
|
export enum ModalType {
|
|
|
ADD = 0,
|
|
@@ -66,12 +67,12 @@ const ProjectModal: React.FC<ProjectModalProps> = ({
|
|
|
})
|
|
|
|
|
|
const onMount = () => {
|
|
|
- form.setSchemaByPath('projectTypeID', {
|
|
|
- enum: pTypeList.map(item => item.value),
|
|
|
- enumNames: pTypeList.map(item => item.label)
|
|
|
- })
|
|
|
+ form.setValues({ ...defaultFormData })
|
|
|
delay(300).then(() => {
|
|
|
- form.setValues({ ...defaultFormData })
|
|
|
+ form.setSchemaByPath('projectTypeID', {
|
|
|
+ enum: pTypeList.map(item => item.value),
|
|
|
+ enumNames: pTypeList.map(item => item.label)
|
|
|
+ })
|
|
|
})
|
|
|
|
|
|
// delay(3000).then(_ => {
|
|
@@ -149,6 +150,9 @@ const ProjectModal: React.FC<ProjectModalProps> = ({
|
|
|
)
|
|
|
}
|
|
|
|
|
|
-export default connect(({ schemaBase }: { schemaBase: SchemaBaseModelState }) => ({
|
|
|
- schema: schemaBase.base[BaseMenuEnum.PROJECT]?.schema
|
|
|
-}))(ProjectModal)
|
|
|
+export default connect(
|
|
|
+ ({ project, schemaBase }: { project: ProjectModelState; schemaBase: SchemaBaseModelState }) => ({
|
|
|
+ pTypeList: project.projectTypeList.map(item => ({ label: item.name, value: item.ID })),
|
|
|
+ schema: schemaBase.base[BaseMenuEnum.PROJECT]?.schema
|
|
|
+ })
|
|
|
+)(ProjectModal)
|