70 lines
1.8 KiB
TypeScript
Raw Normal View History

2025-09-26 21:02:38 +08:00
import {
MyButtons,
MyColumns,
MyPageContainer,
MyProTableProps,
usePageTabs,
} from '@/common';
import { Apis } from '@/gen/Apis';
import { ProTable } from '@ant-design/pro-components';
import { Space } from 'antd';
import Create from './modals/Create';
import Update from './modals/Update';
2025-10-09 23:24:10 +08:00
export default function Index({ title = '内容分类' }) {
2025-09-26 21:02:38 +08:00
// 注册当前页面为标签页
usePageTabs({
tabKey: 'moments-classification',
tabLabel: title,
});
return (
<MyPageContainer
title={title}
enableTabs={true}
tabKey="moments-classification"
tabLabel={title}
>
<ProTable
{...MyProTableProps.props}
expandable={{
defaultExpandAllRows: true,
}}
request={async (params, sort) =>
MyProTableProps.request(
params,
sort,
Apis.Customer.CustomerMomentCategories.List,
)
}
toolBarRender={(action) => [
<Create key="Create" reload={action?.reload} title={title} />,
]}
columns={[
MyColumns.ID(),
{
title: '名称',
dataIndex: 'name',
},
MyColumns.UpdatedAt(),
MyColumns.CreatedAt(),
MyColumns.Option({
render: (_, item: any, index, action) => (
<Space key={index}>
<Update item={item} reload={action?.reload} title={title} />
<MyButtons.Delete
onConfirm={() =>
Apis.Customer.CustomerMomentCategories.Delete({
id: item.id,
}).then(() => action?.reload())
}
/>
</Space>
),
}),
]}
/>
</MyPageContainer>
);
}