101 lines
2.8 KiB
TypeScript
Raw Normal View History

2025-06-30 15:55:47 +08:00
import {
MyBetaModalFormProps,
MyButtons,
MyColumns,
MyProTableProps,
} from '@/common';
2025-06-30 14:24:39 +08:00
import { Apis } from '@/gen/Apis';
2025-06-30 15:55:47 +08:00
import { OrganizationsTypeEnum } from '@/gen/Enums';
2025-06-30 14:24:39 +08:00
import { ProTable } from '@ant-design/pro-components';
2025-06-30 15:55:47 +08:00
import { Space } from 'antd';
2025-07-17 13:58:54 +08:00
import OrganizationsChange from '../modals/OrganizationsChange';
2025-06-30 14:24:39 +08:00
import OrganizationsCreate from '../modals/OrganizationsCreate';
2025-06-30 15:55:47 +08:00
import OrganizationsUpdate from '../modals/OrganizationsUpdate';
2025-06-30 14:24:39 +08:00
export default function Organizations(props: MyBetaModalFormProps) {
return (
<>
<ProTable
{...MyProTableProps.props}
2025-07-01 16:21:27 +08:00
// search={false}
2025-06-30 14:24:39 +08:00
request={async (params, sort) =>
MyProTableProps.request(
{ ...params, companies_id: props?.item?.id },
sort,
Apis.Company.Organizations.List,
)
}
toolBarRender={(action) => [
<OrganizationsCreate
key="Create"
reload={action?.reload}
2025-06-30 15:55:47 +08:00
item={props?.item}
2025-06-30 14:24:39 +08:00
title="组织"
/>,
]}
options={false}
columns={[
2025-07-16 10:18:01 +08:00
MyColumns.EnumTag({
title: '组织类型',
dataIndex: 'type',
valueEnum: OrganizationsTypeEnum,
search: false,
}),
{
title: '组织名称',
dataIndex: 'name',
},
2025-07-01 16:21:27 +08:00
{
title: '组织ID',
dataIndex: 'id',
search: false,
},
2025-06-30 14:24:39 +08:00
{
2025-06-30 15:55:47 +08:00
title: '上级组织',
dataIndex: ['organization_parent', 'name'],
2025-07-01 16:21:27 +08:00
search: false,
2025-06-30 15:55:47 +08:00
},
{
2025-07-16 10:18:01 +08:00
title: '上级组织ID',
dataIndex: ['organization_parent', 'id'],
2025-07-01 16:21:27 +08:00
search: false,
2025-07-16 10:18:01 +08:00
},
2025-07-01 16:21:27 +08:00
// {
// title: '负责人',
// dataIndex: ['manager', 'name'],
// },
// {
// title: '联系电话',
// dataIndex: 'manager_phone',
// },
2025-06-30 15:55:47 +08:00
MyColumns.Option({
render: (_, item: any, index, action) => (
<Space key={index}>
2025-07-17 13:58:54 +08:00
<OrganizationsChange
item={{ ...item, companies_id: props?.item?.id }}
reload={action?.reload}
title="组织"
/>
2025-06-30 15:55:47 +08:00
<OrganizationsUpdate
item={{ ...item, companies_id: props?.item?.id }}
reload={action?.reload}
title="组织"
/>
<MyButtons.Delete
onConfirm={() =>
Apis.Company.Organizations.Delete({ id: item.id }).then(
() => action?.reload(),
)
}
/>
</Space>
),
}),
2025-06-30 14:24:39 +08:00
]}
/>
</>
);
}