import React, { useState } from 'react'; import { PageHeader, Tabs, Button, Statistic, Descriptions } from 'antd'; import { CollectionTabPane } from './CollectionTabPane'; import { getPathName, redirectTo } from './utils'; import api from '@/api-client'; import { useRequest } from 'umi'; import { Spin } from '@nocobase/client'; import { Helmet } from 'umi'; export function CollectionSingle(props) { console.log(props); const { item = {} } = props; const { tabs = [] } = props.collection; const activeTab = tabs.find(tab => tab.name == item.tabName)||{}; console.log(activeTab); const { data = {}, loading } = useRequest(() => activeTab && api.resource(activeTab.collection_name).getPageInfo({ resourceKey: item.itemId, })); const [activing, setActiving] = useState(false); if (!activeTab) { return null; } if (loading) { return ; } return (
{data.pageTitle} { redirectTo({ ...props.match.params, removeLastItem: true, }); }} title={data.pageTitle} // subTitle="This is a subtitle" extra={[ // , // , // , ]} footer={ { setActiving(true); redirectTo({ ...props.match.params, lastItem: { tabName: activeKey, }, }); setTimeout(() => { setActiving(false); }, 2) }} > {tabs.map(tab => )} } />
); } export default CollectionSingle;