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 MeteInfo from '../components/MeteInfo'; import HasHouse from '../table/HasHouse'; import ReadingLIst from '../table/ReadingLIst'; import Tasks from '../table/Tasks'; export default function Show({ title = '仪表详情' }) { const { id } = useParams<{ id: string }>(); const [data, setShow] = useState({}); console.log('id', data); // 注册标签页 const { addTab } = usePageTabs({ tabKey: `meter-detail-${id}`, tabLabel: `仪表:${data?.name}` || title, }); const loadShow = () => { let paramsId: any = { id: id ?? 0 }; Apis.Meter.HouseMeters.Show(paramsId).then((res) => { setShow(res?.data); // 更新标签页标题 // if (res?.data?.name) { // addTab({ // key: `meter-detail-${id}`, // label: title, // path: `/mete/readings/show/${id}`, // }); // } }); }; useEffect(() => { loadShow(); }, [id]); let items = [ { label: '抄表数据', key: 'Readings', closable: false, children: ( { loadShow(); }} /> ), }, { label: '仪表任务', key: 'Tasks', closable: false, children: , }, { label: '关联房屋', key: 'HasHouse', closable: false, children: , }, ]; return ( ); }