Удалены старые меню

This commit is contained in:
goodmice 2022-10-13 13:45:32 +05:00
parent 411b79ee60
commit 9c2b0ecd26
No known key found for this signature in database
GPG Key ID: 63EA771203189CF1
8 changed files with 68 additions and 190 deletions

View File

@ -1,9 +1,7 @@
import { Layout } from 'antd'
import { memo, useMemo } from 'react'
import { Navigate, Route, Routes } from 'react-router-dom'
import { RootPathContext, useRootPath } from '@asb/context'
import { PrivateMenu } from '@components/Private'
import { NoAccessComponent, wrapPrivateComponent } from '@utils'
import TelemetryViewer from './TelemetryViewer'
@ -15,23 +13,12 @@ const Telemetry = memo(() => {
return (
<RootPathContext.Provider value={rootPath}>
<Layout>
<PrivateMenu>
<PrivateMenu.Link content={TelemetryViewer} />
<PrivateMenu.Link content={TelemetryMerger} />
</PrivateMenu>
<Layout>
<Layout.Content className={'site-layout-background'}>
<Routes>
<Route index element={<Navigate to={TelemetryViewer.route} replace />} />
<Route path={'*'} element={<NoAccessComponent />} />
<Route path={TelemetryViewer.route} element={<TelemetryViewer />} />
<Route path={TelemetryMerger.route} element={<TelemetryMerger />} />
</Routes>
</Layout.Content>
</Layout>
</Layout>
</RootPathContext.Provider>
)
})

View File

@ -1,9 +1,8 @@
import { useState, useEffect, memo, useMemo } from 'react'
import { Navigate, Route, Routes } from 'react-router-dom'
import { Col, Layout, Row } from 'antd'
import { useState, useEffect, memo } from 'react'
import { Row } from 'antd'
import { useWell, useRootPath } from '@asb/context'
import { PrivateMenu } from '@components/Private'
import { useWell } from '@asb/context'
import LoaderPortal from '@components/LoaderPortal'
import WellSelector from '@components/selectors/WellSelector'
import { invokeWebApiWrapperAsync } from '@components/factory'
@ -13,8 +12,6 @@ import { OperationStatService, WellCompositeService } from '@api'
import ClusterWells from '@pages/Cluster/ClusterWells'
import WellCompositeSections from './WellCompositeSections'
const { Content } = Layout
const properties = {
requirements: ['OperationStat.get', 'WellComposite.get'],
title: 'Композитная скважина',
@ -24,12 +21,9 @@ const properties = {
const WellCompositeEditor = memo(() => {
const [well] = useWell()
const root = useRootPath()
const rootPath = useMemo(() => `${root}/${properties.key}`, [root])
const [statsWells, setStatsWells] = useState([])
const [showLoader, setShowLoader] = useState(false)
const [showTabLoader, setShowTabLoader] = useState(false)
const [selectedIdWells, setSelectedIdWells] = useState([])
const [selectedSections, setSelectedSections] = useState([])
@ -61,7 +55,7 @@ const WellCompositeEditor = memo(() => {
const stats = arrayOrDefault(await OperationStatService.getWellsStat(selectedIdWells))
setStatsWells(stats)
},
setShowTabLoader,
setShowLoader,
'Не удалось загрузить статистику по скважинам/секциям',
{ actionName: 'Получение статистики по скважинам/секциям' }
)
@ -70,19 +64,8 @@ const WellCompositeEditor = memo(() => {
return (
<LoaderPortal show={showLoader}>
<Row align={'middle'} justify={'space-between'} wrap={false} style={{ backgroundColor: 'white' }}>
<Col span={18}>
<WellSelector onChange={setSelectedIdWells} value={selectedIdWells} />
</Col>
<Col span={6}>
<PrivateMenu root={rootPath} className={'well_menu'}>
<PrivateMenu.Link content={ClusterWells} />
<PrivateMenu.Link content={WellCompositeSections} />
</PrivateMenu>
</Col>
</Row>
<Layout>
<Content className={'site-layout-background'}>
<LoaderPortal show={showTabLoader}>
<Routes>
<Route index element={<Navigate to={ClusterWells.route} replace/>} />
<Route path={'*'} element={<NoAccessComponent />} />
@ -91,9 +74,6 @@ const WellCompositeEditor = memo(() => {
<Route path={WellCompositeSections.route} element={<WellCompositeSections statsWells={statsWells} selectedSections={selectedSections} />} />
</Routes>
</LoaderPortal>
</Content>
</Layout>
</LoaderPortal>
)
})

View File

@ -1,9 +1,7 @@
import { memo, useMemo } from 'react'
import { Navigate, Route, Routes } from 'react-router-dom'
import { Layout } from 'antd'
import { RootPathContext, useRootPath } from '@asb/context'
import { PrivateMenu } from '@components/Private'
import { NoAccessComponent, wrapPrivateComponent } from '@utils'
import Statistics from './Statistics'
@ -15,13 +13,6 @@ const Analytics = memo(() => {
return (
<RootPathContext.Provider value={rootPath}>
<Layout>
<PrivateMenu className={'well_menu'}>
<PrivateMenu.Link content={WellCompositeEditor} />
<PrivateMenu.Link key={'statistics'} title={'Оценка по ЦБ'} content={Statistics} />
</PrivateMenu>
<Layout>
<Layout.Content className={'site-layout-background'}>
<Routes>
<Route index element={<Navigate to={WellCompositeEditor.getKey()} replace />} />
<Route path={'*'} element={<NoAccessComponent />} />
@ -29,9 +20,6 @@ const Analytics = memo(() => {
<Route path={WellCompositeEditor.route} element={<WellCompositeEditor />} />
<Route path={Statistics.route} element={<Statistics />} />
</Routes>
</Layout.Content>
</Layout>
</Layout>
</RootPathContext.Provider>
)
})

View File

@ -1,4 +1,4 @@
import React, { memo, useMemo } from 'react'
import { memo, useMemo } from 'react'
import { BankOutlined } from '@ant-design/icons'
import { makeTextColumn, Table } from '@components/Table'
@ -9,7 +9,7 @@ const columns = [
makeTextColumn('Тип компании', 'companyTypeCaption'),
]
const CompaniesTable = memo(({companies}) => {
const CompaniesTable = memo(({ companies }) => {
const dataCompanies = useMemo(() => companies?.map((company) => ({
key: company.id,
logo: company?.logo ? <img src={company.logo}/> : <BankOutlined/>,

View File

@ -1,16 +1,11 @@
import { Navigate, Route, Routes } from 'react-router-dom'
import { memo, useMemo } from 'react'
import { FolderOutlined } from '@ant-design/icons'
import { Layout } from 'antd'
import { RootPathContext, useRootPath } from '@asb/context'
import { PrivateMenu } from '@components/Private'
import { getTabname, wrapPrivateComponent, NoAccessComponent, hasPermission } from '@utils'
import { wrapPrivateComponent, NoAccessComponent, hasPermission } from '@utils'
import DocumentsTemplate from './DocumentsTemplate'
const { Content } = Layout
const makeDocCat = (id, key, title, permissions = ['File.get']) => ({ id, key, title, permissions })
export const documentCategories = [
@ -27,7 +22,6 @@ export const documentCategories = [
]
const MenuDocuments = memo(() => {
const category = getTabname()
const root = useRootPath()
const rootPath = useMemo(() => `${root}/document`, [root])
@ -35,17 +29,6 @@ const MenuDocuments = memo(() => {
return (
<RootPathContext.Provider value={rootPath}>
<PrivateMenu mode={'horizontal'} selectable={true} className={'well_menu'} selectedKeys={[category]}>
{categories.map(category => (
<PrivateMenu.Link
key={`${category.key}`}
icon={<FolderOutlined/>}
title={category.title}
/>
))}
</PrivateMenu>
<Layout>
<Content className={'site-layout-background'}>
<Routes>
{categories.length > 0 && (
<Route index element={<Navigate to={categories[0].key} replace />} />
@ -61,8 +44,6 @@ const MenuDocuments = memo(() => {
)} />
))}
</Routes>
</Content>
</Layout>
</RootPathContext.Provider>
)
})

View File

@ -1,31 +1,18 @@
import { Navigate, Route, Routes } from 'react-router-dom'
import { memo, useMemo } from 'react'
import { FilePdfOutlined } from '@ant-design/icons'
import { Layout } from 'antd'
import { RootPathContext, useRootPath } from '@asb/context'
import { PrivateMenu } from '@components/Private'
import { NoAccessComponent, wrapPrivateComponent } from '@utils'
import DailyReport from './DailyReport'
import DiagramReport from './DiagramReport'
const { Content } = Layout
const Reports = memo(() => {
const root = useRootPath()
const rootPath = useMemo(() => `${root}/reports`, [root])
return (
<RootPathContext.Provider value={rootPath}>
<Layout>
<PrivateMenu className={'well_menu'}>
<PrivateMenu.Link content={DiagramReport} icon={<FilePdfOutlined />} />
<PrivateMenu.Link content={DailyReport} />
</PrivateMenu>
<Layout>
<Content className={'site-layout-background'}>
<Routes>
<Route index element={<Navigate to={'diagram_report'} replace />} />
<Route path={'*'} element={<NoAccessComponent />} />
@ -33,9 +20,6 @@ const Reports = memo(() => {
<Route path={DiagramReport.route} element={<DiagramReport />} />
<Route path={DailyReport.route} element={<DailyReport />} />
</Routes>
</Content>
</Layout>
</Layout>
</RootPathContext.Provider>
)
})

View File

@ -1,10 +1,8 @@
import { Navigate, Route, Routes } from 'react-router-dom'
import { memo, useMemo } from 'react'
import { Layout } from 'antd'
import { AlertOutlined, FundViewOutlined, DatabaseOutlined } from '@ant-design/icons'
import { FundViewOutlined } from '@ant-design/icons'
import { RootPathContext, useRootPath } from '@asb/context'
import { PrivateMenu } from '@components/Private'
import { NoAccessComponent, wrapPrivateComponent } from '@utils'
import Archive from './Archive'
@ -16,26 +14,12 @@ import OperationTime from './OperationTime'
import '@styles/index.css'
const { Content } = Layout
const Telemetry = memo(() => {
const root = useRootPath()
const rootPath = useMemo(() => `${root}/telemetry`, [root])
return (
<RootPathContext.Provider value={rootPath}>
<Layout>
<PrivateMenu className={'well_menu'}>
<PrivateMenu.Link content={TelemetryView} icon={<FundViewOutlined />} />
<PrivateMenu.Link content={Messages} icon={<AlertOutlined/>} />
<PrivateMenu.Link content={Archive} icon={<DatabaseOutlined />} />
<PrivateMenu.Link content={DashboardNNB} />
<PrivateMenu.Link content={Operations} />
<PrivateMenu.Link content={OperationTime} />
</PrivateMenu>
<Layout>
<Content className={'site-layout-background'}>
<Routes>
<Route index element={<Navigate to={TelemetryView.route} replace />} />
<Route path={'*'} element={<NoAccessComponent />} />
@ -47,9 +31,6 @@ const Telemetry = memo(() => {
<Route path={Operations.route} element={<Operations />} />
<Route path={OperationTime.route} element={<OperationTime />} />
</Routes>
</Content>
</Layout>
</Layout>
</RootPathContext.Provider>
)
})

View File

@ -1,17 +1,8 @@
import { useNavigate, useLocation, Route, Routes, Navigate } from 'react-router-dom'
import { memo, useCallback, useMemo } from 'react'
import { Layout } from 'antd'
import {
BarChartOutlined,
BuildOutlined,
ControlOutlined,
LineChartOutlined,
TableOutlined,
} from '@ant-design/icons'
import { RootPathContext, useRootPath } from '@asb/context'
import { Flex } from '@components/Grid'
import { PrivateMenu } from '@components/Private'
import { getTabname, NoAccessComponent, wrapPrivateComponent } from '@utils'
import Tvd from './Tvd'
@ -21,8 +12,6 @@ import { DrillProcessFlow } from './DrillProcessFlow'
import { WellSectionsStat } from './WellSectionsStat'
import { WellOperationsEditorPlan, WellOperationsEditorFact } from './WellOperationsEditor'
const { Content } = Layout
const properties = {
requirements: [],
title: 'Операции по скважине',
@ -46,18 +35,8 @@ const WellOperations = memo(() => {
return(
<RootPathContext.Provider value={rootPath}>
<Flex style={{ width: '100%' }}>
<PrivateMenu className={'well_menu'} style={{ flex: 1 }}>
<PrivateMenu.Link content={Tvd} icon={<LineChartOutlined />} />
<PrivateMenu.Link content={WellSectionsStat} icon={<BuildOutlined />} key={'sections'} title={'Секции'} />
<PrivateMenu.Link content={WellOperationsEditorPlan} icon={<TableOutlined />} />
<PrivateMenu.Link content={WellOperationsEditorFact} icon={<TableOutlined />} />
<PrivateMenu.Link content={DrillProcessFlow} icon={<BarChartOutlined />} key={'drillProcessFlow'} title={'РТК'} />
<PrivateMenu.Link content={WellDrillParams} icon={<ControlOutlined />} key={'params'} title={'Режимы'} />
</PrivateMenu>
<ImportExportBar disabled={isIEBarDisabled} onImported={onImported}/>
</Flex>
<Layout>
<Content className={'site-layout-background'}>
<Routes>
<Route index element={<Navigate to={Tvd.getKey()} replace />} />
<Route path={'*'} element={<NoAccessComponent />} />
@ -69,8 +48,6 @@ const WellOperations = memo(() => {
<Route path={'drillProcessFlow'} element={<DrillProcessFlow />} />
<Route path={'params'} element={<WellDrillParams />} />
</Routes>
</Content>
</Layout>
</RootPathContext.Provider>
)
})