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