|
@@ -1,5 +1,4 @@
|
|
import ProTable from '@ant-design/pro-table'
|
|
import ProTable from '@ant-design/pro-table'
|
|
-import type { ProColumnType } from '@ant-design/pro-table'
|
|
|
|
import React, { useState, useEffect, useRef, useMemo } from 'react'
|
|
import React, { useState, useEffect, useRef, useMemo } from 'react'
|
|
import { Button, Tooltip } from 'antd'
|
|
import { Button, Tooltip } from 'antd'
|
|
import consts from '@/utils/consts'
|
|
import consts from '@/utils/consts'
|
|
@@ -7,15 +6,16 @@ import { connect, useAccess } from '@umijs/max'
|
|
import dayjs from 'dayjs'
|
|
import dayjs from 'dayjs'
|
|
import { queryAccountList } from '@/services/api/institution'
|
|
import { queryAccountList } from '@/services/api/institution'
|
|
import StaffDetail from '@/pages/Institutions/Staff/components/StaffDetail'
|
|
import StaffDetail from '@/pages/Institutions/Staff/components/StaffDetail'
|
|
-import type { SchemaBaseModelState } from '@/pages/Schema/Base/model'
|
|
|
|
import { BaseMenuEnum } from '@/pages/Schema/Base'
|
|
import { BaseMenuEnum } from '@/pages/Schema/Base'
|
|
import { generateColumns } from '@/utils/util'
|
|
import { generateColumns } from '@/utils/util'
|
|
-import AnimateContent from '@/components/AnimateContent'
|
|
|
|
import { ModalType } from '@/utils/enum'
|
|
import { ModalType } from '@/utils/enum'
|
|
-import type { ColumnsStateType } from '@ant-design/pro-table/lib/typing'
|
|
|
|
import { BackstagePermission } from '@/enums/access'
|
|
import { BackstagePermission } from '@/enums/access'
|
|
import { UserOutlined } from '@ant-design/icons'
|
|
import { UserOutlined } from '@ant-design/icons'
|
|
import classNames from 'classnames'
|
|
import classNames from 'classnames'
|
|
|
|
+import useDrawer from '@/components/Drawer'
|
|
|
|
+import type { SchemaBaseModelState } from '@/pages/Schema/Base/model'
|
|
|
|
+import type { ColumnsStateType } from '@ant-design/pro-table/lib/typing'
|
|
|
|
+import type { ProColumnType } from '@ant-design/pro-table'
|
|
|
|
|
|
type ListProps = ConnectProps & {
|
|
type ListProps = ConnectProps & {
|
|
accountType: API.AccountType[]
|
|
accountType: API.AccountType[]
|
|
@@ -29,12 +29,12 @@ const Staff: React.FC<ListProps> = ({
|
|
dataID,
|
|
dataID,
|
|
companyName,
|
|
companyName,
|
|
dispatch,
|
|
dispatch,
|
|
- accountTypeList,
|
|
|
|
memberTotal = 3,
|
|
memberTotal = 3,
|
|
managerID
|
|
managerID
|
|
}) => {
|
|
}) => {
|
|
const tRef = useRef<ActionType>(null)
|
|
const tRef = useRef<ActionType>(null)
|
|
const { validatePerm } = useAccess()
|
|
const { validatePerm } = useAccess()
|
|
|
|
+ const [drawer, drawerDom] = useDrawer()
|
|
const [state, setState] = useState({
|
|
const [state, setState] = useState({
|
|
params: {
|
|
params: {
|
|
search: null,
|
|
search: null,
|
|
@@ -176,12 +176,15 @@ const Staff: React.FC<ListProps> = ({
|
|
)}
|
|
)}
|
|
onClick={() => {
|
|
onClick={() => {
|
|
validatePerm(BackstagePermission.EDIT_INSTITUTION_STAFF) &&
|
|
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()}
|
|
|
|
+ />
|
|
|
|
+ )
|
|
})
|
|
})
|
|
}}>
|
|
}}>
|
|
编辑
|
|
编辑
|
|
@@ -243,19 +246,21 @@ const Staff: React.FC<ListProps> = ({
|
|
type="primary"
|
|
type="primary"
|
|
disabled={!validatePerm(BackstagePermission.ADD_INSTITUTION_STAFF)}
|
|
disabled={!validatePerm(BackstagePermission.ADD_INSTITUTION_STAFF)}
|
|
onClick={() => {
|
|
onClick={() => {
|
|
- setState({
|
|
|
|
- ...state,
|
|
|
|
- visible: true,
|
|
|
|
- currentModalType: ModalType.ADD,
|
|
|
|
- institutionDisable: true,
|
|
|
|
- title: '',
|
|
|
|
- defaultFormData: {
|
|
|
|
- institutionID: dataID,
|
|
|
|
- institution: {
|
|
|
|
- ID: dataID,
|
|
|
|
- name: companyName
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+ drawer.open({
|
|
|
|
+ title: '添加人员',
|
|
|
|
+ children: (
|
|
|
|
+ <StaffDetail
|
|
|
|
+ type={ModalType.ADD}
|
|
|
|
+ defaultFormData={{
|
|
|
|
+ institutionID: dataID,
|
|
|
|
+ institution: {
|
|
|
|
+ ID: dataID,
|
|
|
|
+ name: companyName
|
|
|
|
+ }
|
|
|
|
+ }}
|
|
|
|
+ reload={() => tRef.current?.reload()}
|
|
|
|
+ />
|
|
|
|
+ )
|
|
})
|
|
})
|
|
}}>
|
|
}}>
|
|
添加人员
|
|
添加人员
|
|
@@ -264,23 +269,7 @@ const Staff: React.FC<ListProps> = ({
|
|
]
|
|
]
|
|
}}
|
|
}}
|
|
/>
|
|
/>
|
|
- <AnimateContent
|
|
|
|
- title={
|
|
|
|
- <>
|
|
|
|
- {state.currentModalType === ModalType.ADD ? '新增账号' : null}
|
|
|
|
- {state.currentModalType === ModalType.UPDATE ? `编辑账号(${state.title})` : null}
|
|
|
|
- </>
|
|
|
|
- }
|
|
|
|
- visible={state.visible}
|
|
|
|
- onVisibleChange={visible => setState({ ...state, visible })}>
|
|
|
|
- <StaffDetail
|
|
|
|
- onVisibleChange={(visible: boolean) => setState({ ...state, visible })}
|
|
|
|
- type={state.currentModalType}
|
|
|
|
- defaultFormData={{ ...state.defaultFormData }}
|
|
|
|
- accountTypeList={accountTypeList}
|
|
|
|
- reload={() => tRef.current?.reload()}
|
|
|
|
- />
|
|
|
|
- </AnimateContent>
|
|
|
|
|
|
+ {drawerDom}
|
|
</div>
|
|
</div>
|
|
)
|
|
)
|
|
}
|
|
}
|