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