2025-07-10 18:01:45 +08:00
|
|
|
import {
|
|
|
|
|
MyButtons,
|
|
|
|
|
MyColumns,
|
|
|
|
|
MyPageContainer,
|
|
|
|
|
MyProTableProps,
|
2025-07-25 16:42:54 +08:00
|
|
|
usePageTabs,
|
2025-07-10 18:01:45 +08:00
|
|
|
} from '@/common';
|
|
|
|
|
import { Apis } from '@/gen/Apis';
|
|
|
|
|
import {
|
|
|
|
|
AssetHousesOwnershipTypeEnum,
|
|
|
|
|
AssetHousesStatusEnum,
|
|
|
|
|
AssetHousesUsageEnum,
|
|
|
|
|
} from '@/gen/Enums';
|
|
|
|
|
import { ProTable } from '@ant-design/pro-components';
|
|
|
|
|
import { useNavigate } from '@umijs/max';
|
2025-08-08 18:35:02 +08:00
|
|
|
import { Space, Tag } from 'antd';
|
2025-07-10 18:01:45 +08:00
|
|
|
import Delivery from './modals/Delivery';
|
|
|
|
|
|
|
|
|
|
export default function Index({ title = '房屋档案' }) {
|
|
|
|
|
const navigate = useNavigate();
|
2025-07-25 16:42:54 +08:00
|
|
|
// 注册当前页面为标签页
|
|
|
|
|
usePageTabs({
|
|
|
|
|
tabKey: 'archive-asset-houses',
|
|
|
|
|
tabLabel: title,
|
|
|
|
|
});
|
2025-07-10 18:01:45 +08:00
|
|
|
return (
|
|
|
|
|
<MyPageContainer title={title}>
|
|
|
|
|
<ProTable
|
|
|
|
|
{...MyProTableProps.props}
|
|
|
|
|
request={async (params, sort) =>
|
|
|
|
|
MyProTableProps.request(params, sort, Apis.Asset.AssetHouses.List)
|
|
|
|
|
}
|
|
|
|
|
columns={[
|
|
|
|
|
MyColumns.ID(),
|
2025-08-08 18:35:02 +08:00
|
|
|
{
|
|
|
|
|
title: '房屋名称',
|
|
|
|
|
dataIndex: 'full_name',
|
|
|
|
|
ellipsis: true,
|
|
|
|
|
},
|
|
|
|
|
MyColumns.EnumTag({
|
|
|
|
|
title: '房屋状态',
|
|
|
|
|
dataIndex: 'status',
|
|
|
|
|
valueEnum: AssetHousesStatusEnum,
|
|
|
|
|
search: false,
|
|
|
|
|
}),
|
|
|
|
|
|
2025-07-10 18:01:45 +08:00
|
|
|
MyColumns.EnumTag({
|
|
|
|
|
title: '产权性质',
|
|
|
|
|
dataIndex: 'ownership_type',
|
|
|
|
|
valueEnum: AssetHousesOwnershipTypeEnum,
|
|
|
|
|
}),
|
|
|
|
|
MyColumns.EnumTag({
|
|
|
|
|
title: '用途',
|
|
|
|
|
dataIndex: 'usage',
|
|
|
|
|
valueEnum: AssetHousesUsageEnum,
|
|
|
|
|
}),
|
|
|
|
|
{
|
2025-08-08 18:35:02 +08:00
|
|
|
title: '楼层',
|
|
|
|
|
dataIndex: 'floor',
|
2025-07-10 18:01:45 +08:00
|
|
|
render(_, record) {
|
2025-08-08 18:35:02 +08:00
|
|
|
return `${record?.floor}层`;
|
2025-07-10 18:01:45 +08:00
|
|
|
},
|
|
|
|
|
search: false,
|
|
|
|
|
},
|
|
|
|
|
{
|
2025-08-08 18:35:02 +08:00
|
|
|
title: '建筑面积',
|
|
|
|
|
dataIndex: 'built_area',
|
2025-07-10 18:01:45 +08:00
|
|
|
render(_, record) {
|
2025-08-08 18:35:02 +08:00
|
|
|
return `${record?.built_area || ''} m²`;
|
2025-07-10 18:01:45 +08:00
|
|
|
},
|
|
|
|
|
search: false,
|
|
|
|
|
},
|
|
|
|
|
{
|
2025-08-08 18:35:02 +08:00
|
|
|
title: '产权人/住户',
|
2025-07-10 18:01:45 +08:00
|
|
|
render(_, record) {
|
2025-08-08 18:35:02 +08:00
|
|
|
const owners =
|
|
|
|
|
record?.house_occupants?.filter(
|
|
|
|
|
(res: any) => res?.house_relation === 'Owner',
|
|
|
|
|
) || [];
|
|
|
|
|
const residents =
|
|
|
|
|
record?.house_occupants?.filter(
|
|
|
|
|
(res: any) => res?.house_relation === 'Resident',
|
|
|
|
|
) || [];
|
|
|
|
|
|
2025-07-25 16:42:54 +08:00
|
|
|
return (
|
2025-08-08 18:35:02 +08:00
|
|
|
<div>
|
|
|
|
|
{owners.length > 0 && (
|
|
|
|
|
<div>
|
|
|
|
|
<Tag color="blue">产权人</Tag>
|
|
|
|
|
{owners.map((owner: any) => owner?.name).join('、')}
|
|
|
|
|
</div>
|
|
|
|
|
)}
|
|
|
|
|
{residents.length > 0 && (
|
|
|
|
|
<div style={{ marginTop: 4 }}>
|
|
|
|
|
<Tag color="green">住户</Tag>
|
|
|
|
|
{residents
|
|
|
|
|
.map((resident: any) => resident?.name)
|
|
|
|
|
.join('、')}
|
|
|
|
|
</div>
|
|
|
|
|
)}
|
|
|
|
|
{owners.length === 0 && residents.length === 0 && (
|
|
|
|
|
<Tag color="default">暂无</Tag>
|
|
|
|
|
)}
|
|
|
|
|
</div>
|
|
|
|
|
);
|
2025-07-10 18:01:45 +08:00
|
|
|
},
|
|
|
|
|
search: false,
|
|
|
|
|
},
|
2025-08-08 18:35:02 +08:00
|
|
|
|
2025-07-10 18:01:45 +08:00
|
|
|
MyColumns.Option({
|
|
|
|
|
render: (_, item: any, index, action) => (
|
|
|
|
|
<Space key={index}>
|
2025-08-08 18:35:02 +08:00
|
|
|
<MyButtons.View
|
2025-08-27 11:24:29 +08:00
|
|
|
title="查看"
|
2025-08-08 18:35:02 +08:00
|
|
|
onClick={() => {
|
|
|
|
|
navigate(`/archive/${item.id}`);
|
|
|
|
|
}}
|
|
|
|
|
/>
|
|
|
|
|
{!item?.house_occupants?.length ? (
|
2025-07-16 10:18:01 +08:00
|
|
|
<Delivery
|
|
|
|
|
item={item}
|
|
|
|
|
reload={action?.reload}
|
2025-08-27 11:24:29 +08:00
|
|
|
title="添加产权人"
|
2025-07-16 10:18:01 +08:00
|
|
|
/>
|
2025-08-08 18:35:02 +08:00
|
|
|
) : (
|
2025-08-27 11:24:29 +08:00
|
|
|
''
|
2025-07-10 18:01:45 +08:00
|
|
|
)}
|
|
|
|
|
</Space>
|
|
|
|
|
),
|
|
|
|
|
}),
|
|
|
|
|
]}
|
|
|
|
|
/>
|
|
|
|
|
</MyPageContainer>
|
|
|
|
|
);
|
|
|
|
|
}
|