From c8921c23cdc461da701141beec0dde3e47931267 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A4=D1=80=D0=BE=D0=BB=D0=BE=D0=B2?= Date: Thu, 19 Aug 2021 17:52:22 +0500 Subject: [PATCH] add wellSections page --- src/pages/WellOperations/WellSectionsStat.jsx | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 src/pages/WellOperations/WellSectionsStat.jsx 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