forked from ddrilling/asb_cloud_front
add wellSections page
This commit is contained in:
parent
98a87b3f3a
commit
c8921c23cd
42
src/pages/WellOperations/WellSectionsStat.jsx
Normal file
42
src/pages/WellOperations/WellSectionsStat.jsx
Normal file
@ -0,0 +1,42 @@
|
||||
import { useState, useEffect } from 'react'
|
||||
import { Table } from 'antd'
|
||||
import LoaderPortal from '../../components/LoaderPortal'
|
||||
import { makeColumn, makeColumnsPlanFact, invokeWebApiWrapperAsync } from '../../components/factory'
|
||||
import { WellSectionService } from '../../services/api'
|
||||
|
||||
const makeNumberRender = (format) => ((value) => (+value).toFixed(format))
|
||||
|
||||
const columns = [
|
||||
makeColumn('Тип секции','sectionType'),
|
||||
makeColumnsPlanFact('Глубина' ,'wellDepth', {render:makeNumberRender(2)}),
|
||||
makeColumnsPlanFact('Часы' ,'duration', {render:makeNumberRender(2)}),
|
||||
makeColumnsPlanFact('МСП' ,'mechSpeed', {render:makeNumberRender(2)}),
|
||||
makeColumnsPlanFact('Рейсовая скорость' ,'routeSpeed', {render:makeNumberRender(2)}),
|
||||
makeColumnsPlanFact('Подъем КНБК' ,'bhaUpSpeed', {render:makeNumberRender(2)}),
|
||||
makeColumnsPlanFact('Спуск КНБК' ,'bhaDownSpeed', {render:makeNumberRender(2)}),
|
||||
makeColumnsPlanFact('Спуск ОК' ,'casingDownSpeed', {render:makeNumberRender(2)}),
|
||||
]
|
||||
|
||||
export const WellSectionsStat = ({idWell}) => {
|
||||
const [sections, setSections] = useState([])
|
||||
const [showLoader, setShowLoader] = useState(false)
|
||||
|
||||
useEffect(() => invokeWebApiWrapperAsync(
|
||||
async () => {
|
||||
const sectiionsPaginated = await WellSectionService.getAll(idWell, 0, 1000)
|
||||
if(sectiionsPaginated?.items?.length){
|
||||
const sections = sectiionsPaginated.items.sort((a,b)=>a.wellDepthPlan - b.wellDepthPlan)
|
||||
setSections(sections)
|
||||
}
|
||||
},
|
||||
setShowLoader
|
||||
),[idWell])
|
||||
|
||||
return <LoaderPortal show={showLoader}>
|
||||
<Table
|
||||
bordered
|
||||
size='small'
|
||||
columns={columns}
|
||||
dataSource={sections}/>
|
||||
</LoaderPortal>
|
||||
}
|
Loading…
Reference in New Issue
Block a user