|
@@ -1,8 +1,8 @@
|
|
|
import { connect, useRequest } from 'umi'
|
|
|
import { useEffect, useRef, useState } from 'react'
|
|
|
-import { message, Tabs } from 'antd'
|
|
|
+import { message, Tabs, TreeSelect, Form } from 'antd'
|
|
|
import { getApprovalList, setApproval } from '@/services/api/project'
|
|
|
-import { queryAcountList } from '@/services/api/institution'
|
|
|
+import { queryAcountInstitutionList } from '@/services/api/institution'
|
|
|
import { delay } from '@/utils/util'
|
|
|
import FormRender, { useForm } from 'form-render'
|
|
|
import { BaseMenuEnum } from '@/pages/Schema/Base'
|
|
@@ -44,15 +44,16 @@ const DetailModal: React.FC<ProjectModalProps> = ({
|
|
|
const ref = useRef<FormInstance>(null)
|
|
|
const { TabPane } = Tabs
|
|
|
const [state, setState] = useState({
|
|
|
- acountList: [],
|
|
|
+ acountInstitutionList: [],
|
|
|
approvalList: [],
|
|
|
activeKey: ''
|
|
|
})
|
|
|
+ console.log(state.acountInstitutionList)
|
|
|
|
|
|
- const { run: tryAcountList } = useRequest(() => queryAcountList(), {
|
|
|
+ const { run: tryAcountInstitutionList } = useRequest(() => queryAcountInstitutionList(), {
|
|
|
manual: true,
|
|
|
onSuccess: result => {
|
|
|
- setState({ ...state, acountList: result.items })
|
|
|
+ setState({ ...state, acountInstitutionList: result })
|
|
|
}
|
|
|
})
|
|
|
|
|
@@ -81,7 +82,7 @@ const DetailModal: React.FC<ProjectModalProps> = ({
|
|
|
}
|
|
|
if (state.activeKey === '2') {
|
|
|
const TabFormData = {
|
|
|
- accountID: defaultFormData.approval.name,
|
|
|
+ // accountID: defaultFormData.approval.name,
|
|
|
approvalID: defaultFormData.reportAccount.name
|
|
|
}
|
|
|
ref.current?.setFieldsValue({ ...TabFormData })
|
|
@@ -100,7 +101,6 @@ const DetailModal: React.FC<ProjectModalProps> = ({
|
|
|
})
|
|
|
// console.log(currentFormData)
|
|
|
form.setValues({ ...currentFormData })
|
|
|
- // form.setValues({ ...defaultFormData })
|
|
|
delay(80).then(() => {
|
|
|
form.setSchemaByPath('projectTypeID', {
|
|
|
enum: pTypeList.map(item => item.value),
|
|
@@ -112,8 +112,8 @@ const DetailModal: React.FC<ProjectModalProps> = ({
|
|
|
const onChange = key => {
|
|
|
setState({ ...state, activeKey: key })
|
|
|
if (key === '2') {
|
|
|
- if (!state.acountList?.length) {
|
|
|
- tryAcountList()
|
|
|
+ if (!state.acountInstitutionList?.length) {
|
|
|
+ tryAcountInstitutionList()
|
|
|
}
|
|
|
if (!state.approvalList?.length) {
|
|
|
tryApprovalList()
|
|
@@ -136,7 +136,15 @@ const DetailModal: React.FC<ProjectModalProps> = ({
|
|
|
formRef={ref}
|
|
|
submitter={{ resetButtonProps: { style: { display: 'none' } } }}
|
|
|
onFinish={onFinish}>
|
|
|
- <ProFormSelect
|
|
|
+ <Form.Item label="上报人" name="accountID">
|
|
|
+ <TreeSelect
|
|
|
+ style={{ width: '100%' }}
|
|
|
+ placeholder="请选择上报人"
|
|
|
+ treeDefaultExpandAll
|
|
|
+ treeData={state.acountInstitutionList}
|
|
|
+ />
|
|
|
+ </Form.Item>
|
|
|
+ {/* <ProFormSelect
|
|
|
name="accountID"
|
|
|
label={'上报人'}
|
|
|
placeholder="请选择上报人"
|
|
@@ -144,7 +152,7 @@ const DetailModal: React.FC<ProjectModalProps> = ({
|
|
|
label: item.name,
|
|
|
value: item.ID
|
|
|
}))}
|
|
|
- />
|
|
|
+ /> */}
|
|
|
<ProFormSelect
|
|
|
name="approvalID"
|
|
|
label={'审批流程'}
|