110 lines
3.0 KiB
TypeScript
110 lines
3.0 KiB
TypeScript
|
|
import { MyColumns, MyProTableProps } from '@/common';
|
||
|
|
import { Apis } from '@/gen/Apis';
|
||
|
|
import {
|
||
|
|
HouseOccupantsHouseRelationEnum,
|
||
|
|
HouseOccupantsRelationWithOwnerEnum,
|
||
|
|
HouseOccupantsStatusEnum,
|
||
|
|
} from '@/gen/Enums';
|
||
|
|
import { ProTable } from '@ant-design/pro-components';
|
||
|
|
import { Space } from 'antd';
|
||
|
|
import { useEffect, useRef } from 'react';
|
||
|
|
import AddOccupant from '../modals/AddOccupant';
|
||
|
|
import MoveOut from '../modals/MoveOut';
|
||
|
|
import Transfer from '../modals/Transfer';
|
||
|
|
|
||
|
|
export default function Index({ ...rest }) {
|
||
|
|
const actionLooks = useRef<any>();
|
||
|
|
useEffect(() => {
|
||
|
|
actionLooks?.current.reloadAndRest();
|
||
|
|
}, [rest.loadmore]);
|
||
|
|
|
||
|
|
return (
|
||
|
|
<>
|
||
|
|
<ProTable<Record<any, any>>
|
||
|
|
{...MyProTableProps.props}
|
||
|
|
actionRef={actionLooks}
|
||
|
|
request={async (params, sort) =>
|
||
|
|
MyProTableProps.request(
|
||
|
|
{
|
||
|
|
...params,
|
||
|
|
asset_houses_id: rest.item?.id,
|
||
|
|
status: 'Normal',
|
||
|
|
},
|
||
|
|
sort,
|
||
|
|
Apis.Archive.HouseOccupants.List,
|
||
|
|
)
|
||
|
|
}
|
||
|
|
toolBarRender={(action) => [
|
||
|
|
<Transfer
|
||
|
|
key="Transfer"
|
||
|
|
item={rest.item}
|
||
|
|
reload={action?.reload}
|
||
|
|
title=" 过户登记"
|
||
|
|
/>,
|
||
|
|
<AddOccupant
|
||
|
|
key="AddOccupant"
|
||
|
|
item={rest.item}
|
||
|
|
reload={action?.reload}
|
||
|
|
title="添加住户"
|
||
|
|
/>,
|
||
|
|
]}
|
||
|
|
search={false}
|
||
|
|
columns={[
|
||
|
|
MyColumns.EnumTag({
|
||
|
|
title: '房客关系',
|
||
|
|
dataIndex: 'house_relation',
|
||
|
|
valueEnum: HouseOccupantsHouseRelationEnum,
|
||
|
|
search: false,
|
||
|
|
}),
|
||
|
|
MyColumns.EnumTag({
|
||
|
|
title: '与产权人关系',
|
||
|
|
dataIndex: 'relation_with_owner',
|
||
|
|
valueEnum: HouseOccupantsRelationWithOwnerEnum,
|
||
|
|
search: false,
|
||
|
|
}),
|
||
|
|
{
|
||
|
|
title: '姓名',
|
||
|
|
dataIndex: 'name',
|
||
|
|
},
|
||
|
|
{
|
||
|
|
title: '电话',
|
||
|
|
dataIndex: 'phone',
|
||
|
|
},
|
||
|
|
|
||
|
|
{
|
||
|
|
title: '是否入住',
|
||
|
|
dataIndex: 'is_live_in',
|
||
|
|
render(_, record) {
|
||
|
|
return `${record?.is_live_in ? '是' : '-'} `;
|
||
|
|
},
|
||
|
|
},
|
||
|
|
{
|
||
|
|
title: '入住日期',
|
||
|
|
dataIndex: 'is_live_in',
|
||
|
|
render(_, record) {
|
||
|
|
return `待补充`;
|
||
|
|
},
|
||
|
|
},
|
||
|
|
MyColumns.EnumTag({
|
||
|
|
title: '状态',
|
||
|
|
dataIndex: 'status',
|
||
|
|
valueEnum: HouseOccupantsStatusEnum,
|
||
|
|
search: false,
|
||
|
|
}),
|
||
|
|
// MyColumns.UpdatedAt(),
|
||
|
|
MyColumns.Option({
|
||
|
|
render: (_, item: any, index, action) => (
|
||
|
|
<Space key={index}>
|
||
|
|
{/* <GridCreateUpdate item={item} reload={action?.reload} /> */}
|
||
|
|
{item?.is_live_in && (
|
||
|
|
<MoveOut item={item} reload={action?.reload} title="搬离" />
|
||
|
|
)}
|
||
|
|
</Space>
|
||
|
|
),
|
||
|
|
}),
|
||
|
|
]}
|
||
|
|
/>
|
||
|
|
</>
|
||
|
|
);
|
||
|
|
}
|