Исправлена работа переходов на документы и операции по телеметрии

This commit is contained in:
Александр Сироткин 2022-02-07 15:18:19 +05:00
parent 374eaaef21
commit 2667a39361
2 changed files with 8 additions and 7 deletions

View File

@ -1,9 +1,10 @@
import { join } from 'path'
import { memo } from 'react' import { memo } from 'react'
import { Layout, Menu } from 'antd' import { Layout, Menu } from 'antd'
import { FolderOutlined } from '@ant-design/icons' import { FolderOutlined } from '@ant-design/icons'
import { Switch, useParams } from 'react-router-dom' import { Switch, useParams } from 'react-router-dom'
import { PrivateDefaultRoute, PrivateMenuItem, PrivateRoute } from '@components/Private' import { PrivateDefaultRoute, PrivateMenuItemLink, PrivateRoute } from '@components/Private'
import DocumentsTemplate from './DocumentsTemplate' import DocumentsTemplate from './DocumentsTemplate'
@ -30,7 +31,7 @@ export const MenuDocuments = memo(({ idWell }) => {
<> <>
<Menu mode={'horizontal'} selectable={true} className={'well_menu'} selectedKeys={[category]}> <Menu mode={'horizontal'} selectable={true} className={'well_menu'} selectedKeys={[category]}>
{documentCategories.map(category => ( {documentCategories.map(category => (
<PrivateMenuItem.Link <PrivateMenuItemLink
root={root} root={root}
key={`${category.key}`} key={`${category.key}`}
path={`${category.key}`} path={`${category.key}`}
@ -44,11 +45,11 @@ export const MenuDocuments = memo(({ idWell }) => {
<Content className={'site-layout-background'}> <Content className={'site-layout-background'}>
<Switch> <Switch>
{documentCategories.map(category => ( {documentCategories.map(category => (
<PrivateRoute path={`${root}/${category.key}`} key={`${category.key}`}> <PrivateRoute path={join(root, category.key)} key={`${category.key}`}>
<DocumentsTemplate idCategory={category.id} idWell={idWell}/> <DocumentsTemplate idCategory={category.id} idWell={idWell} />
</PrivateRoute> </PrivateRoute>
))} ))}
<PrivateDefaultRoute urls={documentCategories.map((cat) => `${root}/${cat.key}`)}/> <PrivateDefaultRoute urls={documentCategories.map((cat) => join(root, cat.key))}/>
</Switch> </Switch>
</Content> </Content>
</Layout> </Layout>

View File

@ -61,10 +61,10 @@ export const Well = memo(() => {
<PrivateRoute path={`${rootPath}/archive`}> <PrivateRoute path={`${rootPath}/archive`}>
<Archive idWell={idWell} /> <Archive idWell={idWell} />
</PrivateRoute> </PrivateRoute>
<PrivateRoute path={`${rootPath}/telemetryAnalysis/:tab`}> <PrivateRoute path={`${rootPath}/telemetryAnalysis/:tab?`}>
<TelemetryAnalysis idWell={idWell} /> <TelemetryAnalysis idWell={idWell} />
</PrivateRoute> </PrivateRoute>
<PrivateRoute path={`${rootPath}/document/:category`}> <PrivateRoute path={`${rootPath}/document/:category?`}>
<Documents idWell={idWell} /> <Documents idWell={idWell} />
</PrivateRoute> </PrivateRoute>
<PrivateRoute path={`${rootPath}/measure`}> <PrivateRoute path={`${rootPath}/measure`}>