forked from ddrilling/asb_cloud_front
WellOperationStatService переименован
This commit is contained in:
parent
5ad3bd5e07
commit
43a01bd57f
@ -25,7 +25,7 @@ interface TreeNodeData {
|
||||
children?: TreeNodeData[]
|
||||
}
|
||||
|
||||
export const WellTreeSelector = (): React.ReactNode => {
|
||||
export const WellTreeSelector = () => {
|
||||
const [wellsTree, setWellsTree] = useState<TreeNodeData[]>([])
|
||||
const [showLoader, setShowLoader] = useState<boolean>(false)
|
||||
const history = useHistory()
|
||||
|
@ -1,17 +1,16 @@
|
||||
import { WellOperationStatService } from '../../services/api';
|
||||
import { OperationStatService } from '../../services/api'
|
||||
|
||||
const maxPrefix = "isMax"
|
||||
const minPrefix = "isMin"
|
||||
const maxPrefix = 'isMax'
|
||||
const minPrefix = 'isMin'
|
||||
|
||||
export const getPrecision = (number) => Number.isNaN(number ?? NaN) ? '-' : number.toFixed(2)
|
||||
|
||||
export const getOperations = async (idWell) => {
|
||||
const ops = await WellOperationStatService.getTvd(idWell);
|
||||
const ops = await OperationStatService.getTvd(idWell)
|
||||
|
||||
if (!ops) return [];
|
||||
if (!ops) return []
|
||||
|
||||
const convert = wellOperationDto =>
|
||||
({
|
||||
const convert = wellOperationDto => ({
|
||||
key: wellOperationDto?.id,
|
||||
depth: wellOperationDto?.depthStart,
|
||||
date: wellOperationDto?.dateStart
|
||||
@ -34,15 +33,15 @@ export const getOperations = async (idWell) => {
|
||||
|
||||
export const makeFilterMinMaxFunction = (key) => (filterValue,
|
||||
dataItem) =>
|
||||
filterValue === "max"
|
||||
filterValue === 'max'
|
||||
? dataItem[maxPrefix + key]
|
||||
: filterValue === "min"
|
||||
: filterValue === 'min'
|
||||
? dataItem[minPrefix + key]
|
||||
: false
|
||||
|
||||
export const calcAndUpdateStats = (data, keys) => {
|
||||
let mins = {}
|
||||
let maxs = {}
|
||||
const mins = {}
|
||||
const maxs = {}
|
||||
|
||||
keys.forEach((key) => {
|
||||
maxs[key] = Number.MIN_VALUE
|
||||
@ -52,7 +51,6 @@ export const calcAndUpdateStats = (data, keys) => {
|
||||
data.forEach((item) => {
|
||||
keys.forEach((key) => {
|
||||
if (mins[key] > item[key]) mins[key] = item[key]
|
||||
|
||||
if (maxs[key] < item[key]) maxs[key] = item[key]
|
||||
})
|
||||
})
|
||||
|
@ -3,7 +3,7 @@ import { useState, useEffect } from 'react'
|
||||
import ClusterWells from './ClusterWells'
|
||||
import LoaderPortal from '../../components/LoaderPortal'
|
||||
import { invokeWebApiWrapperAsync } from '../../components/factory'
|
||||
import { WellOperationStatService } from '../../services/api'
|
||||
import { OperationStatService } from '../../services/api'
|
||||
|
||||
|
||||
export const Cluster = () => {
|
||||
@ -13,7 +13,7 @@ export const Cluster = () => {
|
||||
|
||||
useEffect(() => invokeWebApiWrapperAsync(
|
||||
async () => {
|
||||
const clusterData = await WellOperationStatService.getStatCluster(idClaster)
|
||||
const clusterData = await OperationStatService.getStatCluster(idClaster)
|
||||
setData(clusterData?.statsWells ?? [])
|
||||
},
|
||||
setShowLoader,
|
||||
|
@ -1,16 +1,16 @@
|
||||
import { useEffect, useState } from "react"
|
||||
import { invokeWebApiWrapperAsync } from "../../../components/factory"
|
||||
import LoaderPortal from "../../../components/LoaderPortal";
|
||||
import { WellOperationStatService } from "../../../services/api";
|
||||
import ClusterWells from "../../Cluster/ClusterWells";
|
||||
import { useEffect, useState } from 'react'
|
||||
import { invokeWebApiWrapperAsync } from '../../../components/factory'
|
||||
import LoaderPortal from '../../../components/LoaderPortal'
|
||||
import { OperationStatService } from '../../../services/api'
|
||||
import ClusterWells from '../../Cluster/ClusterWells'
|
||||
|
||||
export const WellCompositeInfo = ({idWell, selectedIdWells}) => {
|
||||
const [showLoader, setShowLoader] = useState(false);
|
||||
const [statsWells, setStatsWells] = useState([]);
|
||||
const [showLoader, setShowLoader] = useState(false)
|
||||
const [statsWells, setStatsWells] = useState([])
|
||||
|
||||
useEffect(() => invokeWebApiWrapperAsync(
|
||||
async () => {
|
||||
const operations = await WellOperationStatService.getWellsStat(selectedIdWells)
|
||||
const operations = await OperationStatService.getWellsStat(selectedIdWells)
|
||||
setStatsWells(operations)
|
||||
},
|
||||
setShowLoader,
|
||||
|
@ -5,14 +5,14 @@ import { DepositService, WellCompositeService } from '../../../services/api'
|
||||
import { invokeWebApiWrapperAsync } from '../../../components/factory'
|
||||
import LoaderPortal from '../../../components/LoaderPortal'
|
||||
import { WellCompositeSections } from './WellCompositeSections'
|
||||
import { WellOperationStatService } from '../../../services/api'
|
||||
import { OperationStatService } from '../../../services/api'
|
||||
import ClusterWells from '../../Cluster/ClusterWells'
|
||||
|
||||
const { Content } = Layout
|
||||
|
||||
export const WellCompositeEditor = ({idWell}) => {
|
||||
const { tab } = useParams()
|
||||
const rootPath = `/well/${idWell}/operations/composite`;
|
||||
const rootPath = `/well/${idWell}/operations/composite`
|
||||
|
||||
const [wellsTree, setWellsTree] = useState([])
|
||||
const [showLoader, setShowLoader] = useState(false)
|
||||
@ -68,7 +68,7 @@ export const WellCompositeEditor = ({idWell}) => {
|
||||
|
||||
useEffect(() => invokeWebApiWrapperAsync(
|
||||
async () => {
|
||||
const stats = await WellOperationStatService.getWellsStat(selectedIdWells)
|
||||
const stats = await OperationStatService.getWellsStat(selectedIdWells)
|
||||
setStatsWells(Array.isArray(stats) ? stats : [])
|
||||
},
|
||||
setShowTabLoader,
|
||||
@ -98,22 +98,22 @@ export const WellCompositeEditor = ({idWell}) => {
|
||||
</Col>
|
||||
<Col span={6}>
|
||||
<Menu
|
||||
mode="horizontal"
|
||||
mode={'horizontal'}
|
||||
selectable={true}
|
||||
className="well_menu"
|
||||
className={'well_menu'}
|
||||
selectedKeys={[tab]}
|
||||
>
|
||||
<Menu.Item key="wells">
|
||||
<Menu.Item key={'wells'}>
|
||||
<Link to={`${rootPath}/wells`}>Статистика по скважинам</Link>
|
||||
</Menu.Item>
|
||||
<Menu.Item key="sections">
|
||||
<Menu.Item key={'sections'}>
|
||||
<Link to={`${rootPath}/sections`}>Статистика по секциям</Link>
|
||||
</Menu.Item>
|
||||
</Menu>
|
||||
</Col>
|
||||
</Row>
|
||||
<Layout>
|
||||
<Content className="site-layout-background">
|
||||
<Content className={'site-layout-background'}>
|
||||
<LoaderPortal show={showTabLoader}>
|
||||
<Switch>
|
||||
<Route path={`${rootPath}/wells`}>
|
||||
|
@ -2,24 +2,24 @@ import { useState, useEffect } from 'react'
|
||||
import LoaderPortal from '../../components/LoaderPortal'
|
||||
import { invokeWebApiWrapperAsync } from '../../components/factory'
|
||||
import { Table, makeColumn, makeColumnsPlanFact } from '../../components/Table'
|
||||
import { WellOperationStatService } from '../../services/api'
|
||||
import { OperationStatService } from '../../services/api'
|
||||
|
||||
const makeNumberRender = format => value => {
|
||||
const makeNumberRender = value => {
|
||||
const v = +value
|
||||
if(Number.isFinite(v))
|
||||
return v.toFixed(format)
|
||||
return v.toFixed(2)
|
||||
return '-'
|
||||
}
|
||||
|
||||
const columns = [
|
||||
makeColumn('Тип секции', 'sectionType'),
|
||||
makeColumnsPlanFact('Глубина' ,'wellDepth', {render:makeNumberRender(2)}),
|
||||
makeColumnsPlanFact('Часы' ,'duration', {render:makeNumberRender(2)}),
|
||||
makeColumnsPlanFact('МСП' ,'rop', {render:makeNumberRender(2)}),
|
||||
makeColumnsPlanFact('Рейсовая скорость' ,'routeSpeed', {render:makeNumberRender(2)}),
|
||||
makeColumnsPlanFact('Подъем КНБК' ,'bhaUpSpeed', {render:makeNumberRender(2)}),
|
||||
makeColumnsPlanFact('Спуск КНБК' ,'bhaDownSpeed', {render:makeNumberRender(2)}),
|
||||
makeColumnsPlanFact('Спуск ОК' ,'casingDownSpeed', {render:makeNumberRender(2)}),
|
||||
makeColumnsPlanFact('Глубина' ,'wellDepth', {render:makeNumberRender}),
|
||||
makeColumnsPlanFact('Часы' ,'duration', {render:makeNumberRender}),
|
||||
makeColumnsPlanFact('МСП' ,'rop', {render:makeNumberRender}),
|
||||
makeColumnsPlanFact('Рейсовая скорость' ,'routeSpeed', {render:makeNumberRender}),
|
||||
makeColumnsPlanFact('Подъем КНБК' ,'bhaUpSpeed', {render:makeNumberRender}),
|
||||
makeColumnsPlanFact('Спуск КНБК' ,'bhaDownSpeed', {render:makeNumberRender}),
|
||||
makeColumnsPlanFact('Спуск ОК' ,'casingDownSpeed', {render:makeNumberRender}),
|
||||
]
|
||||
|
||||
const calcDuration = (start, end) => {
|
||||
@ -36,7 +36,7 @@ export const WellSectionsStat = ({idWell}) => {
|
||||
|
||||
useEffect(() => invokeWebApiWrapperAsync(
|
||||
async () => {
|
||||
const sectionsResponse = await WellOperationStatService.getStatWell(idWell)
|
||||
const sectionsResponse = await OperationStatService.getStatWell(idWell)
|
||||
|
||||
if(sectionsResponse?.sections){
|
||||
const sections = sectionsResponse.sections
|
||||
@ -66,11 +66,14 @@ export const WellSectionsStat = ({idWell}) => {
|
||||
setShowLoader
|
||||
), [idWell])
|
||||
|
||||
return <LoaderPortal show={showLoader}>
|
||||
return (
|
||||
<LoaderPortal show={showLoader}>
|
||||
<Table
|
||||
bordered
|
||||
size='small'
|
||||
size={'small'}
|
||||
columns={columns}
|
||||
dataSource={sections}/>
|
||||
dataSource={sections}
|
||||
/>
|
||||
</LoaderPortal>
|
||||
)
|
||||
}
|
Loading…
Reference in New Issue
Block a user