Browse Source

fix: 单位人员管理的添加

outaozhen 3 years ago
parent
commit
74c16f7648

+ 7 - 7
src/pages/Institutions/Staff/components/StaffDrawer.tsx

@@ -69,12 +69,12 @@ const StaffDrawer: React.FC<StaffModalProps> = ({
 
   const onMount = () => {
     form.setValues({ ...defaultFormData })
-    delay().then(() => {
-      form.setSchemaByPath('projectTypeID', {
-        enum: pTypeList.map(item => item.value),
-        enumNames: pTypeList.map(item => item.label)
-      })
-    })
+    // delay().then(() => {
+    //   form.setSchemaByPath('accountType', {
+    //     enum: accountType.map(item => item.value),
+    //     enumNames: accountType.map(item => item.label)
+    //   })
+    // })
   }
 
   // const handleOnFinish = () => {
@@ -143,6 +143,6 @@ const StaffDrawer: React.FC<StaffModalProps> = ({
 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
+    schema: schemaBase.base[BaseMenuEnum.STAFF]?.schema
   })
 )(StaffDrawer)

+ 37 - 20
src/pages/Institutions/Staff/index.tsx

@@ -10,6 +10,8 @@ import type { InstitutionsModelState } from '../model'
 import { queryAcountList } from '@/services/api/institution'
 import dayjs from 'dayjs'
 import StaffDrawer, { ModalType } from './components/StaffDrawer'
+import type { SchemaBaseModelState } from '@/pages/Schema/Base/model'
+import { BaseMenuEnum } from '@/pages/Schema/Base'
 
 type ListProps = ConnectProps & {
   accountType: API.AccountType[]
@@ -18,11 +20,17 @@ type ListProps = ConnectProps & {
 const CompanyList: React.FC<ListProps> = ({ dispatch, accountType }) => {
   const tRef = useRef<ActionType>(null)
   useEffect(() => {
-    if (!accountType.length) {
-      dispatch({
-        type: 'institutions/getAccountTypeList'
-      })
-    }
+    // if (!accountType.length) {
+    //   dispatch({
+    //     type: 'institutions/getAccountTypeList'
+    //   })
+    // }
+    dispatch({
+      type: 'schemaBase/querySchema',
+      payload: {
+        columnType: BaseMenuEnum.STAFF
+      }
+    })
   }, [])
   const [state, setState] = useState({
     params: {
@@ -46,18 +54,18 @@ const CompanyList: React.FC<ListProps> = ({ dispatch, accountType }) => {
       dataIndex: 'name',
       title: '名称'
     },
-    {
-      dataIndex: 'accountType',
-      title: '账号类型',
-      filters: true,
-      valueEnum: accountType.reduce((prev, curr) => {
-        const obj = { ...prev }
-        obj[curr.value] = {
-          text: curr.name
-        }
-        return obj
-      }, {})
-    },
+    // {
+    //   dataIndex: 'accountType',
+    //   title: '账号类型',
+    //   filters: true,
+    //   valueEnum: accountType.reduce((prev, curr) => {
+    //     const obj = { ...prev }
+    //     obj[curr.value] = {
+    //       text: curr.name
+    //     }
+    //     return obj
+    //   }, {})
+    // },
     // {
     //   dataIndex: 'institution',
     //   title: '所属企事业单位',
@@ -172,6 +180,15 @@ const CompanyList: React.FC<ListProps> = ({ dispatch, accountType }) => {
   )
 }
 
-export default connect(({ institutions }: { institutions: InstitutionsModelState }) => ({
-  accountType: institutions.accountType
-}))(CompanyList)
+export default connect(
+  ({
+    institutions,
+    schemaBase
+  }: {
+    institutions: InstitutionsModelState
+    schemaBase: SchemaBaseModelState
+  }) => ({
+    // pTypeList: project.projectTypeList.map(item => ({ label: item.name, value: item.ID })),
+    schema: schemaBase.base[BaseMenuEnum.STAFF]?.schema
+  })
+)(CompanyList)