|
@@ -1,7 +1,7 @@
|
|
import { getProject } from '@/services/api/project'
|
|
import { getProject } from '@/services/api/project'
|
|
import { PageContainer } from '@ant-design/pro-layout'
|
|
import { PageContainer } from '@ant-design/pro-layout'
|
|
import React, { useEffect, useState } from 'react'
|
|
import React, { useEffect, useState } from 'react'
|
|
-import { useRequest } from '@umijs/max'
|
|
|
|
|
|
+import { useLocation, useParams, useRequest } from '@umijs/max'
|
|
import ProjectInfo from './components/ProjectInfo'
|
|
import ProjectInfo from './components/ProjectInfo'
|
|
import type { RouteComponentProps } from 'umi/node_modules/@types/react-router'
|
|
import type { RouteComponentProps } from 'umi/node_modules/@types/react-router'
|
|
import RolePerm from './components/RolePerm'
|
|
import RolePerm from './components/RolePerm'
|
|
@@ -23,8 +23,9 @@ type ProjectDetailStateProps = {
|
|
projectInfo: Nullable<API.ProjectListItem>
|
|
projectInfo: Nullable<API.ProjectListItem>
|
|
selectKey: TabEnum
|
|
selectKey: TabEnum
|
|
}
|
|
}
|
|
-const ProjectDetail: React.FC<RouteComponentProps> = ({ location }) => {
|
|
|
|
- const { dataID } = location.state
|
|
|
|
|
|
+const ProjectDetail: React.FC<RouteComponentProps> = () => {
|
|
|
|
+ const { id: ID } = useParams()
|
|
|
|
+
|
|
const [state, setState] = useState<ProjectDetailStateProps>({
|
|
const [state, setState] = useState<ProjectDetailStateProps>({
|
|
projectInfo: null,
|
|
projectInfo: null,
|
|
selectKey: TabEnum.INFO
|
|
selectKey: TabEnum.INFO
|
|
@@ -34,10 +35,10 @@ const ProjectDetail: React.FC<RouteComponentProps> = ({ location }) => {
|
|
onSuccess: (result: API.ProjectDetail) => setState({ ...state, projectInfo: result })
|
|
onSuccess: (result: API.ProjectDetail) => setState({ ...state, projectInfo: result })
|
|
})
|
|
})
|
|
useEffect(() => {
|
|
useEffect(() => {
|
|
- if (dataID) {
|
|
|
|
- tryGetProjectInfo({ ID: dataID })
|
|
|
|
|
|
+ if (ID) {
|
|
|
|
+ tryGetProjectInfo({ ID })
|
|
}
|
|
}
|
|
- }, [dataID])
|
|
|
|
|
|
+ }, [ID])
|
|
|
|
|
|
const renderChildren = () => {
|
|
const renderChildren = () => {
|
|
switch (state.selectKey) {
|
|
switch (state.selectKey) {
|