pay-admin/src/pages/company/companies/modals/OrganizationsCreate.tsx

76 lines
2.0 KiB
TypeScript
Raw Normal View History

2025-06-30 14:24:39 +08:00
import {
MyBetaModalFormProps,
MyButtons,
MyFormItems,
MyModalFormProps,
rulesHelper,
} from '@/common';
2025-06-30 15:55:47 +08:00
import { Selects } from '@/components/Select';
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 { BetaSchemaForm } from '@ant-design/pro-components';
import { message } from 'antd';
export default function Create(props: MyBetaModalFormProps) {
return (
2025-06-30 15:55:47 +08:00
<BetaSchemaForm<ApiTypes.Company.Organizations.Store>
2025-06-30 14:24:39 +08:00
{...MyModalFormProps.props}
title={`添加${props.title}`}
wrapperCol={{ span: 24 }}
width="800px"
trigger={<MyButtons.Create title={`添加${props.title}`} />}
onFinish={async (values) =>
2025-06-30 15:55:47 +08:00
Apis.Company.Organizations.Store({
...values,
companies_id: props?.item?.id,
})
2025-06-30 14:24:39 +08:00
.then(() => {
props.reload?.();
message.success(props.title + '成功');
return true;
})
.catch(() => false)
}
columns={[
2025-06-30 15:55:47 +08:00
Selects?.Organizations({
title: '上级组织',
key: 'parent_id',
params: { companies_id: props?.item?.id },
colProps: { span: 24 },
}),
2025-06-30 14:24:39 +08:00
{
key: 'name',
2025-06-30 15:55:47 +08:00
title: '组织名称',
colProps: { span: 24 },
2025-06-30 14:24:39 +08:00
formItemProps: { ...rulesHelper.text },
},
2025-06-30 15:55:47 +08:00
MyFormItems.EnumRadio({
key: 'type',
title: '类型',
colProps: { span: 24 },
valueEnum: OrganizationsTypeEnum,
required: true,
}),
Selects?.Employees({
title: '负责人',
2025-06-30 14:24:39 +08:00
colProps: { span: 8 },
2025-06-30 15:55:47 +08:00
}),
2025-06-30 14:24:39 +08:00
{
2025-06-30 15:55:47 +08:00
key: 'manager_phone',
title: '负责人手机',
2025-06-30 14:24:39 +08:00
colProps: { span: 8 },
valueType: 'number',
fieldProps: {
maxLength: 11,
},
},
{
2025-06-30 15:55:47 +08:00
key: 'manager_email',
title: '负责人邮箱',
2025-06-30 14:24:39 +08:00
colProps: { span: 8 },
},
]}
/>
);
}