diff --git a/src/pages/WellOperations/WellSectionsStat.jsx b/src/pages/WellOperations/WellSectionsStat.jsx new file mode 100644 index 0000000..98f49f6 --- /dev/null +++ b/src/pages/WellOperations/WellSectionsStat.jsx @@ -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 + + +} \ No newline at end of file