All checks were successful
Build and Push Docker Image / build (push) Successful in 3m11s
112 lines
2.9 KiB
TypeScript
112 lines
2.9 KiB
TypeScript
import {
|
|
MyBetaModalFormProps,
|
|
MyButtons,
|
|
MyFormItems,
|
|
MyModalFormProps,
|
|
rulesHelper,
|
|
} from '@/common';
|
|
import { Address } from '@/components/Address';
|
|
import { Apis } from '@/gen/Apis';
|
|
import { BetaSchemaForm } from '@ant-design/pro-components';
|
|
import { message } from 'antd';
|
|
|
|
export default function Create(props: MyBetaModalFormProps) {
|
|
return (
|
|
<BetaSchemaForm<ApiTypes.Company.Companies.Store>
|
|
{...MyModalFormProps.props}
|
|
title={`添加机构`}
|
|
wrapperCol={{ span: 24 }}
|
|
width="600px"
|
|
trigger={<MyButtons.Create title={`添加机构`} />}
|
|
onFinish={async (values) =>
|
|
Apis.Company.Companies.Store({
|
|
...values,
|
|
merchant_type: 'PropertyManagement',
|
|
})
|
|
.then(() => {
|
|
props.reload?.();
|
|
message.success(props.title + '成功');
|
|
return true;
|
|
})
|
|
.catch(() => false)
|
|
}
|
|
columns={[
|
|
{
|
|
key: 'short_name',
|
|
title: '机构简称',
|
|
colProps: { span: 6 },
|
|
formItemProps: { ...rulesHelper.text },
|
|
},
|
|
{
|
|
key: 'name',
|
|
title: '企业名称',
|
|
colProps: { span: 18 },
|
|
formItemProps: { ...rulesHelper.text },
|
|
},
|
|
{
|
|
key: 'business_license_number',
|
|
title: '营业执照号',
|
|
colProps: { span: 24 },
|
|
tooltip: '限制20位',
|
|
formItemProps: { ...rulesHelper.text },
|
|
fieldProps: {
|
|
maxLength: 18,
|
|
},
|
|
},
|
|
|
|
{
|
|
key: 'contact_name',
|
|
title: '联系人姓名',
|
|
colProps: { span: 6 },
|
|
formItemProps: { ...rulesHelper.text },
|
|
},
|
|
{
|
|
key: 'contact_phone',
|
|
title: '联系人手机',
|
|
colProps: { span: 8 },
|
|
valueType: 'number',
|
|
fieldProps: {
|
|
maxLength: 11,
|
|
},
|
|
formItemProps: { ...rulesHelper.phone },
|
|
},
|
|
{
|
|
key: 'contact_email',
|
|
title: '联系人邮箱',
|
|
valueType: 'text',
|
|
colProps: { span: 10 },
|
|
fieldProps: {
|
|
placeholder: '139@mail.com',
|
|
type: 'email',
|
|
},
|
|
formItemProps: {
|
|
rules: [
|
|
{
|
|
pattern: /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/,
|
|
message: '请输入正确的邮箱,如 139@email.com 格式输入',
|
|
},
|
|
],
|
|
},
|
|
},
|
|
Address.Cascader({
|
|
key: 'casacader',
|
|
title: '联系地址',
|
|
colProps: { span: 14 },
|
|
keys: ['province', 'city', 'area', 'street'],
|
|
required: true,
|
|
}),
|
|
{
|
|
key: 'address',
|
|
title: '详细地址',
|
|
colProps: { span: 10 },
|
|
},
|
|
MyFormItems.UploadImages({
|
|
key: 'business_license_image',
|
|
title: '营业执照',
|
|
max: 1,
|
|
}),
|
|
]}
|
|
/>
|
|
);
|
|
}
|