uiuJun 8f9c9fc6a1
Some checks failed
Build and Push Docker Image / build (push) Has been cancelled
feat:收费标准0.8
2025-09-02 16:22:57 +08:00

144 lines
4.1 KiB
TypeScript

import {
MyButtons,
MyColumns,
MyPageContainer,
MyProTableProps,
usePageTabs,
} from '@/common';
import { Apis } from '@/gen/Apis';
import {
AssetHousesOwnershipTypeEnum,
AssetHousesUsageEnum,
} from '@/gen/Enums';
import { ProTable } from '@ant-design/pro-components';
import { useNavigate } from '@umijs/max';
import { Space, Tag } from 'antd';
import Delivery from './modals/Delivery';
export default function Index({ title = '房屋档案' }) {
const navigate = useNavigate();
// 注册当前页面为标签页
usePageTabs({
tabKey: 'archive-asset-houses',
tabLabel: title,
});
return (
<MyPageContainer title={title}>
<ProTable
{...MyProTableProps.props}
request={async (params, sort) =>
MyProTableProps.request(params, sort, Apis.Asset.AssetHouses.List)
}
columns={[
MyColumns.ID(),
{
title: '项目名称',
dataIndex: ['asset_project', 'name'],
search: {
transform: (value) => {
return { project_name: value };
},
},
},
{
title: '房屋名称',
dataIndex: 'full_name',
ellipsis: true,
},
// MyColumns.EnumTag({
// title: '房屋状态',
// dataIndex: 'status',
// valueEnum: AssetHousesStatusEnum,
// search: false,
// }),
MyColumns.EnumTag({
title: '产权性质',
dataIndex: 'ownership_type',
valueEnum: AssetHousesOwnershipTypeEnum,
}),
MyColumns.EnumTag({
title: '用途',
dataIndex: 'usage',
valueEnum: AssetHousesUsageEnum,
}),
{
title: '楼层',
dataIndex: 'floor',
render(_, record) {
return `${record?.floor}`;
},
search: false,
},
{
title: '建筑面积',
dataIndex: 'built_area',
render(_, record) {
return `${record?.built_area || ''}`;
},
search: false,
},
{
title: '客户信息',
render(_, record) {
const owners =
record?.house_occupants?.filter(
(res: any) => res?.house_relation === 'Owner',
) || [];
const residents =
record?.house_occupants?.filter(
(res: any) => res?.house_relation === 'Resident',
) || [];
return (
<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>
);
},
search: false,
},
MyColumns.Option({
render: (_, item: any, index, action) => (
<Space key={index}>
<MyButtons.View
title="查看"
onClick={() => {
navigate(`/archive/${item.id}`);
}}
/>
{!item?.house_occupants?.length ? (
<Delivery
item={item}
reload={action?.reload}
title="添加产权人"
/>
) : (
''
)}
</Space>
),
}),
]}
/>
</MyPageContainer>
);
}