forked from ddrilling/asb_cloud_front
CF2-39: В новых абсолютных путях маршрутизации их общая часть вынесена в переменную
This commit is contained in:
parent
38e10aa1f4
commit
6d46c8cb82
@ -11,6 +11,8 @@ export default function MenuDocuments() {
|
|||||||
let { id } = useParams()
|
let { id } = useParams()
|
||||||
let currentPath = useLocation().pathname
|
let currentPath = useLocation().pathname
|
||||||
|
|
||||||
|
const rootPath = `/well/${id}`
|
||||||
|
|
||||||
const [selectedElement, setSelectedElement] = useState('fluidService')
|
const [selectedElement, setSelectedElement] = useState('fluidService')
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@ -27,28 +29,28 @@ export default function MenuDocuments() {
|
|||||||
selectedKeys={[selectedElement]}
|
selectedKeys={[selectedElement]}
|
||||||
>
|
>
|
||||||
<Menu.Item key="fluidService" icon={<FolderOutlined/>}>
|
<Menu.Item key="fluidService" icon={<FolderOutlined/>}>
|
||||||
<Link to={{pathname: `/well/${id}/documents/fluidService`}}>Растворный сервис</Link>
|
<Link to={{pathname: `${rootPath}/documents/fluidService`}}>Растворный сервис</Link>
|
||||||
</Menu.Item>
|
</Menu.Item>
|
||||||
<Menu.Item key="cementing" icon={<FolderOutlined/>}>
|
<Menu.Item key="cementing" icon={<FolderOutlined/>}>
|
||||||
<Link to={{pathname: `/well/${id}/documents/cementing`}}>Цементирование</Link>
|
<Link to={{pathname: `${rootPath}/documents/cementing`}}>Цементирование</Link>
|
||||||
</Menu.Item>
|
</Menu.Item>
|
||||||
<Menu.Item key="nnb" icon={<FolderOutlined/>}>
|
<Menu.Item key="nnb" icon={<FolderOutlined/>}>
|
||||||
<Link to={{pathname: `/well/${id}/documents/nnb`}}>ННБ</Link>
|
<Link to={{pathname: `${rootPath}/documents/nnb`}}>ННБ</Link>
|
||||||
</Menu.Item>
|
</Menu.Item>
|
||||||
<Menu.Item key="gti" icon={<FolderOutlined/>}>
|
<Menu.Item key="gti" icon={<FolderOutlined/>}>
|
||||||
<Link to={{pathname: `/well/${id}/documents/gti`}}>ГТИ</Link>
|
<Link to={{pathname: `${rootPath}/documents/gti`}}>ГТИ</Link>
|
||||||
</Menu.Item>
|
</Menu.Item>
|
||||||
<Menu.Item key="documentsForWell" icon={<FolderOutlined/>}>
|
<Menu.Item key="documentsForWell" icon={<FolderOutlined/>}>
|
||||||
<Link to={{pathname: `/well/${id}/documents/documentsForWell`}}>Документы по скважине</Link>
|
<Link to={{pathname: `${rootPath}/documents/documentsForWell`}}>Документы по скважине</Link>
|
||||||
</Menu.Item>
|
</Menu.Item>
|
||||||
<Menu.Item key="supervisor" icon={<FolderOutlined/>}>
|
<Menu.Item key="supervisor" icon={<FolderOutlined/>}>
|
||||||
<Link to={{pathname: `/well/${id}/documents/supervisor`}}>Супервайзер</Link>
|
<Link to={{pathname: `${rootPath}/documents/supervisor`}}>Супервайзер</Link>
|
||||||
</Menu.Item>
|
</Menu.Item>
|
||||||
<Menu.Item key="master" icon={<FolderOutlined/>}>
|
<Menu.Item key="master" icon={<FolderOutlined/>}>
|
||||||
<Link to={{pathname: `/well/${id}/documents/master`}}>Мастер</Link>
|
<Link to={{pathname: `${rootPath}/documents/master`}}>Мастер</Link>
|
||||||
</Menu.Item>
|
</Menu.Item>
|
||||||
<Menu.Item key="lastData" icon={<FolderOutlined/>}>
|
<Menu.Item key="lastData" icon={<FolderOutlined/>}>
|
||||||
<Link to={{pathname: `/well/${id}/documents/lastData`}}>Последние данные</Link>
|
<Link to={{pathname: `${rootPath}/documents/lastData`}}>Последние данные</Link>
|
||||||
</Menu.Item>
|
</Menu.Item>
|
||||||
</Menu>
|
</Menu>
|
||||||
|
|
||||||
|
@ -14,6 +14,7 @@ const { Content } = Layout
|
|||||||
|
|
||||||
export default function Well() {
|
export default function Well() {
|
||||||
let { id } = useParams()
|
let { id } = useParams()
|
||||||
|
const rootPath = `/well/${id}`
|
||||||
|
|
||||||
const {SubMenu} = Menu
|
const {SubMenu} = Menu
|
||||||
|
|
||||||
@ -25,25 +26,25 @@ export default function Well() {
|
|||||||
className="well_menu"
|
className="well_menu"
|
||||||
>
|
>
|
||||||
<Menu.Item key="1" icon={<FundViewOutlined/>}>
|
<Menu.Item key="1" icon={<FundViewOutlined/>}>
|
||||||
<Link to={{pathname: `/well/${id}/telemetry`}}>Мониторинг</Link>
|
<Link to={{pathname: `${rootPath}/telemetry`}}>Мониторинг</Link>
|
||||||
</Menu.Item>
|
</Menu.Item>
|
||||||
<Menu.Item key="2" icon={<FolderOutlined/>}>
|
<Menu.Item key="2" icon={<FolderOutlined/>}>
|
||||||
<Link to={{pathname: `/well/${id}/message`}}>Сообщения</Link>
|
<Link to={{pathname: `${rootPath}/message`}}>Сообщения</Link>
|
||||||
</Menu.Item>
|
</Menu.Item>
|
||||||
<Menu.Item key="3" icon={<FolderOutlined/>}>
|
<Menu.Item key="3" icon={<FolderOutlined/>}>
|
||||||
<Link to={{pathname: `/well/${id}/report`}}>Рапорт</Link>
|
<Link to={{pathname: `${rootPath}/report`}}>Рапорт</Link>
|
||||||
</Menu.Item>
|
</Menu.Item>
|
||||||
<Menu.Item key="4" icon={<FolderOutlined/>}>
|
<Menu.Item key="4" icon={<FolderOutlined/>}>
|
||||||
<Link to={{pathname: `/well/${id}/analysis`}}>Анализ</Link>
|
<Link to={{pathname: `${rootPath}/analysis`}}>Анализ</Link>
|
||||||
</Menu.Item>
|
</Menu.Item>
|
||||||
<Menu.Item key="5" icon={<FolderOutlined/>}>
|
<Menu.Item key="5" icon={<FolderOutlined/>}>
|
||||||
<Link to={{pathname: `/well/${id}/wellAnalysis`}}>Операции по скважине</Link>
|
<Link to={{pathname: `${rootPath}/wellAnalysis`}}>Операции по скважине</Link>
|
||||||
</Menu.Item>
|
</Menu.Item>
|
||||||
<Menu.Item key="6" icon={<FolderOutlined/>}>
|
<Menu.Item key="6" icon={<FolderOutlined/>}>
|
||||||
<Link to={{pathname: `/well/${id}/file`}}>Файлы</Link>
|
<Link to={{pathname: `${rootPath}/file`}}>Файлы</Link>
|
||||||
</Menu.Item>
|
</Menu.Item>
|
||||||
<Menu.Item key="7" icon={<FolderOutlined/>}>
|
<Menu.Item key="7" icon={<FolderOutlined/>}>
|
||||||
<Link to={{pathname: `/well/${id}/archive`}}>Архив</Link>
|
<Link to={{pathname: `${rootPath}/archive`}}>Архив</Link>
|
||||||
</Menu.Item>
|
</Menu.Item>
|
||||||
<SubMenu
|
<SubMenu
|
||||||
key="documentsSub"
|
key="documentsSub"
|
||||||
@ -52,28 +53,28 @@ export default function Well() {
|
|||||||
selectable={true}
|
selectable={true}
|
||||||
>
|
>
|
||||||
<Menu.Item key="documentsSub1" icon={<FolderOutlined/>}>
|
<Menu.Item key="documentsSub1" icon={<FolderOutlined/>}>
|
||||||
<Link to={{pathname: `/well/${id}/documents/fluidService`}}>Растворный сервис</Link>
|
<Link to={{pathname: `${rootPath}/documents/fluidService`}}>Растворный сервис</Link>
|
||||||
</Menu.Item>
|
</Menu.Item>
|
||||||
<Menu.Item key="documentsSub1.1" icon={<FolderOutlined/>}>
|
<Menu.Item key="documentsSub1.1" icon={<FolderOutlined/>}>
|
||||||
<Link to={{pathname: `/well/${id}/documents/cementing`}}>Цементирование</Link>
|
<Link to={{pathname: `${rootPath}/documents/cementing`}}>Цементирование</Link>
|
||||||
</Menu.Item>
|
</Menu.Item>
|
||||||
<Menu.Item key="documentsSub1.2" icon={<FolderOutlined/>}>
|
<Menu.Item key="documentsSub1.2" icon={<FolderOutlined/>}>
|
||||||
<Link to={{pathname: `/well/${id}/documents/nnb`}}>ННБ</Link>
|
<Link to={{pathname: `${rootPath}/documents/nnb`}}>ННБ</Link>
|
||||||
</Menu.Item>
|
</Menu.Item>
|
||||||
<Menu.Item key="documentsSub1.3" icon={<FolderOutlined/>}>
|
<Menu.Item key="documentsSub1.3" icon={<FolderOutlined/>}>
|
||||||
<Link to={{pathname: `/well/${id}/documents/gti`}}>ГТИ</Link>
|
<Link to={{pathname: `${rootPath}/documents/gti`}}>ГТИ</Link>
|
||||||
</Menu.Item>
|
</Menu.Item>
|
||||||
<Menu.Item key="documentsSub1.4" icon={<FolderOutlined/>}>
|
<Menu.Item key="documentsSub1.4" icon={<FolderOutlined/>}>
|
||||||
<Link to={{pathname: `/well/${id}/documents/documentsForWell`}}>Документы по скважине</Link>
|
<Link to={{pathname: `${rootPath}/documents/documentsForWell`}}>Документы по скважине</Link>
|
||||||
</Menu.Item>
|
</Menu.Item>
|
||||||
<Menu.Item key="documentsSub1.5" icon={<FolderOutlined/>}>
|
<Menu.Item key="documentsSub1.5" icon={<FolderOutlined/>}>
|
||||||
<Link to={{pathname: `/well/${id}/documents/supervisor`}}>Супервайзер</Link>
|
<Link to={{pathname: `${rootPath}/documents/supervisor`}}>Супервайзер</Link>
|
||||||
</Menu.Item>
|
</Menu.Item>
|
||||||
<Menu.Item key="documentsSub1.6" icon={<FolderOutlined/>}>
|
<Menu.Item key="documentsSub1.6" icon={<FolderOutlined/>}>
|
||||||
<Link to={{pathname: `/well/${id}/documents/master`}}>Мастер</Link>
|
<Link to={{pathname: `${rootPath}/documents/master`}}>Мастер</Link>
|
||||||
</Menu.Item>
|
</Menu.Item>
|
||||||
<Menu.Item key="documentsSub1.7" icon={<FolderOutlined/>}>
|
<Menu.Item key="documentsSub1.7" icon={<FolderOutlined/>}>
|
||||||
<Link to={{pathname: `/well/${id}/documents/lastData`}}>Последние данные</Link>
|
<Link to={{pathname: `${rootPath}/documents/lastData`}}>Последние данные</Link>
|
||||||
</Menu.Item>
|
</Menu.Item>
|
||||||
</SubMenu>
|
</SubMenu>
|
||||||
</Menu>
|
</Menu>
|
||||||
@ -106,7 +107,7 @@ export default function Well() {
|
|||||||
<MenuDocuments/>
|
<MenuDocuments/>
|
||||||
</Route>
|
</Route>
|
||||||
<Route path="/">
|
<Route path="/">
|
||||||
<Redirect to={{pathname: `/well/${id}/telemetry`}}/>
|
<Redirect to={{pathname: `${rootPath}/telemetry`}}/>
|
||||||
</Route>
|
</Route>
|
||||||
</Switch>
|
</Switch>
|
||||||
</Content>
|
</Content>
|
||||||
|
Loading…
Reference in New Issue
Block a user