forked from ddrilling/asb_cloud_front
* Исправлен роутинг операции по скважине
* Добавлена работа с правами для Setpoints * Добавлена подсказка для поля пользователь на мониторинге * Добавлена блокировка статуса скважины при отсутствии разрешения
This commit is contained in:
parent
2667a39361
commit
e3e5a1bf4e
@ -10,27 +10,25 @@ export const TelemetryAnalysisDepthToDay = memo(({ idWell }) => {
|
|||||||
const [bitPositionData, setBitPositionData] = useState([])
|
const [bitPositionData, setBitPositionData] = useState([])
|
||||||
const [loader, setLoader] = useState(false)
|
const [loader, setLoader] = useState(false)
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => invokeWebApiWrapperAsync(
|
||||||
setLoader(true)
|
async () => {
|
||||||
invokeWebApiWrapperAsync(
|
const depthToDayData = await TelemetryAnalyticsService.getWellDepthToDay(idWell)
|
||||||
async () => {
|
|
||||||
const depthToDayData = await TelemetryAnalyticsService.getWellDepthToDay(idWell)
|
|
||||||
|
|
||||||
const depths = depthToDayData.map(el => ({depth: el.wellDepth, date: el.date}))
|
const depths = depthToDayData.map(el => ({depth: el.wellDepth, date: el.date}))
|
||||||
.sort((a, b) => new Date(a.date) - new Date(b.date))
|
.sort((a, b) => new Date(a.date) - new Date(b.date))
|
||||||
setDepthData(depths)
|
setDepthData(depths)
|
||||||
|
|
||||||
const bitPositions = depthToDayData.map(el => ({depth: el.bitDepth, date: el.date}))
|
const bitPositions = depthToDayData.map(el => ({depth: el.bitDepth, date: el.date}))
|
||||||
.sort((a, b) => new Date(a.date) - new Date(b.date))
|
.sort((a, b) => new Date(a.date) - new Date(b.date))
|
||||||
setBitPositionData(bitPositions)
|
setBitPositionData(bitPositions)
|
||||||
},
|
},
|
||||||
setLoader,
|
setLoader,
|
||||||
`Не удалось получить данные для анализа Глубина-День по скважине "${idWell}"`)
|
`Не удалось получить данные для анализа Глубина-День по скважине "${idWell}"`
|
||||||
}, [idWell])
|
), [idWell])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<LoaderPortal show={loader}>
|
<LoaderPortal show={loader}>
|
||||||
<div className='mt-20px'>
|
<div className={'mt-20px'}>
|
||||||
<ChartTelemetryDepthToDay
|
<ChartTelemetryDepthToDay
|
||||||
depthData={depthData}
|
depthData={depthData}
|
||||||
bitPositionData={bitPositionData}
|
bitPositionData={bitPositionData}
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
export const TelemetryAnalysisOperationsToInterval = ({ idWell }) => (<>123</>)
|
import { memo } from 'react'
|
||||||
|
|
||||||
|
export const TelemetryAnalysisOperationsToInterval = memo(({ idWell }) => (<>{idWell} 123</>))
|
||||||
|
|
||||||
export default TelemetryAnalysisOperationsToInterval
|
export default TelemetryAnalysisOperationsToInterval
|
||||||
|
@ -28,26 +28,26 @@ export const TelemetryAnalysis = memo(({ idWell }) => {
|
|||||||
|
|
||||||
<Layout>
|
<Layout>
|
||||||
<Content className={'site-layout-background'}>
|
<Content className={'site-layout-background'}>
|
||||||
<Switch>
|
<Switch>
|
||||||
<PrivateRoute root={rootPath} path={'depthToDay'}>
|
<PrivateRoute path={`${rootPath}/depthToDay`}>
|
||||||
<TelemetryAnalysisDepthToDay idWell={idWell}/>
|
<TelemetryAnalysisDepthToDay idWell={idWell}/>
|
||||||
</PrivateRoute>
|
</PrivateRoute>
|
||||||
<PrivateRoute root={rootPath} path={'depthToInterval'}>
|
<PrivateRoute path={`${rootPath}/depthToInterval`}>
|
||||||
<TelemetryAnalysisDepthToInterval idWell={idWell}/>
|
<TelemetryAnalysisDepthToInterval idWell={idWell}/>
|
||||||
</PrivateRoute>
|
</PrivateRoute>
|
||||||
<PrivateRoute root={rootPath} path={'operationsSummary'}>
|
<PrivateRoute path={`${rootPath}/operationsSummary`}>
|
||||||
<TelemetryAnalysisOperationsSummary idWell={idWell}/>
|
<TelemetryAnalysisOperationsSummary idWell={idWell}/>
|
||||||
</PrivateRoute>
|
</PrivateRoute>
|
||||||
<PrivateRoute root={rootPath} path={'operationsToInterval'}>
|
<PrivateRoute path={`${rootPath}/operationsToInterval`}>
|
||||||
<TelemetryAnalysisOperationsToInterval idWell={idWell}/>
|
<TelemetryAnalysisOperationsToInterval idWell={idWell}/>
|
||||||
</PrivateRoute>
|
</PrivateRoute>
|
||||||
<PrivateDefaultRoute urls={[
|
<PrivateDefaultRoute urls={[
|
||||||
`${rootPath}/depthToDay`,
|
`${rootPath}/depthToDay`,
|
||||||
`${rootPath}/depthToInterval`,
|
`${rootPath}/depthToInterval`,
|
||||||
`${rootPath}/operationsSummary`,
|
`${rootPath}/operationsSummary`,
|
||||||
`${rootPath}/operationsToInterval`,
|
`${rootPath}/operationsToInterval`,
|
||||||
]}/>
|
]}/>
|
||||||
</Switch>
|
</Switch>
|
||||||
</Content>
|
</Content>
|
||||||
</Layout>
|
</Layout>
|
||||||
</>
|
</>
|
||||||
|
@ -11,6 +11,7 @@ import { SetpointsService } from '@api'
|
|||||||
|
|
||||||
import { SetpointSender } from './SetpointSender'
|
import { SetpointSender } from './SetpointSender'
|
||||||
import { SetpointViewer, getSetpointStatus } from './SetpointViewer'
|
import { SetpointViewer, getSetpointStatus } from './SetpointViewer'
|
||||||
|
import { hasPermission } from '@asb/utils/permissions'
|
||||||
|
|
||||||
export const Setpoints = ({ idWell, ...other }) => {
|
export const Setpoints = ({ idWell, ...other }) => {
|
||||||
const [isModalVisible, setIsModalVisible] = useState(false)
|
const [isModalVisible, setIsModalVisible] = useState(false)
|
||||||
@ -49,7 +50,7 @@ export const Setpoints = ({ idWell, ...other }) => {
|
|||||||
{ dataIndex: 'id', render: (id) => <Button onClick={() => showMore(id)}>Подробнее</Button> },
|
{ dataIndex: 'id', render: (id) => <Button onClick={() => showMore(id)}>Подробнее</Button> },
|
||||||
]
|
]
|
||||||
|
|
||||||
const updateTable = () => invokeWebApiWrapperAsync(
|
const updateTable = async () => await invokeWebApiWrapperAsync(
|
||||||
async () => {
|
async () => {
|
||||||
const setpoints = await SetpointsService.getByIdWell(idWell)
|
const setpoints = await SetpointsService.getByIdWell(idWell)
|
||||||
setSetpoints(setpoints)
|
setSetpoints(setpoints)
|
||||||
@ -58,16 +59,19 @@ export const Setpoints = ({ idWell, ...other }) => {
|
|||||||
`Не удалось загрузить список для скважины "${idWell}"`
|
`Не удалось загрузить список для скважины "${idWell}"`
|
||||||
)
|
)
|
||||||
|
|
||||||
useEffect(updateTable, [idWell])
|
const onOpenClick = async () => {
|
||||||
|
await updateTable()
|
||||||
|
setIsModalVisible(true)
|
||||||
|
}
|
||||||
|
|
||||||
const onSenderClose = (pushed) => {
|
const onSenderClose = (pushed) => {
|
||||||
if (pushed) updateTable()
|
if (pushed) updateTable()
|
||||||
setIsSenderVisible(false)
|
setIsSenderVisible(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return hasPermission('Setpoints.get') && (
|
||||||
<div {...other}>
|
<div {...other}>
|
||||||
<Button onClick={() => setIsModalVisible(true)} loading={isLoading}>
|
<Button onClick={onOpenClick} loading={isLoading}>
|
||||||
Рекомендованные уставки
|
Рекомендованные уставки
|
||||||
</Button>
|
</Button>
|
||||||
<Modal
|
<Modal
|
||||||
@ -75,11 +79,11 @@ export const Setpoints = ({ idWell, ...other }) => {
|
|||||||
title={'Рекомендованные уставки'}
|
title={'Рекомендованные уставки'}
|
||||||
visible={isModalVisible}
|
visible={isModalVisible}
|
||||||
onCancel={() => setIsModalVisible(false)}
|
onCancel={() => setIsModalVisible(false)}
|
||||||
footer={
|
footer={hasPermission('Setpoints.edit') && (
|
||||||
<Button onClick={() => setIsSenderVisible(true)}>
|
<Button onClick={() => setIsSenderVisible(true)}>
|
||||||
Рекомендовать
|
Рекомендовать
|
||||||
</Button>
|
</Button>
|
||||||
}
|
)}
|
||||||
>
|
>
|
||||||
<LoaderPortal show={isLoading}>
|
<LoaderPortal show={isLoading}>
|
||||||
<Table
|
<Table
|
||||||
|
@ -1,11 +1,12 @@
|
|||||||
|
import { Tooltip } from 'antd'
|
||||||
import { Display } from '@components/Display'
|
import { Display } from '@components/Display'
|
||||||
|
|
||||||
export const UserOfWell = ({ data }) => (
|
export const UserOfWell = ({ data }) => (
|
||||||
<Display
|
<Display
|
||||||
className={'border_small display_flex_container user_card'}
|
className={'border_small display_flex_container user_card'}
|
||||||
label={'Пользователь'}
|
label={<Tooltip title={'Пользователь панели оператора'}>Пользователь</Tooltip>}
|
||||||
value={data[data.length - 1]?.user}
|
value={data[data.length - 1]?.user}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
|
|
||||||
export default UserOfWell
|
export default UserOfWell
|
||||||
|
@ -1,5 +1,20 @@
|
|||||||
import { useState, useEffect } from 'react'
|
|
||||||
import { Select } from 'antd'
|
import { Select } from 'antd'
|
||||||
|
import { useState, useEffect } from 'react'
|
||||||
|
|
||||||
|
import {
|
||||||
|
DrillFlowChartService,
|
||||||
|
OperationStatService,
|
||||||
|
TelemetryDataSaubService,
|
||||||
|
TelemetryDataSpinService,
|
||||||
|
WellService
|
||||||
|
} from '@api'
|
||||||
|
import { makeDateSorter } from '@components/Table'
|
||||||
|
import LoaderPortal from '@components/LoaderPortal'
|
||||||
|
import { Grid, GridItem, Flex } from '@components/Grid'
|
||||||
|
import { invokeWebApiWrapperAsync } from '@components/factory'
|
||||||
|
import { PeriodPicker, defaultPeriod } from '@components/PeriodPicker'
|
||||||
|
import { hasPermission } from '@utils/permissions'
|
||||||
|
import { Subscribe } from '@services/signalr'
|
||||||
|
|
||||||
import { MonitoringColumn } from './MonitoringColumn'
|
import { MonitoringColumn } from './MonitoringColumn'
|
||||||
import { CustomColumn } from './CustomColumn'
|
import { CustomColumn } from './CustomColumn'
|
||||||
@ -8,26 +23,12 @@ import { ModeDisplay } from './ModeDisplay'
|
|||||||
import { UserOfWell } from './UserOfWells'
|
import { UserOfWell } from './UserOfWells'
|
||||||
import { Setpoints } from './Setpoints'
|
import { Setpoints } from './Setpoints'
|
||||||
|
|
||||||
import LoaderPortal from '../../components/LoaderPortal'
|
import MomentStabPicEnabled from '@images/DempherOn.png'
|
||||||
import { Grid, GridItem, Flex } from '../../components/Grid'
|
import MomentStabPicDisabled from '@images/DempherOff.png'
|
||||||
import { Subscribe } from '../../services/signalr'
|
import SpinPicEnabled from '@images/SpinEnabled.png'
|
||||||
import {
|
import SpinPicDisabled from '@images/SpinDisabled.png'
|
||||||
DrillFlowChartService,
|
|
||||||
OperationStatService,
|
|
||||||
TelemetryDataSaubService,
|
|
||||||
TelemetryDataSpinService,
|
|
||||||
WellService
|
|
||||||
} from '../../services/api'
|
|
||||||
import { makeDateSorter } from '../../components/Table'
|
|
||||||
import { invokeWebApiWrapperAsync } from '../../components/factory'
|
|
||||||
import { PeriodPicker, defaultPeriod } from '../../components/PeriodPicker'
|
|
||||||
|
|
||||||
import MomentStabPicEnabled from '../../images/DempherOn.png'
|
import '@styles/message.css'
|
||||||
import MomentStabPicDisabled from '../../images/DempherOff.png'
|
|
||||||
import SpinPicEnabled from '../../images/SpinEnabled.png'
|
|
||||||
import SpinPicDisabled from '../../images/SpinDisabled.png'
|
|
||||||
|
|
||||||
import '../../styles/message.css'
|
|
||||||
|
|
||||||
const { Option } = Select
|
const { Option } = Select
|
||||||
|
|
||||||
@ -386,7 +387,7 @@ export default function TelemetryView({ idWell }) {
|
|||||||
</div>
|
</div>
|
||||||
<div style={{ marginLeft: '1rem' }}>
|
<div style={{ marginLeft: '1rem' }}>
|
||||||
Статус:
|
Статус:
|
||||||
<Select value={wellData.idState ?? 0} onChange={onStatusChanged}>
|
<Select value={wellData.idState ?? 0} onChange={onStatusChanged} disabled={!hasPermission('Well.edit')}>
|
||||||
<Option value={0} disabled hidden>Неизвестно</Option>
|
<Option value={0} disabled hidden>Неизвестно</Option>
|
||||||
<Option value={1}>В работе</Option>
|
<Option value={1}>В работе</Option>
|
||||||
<Option value={2}>Завершено</Option>
|
<Option value={2}>Завершено</Option>
|
||||||
|
Loading…
Reference in New Issue
Block a user