|
@@ -4,12 +4,14 @@ import { Button } from 'antd'
|
|
|
import consts from '@/utils/consts'
|
|
|
// import { history } from 'umi'
|
|
|
import { connect } from 'umi'
|
|
|
+import dayjs from 'dayjs'
|
|
|
import { queryAcountList } from '@/services/api/institution'
|
|
|
import StaffDrawer, { ModalType } from '@/pages/Institutions/Staff/components/StaffDrawer'
|
|
|
import type { SchemaBaseModelState } from '@/pages/Schema/Base/model'
|
|
|
import { BaseMenuEnum } from '@/pages/Schema/Base'
|
|
|
import type { InstitutionsModelState } from '@/pages/Institutions/model'
|
|
|
import { generateColumns } from '@/utils/util'
|
|
|
+import { genderEum } from '@/pages/Institutions/Staff'
|
|
|
|
|
|
type ListProps = ConnectProps & {
|
|
|
accountType: API.AccountType[]
|
|
@@ -34,7 +36,8 @@ const Staff: React.FC<ListProps> = ({ schema, dataID, dispatch, accountTypeList
|
|
|
const [state, setState] = useState({
|
|
|
params: {
|
|
|
search: null,
|
|
|
- accountType: '1'
|
|
|
+ accountType: '1',
|
|
|
+ dataID: dataID
|
|
|
},
|
|
|
visible: false,
|
|
|
currentModalType: ModalType.ADD,
|
|
@@ -50,23 +53,55 @@ const Staff: React.FC<ListProps> = ({ schema, dataID, dispatch, accountTypeList
|
|
|
title: '姓名'
|
|
|
},
|
|
|
{
|
|
|
+ dataIndex: 'password',
|
|
|
+ key: 'password',
|
|
|
+ title: '密码'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ dataIndex: 'gender',
|
|
|
+ key: 'gender',
|
|
|
+ title: '性别',
|
|
|
+ render: (_, { gender }) => {
|
|
|
+ return <span>{genderEum[gender]}</span>
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
dataIndex: 'institution',
|
|
|
- title: '组织架构',
|
|
|
- render: (_, record) => record.institution.name
|
|
|
+ key: 'institution',
|
|
|
+ title: '所属企事业单位',
|
|
|
+ renderText: (_, record) => record.institution.name
|
|
|
},
|
|
|
{
|
|
|
dataIndex: 'phone',
|
|
|
+ key: 'phone',
|
|
|
title: '手机'
|
|
|
},
|
|
|
{
|
|
|
dataIndex: 'createdTime',
|
|
|
- title: '创建时间'
|
|
|
+ key: 'createdTime',
|
|
|
+ title: '创建时间',
|
|
|
+ renderText: text => dayjs(text * 1000).format('YYYY-MM-DD')
|
|
|
},
|
|
|
{
|
|
|
dataIndex: 'created',
|
|
|
+ key: 'created',
|
|
|
title: '创建人'
|
|
|
},
|
|
|
{
|
|
|
+ dataIndex: 'accountType',
|
|
|
+ key: 'accountType',
|
|
|
+ title: '账号类型',
|
|
|
+ filters: true,
|
|
|
+ filterMultiple: false,
|
|
|
+ valueEnum: accountTypeList.reduce((prev, curr) => {
|
|
|
+ const items = { ...prev }
|
|
|
+ items[curr.value] = {
|
|
|
+ text: curr.label
|
|
|
+ }
|
|
|
+ return items
|
|
|
+ }, {})
|
|
|
+ },
|
|
|
+ {
|
|
|
title: '操作',
|
|
|
dataIndex: 'operation',
|
|
|
render: (_, record) => (
|
|
@@ -79,11 +114,12 @@ const Staff: React.FC<ListProps> = ({ schema, dataID, dispatch, accountTypeList
|
|
|
visible: true,
|
|
|
currentModalType: ModalType.UPDATE,
|
|
|
defaultFormData: {
|
|
|
- ...record,
|
|
|
institution: null,
|
|
|
- institutionID: record.ID,
|
|
|
+ ID: record.ID,
|
|
|
+ name: record.name,
|
|
|
+ institutionID: record.institution.ID,
|
|
|
accountType: record.accountType,
|
|
|
- dataID: record.institution.ID
|
|
|
+ dataID: record.institutionID
|
|
|
}
|
|
|
})
|
|
|
}}>
|
|
@@ -119,6 +155,7 @@ const Staff: React.FC<ListProps> = ({ schema, dataID, dispatch, accountTypeList
|
|
|
},
|
|
|
actions: [
|
|
|
<Button
|
|
|
+ type="primary"
|
|
|
onClick={() => {
|
|
|
setState({ ...state, visible: true, currentModalType: ModalType.ADD })
|
|
|
}}>
|