95 lines
2.3 KiB
TypeScript
Raw Normal View History

2025-06-30 15:55:47 +08:00
import {
MyButtons,
MyColumns,
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';
import EmployeeUpdate from '../company/components/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,
closable: true,
2025-07-25 16:42:54 +08:00
});
2025-06-30 15:55:47 +08:00
return (
<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,
)
}
// toolBarRender={(action) => [
// <EmployeesCreate
// key="Create"
// reload={action?.reload}
// title={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
},
{
title: '组织',
dataIndex: ['organization', 'name'],
2025-07-01 09:35:27 +08:00
search: false,
2025-07-10 18:01:45 +08:00
},
{
title: '姓名',
dataIndex: 'name',
},
{
title: '手机号',
dataIndex: 'phone',
},
{
title: '岗位',
dataIndex: ['position', 'name'],
search: false,
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}>
<EmployeeUpdate
2025-07-25 16:42:54 +08:00
item={item}
reload={action?.reload}
title={title}
/>
2025-06-30 15:55:47 +08:00
<MyButtons.Delete
onConfirm={() =>
Apis.Common.Admins.Delete({ id: item.id }).then(() =>
action?.reload(),
)
}
/>
</Space>
),
}),
]}
/>
</MyPageContainer>
);
}