// 菜单管理-详情 import { PageContainer } from '@ant-design/pro-layout'; import { useIntl } from '@@/plugin-locale/localeExports'; import { useEffect, useState } from 'react'; import BaseDetail from './edit'; import Buttons from './buttons'; import { useLocation, useParams, useRequest } from 'umi'; import { service } from '@/pages/system/Menu'; type LocationType = { id?: string; }; export default () => { const intl = useIntl(); const [tabKey, setTabKey] = useState('detail'); const [pId, setPid] = useState(null); const location = useLocation(); const params: any = new URLSearchParams(location.search); const param = useParams<{ id?: string }>(); const { data, run: queryData } = useRequest(service.queryDetail, { manual: true, formatResult: (response) => { return response.result; }, }); /** * 获取当前菜单详情 */ const queryDetail = (editId?: string) => { const id = editId || param.id; const _pId = params.get('pId'); if (id && id !== ':id') { queryData(id); } if (_pId) { setPid(_pId); } }; useEffect(() => { queryDetail(); /* eslint-disable */ }, [location]); return ( { setTabKey(key); }} > {tabKey === 'detail' && data ? ( ) : ( )} ); };