158 lines
4.7 KiB
TypeScript
158 lines
4.7 KiB
TypeScript
|
|
import {
|
||
|
|
MyBetaModalFormProps,
|
||
|
|
MyButtons,
|
||
|
|
MyFormItems,
|
||
|
|
MyModalFormProps,
|
||
|
|
rulesHelper,
|
||
|
|
} from '@/common';
|
||
|
|
import { Apis } from '@/gen/Apis';
|
||
|
|
import {
|
||
|
|
HouseOccupantsCardTypeEnum,
|
||
|
|
HouseRegistersCustomerTypeEnum,
|
||
|
|
} from '@/gen/Enums';
|
||
|
|
import { BetaSchemaForm, ProCard } from '@ant-design/pro-components';
|
||
|
|
import { Form, message } from 'antd';
|
||
|
|
|
||
|
|
export default function Create(props: MyBetaModalFormProps) {
|
||
|
|
const [form] = Form.useForm();
|
||
|
|
return (
|
||
|
|
<BetaSchemaForm<ApiTypes.Archive.HouseRegisters.Store>
|
||
|
|
{...MyModalFormProps.props}
|
||
|
|
title={`添加${props.title}`}
|
||
|
|
wrapperCol={{ span: 24 }}
|
||
|
|
width="900px"
|
||
|
|
form={form}
|
||
|
|
trigger={
|
||
|
|
<MyButtons.Default title={props.title} size="middle" type="primary" />
|
||
|
|
}
|
||
|
|
onOpenChange={(open: any) => {
|
||
|
|
if (open) {
|
||
|
|
form.resetFields(); // 清空表单数据
|
||
|
|
}
|
||
|
|
}}
|
||
|
|
onFinish={async (values) =>
|
||
|
|
Apis.Archive.HouseRegisters.Store({
|
||
|
|
...values,
|
||
|
|
asset_houses_id: props?.item?.asset_houses_id,
|
||
|
|
type: 'Delivery',
|
||
|
|
})
|
||
|
|
.then(() => {
|
||
|
|
props.reload?.();
|
||
|
|
message.success(props.title + '成功');
|
||
|
|
return true;
|
||
|
|
})
|
||
|
|
.catch(() => false)
|
||
|
|
}
|
||
|
|
columns={[
|
||
|
|
MyFormItems.EnumRadio({
|
||
|
|
key: 'customer_type',
|
||
|
|
title: '客户类型',
|
||
|
|
colProps: { span: 12 },
|
||
|
|
valueEnum: HouseRegistersCustomerTypeEnum,
|
||
|
|
}),
|
||
|
|
{
|
||
|
|
valueType: 'formList',
|
||
|
|
dataIndex: 'customer_info',
|
||
|
|
colProps: { span: 24 },
|
||
|
|
fieldProps: {
|
||
|
|
copyIconProps: false,
|
||
|
|
creatorButtonProps: {
|
||
|
|
creatorButtonText: '增加产权人',
|
||
|
|
style: { color: 'red' },
|
||
|
|
danger: true,
|
||
|
|
},
|
||
|
|
itemRender: (
|
||
|
|
{ listDom, action }: any,
|
||
|
|
{ index }: { index: number },
|
||
|
|
) => {
|
||
|
|
return (
|
||
|
|
<ProCard
|
||
|
|
bordered
|
||
|
|
style={{ marginBlockEnd: 8 }}
|
||
|
|
title={`产权人${index + 1}`}
|
||
|
|
extra={action}
|
||
|
|
bodyStyle={{ paddingBlockEnd: 0 }}
|
||
|
|
>
|
||
|
|
{listDom}
|
||
|
|
</ProCard>
|
||
|
|
);
|
||
|
|
},
|
||
|
|
},
|
||
|
|
columns: [
|
||
|
|
{
|
||
|
|
valueType: 'group',
|
||
|
|
columns: [
|
||
|
|
{
|
||
|
|
title: '姓名',
|
||
|
|
dataIndex: 'name',
|
||
|
|
colProps: { span: 12 },
|
||
|
|
formItemProps: { ...rulesHelper.text },
|
||
|
|
},
|
||
|
|
{
|
||
|
|
title: '手机号',
|
||
|
|
dataIndex: 'phone',
|
||
|
|
colProps: { span: 6 },
|
||
|
|
fieldProps: {
|
||
|
|
maxLength: 11,
|
||
|
|
},
|
||
|
|
formItemProps: { ...rulesHelper.text },
|
||
|
|
},
|
||
|
|
{
|
||
|
|
title: '备用手机号',
|
||
|
|
dataIndex: 'reserve_phone',
|
||
|
|
colProps: { span: 6 },
|
||
|
|
fieldProps: {
|
||
|
|
maxLength: 11,
|
||
|
|
},
|
||
|
|
},
|
||
|
|
MyFormItems.EnumSelect({
|
||
|
|
key: 'card_type',
|
||
|
|
title: '证件类型',
|
||
|
|
colProps: { span: 12 },
|
||
|
|
valueEnum: HouseOccupantsCardTypeEnum,
|
||
|
|
required: true,
|
||
|
|
}),
|
||
|
|
{
|
||
|
|
title: '证件号码',
|
||
|
|
dataIndex: 'id_card',
|
||
|
|
colProps: { span: 12 },
|
||
|
|
fieldProps: {
|
||
|
|
maxLength: 18,
|
||
|
|
},
|
||
|
|
formItemProps: { ...rulesHelper.text },
|
||
|
|
},
|
||
|
|
|
||
|
|
// {
|
||
|
|
// title: '是否在居住中',
|
||
|
|
// dataIndex: 'is_live_in',
|
||
|
|
// colProps: { span: 8 },
|
||
|
|
// valueType: 'switch',
|
||
|
|
// },
|
||
|
|
{
|
||
|
|
valueType: 'group',
|
||
|
|
columns: [
|
||
|
|
MyFormItems.UploadImages({
|
||
|
|
key: 'card_front_image',
|
||
|
|
title: '证件正面',
|
||
|
|
max: 1,
|
||
|
|
colProps: { span: 4 },
|
||
|
|
formItemProps: { ...rulesHelper.text },
|
||
|
|
}),
|
||
|
|
MyFormItems.UploadImages({
|
||
|
|
key: 'card_back_image',
|
||
|
|
title: '证件反面',
|
||
|
|
max: 1,
|
||
|
|
colProps: { span: 4 },
|
||
|
|
formItemProps: { ...rulesHelper.text },
|
||
|
|
}),
|
||
|
|
],
|
||
|
|
},
|
||
|
|
],
|
||
|
|
},
|
||
|
|
],
|
||
|
|
},
|
||
|
|
]}
|
||
|
|
/>
|
||
|
|
);
|
||
|
|
}
|