|
@@ -2,6 +2,7 @@ import { connect, useRequest } from 'umi'
|
|
|
import { useEffect, useRef, useState } from 'react'
|
|
|
import { message, Tabs } from 'antd'
|
|
|
import { getApprovalList, setApproval } from '@/services/api/project'
|
|
|
+import { queryAcountList } from '@/services/api/institution'
|
|
|
import { delay } from '@/utils/util'
|
|
|
import FormRender, { useForm } from 'form-render'
|
|
|
import { BaseMenuEnum } from '@/pages/Schema/Base'
|
|
@@ -37,6 +38,8 @@ const DetailModal: React.FC<ProjectModalProps> = ({
|
|
|
pTypeList,
|
|
|
reloadTable
|
|
|
}) => {
|
|
|
+ // console.log(defaultFormData)
|
|
|
+
|
|
|
const form = useForm()
|
|
|
const ref = useRef<FormInstance>(null)
|
|
|
const { TabPane } = Tabs
|
|
@@ -45,6 +48,13 @@ const DetailModal: React.FC<ProjectModalProps> = ({
|
|
|
approvalList: []
|
|
|
})
|
|
|
|
|
|
+ const { run: tryAcountList } = useRequest(() => queryAcountList(), {
|
|
|
+ manual: true,
|
|
|
+ onSuccess: result => {
|
|
|
+ setState({ ...state, acountList: result.items })
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
const { run: tryApprovalList } = useRequest(() => getApprovalList(), {
|
|
|
manual: true,
|
|
|
onSuccess: result => {
|
|
@@ -68,14 +78,25 @@ const DetailModal: React.FC<ProjectModalProps> = ({
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
+ // form.setFieldsValue({ ...defaultFormData })
|
|
|
+ tryAcountList()
|
|
|
tryApprovalList()
|
|
|
}, [visible])
|
|
|
|
|
|
const onMount = () => {
|
|
|
- form.setValues({ ...defaultFormData })
|
|
|
- delay(80).then(() => {
|
|
|
- // console.log(pTypeList)
|
|
|
+ const newObject = { ...defaultFormData }
|
|
|
+ const keys = Object.keys(newObject)
|
|
|
+ keys.forEach(key => {
|
|
|
+ if (key instanceof Object) {
|
|
|
+ const newObjectKey = newObject[key]
|
|
|
+ newObject.objectID = newObjectKey.ID
|
|
|
+ }
|
|
|
+ })
|
|
|
+ form.setValues({ ...newObject })
|
|
|
+ console.log({ ...newObject })
|
|
|
|
|
|
+ // form.setValues({ ...defaultFormData })
|
|
|
+ delay(80).then(() => {
|
|
|
form.setSchemaByPath('projectTypeID', {
|
|
|
enum: pTypeList.map(item => item.value),
|
|
|
enumNames: pTypeList.map(item => item.label)
|