2021-08-27 14:21:48 +05:00
|
|
|
|
import {
|
|
|
|
|
FolderOutlined,
|
|
|
|
|
FilePdfOutlined,
|
2021-09-01 15:55:23 +05:00
|
|
|
|
ExperimentOutlined,
|
2022-02-14 17:47:03 +05:00
|
|
|
|
DeploymentUnitOutlined,
|
2021-12-20 12:44:07 +05:00
|
|
|
|
} from '@ant-design/icons'
|
2022-04-19 12:51:30 +05:00
|
|
|
|
import { Layout } from 'antd'
|
2022-08-16 10:58:22 +05:00
|
|
|
|
import { memo, useCallback, useEffect, useMemo, useState } from 'react'
|
2022-06-09 17:51:41 +05:00
|
|
|
|
import { Navigate, Route, Routes, useParams } from 'react-router-dom'
|
2022-01-25 02:00:07 +05:00
|
|
|
|
|
2022-08-16 10:58:22 +05:00
|
|
|
|
import { WellContext, RootPathContext, useRootPath } from '@asb/context'
|
2022-06-09 17:51:41 +05:00
|
|
|
|
import { LayoutPortal } from '@components/Layout'
|
|
|
|
|
import { PrivateMenu } from '@components/Private'
|
2022-08-16 10:58:22 +05:00
|
|
|
|
import { invokeWebApiWrapperAsync } from '@components/factory'
|
2022-06-09 17:51:41 +05:00
|
|
|
|
import { NoAccessComponent, wrapPrivateComponent } from '@utils'
|
2022-08-16 10:58:22 +05:00
|
|
|
|
import { WellService } from '@api'
|
2022-01-25 02:00:07 +05:00
|
|
|
|
|
2021-12-20 12:44:07 +05:00
|
|
|
|
import Measure from './Measure'
|
2022-04-18 17:36:57 +05:00
|
|
|
|
import Reports from './Reports'
|
2022-09-12 12:30:41 +05:00
|
|
|
|
import WellCase from './WellCase'
|
2022-03-13 22:11:58 +05:00
|
|
|
|
import Analytics from './Analytics'
|
2022-01-25 02:00:07 +05:00
|
|
|
|
import Documents from './Documents'
|
2022-03-28 16:15:43 +05:00
|
|
|
|
import Telemetry from './Telemetry'
|
2021-12-20 12:44:07 +05:00
|
|
|
|
import WellOperations from './WellOperations'
|
2022-01-25 02:00:07 +05:00
|
|
|
|
import DrillingProgram from './DrillingProgram'
|
2021-04-16 15:50:01 +05:00
|
|
|
|
|
2022-03-10 20:46:02 +05:00
|
|
|
|
import '@styles/index.css'
|
|
|
|
|
|
2021-12-20 12:44:07 +05:00
|
|
|
|
const { Content } = Layout
|
2021-04-16 15:50:01 +05:00
|
|
|
|
|
2022-06-09 17:51:41 +05:00
|
|
|
|
const Well = memo(() => {
|
|
|
|
|
const { idWell } = useParams()
|
2022-08-16 10:58:22 +05:00
|
|
|
|
|
|
|
|
|
const [well, setWell] = useState({ id: idWell })
|
|
|
|
|
|
2022-06-09 17:51:41 +05:00
|
|
|
|
const root = useRootPath()
|
2022-04-19 15:38:53 +05:00
|
|
|
|
const rootPath = useMemo(() => `${root}/well/${idWell}`, [root, idWell])
|
2021-05-25 12:02:39 +05:00
|
|
|
|
|
2022-08-16 10:58:22 +05:00
|
|
|
|
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,
|
2022-08-18 11:49:10 +05:00
|
|
|
|
`Не удалось изменить данные скважины`,
|
|
|
|
|
{ actionName: 'Изменение данных скважины', well }
|
2022-08-16 10:58:22 +05:00
|
|
|
|
), [well])
|
|
|
|
|
|
2021-12-20 12:44:07 +05:00
|
|
|
|
return (
|
2022-06-09 17:51:41 +05:00
|
|
|
|
<LayoutPortal>
|
|
|
|
|
<RootPathContext.Provider value={rootPath}>
|
|
|
|
|
<PrivateMenu className={'well_menu'}>
|
|
|
|
|
<PrivateMenu.Link content={Telemetry} />
|
|
|
|
|
<PrivateMenu.Link content={Reports} icon={<FilePdfOutlined />} />
|
|
|
|
|
<PrivateMenu.Link content={Analytics} icon={<DeploymentUnitOutlined />} />
|
|
|
|
|
<PrivateMenu.Link content={WellOperations} icon={<FolderOutlined />} />
|
|
|
|
|
<PrivateMenu.Link content={Documents} icon={<FolderOutlined />} />
|
|
|
|
|
<PrivateMenu.Link content={Measure} icon={<ExperimentOutlined />} />
|
|
|
|
|
<PrivateMenu.Link content={DrillingProgram} icon={<FolderOutlined />} />
|
2022-09-12 12:30:41 +05:00
|
|
|
|
<PrivateMenu.Link content={WellCase} icon={<FolderOutlined />} />
|
2022-04-19 15:38:53 +05:00
|
|
|
|
</PrivateMenu>
|
|
|
|
|
|
2022-08-16 10:58:22 +05:00
|
|
|
|
<WellContext.Provider value={[well, updateWell]}>
|
2022-04-19 15:38:53 +05:00
|
|
|
|
<Layout>
|
|
|
|
|
<Content className={'site-layout-background'}>
|
2022-06-09 17:51:41 +05:00
|
|
|
|
<Routes>
|
|
|
|
|
<Route index element={<Navigate to={Telemetry.getKey()} replace />} />
|
|
|
|
|
<Route path={'*'} element={<NoAccessComponent />} />
|
|
|
|
|
|
|
|
|
|
<Route path={Telemetry.route} element={<Telemetry />} />
|
|
|
|
|
<Route path={Reports.route} element={<Reports />} />
|
|
|
|
|
<Route path={Analytics.route} element={<Analytics />} />
|
|
|
|
|
<Route path={WellOperations.route} element={<WellOperations />} />
|
|
|
|
|
<Route path={Documents.route} element={<Documents />} />
|
|
|
|
|
<Route path={Measure.route} element={<Measure />} />
|
|
|
|
|
<Route path={DrillingProgram.route} element={<DrillingProgram />} />
|
2022-09-12 12:30:41 +05:00
|
|
|
|
<Route path={WellCase.route} element={<WellCase />} />
|
2022-06-09 17:51:41 +05:00
|
|
|
|
</Routes>
|
2022-04-19 15:38:53 +05:00
|
|
|
|
</Content>
|
|
|
|
|
</Layout>
|
2022-08-16 10:58:22 +05:00
|
|
|
|
</WellContext.Provider>
|
2022-06-09 17:51:41 +05:00
|
|
|
|
</RootPathContext.Provider>
|
|
|
|
|
</LayoutPortal>
|
2021-12-20 12:44:07 +05:00
|
|
|
|
)
|
2022-02-07 14:58:38 +05:00
|
|
|
|
})
|
2022-01-25 02:00:07 +05:00
|
|
|
|
|
2022-06-09 17:51:41 +05:00
|
|
|
|
export default wrapPrivateComponent(Well, {
|
|
|
|
|
requirements: [],
|
|
|
|
|
title: 'Скважина',
|
|
|
|
|
route: 'well/:idWell/*',
|
|
|
|
|
key: 'well',
|
|
|
|
|
})
|