2025-08-08 18:35:02 +08:00
|
|
|
import { MyPageContainer, usePageTabs } from '@/common';
|
2025-07-10 18:01:45 +08:00
|
|
|
import { Apis } from '@/gen/Apis';
|
|
|
|
|
import { ProCard } from '@ant-design/pro-components';
|
|
|
|
|
import { useParams } from '@umijs/max';
|
|
|
|
|
import { Tabs } from 'antd';
|
|
|
|
|
import { useEffect, useState } from 'react';
|
|
|
|
|
import HouseInfo from './components/HouseInfo';
|
2025-08-08 18:35:02 +08:00
|
|
|
import OccupantsHistory from './components/OccupantsHistory';
|
|
|
|
|
import OccupantsNow from './components/OccupantsNow';
|
|
|
|
|
import RegistersList from './components/RegistersList';
|
2025-07-10 18:01:45 +08:00
|
|
|
|
2025-08-08 18:35:02 +08:00
|
|
|
export default function Show({ title = '房屋档案' }) {
|
2025-07-10 18:01:45 +08:00
|
|
|
const { id } = useParams<{ id: string }>();
|
|
|
|
|
const [data, setShow] = useState<any>({});
|
2025-08-08 18:35:02 +08:00
|
|
|
|
|
|
|
|
// 注册标签页
|
|
|
|
|
const { addTab } = usePageTabs({
|
|
|
|
|
tabKey: `asset-house-detail-${id}`,
|
|
|
|
|
tabLabel: `${data?.name}档案` || title,
|
|
|
|
|
});
|
|
|
|
|
|
2025-07-10 18:01:45 +08:00
|
|
|
const loadShow = () => {
|
|
|
|
|
let paramsId: any = { id: id ?? 0 };
|
|
|
|
|
Apis.Asset.AssetHouses.Show(paramsId).then((res) => {
|
|
|
|
|
setShow(res?.data);
|
2025-08-08 18:35:02 +08:00
|
|
|
// 更新标签页标题
|
|
|
|
|
if (res?.data?.full_name) {
|
|
|
|
|
addTab({
|
|
|
|
|
key: `asset-house-detail-${id}`,
|
|
|
|
|
label: title,
|
|
|
|
|
path: `/archive/${id}`,
|
|
|
|
|
});
|
|
|
|
|
}
|
2025-07-10 18:01:45 +08:00
|
|
|
});
|
|
|
|
|
};
|
2025-08-08 18:35:02 +08:00
|
|
|
|
2025-07-10 18:01:45 +08:00
|
|
|
useEffect(() => {
|
|
|
|
|
loadShow();
|
|
|
|
|
}, [id]);
|
|
|
|
|
|
|
|
|
|
let items = [
|
|
|
|
|
{
|
2025-07-25 16:42:54 +08:00
|
|
|
label: '当前客户',
|
2025-07-10 18:01:45 +08:00
|
|
|
key: '1',
|
|
|
|
|
closable: false,
|
2025-08-08 18:35:02 +08:00
|
|
|
children: (
|
2025-07-16 10:18:01 +08:00
|
|
|
<OccupantsNow
|
2025-07-25 16:42:54 +08:00
|
|
|
item={{ ...data, asset_houses_id: id }}
|
2025-07-16 10:18:01 +08:00
|
|
|
reload={() => loadShow()}
|
|
|
|
|
/>
|
|
|
|
|
),
|
2025-07-10 18:01:45 +08:00
|
|
|
},
|
|
|
|
|
{
|
2025-07-25 16:42:54 +08:00
|
|
|
label: '历史客户',
|
2025-07-10 18:01:45 +08:00
|
|
|
key: '2',
|
|
|
|
|
closable: false,
|
2025-07-25 16:42:54 +08:00
|
|
|
children: <OccupantsHistory item={{ ...data, asset_houses_id: id }} />,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
label: '操作记录',
|
|
|
|
|
key: '3',
|
|
|
|
|
closable: false,
|
|
|
|
|
children: <RegistersList item={{ ...data, asset_houses_id: id }} />,
|
2025-07-10 18:01:45 +08:00
|
|
|
},
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<MyPageContainer title={title}>
|
2025-08-08 18:35:02 +08:00
|
|
|
<HouseInfo item={data} reload={loadShow} />
|
|
|
|
|
<ProCard style={{ marginTop: 16 }}>
|
|
|
|
|
<Tabs type="card" items={items} defaultActiveKey="1" size="small" />
|
2025-07-10 18:01:45 +08:00
|
|
|
</ProCard>
|
|
|
|
|
</MyPageContainer>
|
|
|
|
|
);
|
|
|
|
|
}
|