* Добавлены крошки в разделе админки, куста и скважины

* Улучшены стили на страницах скважины
This commit is contained in:
goodmice 2022-10-25 18:59:10 +05:00
parent 879fea41a5
commit c3d53284bd
No known key found for this signature in database
GPG Key ID: 63EA771203189CF1
6 changed files with 68 additions and 54 deletions

View File

@ -11,6 +11,8 @@ export const RootPathContext = createContext<string>('/')
export const UserContext = createContext<UserTokenDto>({})
/** Контекст метода редактирования параметров заголовка и меню */
export const LayoutPropsContext = createContext<(props: LayoutPortalProps) => void>(() => {})
/** Контекст для блока справа от крошек на страницах скважин и админки */
export const TopRightBlockContext = createContext<(block: JSX.Element) => void>(() => {})
/**
* Получить текущую скважину
@ -33,6 +35,8 @@ export const useRootPath = () => useContext(RootPathContext)
*/
export const useUser = () => useContext(UserContext)
export const useTopRightBlock = () => useContext(TopRightBlockContext)
/**
* Получить метод задания параметров заголовка и меню
*

View File

@ -2,9 +2,10 @@ import { Navigate, Route, Routes } from 'react-router-dom'
import { lazy, memo, useMemo } from 'react'
import { RootPathContext, useLayoutProps, useRootPath } from '@asb/context'
import { MenuBreadcrumbItems } from '@components/MenuBreadcrumb'
import { NoAccessComponent, wrapPrivateComponent } from '@utils'
import AdminNavigationMenu from './AdminNavigationMenu'
import { AdminNavigationMenu, menuItems } from './AdminNavigationMenu'
const ClusterController = lazy(() => import('./ClusterController'))
const CompanyController = lazy(() => import('./CompanyController'))
@ -23,6 +24,7 @@ const layoutProps = {
sider: <AdminNavigationMenu />,
title: 'Администраторская панель',
isAdmin: true,
breadcrumb: <MenuBreadcrumbItems menuItems={menuItems} pathRoot={/^\/admin\//} />,
}
const AdminPanel = memo(() => {
@ -56,9 +58,4 @@ const AdminPanel = memo(() => {
)
})
export default wrapPrivateComponent(AdminPanel, {
requirements: ['RequestTracker.get'],
title: 'Панель администратора',
route: 'admin/*',
key: 'admin',
})
export default wrapPrivateComponent(AdminPanel, { requirements: ['RequestTracker.get'] })

View File

@ -10,7 +10,8 @@ import { OperationStatService } from '@api'
import ClusterWells from './ClusterWells'
const layoutProps = {
title: 'Анализ скважин куста'
title: 'Анализ скважин куста',
breadcrumb: true,
}
const Cluster = memo(() => {

View File

@ -94,7 +94,7 @@ export const DocumentsTemplate = ({ idCategory, well: givenWell, mimeTypes, head
return (
<LoaderPortal show={showLoader}>
<div style={{ margin: 16, display: 'flex' }}>
<div style={{ margin: 16, marginTop: 0, display: 'flex' }}>
<div>
<span>Фильтр по дате</span>
<div>

View File

@ -1,12 +1,13 @@
import { lazy, memo, useCallback, useEffect, useMemo, useState } from 'react'
import { Navigate, Route, Routes, useParams } from 'react-router-dom'
import { Navigate, Route, Routes, useLocation, useParams } from 'react-router-dom'
import { WellContext, RootPathContext, useRootPath, useLayoutProps } from '@asb/context'
import { WellContext, RootPathContext, useRootPath, useLayoutProps, TopRightBlockContext } from '@asb/context'
import { invokeWebApiWrapperAsync } from '@components/factory'
import { MenuBreadcrumbItems } from '@components/MenuBreadcrumb'
import { NoAccessComponent, wrapPrivateComponent } from '@utils'
import { WellService } from '@api'
import NavigationMenu from './NavigationMenu'
import { NavigationMenu, menuItems } from './NavigationMenu'
import '@styles/index.css'
@ -42,7 +43,10 @@ const WellCompositeEditor = lazy(() => import('./Analytics/WellCompositeEditor')
const Well = memo(() => {
const { idWell } = useParams()
const location = useLocation()
const [well, setWell] = useState({ id: idWell })
const [topRightBlock, setTopRightBlock] = useState()
const root = useRootPath()
const rootPath = useMemo(() => `${root}/well/${idWell}`, [root, idWell])
@ -71,56 +75,64 @@ const Well = memo(() => {
)
}, [idWell])
useEffect(() => setLayoutProps({ sider: <NavigationMenu idWell={well.id} /> }), [well, setLayoutProps])
useEffect(() => setLayoutProps({
sider: <NavigationMenu idWell={well.id} />,
breadcrumb: <MenuBreadcrumbItems menuItems={menuItems} pathRoot={/^\/well\/[0-9]+\//} />,
topRightBlock: topRightBlock,
}), [well, setLayoutProps, topRightBlock])
useEffect(() => setTopRightBlock(undefined), [location])
return (
<RootPathContext.Provider value={rootPath}>
<WellContext.Provider value={[well, updateWell]}>
<Routes>
<Route index element={<Navigate to={'telemetry'} replace />} />
<Route path={'*'} element={<NoAccessComponent />} />
<Route path={'telemetry/*'} element={<Telemetry />}>
<TopRightBlockContext.Provider value={setTopRightBlock}>
<Routes>
<Route index element={<Navigate to={'telemetry'} replace />} />
<Route path={'*'} element={<NoAccessComponent />} />
<Route path={'telemetry'} element={<TelemetryView />} />
<Route path={'messages'} element={<Messages />} />
<Route path={'archive'} element={<Archive />} />
<Route path={'dashboard_nnb/*'} element={<DashboardNNB />} />
<Route path={'operations'} element={<Operations />} />
<Route path={'operation_time'} element={<OperationTime />} />
</Route>
<Route path={'reports/*'} element={<Reports />}>
<Route index element={<Navigate to={'diagram_report'} replace />} />
<Route path={'*'} element={<NoAccessComponent />} />
<Route path={'telemetry/*'} element={<Telemetry />}>
<Route index element={<Navigate to={'telemetry'} replace />} />
<Route path={'*'} element={<NoAccessComponent />} />
<Route path={'diagram_report'} element={<DiagramReport />} />
<Route path={'daily_report'} element={<DailyReport />} />
</Route>
<Route path={'analytics/*'} element={<Analytics />}>
<Route index element={<Navigate to={'composite'} replace />} />
<Route path={'*'} element={<NoAccessComponent />} />
<Route path={'telemetry'} element={<TelemetryView />} />
<Route path={'messages'} element={<Messages />} />
<Route path={'archive'} element={<Archive />} />
<Route path={'dashboard_nnb/*'} element={<DashboardNNB />} />
<Route path={'operations'} element={<Operations />} />
<Route path={'operation_time'} element={<OperationTime />} />
</Route>
<Route path={'reports/*'} element={<Reports />}>
<Route index element={<Navigate to={'diagram_report'} replace />} />
<Route path={'*'} element={<NoAccessComponent />} />
<Route path={'composite/*'} element={<WellCompositeEditor />} />
<Route path={'statistics'} element={<Statistics />} />
</Route>
<Route path={'operations/*'} element={<WellOperations />}>
<Route index element={<Navigate to={'tvd'} replace />} />
<Route path={'*'} element={<NoAccessComponent />} />
<Route path={'diagram_report'} element={<DiagramReport />} />
<Route path={'daily_report'} element={<DailyReport />} />
</Route>
<Route path={'analytics/*'} element={<Analytics />}>
<Route index element={<Navigate to={'composite'} replace />} />
<Route path={'*'} element={<NoAccessComponent />} />
<Route path={'tvd'} element={<Tvd />} />
<Route path={'sections'} element={<WellSectionsStat />} />
<Route path={'plan'} element={<WellOperationsEditorPlan />} />
<Route path={'fact'} element={<WellOperationsEditorFact />} />
<Route path={'drillProcessFlow'} element={<DrillProcessFlow />} />
<Route path={'params'} element={<WellDrillParams />} />
</Route>
<Route path={'document/*'} element={<Documents />} />
<Route path={'measure/*'} element={<Measure />} />
<Route path={'drillingProgram'} element={<DrillingProgram />} />
<Route path={'well_case'} element={<WellCase />} />
</Routes>
<Route path={'composite/*'} element={<WellCompositeEditor />} />
<Route path={'statistics'} element={<Statistics />} />
</Route>
<Route path={'operations/*'} element={<WellOperations />}>
<Route index element={<Navigate to={'tvd'} replace />} />
<Route path={'*'} element={<NoAccessComponent />} />
<Route path={'tvd'} element={<Tvd />} />
<Route path={'sections'} element={<WellSectionsStat />} />
<Route path={'plan'} element={<WellOperationsEditorPlan />} />
<Route path={'fact'} element={<WellOperationsEditorFact />} />
<Route path={'drillProcessFlow'} element={<DrillProcessFlow />} />
<Route path={'params'} element={<WellDrillParams />} />
</Route>
<Route path={'document/*'} element={<Documents />} />
<Route path={'measure/*'} element={<Measure />} />
<Route path={'drillingProgram'} element={<DrillingProgram />} />
<Route path={'well_case'} element={<WellCase />} />
</Routes>
</TopRightBlockContext.Provider>
</WellContext.Provider>
</RootPathContext.Provider>
)

View File

@ -6,19 +6,19 @@
min-height: 80vh;
.tvd-top {
margin: 0 15px;
display: flex;
align-items: center;
justify-content: space-between;
margin-top: 20px;
.tvd-inputs {
display: flex;
align-items: center;
gap: 15px;
.tvd-input-group {
display: flex;
align-items: center;
margin: 0 15px;
& > span {
margin-right: 5px;