2025-06-29 18:42:50 +08:00
|
|
|
import {
|
|
|
|
|
MyButtons,
|
|
|
|
|
MyColumns,
|
|
|
|
|
MyPageContainer,
|
|
|
|
|
MyProTableProps,
|
2025-07-25 16:42:54 +08:00
|
|
|
usePageTabs,
|
2025-06-29 18:42:50 +08:00
|
|
|
} from '@/common';
|
|
|
|
|
import { Apis } from '@/gen/Apis';
|
|
|
|
|
import { CompaniesMerchantTypeEnum } from '@/gen/Enums';
|
|
|
|
|
import { ProTable } from '@ant-design/pro-components';
|
2025-06-30 14:24:39 +08:00
|
|
|
import { useNavigate } from '@umijs/max';
|
2025-06-29 18:42:50 +08:00
|
|
|
import { Space } from 'antd';
|
|
|
|
|
import Create from './modals/Create';
|
|
|
|
|
|
|
|
|
|
export default function Index({ title = '机构管理' }) {
|
2025-06-30 14:24:39 +08:00
|
|
|
const navigate = useNavigate();
|
2025-07-25 16:42:54 +08:00
|
|
|
|
|
|
|
|
// 注册当前页面为标签页
|
|
|
|
|
usePageTabs({
|
|
|
|
|
tabKey: 'company-companies',
|
|
|
|
|
tabLabel: title,
|
|
|
|
|
});
|
|
|
|
|
|
2025-06-29 18:42:50 +08:00
|
|
|
return (
|
2025-07-25 16:42:54 +08:00
|
|
|
<MyPageContainer
|
|
|
|
|
title={title}
|
|
|
|
|
enableTabs={true}
|
|
|
|
|
tabKey="company-companies"
|
|
|
|
|
tabLabel={title}
|
|
|
|
|
>
|
2025-06-29 18:42:50 +08:00
|
|
|
<ProTable
|
|
|
|
|
{...MyProTableProps.props}
|
|
|
|
|
request={async (params, sort) =>
|
|
|
|
|
MyProTableProps.request(params, sort, Apis.Company.Companies.List)
|
|
|
|
|
}
|
|
|
|
|
toolBarRender={(action) => [
|
|
|
|
|
<Create key="Create" reload={action?.reload} title={title} />,
|
|
|
|
|
]}
|
|
|
|
|
columns={[
|
|
|
|
|
MyColumns.ID(),
|
2025-06-30 15:56:13 +08:00
|
|
|
MyColumns.EnumTag({
|
|
|
|
|
title: '类型',
|
|
|
|
|
dataIndex: 'merchant_type',
|
|
|
|
|
valueEnum: CompaniesMerchantTypeEnum,
|
|
|
|
|
}),
|
2025-06-29 18:42:50 +08:00
|
|
|
{
|
2025-07-01 09:35:27 +08:00
|
|
|
title: '机构名称',
|
2025-06-29 18:42:50 +08:00
|
|
|
dataIndex: 'name',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '组织简称',
|
|
|
|
|
dataIndex: 'short_name',
|
2025-07-01 09:35:27 +08:00
|
|
|
search: false,
|
2025-06-29 18:42:50 +08:00
|
|
|
},
|
2025-06-30 15:56:13 +08:00
|
|
|
|
2025-06-29 18:42:50 +08:00
|
|
|
{
|
|
|
|
|
title: '营业执照号',
|
|
|
|
|
dataIndex: 'business_license_number',
|
2025-07-01 09:35:27 +08:00
|
|
|
search: false,
|
2025-06-29 18:42:50 +08:00
|
|
|
},
|
|
|
|
|
MyColumns.UpdatedAt(),
|
2025-06-30 15:56:13 +08:00
|
|
|
// MyColumns.CreatedAt(),
|
2025-06-29 18:42:50 +08:00
|
|
|
MyColumns.Option({
|
|
|
|
|
render: (_, item: any, index, action) => (
|
|
|
|
|
<Space key={index}>
|
2025-06-30 14:24:39 +08:00
|
|
|
{/* <Update item={item} reload={action?.reload} title={title} /> */}
|
|
|
|
|
<MyButtons.View
|
|
|
|
|
title="详情"
|
|
|
|
|
onClick={() => {
|
|
|
|
|
navigate(`/company/companies/${item.id}`);
|
|
|
|
|
}}
|
|
|
|
|
/>
|
2025-06-29 18:42:50 +08:00
|
|
|
<MyButtons.Delete
|
|
|
|
|
onConfirm={() =>
|
|
|
|
|
Apis.Common.Admins.Delete({ id: item.id }).then(() =>
|
|
|
|
|
action?.reload(),
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
/>
|
|
|
|
|
</Space>
|
|
|
|
|
),
|
|
|
|
|
}),
|
|
|
|
|
]}
|
|
|
|
|
/>
|
|
|
|
|
</MyPageContainer>
|
|
|
|
|
);
|
|
|
|
|
}
|