import { MyButtons, MyColumns, MyImportModal, MyPageContainer, MyProTableProps, } from '@/common'; import { Selects } from '@/components/Select'; 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(); return ( MyProTableProps.request(params, sort, Apis.Asset.AssetHouses.List) } toolBarRender={(action) => [ , ]} columns={[ MyColumns.ID({ search: false }), Selects?.AssetProjects({ title: '选择项目', key: 'asset_projects_id', hidden: true, }), { 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, search: false, }), 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 || ''} m²`; // }, // 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 (
{owners.length > 0 && (
产权人 {owners.map((owner: any) => owner?.name).join('、')}
)} {residents.length > 0 && (
住户 {residents .map((resident: any) => resident?.name) .join('、')}
)} {owners.length === 0 && residents.length === 0 && ( 暂无 )}
); }, search: false, }, MyColumns.Option({ render: (_, item: any, index, action) => ( { navigate(`/customer/archive/show/${item.id}`); }} /> {/* {!item?.house_occupants?.length ? ( ) : ( '' )} */} ), }), ]} />
); }