import { MyPageContainer, usePageTabs } from '@/common'; 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 AssetAccounts from './components/AssetAccounts'; import MyAssetBuildings from './components/AssetBuildings'; import AssetGrid from './components/AssetGrid'; import AssetInfo from './components/AssetInfo'; import Basic from './components/Basic'; export default function Show({ title }: { title?: string } = {}) { const { id } = useParams<{ id: string }>(); const [data, setShow] = useState({}); // 注册当前页面为标签页 const { addTab } = usePageTabs({ tabKey: `asset-show-${id}`, tabLabel: data?.name || title || '项目详情', }); const loadShow = () => { let paramsId: any = { id: id ?? 0 }; Apis.Asset.AssetProjects.Show(paramsId).then((res) => { setShow(res?.data); // 更新标签页名称为API返回的name if (res?.data?.name) { addTab({ key: `asset-show-${id}`, label: res.data.name, path: `/asset/${id}`, }); } }); }; useEffect(() => { loadShow(); }, [id]); let items = [ { label: '基本信息', key: 'info', closable: false, children: loadShow()} />, }, { label: '楼栋管理', key: 'asset_buildings', closable: false, children: , }, { label: '网格管理', key: 'grid', closable: false, children: , }, { label: '收款账号', key: 'asset_accounts', closable: false, children: , }, // { // label: '车位管理', // key: 'carport', // closable: false, // children: , // }, ]; return ( loadShow()} /> ); }