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 { Form, message } from 'antd'; export default function Create(props: MyBetaModalFormProps) { const [form] = Form.useForm(); return ( {...MyModalFormProps.props} title={`添加${props.title}`} wrapperCol={{ span: 24 }} width="500px" trigger={} form={form} onOpenChange={(open: any) => { if (open) { form.resetFields(); // 清空表单数据 } }} onFinish={async (values: any) => Apis.Company.Organizations.Store({ ...values, companies_id: props?.item?.id, parent_id: values?.parent_id?.[values.parent_id.length - 1], }) .then(() => { props.reload?.(); message.success(props.title + '成功'); return true; }) .catch(() => false) } columns={[ Selects?.OrganizationsTree({ 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 }, // }, ]} /> ); }