2025-06-30 15:56:13 +08:00

86 lines
2.4 KiB
TypeScript

import {
MyButtons,
MyColumns,
MyPageContainer,
MyProTableProps,
} from '@/common';
import { Apis } from '@/gen/Apis';
import { CompaniesMerchantTypeEnum } from '@/gen/Enums';
import { ProTable } from '@ant-design/pro-components';
import { useNavigate } from '@umijs/max';
import { Space } from 'antd';
import Create from './modals/Create';
export default function Index({ title = '机构管理' }) {
const navigate = useNavigate();
return (
<MyPageContainer title={title}>
<ProTable
{...MyProTableProps.props}
search={false}
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(),
MyColumns.EnumTag({
title: '类型',
dataIndex: 'merchant_type',
valueEnum: CompaniesMerchantTypeEnum,
}),
{
title: '组织名称',
dataIndex: 'name',
},
{
title: '组织简称',
dataIndex: 'short_name',
},
{
title: '营业执照号',
dataIndex: 'business_license_number',
},
// {
// title: '联系人',
// dataIndex: 'contact_name',
// },
// {
// title: '手机号',
// dataIndex: 'contact_phone',
// },
// {
// title: '联系人邮箱',
// dataIndex: 'contact_email',
// },
MyColumns.UpdatedAt(),
// MyColumns.CreatedAt(),
MyColumns.Option({
render: (_, item: any, index, action) => (
<Space key={index}>
{/* <Update item={item} reload={action?.reload} title={title} /> */}
<MyButtons.View
title="详情"
onClick={() => {
navigate(`/company/companies/${item.id}`);
}}
/>
<MyButtons.Delete
onConfirm={() =>
Apis.Common.Admins.Delete({ id: item.id }).then(() =>
action?.reload(),
)
}
/>
</Space>
),
}),
]}
/>
</MyPageContainer>
);
}