uiuJun 4965586d3f
Some checks failed
Build and Push Docker Image / build (push) Has been cancelled
feat:仪表更新
2025-10-01 15:38:37 +08:00

74 lines
1.9 KiB
TypeScript

import {
MyButtons,
MyColumns,
MyPageContainer,
MyProTableProps,
usePageTabs,
} from '@/common';
import { Apis } from '@/gen/Apis';
import { ProTable } from '@ant-design/pro-components';
import { useNavigate } from '@umijs/max';
import { Space } from 'antd';
import Create from './modals/Create';
import Update from './modals/Update';
export default function Index({ title = '岗位管理' }) {
const navigate = useNavigate();
// 注册当前页面为标签页
usePageTabs({
tabKey: 'positions',
tabLabel: title,
});
return (
<MyPageContainer
title={title}
enableTabs={true}
tabKey="positions"
tabLabel={title}
>
<ProTable
{...MyProTableProps.props}
request={async (params, sort) =>
MyProTableProps.request(params, sort, Apis.Common.Positions.List)
}
toolBarRender={(action) => [
<Create key="Create" reload={action?.reload} title={title} />,
]}
columns={[
MyColumns.ID(),
{
title: '岗位名称',
dataIndex: 'name',
width: 300,
},
{
title: '是否启用',
dataIndex: 'is_use',
search: false,
render: (text) => (text ? '是' : '否'),
width: 200,
},
MyColumns.CreatedAt(),
MyColumns.UpdatedAt(),
MyColumns.Option({
render: (_, item: any, index, action) => (
<Space key={index}>
<Update item={item} reload={action?.reload} title="岗位" />
<MyButtons.Delete
onConfirm={() =>
Apis.Common.Positions.Delete({ id: item.id }).then(() =>
action?.reload(),
)
}
/>
</Space>
),
}),
]}
/>
</MyPageContainer>
);
}