|
@@ -1,15 +1,15 @@
|
|
|
import React, { useEffect } from 'react'
|
|
|
import { message, Button, Drawer } from 'antd'
|
|
|
import { connect, useRequest } from 'umi'
|
|
|
-import consts from '@/utils/consts'
|
|
|
-import { addAccount, queryInstitutionList, updateAccount } from '@/services/api/institution'
|
|
|
-import DebounceSelect from './DebounceSelect'
|
|
|
+// import consts from '@/utils/consts'
|
|
|
+import { addAccount, updateAccount } from '@/services/api/institution'
|
|
|
+// import DebounceSelect from './DebounceSelect'
|
|
|
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 type { InstitutionsModelState } from '../model'
|
|
|
+import type { InstitutionsModelState } from '../../model'
|
|
|
|
|
|
export enum ModalType {
|
|
|
ADD = 0,
|
|
@@ -20,8 +20,14 @@ type StaffModalProps = ConnectProps & {
|
|
|
visible: boolean
|
|
|
setVisible: (visible: boolean) => void
|
|
|
type: ModalType
|
|
|
- defaultFormData?: API.AccountListItem
|
|
|
+ defaultFormData?: {
|
|
|
+ ID: string
|
|
|
+ name: string
|
|
|
+ accountType: string
|
|
|
+ dataID: string
|
|
|
+ }
|
|
|
accountTypeList: API.AccountType
|
|
|
+ organizationList: API.OrganizationalStructureListItem
|
|
|
reloadTable: () => void
|
|
|
schema?: Record<string, any> | null
|
|
|
}
|
|
@@ -34,6 +40,7 @@ const StaffDrawer: React.FC<StaffModalProps> = ({
|
|
|
type,
|
|
|
defaultFormData,
|
|
|
accountTypeList,
|
|
|
+ // organizationList,
|
|
|
// pTypeList,
|
|
|
reloadTable
|
|
|
}) => {
|
|
@@ -43,7 +50,7 @@ const StaffDrawer: React.FC<StaffModalProps> = ({
|
|
|
dispatch({
|
|
|
type: 'schemaBase/querySchema',
|
|
|
payload: {
|
|
|
- columnType: BaseMenuEnum.PROJECT
|
|
|
+ columnType: BaseMenuEnum.STAFF
|
|
|
}
|
|
|
})
|
|
|
}
|
|
@@ -69,12 +76,14 @@ const StaffDrawer: React.FC<StaffModalProps> = ({
|
|
|
const onMount = () => {
|
|
|
form.setValues({ ...defaultFormData })
|
|
|
delay(80).then(() => {
|
|
|
- // console.log(pTypeList)
|
|
|
-
|
|
|
form.setSchemaByPath('accountType', {
|
|
|
enum: accountTypeList.map(item => item.value),
|
|
|
enumNames: accountTypeList.map(item => item.label)
|
|
|
})
|
|
|
+ // form.setSchemaByPath('institution', {
|
|
|
+ // enum: organizationList.map(item => item.value),
|
|
|
+ // enumNames: organizationList.map(item => item.label)
|
|
|
+ // })
|
|
|
})
|
|
|
}
|
|
|
|
|
@@ -110,18 +119,18 @@ const StaffDrawer: React.FC<StaffModalProps> = ({
|
|
|
message.error(error)
|
|
|
}
|
|
|
}
|
|
|
- const queryInstitutionOptions = async search => {
|
|
|
- const { code = -1, data = {} } = await queryInstitutionList({
|
|
|
- search,
|
|
|
- current: 1,
|
|
|
- pageSize: 100
|
|
|
- })
|
|
|
- if (code === consts.RET_CODE.SUCCESS) {
|
|
|
- return data.items.map(item => ({ label: item.name, value: item.ID }))
|
|
|
- }
|
|
|
- return []
|
|
|
- }
|
|
|
- const { institution } = defaultFormData || {}
|
|
|
+ // const queryInstitutionOptions = async search => {
|
|
|
+ // const { code = -1, data = {} } = await queryInstitutionList({
|
|
|
+ // search,
|
|
|
+ // current: 1,
|
|
|
+ // pageSize: 100
|
|
|
+ // })
|
|
|
+ // if (code === consts.RET_CODE.SUCCESS) {
|
|
|
+ // return data.items.map(item => ({ label: item.name, value: item.ID }))
|
|
|
+ // }
|
|
|
+ // return []
|
|
|
+ // }
|
|
|
+ // const { institution } = defaultFormData || {}
|
|
|
return (
|
|
|
<Drawer
|
|
|
width="50vw"
|
|
@@ -149,7 +158,14 @@ export default connect(
|
|
|
institutions: InstitutionsModelState
|
|
|
schemaBase: SchemaBaseModelState
|
|
|
}) => ({
|
|
|
- accountTypeList: institutions.accountType.map(item => ({ label: item.name, value: item.ID })),
|
|
|
+ accountTypeList: institutions.accountType.map(item => ({
|
|
|
+ label: item.name,
|
|
|
+ value: item.value
|
|
|
+ })),
|
|
|
+ // organizationList: institutions.organizationType.map(item => ({
|
|
|
+ // label: item.name,
|
|
|
+ // value: item.dataID
|
|
|
+ // })),
|
|
|
schema: schemaBase.base[BaseMenuEnum.STAFF]?.schema
|
|
|
})
|
|
|
)(StaffDrawer)
|