|
@@ -1,5 +1,4 @@
|
|
|
import ProTable from '@ant-design/pro-table'
|
|
|
-import type { ProColumnType, ActionType } from '@ant-design/pro-table'
|
|
|
import { PageContainer } from '@ant-design/pro-layout'
|
|
|
import consts from '@/utils/consts'
|
|
|
import { useMemo, useRef, useState } from 'react'
|
|
@@ -7,11 +6,12 @@ import { ConnectProps, useAccess } from '@umijs/max'
|
|
|
import { queryAccountList } from '@/services/api/institution'
|
|
|
import dayjs from 'dayjs'
|
|
|
import StaffDetail from './components/StaffDetail'
|
|
|
-import AnimateContent from '@/components/AnimateContent'
|
|
|
import { ModalType } from '@/utils/enum'
|
|
|
-import type { ColumnsStateType } from '@ant-design/pro-table/lib/typing'
|
|
|
import { BackstagePermission } from '@/enums/access'
|
|
|
import classNames from 'classnames'
|
|
|
+import useDrawer from '@/components/Drawer'
|
|
|
+import type { ColumnsStateType } from '@ant-design/pro-table/lib/typing'
|
|
|
+import type { ProColumnType, ActionType } from '@ant-design/pro-table'
|
|
|
|
|
|
type ListProps = ConnectProps & {
|
|
|
accountTypeList: { label: string; value: string }[]
|
|
@@ -25,6 +25,7 @@ export const genderEum = {
|
|
|
const CompanyList: React.FC<ListProps> = () => {
|
|
|
const tRef = useRef<ActionType>(null)
|
|
|
const { validatePerm } = useAccess()
|
|
|
+ const [drawer, DrawerDom] = useDrawer()
|
|
|
const [state, setState] = useState({
|
|
|
params: {
|
|
|
search: null,
|
|
@@ -47,12 +48,15 @@ const CompanyList: React.FC<ListProps> = () => {
|
|
|
<div
|
|
|
className="text-primary cursor-pointer hover:text-hex-967bbd"
|
|
|
onClick={() => {
|
|
|
- setState({
|
|
|
- ...state,
|
|
|
- visible: true,
|
|
|
- currentModalType: ModalType.PREVIEW,
|
|
|
- title: record.name,
|
|
|
- defaultFormData: record
|
|
|
+ drawer.open({
|
|
|
+ title: `员工详情(${record.name})`,
|
|
|
+ children: (
|
|
|
+ <StaffDetail
|
|
|
+ type={ModalType.PREVIEW}
|
|
|
+ defaultFormData={record}
|
|
|
+ reload={() => tRef.current?.reload()}
|
|
|
+ />
|
|
|
+ )
|
|
|
})
|
|
|
}}>
|
|
|
{name}
|
|
@@ -156,12 +160,15 @@ const CompanyList: React.FC<ListProps> = () => {
|
|
|
)}
|
|
|
onClick={() => {
|
|
|
validatePerm(BackstagePermission.EDIT_INSTITUTION_STAFF) &&
|
|
|
- setState({
|
|
|
- ...state,
|
|
|
- visible: true,
|
|
|
- currentModalType: ModalType.UPDATE,
|
|
|
- title: record.name,
|
|
|
- defaultFormData: record
|
|
|
+ drawer.open({
|
|
|
+ title: `编辑账号(${record.name})`,
|
|
|
+ children: (
|
|
|
+ <StaffDetail
|
|
|
+ type={ModalType.UPDATE}
|
|
|
+ defaultFormData={record}
|
|
|
+ reload={() => tRef.current?.reload()}
|
|
|
+ />
|
|
|
+ )
|
|
|
})
|
|
|
}}>
|
|
|
编辑
|
|
@@ -209,31 +216,9 @@ const CompanyList: React.FC<ListProps> = () => {
|
|
|
}}
|
|
|
search={false}
|
|
|
/>
|
|
|
- <AnimateContent
|
|
|
- title={
|
|
|
- <>
|
|
|
- {state.currentModalType === ModalType.UPDATE ? `编辑账号(${state.title})` : null}
|
|
|
- {state.currentModalType === ModalType.PREVIEW ? `员工详情(${state.title})` : null}
|
|
|
- </>
|
|
|
- }
|
|
|
- visible={state.visible}
|
|
|
- onVisibleChange={visible => setState({ ...state, visible })}>
|
|
|
- <StaffDetail
|
|
|
- type={state.currentModalType}
|
|
|
- defaultFormData={state.defaultFormData}
|
|
|
- visible={state.visible}
|
|
|
- reload={() => tRef.current?.reload()}
|
|
|
- onVisibleChange={(visible: boolean) => setState({ ...state, visible })}
|
|
|
- />
|
|
|
- </AnimateContent>
|
|
|
+ {DrawerDom}
|
|
|
</PageContainer>
|
|
|
)
|
|
|
}
|
|
|
|
|
|
-// export default connect(({ institutions }: { institutions: InstitutionsModelState }) => ({
|
|
|
-// accountTypeList: institutions.accountType.map(item => ({
|
|
|
-// label: item.name,
|
|
|
-// value: item.value
|
|
|
-// }))
|
|
|
-// }))(CompanyList)
|
|
|
export default CompanyList
|