2026-01-08 16:35:06 +08:00
|
|
|
import { MyBetaModalFormProps } from '@/common';
|
|
|
|
|
import { Apis } from '@/gen/Apis';
|
|
|
|
|
import { ProCard } from '@ant-design/pro-components';
|
|
|
|
|
import { useParams } from '@umijs/max';
|
|
|
|
|
import { Badge, Tabs } from 'antd';
|
|
|
|
|
import { useEffect, useState } from 'react';
|
|
|
|
|
import OccupantsHistory from '../table/OccupantsHistory';
|
|
|
|
|
import OccupantsNow from '../table/OccupantsNow';
|
|
|
|
|
import RegistersList from '../table/RegistersList';
|
|
|
|
|
import HouseInfo from './HouseInfo';
|
|
|
|
|
import SummaryInfo from './SummaryInfo';
|
|
|
|
|
|
|
|
|
|
export default function Show(props: MyBetaModalFormProps) {
|
|
|
|
|
const { id } = useParams<{ id: string }>();
|
|
|
|
|
const [data, setShow] = useState<any>({});
|
|
|
|
|
const [pendingCount, setPendingCount] = useState<number>(0);
|
|
|
|
|
|
|
|
|
|
const loadShow = () => {
|
|
|
|
|
let paramsId: any = { id: id ?? 0 };
|
|
|
|
|
Apis.Asset.AssetHouses.Show(paramsId).then((res) => {
|
|
|
|
|
setShow(res?.data);
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const loadPendingCount = () => {
|
|
|
|
|
Apis.Archive.HouseRegisters.List({
|
|
|
|
|
asset_houses_id: Number(id),
|
|
|
|
|
status: 'Pending',
|
|
|
|
|
}).then((res) => {
|
|
|
|
|
setPendingCount(res?.meta?.total || 0);
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
loadShow();
|
|
|
|
|
loadPendingCount();
|
|
|
|
|
}, [props.item?.id]);
|
|
|
|
|
|
|
|
|
|
let items = [
|
|
|
|
|
{
|
|
|
|
|
label: '当前客户',
|
|
|
|
|
key: '1',
|
|
|
|
|
closable: false,
|
|
|
|
|
children: (
|
|
|
|
|
<OccupantsNow
|
|
|
|
|
item={{ ...data, asset_houses_id: id }}
|
|
|
|
|
reload={() => {
|
|
|
|
|
loadShow();
|
|
|
|
|
loadPendingCount();
|
|
|
|
|
}}
|
|
|
|
|
/>
|
|
|
|
|
),
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
label: '历史客户',
|
|
|
|
|
key: '2',
|
|
|
|
|
closable: false,
|
|
|
|
|
children: <OccupantsHistory item={{ ...data, asset_houses_id: id }} />,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
label: (
|
|
|
|
|
<div style={{ display: 'flex', alignItems: 'center', gap: '8px' }}>
|
|
|
|
|
<span>操作记录</span>
|
|
|
|
|
{pendingCount > 0 && (
|
|
|
|
|
<Badge count={pendingCount} size="small" overflowCount={99} />
|
|
|
|
|
)}
|
|
|
|
|
</div>
|
|
|
|
|
),
|
|
|
|
|
key: '3',
|
|
|
|
|
closable: false,
|
|
|
|
|
children: (
|
|
|
|
|
<RegistersList
|
|
|
|
|
item={{ ...data, asset_houses_id: id }}
|
|
|
|
|
reload={loadPendingCount}
|
|
|
|
|
/>
|
|
|
|
|
),
|
|
|
|
|
},
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<>
|
|
|
|
|
<HouseInfo item={data} reload={loadShow} />
|
|
|
|
|
{id && <SummaryInfo item={{ ...data, id: id }} reload={loadShow} />}
|
|
|
|
|
<ProCard style={{ marginTop: 16 }}>
|
2026-01-28 18:25:03 +08:00
|
|
|
<Tabs type="card" items={items} defaultActiveKey="1" />
|
2026-01-08 16:35:06 +08:00
|
|
|
</ProCard>
|
|
|
|
|
</>
|
|
|
|
|
);
|
|
|
|
|
}
|