* Связанные со скважиной страницы перемещены в общую директорию

* Роутинг в разделе скважины перенесён в главный файл раздела
This commit is contained in:
goodmice 2022-10-13 16:59:16 +05:00
parent 93e6d2171d
commit fc8b351b7c
No known key found for this signature in database
GPG Key ID: 63EA771203189CF1
74 changed files with 144 additions and 145 deletions

View File

@ -19,36 +19,7 @@ const FileDownload = lazy(() => import('@pages/FileDownload'))
const AdminPanel = lazy(() => import('@pages/AdminPanel')) const AdminPanel = lazy(() => import('@pages/AdminPanel'))
const Deposit = lazy(() => import('@pages/Deposit')) const Deposit = lazy(() => import('@pages/Deposit'))
const Cluster = lazy(() => import('@pages/Cluster')) const Cluster = lazy(() => import('@pages/Cluster'))
const Well = lazy(() => import('@pages/Well')) const Well = lazy(() => import('@asb/pages/Well'))
const Measure = lazy(() => import('@pages/Measure'))
const Reports = lazy(() => import('@pages/Reports'))
const WellCase = lazy(() => import('@pages/WellCase'))
const Analytics = lazy(() => import('@pages/Analytics'))
const Documents = lazy(() => import('@pages/Documents'))
const Telemetry = lazy(() => import('@pages/Telemetry'))
const WellOperations = lazy(() => import('@pages/WellOperations'))
const DrillingProgram = lazy(() => import('@pages/DrillingProgram'))
const Tvd = lazy(() => import('@pages/WellOperations/Tvd'))
const WellDrillParams = lazy(() => import('@pages/WellOperations/WellDrillParams'))
const DrillProcessFlow = lazy(() => import('@pages/WellOperations/DrillProcessFlow'))
const WellSectionsStat = lazy(() => import('@pages/WellOperations/WellSectionsStat'))
const WellOperationsEditorFact = lazy(() => import('@pages/WellOperations/OperationEditor/Fact'))
const WellOperationsEditorPlan = lazy(() => import('@pages/WellOperations/OperationEditor/Plan'))
const Archive = lazy(() => import('@pages/Telemetry/Archive'))
const Messages = lazy(() => import('@pages/Telemetry/Messages'))
const Operations = lazy(() => import('@pages/Telemetry/Operations'))
const DashboardNNB = lazy(() => import('@pages/Telemetry/DashboardNNB'))
const TelemetryView = lazy(() => import('@pages/Telemetry/TelemetryView'))
const OperationTime = lazy(() => import('@pages/Telemetry/OperationTime'))
const DailyReport = lazy(() => import('@pages/Reports/DailyReport'))
const DiagramReport = lazy(() => import('@pages/Reports/DiagramReport'))
const Statistics = lazy(() => import('@pages/Analytics/Statistics'))
const WellCompositeEditor = lazy(() => import('@pages/Analytics/WellCompositeEditor'))
//OpenAPI.BASE = 'http://localhost:3000' //OpenAPI.BASE = 'http://localhost:3000'
OpenAPI.TOKEN = async () => getUserToken() ?? '' OpenAPI.TOKEN = async () => getUserToken() ?? ''
@ -76,51 +47,7 @@ export const App = memo(() => (
<Route path={'/file_download/:idWell/:idFile/*'} element={<FileDownload />} /> <Route path={'/file_download/:idWell/:idFile/*'} element={<FileDownload />} />
<Route path={'/deposit/*'} element={<Deposit />} /> <Route path={'/deposit/*'} element={<Deposit />} />
<Route path={'/cluster/:idCluster'} element={<Cluster />} /> <Route path={'/cluster/:idCluster'} element={<Cluster />} />
<Route path={'/well/:idWell/*'} element={<Well />}> <Route path={'/well/:idWell/*'} element={<Well />} />
<Route index element={<Navigate to={'telemetry'} replace />} />
<Route path={'*'} element={<NoAccessComponent />} />
<Route path={'telemetry/*'} element={<Telemetry />}>
<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={'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={'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 />} />
</Route>
</Route> </Route>
</Routes> </Routes>
</Router> </Router>

View File

@ -1,6 +1,6 @@
import { Link, useLocation } from 'react-router-dom' import { Link, useLocation } from 'react-router-dom'
import { useState, useEffect, memo, useMemo } from 'react' import { useState, useEffect, memo, useMemo } from 'react'
import { Tag, Button, Modal } from 'antd' import { Button, Modal } from 'antd'
import { LineChartOutlined, ProfileOutlined, TeamOutlined } from '@ant-design/icons' import { LineChartOutlined, ProfileOutlined, TeamOutlined } from '@ant-design/icons'
import { import {
@ -13,7 +13,6 @@ import {
makeNumericRender, makeNumericRender,
makeNumericColumn, makeNumericColumn,
} from '@components/Table' } from '@components/Table'
import { CompanyView } from '@components/views'
import LoaderPortal from '@components/LoaderPortal' import LoaderPortal from '@components/LoaderPortal'
import PointerIcon from '@components/icons/PointerIcon' import PointerIcon from '@components/icons/PointerIcon'
import { invokeWebApiWrapperAsync } from '@components/factory' import { invokeWebApiWrapperAsync } from '@components/factory'
@ -25,9 +24,9 @@ import {
wrapPrivateComponent wrapPrivateComponent
} from '@utils' } from '@utils'
import Tvd from '@pages/WellOperations/Tvd' import Tvd from '@pages/Well/WellOperations/Tvd'
import WellOperationsTable from './WellOperationsTable'
import CompaniesTable from '@pages/Cluster/CompaniesTable' import CompaniesTable from '@pages/Cluster/CompaniesTable'
import WellOperationsTable from './WellOperationsTable'
const filtersMinMax = [ const filtersMinMax = [
{ text: 'min', value: 'min' }, { text: 'min', value: 'min' },

View File

@ -1,63 +0,0 @@
import { memo, Suspense, useCallback, useEffect, useMemo, useState } from 'react'
import { Outlet, useParams } from 'react-router-dom'
import { WellContext, RootPathContext, useRootPath } from '@asb/context'
import { LayoutPortal } from '@components/LayoutPortal'
import SuspenseFallback from '@components/SuspenseFallback'
import { invokeWebApiWrapperAsync } from '@components/factory'
import { wrapPrivateComponent } from '@utils'
import { WellService } from '@api'
import NavigationMenu from './NavigationMenu'
import '@styles/index.css'
const Well = memo(() => {
const { idWell } = useParams()
const [well, setWell] = useState({ id: idWell })
const root = useRootPath()
const rootPath = useMemo(() => `${root}/well/${idWell}`, [root, idWell])
useEffect(() => {
invokeWebApiWrapperAsync(
async () => {
const well = await WellService.get(idWell)
setWell(well ?? { id: idWell })
},
undefined,
'Не удалось получить данные по скважине'
)
}, [idWell])
const updateWell = useCallback((data) => invokeWebApiWrapperAsync(
async () => {
const newWell = { ...well, ...data }
await WellService.updateWell(newWell)
setWell(newWell)
},
undefined,
`Не удалось изменить данные скважины`,
{ actionName: 'Изменение данных скважины', well }
), [well])
return (
<RootPathContext.Provider value={rootPath}>
<WellContext.Provider value={[well, updateWell]}>
<LayoutPortal sider={<NavigationMenu />}>
<Suspense fallback={<SuspenseFallback style={{ minHeight: '100%' }} />}>
<Outlet />
</Suspense>
</LayoutPortal>
</WellContext.Provider>
</RootPathContext.Provider>
)
})
export default wrapPrivateComponent(Well, {
requirements: [],
title: 'Скважина',
route: 'well/:idWell/*',
key: 'well',
})

View File

@ -7,7 +7,7 @@ import LoaderPortal from '@components/LoaderPortal'
import { invokeWebApiWrapperAsync } from '@components/factory' import { invokeWebApiWrapperAsync } from '@components/factory'
import { DrillParamsService } from '@api' import { DrillParamsService } from '@api'
import { getColumns } from '@pages/WellOperations/WellDrillParams' import { getColumns } from '@asb/pages/Well/WellOperations/WellDrillParams'
export const NewParamsTable = memo(({ selectedWellsKeys }) => { export const NewParamsTable = memo(({ selectedWellsKeys }) => {
const [params, setParams] = useState([]) const [params, setParams] = useState([])

View File

@ -16,7 +16,7 @@ import {
getOperations getOperations
} from '@utils' } from '@utils'
import Tvd from '@pages/WellOperations/Tvd' import Tvd from '@asb/pages/Well/WellOperations/Tvd'
import WellOperationsTable from '@pages/Cluster/WellOperationsTable' import WellOperationsTable from '@pages/Cluster/WellOperationsTable'
import NewParamsTable from './NewParamsTable' import NewParamsTable from './NewParamsTable'
import CompaniesTable from '@pages/Cluster/CompaniesTable' import CompaniesTable from '@pages/Cluster/CompaniesTable'

View File

View File

View File

View File

View File

View File

View File

@ -10,7 +10,7 @@ import { DetectedOperationService } from '@api'
import { unique } from '@utils/filters' import { unique } from '@utils/filters'
import { formatDate } from '@utils' import { formatDate } from '@utils'
import { makeTooltipRender } from '@pages/Telemetry/Operations/OperationsChart' import { makeTooltipRender } from '../../Telemetry/Operations/OperationsChart'
import { makeGetColor } from '.' import { makeGetColor } from '.'
import '@styles/d3.less' import '@styles/d3.less'

136
src/pages/Well/index.jsx Normal file
View File

@ -0,0 +1,136 @@
import { lazy, memo, Suspense, useCallback, useEffect, useMemo, useState } from 'react'
import { Navigate, Route, Routes, useParams } from 'react-router-dom'
import { WellContext, RootPathContext, useRootPath } from '@asb/context'
import { LayoutPortal } from '@components/LayoutPortal'
import SuspenseFallback from '@components/SuspenseFallback'
import { invokeWebApiWrapperAsync } from '@components/factory'
import { NoAccessComponent, wrapPrivateComponent } from '@utils'
import { WellService } from '@api'
import NavigationMenu from '../NavigationMenu'
import '@styles/index.css'
const Measure = lazy(() => import('./Measure'))
const Reports = lazy(() => import('./Reports'))
const WellCase = lazy(() => import('./WellCase'))
const Analytics = lazy(() => import('./Analytics'))
const Documents = lazy(() => import('./Documents'))
const Telemetry = lazy(() => import('./Telemetry'))
const WellOperations = lazy(() => import('./WellOperations'))
const DrillingProgram = lazy(() => import('./DrillingProgram'))
const Tvd = lazy(() => import('./WellOperations/Tvd'))
const WellDrillParams = lazy(() => import('./WellOperations/WellDrillParams'))
const DrillProcessFlow = lazy(() => import('./WellOperations/DrillProcessFlow'))
const WellSectionsStat = lazy(() => import('./WellOperations/WellSectionsStat'))
const WellOperationsEditorFact = lazy(() => import('./WellOperations/OperationEditor/Fact'))
const WellOperationsEditorPlan = lazy(() => import('./WellOperations/OperationEditor/Plan'))
const Archive = lazy(() => import('./Telemetry/Archive'))
const Messages = lazy(() => import('./Telemetry/Messages'))
const Operations = lazy(() => import('./Telemetry/Operations'))
const DashboardNNB = lazy(() => import('./Telemetry/DashboardNNB'))
const TelemetryView = lazy(() => import('./Telemetry/TelemetryView'))
const OperationTime = lazy(() => import('./Telemetry/OperationTime'))
const DailyReport = lazy(() => import('./Reports/DailyReport'))
const DiagramReport = lazy(() => import('./Reports/DiagramReport'))
const Statistics = lazy(() => import('./Analytics/Statistics'))
const WellCompositeEditor = lazy(() => import('./Analytics/WellCompositeEditor'))
const Well = memo(() => {
const { idWell } = useParams()
const [well, setWell] = useState({ id: idWell })
const root = useRootPath()
const rootPath = useMemo(() => `${root}/well/${idWell}`, [root, idWell])
useEffect(() => {
invokeWebApiWrapperAsync(
async () => {
const well = await WellService.get(idWell)
setWell(well ?? { id: idWell })
},
undefined,
'Не удалось получить данные по скважине'
)
}, [idWell])
const updateWell = useCallback((data) => invokeWebApiWrapperAsync(
async () => {
const newWell = { ...well, ...data }
await WellService.updateWell(newWell)
setWell(newWell)
},
undefined,
`Не удалось изменить данные скважины`,
{ actionName: 'Изменение данных скважины', well }
), [well])
return (
<RootPathContext.Provider value={rootPath}>
<WellContext.Provider value={[well, updateWell]}>
<LayoutPortal sider={<NavigationMenu />}>
<Suspense fallback={<SuspenseFallback style={{ minHeight: '100%' }} />}>
<Routes>
<Route index element={<Navigate to={'telemetry'} replace />} />
<Route path={'*'} element={<NoAccessComponent />} />
<Route path={'telemetry/*'} element={<Telemetry />}>
<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={'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={'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>
</Suspense>
</LayoutPortal>
</WellContext.Provider>
</RootPathContext.Provider>
)
})
export default wrapPrivateComponent(Well, {
requirements: [],
title: 'Скважина',
route: 'well/:idWell/*',
key: 'well',
})