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