187 lines
4.7 KiB
TypeScript
187 lines
4.7 KiB
TypeScript
|
|
import {
|
||
|
|
MyBetaModalFormProps,
|
||
|
|
MyButtons,
|
||
|
|
MyFormItems,
|
||
|
|
MyModalFormProps,
|
||
|
|
rulesHelper,
|
||
|
|
} from '@/common';
|
||
|
|
import { Apis } from '@/gen/Apis';
|
||
|
|
import {
|
||
|
|
AssetHousesOrientationEnum,
|
||
|
|
AssetHousesOwnershipTypeEnum,
|
||
|
|
AssetHousesStatusEnum,
|
||
|
|
AssetHousesUsageEnum,
|
||
|
|
} from '@/gen/Enums';
|
||
|
|
import { BetaSchemaForm } from '@ant-design/pro-components';
|
||
|
|
import { message } from 'antd';
|
||
|
|
|
||
|
|
export default function Create(props: MyBetaModalFormProps) {
|
||
|
|
console.log(props?.item, 'item');
|
||
|
|
return (
|
||
|
|
<BetaSchemaForm<ApiTypes.Asset.AssetHouses.Store>
|
||
|
|
{...MyModalFormProps.props}
|
||
|
|
title={`添加${props.title}`}
|
||
|
|
wrapperCol={{ span: 24 }}
|
||
|
|
width="800px"
|
||
|
|
trigger={
|
||
|
|
<MyButtons.Create
|
||
|
|
title={`添加${props.title}`}
|
||
|
|
disabled={
|
||
|
|
!(props?.item?.asset_units_id && props?.item?.asset_buildings_id)
|
||
|
|
}
|
||
|
|
/>
|
||
|
|
}
|
||
|
|
onFinish={async (values) =>
|
||
|
|
Apis.Asset.AssetHouses.Store({
|
||
|
|
...values,
|
||
|
|
asset_projects_id: props?.item?.id,
|
||
|
|
asset_buildings_id: props?.item?.asset_buildings_id,
|
||
|
|
asset_units_id: props?.item?.asset_units_id,
|
||
|
|
})
|
||
|
|
.then(() => {
|
||
|
|
props.reload?.();
|
||
|
|
message.success(props.title + '成功');
|
||
|
|
return true;
|
||
|
|
})
|
||
|
|
.catch(() => false)
|
||
|
|
}
|
||
|
|
columns={[
|
||
|
|
{
|
||
|
|
key: 'name',
|
||
|
|
title: '房号',
|
||
|
|
colProps: { span: 12 },
|
||
|
|
formItemProps: { ...rulesHelper.text },
|
||
|
|
},
|
||
|
|
{
|
||
|
|
key: 'full_name',
|
||
|
|
title: '房屋全称',
|
||
|
|
colProps: { span: 12 },
|
||
|
|
},
|
||
|
|
MyFormItems.EnumRadio({
|
||
|
|
key: 'ownership_type',
|
||
|
|
title: '产权性质',
|
||
|
|
colProps: { span: 24 },
|
||
|
|
valueEnum: AssetHousesOwnershipTypeEnum,
|
||
|
|
required: true,
|
||
|
|
}),
|
||
|
|
MyFormItems.EnumRadio({
|
||
|
|
key: 'orientation',
|
||
|
|
title: '朝向',
|
||
|
|
colProps: { span: 24 },
|
||
|
|
valueEnum: AssetHousesOrientationEnum,
|
||
|
|
required: true,
|
||
|
|
}),
|
||
|
|
MyFormItems.EnumRadio({
|
||
|
|
key: 'usage',
|
||
|
|
title: '用途',
|
||
|
|
colProps: { span: 24 },
|
||
|
|
valueEnum: AssetHousesUsageEnum,
|
||
|
|
required: true,
|
||
|
|
}),
|
||
|
|
MyFormItems.EnumRadio({
|
||
|
|
key: 'status',
|
||
|
|
title: '房屋状态',
|
||
|
|
colProps: { span: 24 },
|
||
|
|
valueEnum: AssetHousesStatusEnum,
|
||
|
|
required: true,
|
||
|
|
}),
|
||
|
|
|
||
|
|
{
|
||
|
|
key: 'built_area',
|
||
|
|
title: '建筑面积',
|
||
|
|
valueType: 'digit',
|
||
|
|
fieldProps: {
|
||
|
|
addonAfter: '㎡',
|
||
|
|
},
|
||
|
|
colProps: { span: 8 },
|
||
|
|
},
|
||
|
|
{
|
||
|
|
key: 'inside_area',
|
||
|
|
title: '套内面积',
|
||
|
|
valueType: 'digit',
|
||
|
|
fieldProps: {
|
||
|
|
addonAfter: '㎡',
|
||
|
|
},
|
||
|
|
colProps: { span: 8 },
|
||
|
|
},
|
||
|
|
{
|
||
|
|
key: 'chargeable_area',
|
||
|
|
title: '计费面积',
|
||
|
|
valueType: 'digit',
|
||
|
|
fieldProps: {
|
||
|
|
addonAfter: '㎡',
|
||
|
|
},
|
||
|
|
colProps: { span: 8 },
|
||
|
|
},
|
||
|
|
{
|
||
|
|
key: 'floor',
|
||
|
|
title: '楼层',
|
||
|
|
valueType: 'digit',
|
||
|
|
fieldProps: {
|
||
|
|
addonAfter: '楼',
|
||
|
|
},
|
||
|
|
colProps: { span: 8 },
|
||
|
|
},
|
||
|
|
{
|
||
|
|
key: 'ownership_term',
|
||
|
|
title: '产权年限',
|
||
|
|
fieldProps: {
|
||
|
|
addonAfter: '年',
|
||
|
|
},
|
||
|
|
colProps: { span: 8 },
|
||
|
|
},
|
||
|
|
{
|
||
|
|
valueType: 'group',
|
||
|
|
columns: [
|
||
|
|
{
|
||
|
|
key: 'room',
|
||
|
|
title: '房',
|
||
|
|
valueType: 'digit',
|
||
|
|
fieldProps: {
|
||
|
|
addonAfter: '房',
|
||
|
|
},
|
||
|
|
colProps: { span: 4 },
|
||
|
|
},
|
||
|
|
{
|
||
|
|
key: 'hall',
|
||
|
|
title: '厅',
|
||
|
|
valueType: 'digit',
|
||
|
|
fieldProps: {
|
||
|
|
addonAfter: '厅',
|
||
|
|
},
|
||
|
|
colProps: { span: 4 },
|
||
|
|
},
|
||
|
|
{
|
||
|
|
key: 'kitchen',
|
||
|
|
title: '厨',
|
||
|
|
valueType: 'digit',
|
||
|
|
fieldProps: {
|
||
|
|
addonAfter: '厨',
|
||
|
|
},
|
||
|
|
colProps: { span: 4 },
|
||
|
|
},
|
||
|
|
{
|
||
|
|
key: 'bathroom',
|
||
|
|
title: '卫',
|
||
|
|
valueType: 'digit',
|
||
|
|
fieldProps: {
|
||
|
|
addonAfter: '卫',
|
||
|
|
},
|
||
|
|
colProps: { span: 4 },
|
||
|
|
},
|
||
|
|
{
|
||
|
|
key: 'balcony',
|
||
|
|
title: '阳台',
|
||
|
|
valueType: 'digit',
|
||
|
|
fieldProps: {
|
||
|
|
addonAfter: '阳台',
|
||
|
|
},
|
||
|
|
colProps: { span: 4 },
|
||
|
|
},
|
||
|
|
],
|
||
|
|
},
|
||
|
|
]}
|
||
|
|
/>
|
||
|
|
);
|
||
|
|
}
|