2025-06-30 15:55:47 +08:00
|
|
|
import {
|
|
|
|
|
MyButtons,
|
|
|
|
|
MyColumns,
|
2025-09-19 18:55:51 +08:00
|
|
|
MyImportModal,
|
2025-06-30 15:55:47 +08:00
|
|
|
MyPageContainer,
|
|
|
|
|
MyProTableProps,
|
2025-07-25 16:42:54 +08:00
|
|
|
usePageTabs,
|
2025-06-30 15:55:47 +08:00
|
|
|
} from '@/common';
|
|
|
|
|
import { Apis } from '@/gen/Apis';
|
|
|
|
|
import { ProTable } from '@ant-design/pro-components';
|
|
|
|
|
import { Space } from 'antd';
|
2025-09-19 18:55:51 +08:00
|
|
|
import Change from './modals/Change';
|
2025-09-10 19:10:17 +08:00
|
|
|
import EmployeeCreate from './modals/EmployeeCreate';
|
|
|
|
|
import EmployeeUpdate from './modals/EmployeeUpdate';
|
2025-06-30 15:55:47 +08:00
|
|
|
|
2025-07-01 10:40:00 +08:00
|
|
|
export default function Index({ title = '员工管理' }) {
|
2025-07-25 16:42:54 +08:00
|
|
|
// 使用多标签页功能
|
|
|
|
|
usePageTabs({
|
|
|
|
|
tabKey: 'employees-list',
|
|
|
|
|
tabLabel: title,
|
2025-08-08 18:35:02 +08:00
|
|
|
closable: true,
|
2025-07-25 16:42:54 +08:00
|
|
|
});
|
|
|
|
|
|
2025-06-30 15:55:47 +08:00
|
|
|
return (
|
2025-08-08 18:35:02 +08:00
|
|
|
<MyPageContainer
|
2025-07-25 16:42:54 +08:00
|
|
|
enableTabs
|
|
|
|
|
tabKey="employees-list"
|
|
|
|
|
tabLabel={title}
|
|
|
|
|
title={title}
|
|
|
|
|
>
|
2025-06-30 15:55:47 +08:00
|
|
|
<ProTable
|
|
|
|
|
{...MyProTableProps.props}
|
2025-07-01 10:40:00 +08:00
|
|
|
// search={false}
|
2025-06-30 15:55:47 +08:00
|
|
|
request={async (params, sort) =>
|
|
|
|
|
MyProTableProps.request(
|
|
|
|
|
params,
|
|
|
|
|
sort,
|
|
|
|
|
Apis.Company.CompanyEmployees.List,
|
|
|
|
|
)
|
|
|
|
|
}
|
2025-09-01 21:32:29 +08:00
|
|
|
toolBarRender={(action) => [
|
2025-09-19 18:55:51 +08:00
|
|
|
<MyImportModal
|
|
|
|
|
key="ImportHouse"
|
|
|
|
|
title="批量导入"
|
|
|
|
|
type="danger"
|
|
|
|
|
size="middle"
|
|
|
|
|
templateApi={Apis.Company.CompanyEmployees.DownloadTemplate}
|
|
|
|
|
importApi={Apis.Company.CompanyEmployees.Import}
|
|
|
|
|
reload={action?.reload}
|
|
|
|
|
/>,
|
2025-09-01 21:32:29 +08:00
|
|
|
<EmployeeCreate key="Create" reload={action?.reload} title="员工" />,
|
|
|
|
|
]}
|
2025-06-30 15:55:47 +08:00
|
|
|
columns={[
|
|
|
|
|
MyColumns.ID(),
|
|
|
|
|
{
|
|
|
|
|
title: '机构',
|
|
|
|
|
dataIndex: ['company', 'name'],
|
2025-07-01 09:35:27 +08:00
|
|
|
search: false,
|
2025-06-30 15:55:47 +08:00
|
|
|
},
|
|
|
|
|
{
|
2025-08-29 13:56:53 +08:00
|
|
|
title: '所在组织',
|
|
|
|
|
dataIndex: 'organization_path',
|
|
|
|
|
search: {
|
|
|
|
|
transform: (value) => {
|
|
|
|
|
return { organization_name: value };
|
|
|
|
|
},
|
|
|
|
|
},
|
2025-07-10 18:01:45 +08:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '姓名',
|
|
|
|
|
dataIndex: 'name',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '手机号',
|
|
|
|
|
dataIndex: 'phone',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '岗位',
|
|
|
|
|
dataIndex: ['position', 'name'],
|
2025-08-08 18:35:02 +08:00
|
|
|
search: false,
|
2025-06-30 15:55:47 +08:00
|
|
|
},
|
2026-01-15 18:46:34 +08:00
|
|
|
{
|
|
|
|
|
title: '是否管理员',
|
|
|
|
|
dataIndex: 'is_company_admin',
|
|
|
|
|
render: (_, item: any) => {
|
|
|
|
|
return item?.is_company_admin ? '是' : '否';
|
|
|
|
|
},
|
|
|
|
|
},
|
2025-06-30 15:55:47 +08:00
|
|
|
MyColumns.UpdatedAt(),
|
2025-07-10 18:01:45 +08:00
|
|
|
// MyColumns.CreatedAt(),
|
2025-06-30 15:55:47 +08:00
|
|
|
MyColumns.Option({
|
|
|
|
|
render: (_, item: any, index, action) => (
|
|
|
|
|
<Space key={index}>
|
2025-08-08 18:35:02 +08:00
|
|
|
<EmployeeUpdate
|
2025-07-25 16:42:54 +08:00
|
|
|
item={item}
|
|
|
|
|
reload={action?.reload}
|
|
|
|
|
title={title}
|
|
|
|
|
/>
|
2025-09-19 18:55:51 +08:00
|
|
|
<Change item={item} reload={action?.reload} title={title} />
|
2025-06-30 15:55:47 +08:00
|
|
|
<MyButtons.Delete
|
|
|
|
|
onConfirm={() =>
|
2025-10-09 23:24:10 +08:00
|
|
|
Apis.Company.CompanyEmployees.Delete({ id: item.id }).then(
|
|
|
|
|
() => action?.reload(),
|
2025-06-30 15:55:47 +08:00
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
/>
|
|
|
|
|
</Space>
|
|
|
|
|
),
|
|
|
|
|
}),
|
|
|
|
|
]}
|
|
|
|
|
/>
|
|
|
|
|
</MyPageContainer>
|
|
|
|
|
);
|
|
|
|
|
}
|