From e972a660f1bd749be0498b1cf6d635f3f29b0d63 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, 22 Jul 2021 10:18:00 +0500 Subject: [PATCH] =?UTF-8?q?CF2-28=20=D0=A1=D0=BE=D0=B7=D0=B4=D0=B0=D1=82?= =?UTF-8?q?=D1=8C=20=D1=81=D1=82=D1=80=D0=B0=D0=BD=D0=B8=D1=86=D1=83=20?= =?UTF-8?q?=D0=B4=D0=B5=D1=82=D0=B0=D0=BB=D0=B8=D0=B7=D0=B0=D1=86=D0=B8?= =?UTF-8?q?=D0=B8=20=D0=BA=D1=83=D1=81=D1=82=D0=B0(Cluster).=20=D0=9F?= =?UTF-8?q?=D0=B5=D1=80=D0=B5=D0=BD=D0=B5=D1=81=D1=82=D0=B8=20=D0=BD=D0=B0?= =?UTF-8?q?=20=D0=BD=D0=B5=D0=B5=20=D0=B2=D0=BA=D0=BB=D0=B0=D0=B4=D0=BA?= =?UTF-8?q?=D1=83=20=D0=B0=D0=BD=D0=B0=D0=BB=D0=B8=D0=B7=20(=D0=BB=D1=83?= =?UTF-8?q?=D1=87=D1=88=D0=B0=D1=8F/=D1=85=D1=83=D0=B4=D1=88=D0=B0=D1=8F?= =?UTF-8?q?=20=D1=81=D0=BA=D0=B2=D0=B0=D0=B6=D0=B8=D0=BD=D0=B0)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/Cluster.jsx | 141 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 138 insertions(+), 3 deletions(-) diff --git a/src/pages/Cluster.jsx b/src/pages/Cluster.jsx index d8743b3..74855b2 100644 --- a/src/pages/Cluster.jsx +++ b/src/pages/Cluster.jsx @@ -1,8 +1,143 @@ import {useParams} from "react-router-dom"; +import {Link} from "react-router-dom"; +import LoaderPortal from '../components/LoaderPortal' +import { useState, useEffect } from "react"; +import {ClusterService} from '../services/api' +import notify from '../components/notify' +import {Table, Tag, Button} from 'antd'; -export default function Cluster() { - +const columns = [ + { + title: 'скв №', + key: 'caption', + dataIndex: 'caption', + render: (_, item) => {item.caption} + }, + { + title: 'Тип скв.', + key: 'wellType', + dataIndex: 'wellType', + }, + { + title: 'Фактические сроки бурения', + children: [ + { + title: 'начало', + key: 'factStart', + dataIndex: 'factStart', + }, + { + title: 'окончание', + key: 'factEnd', + dataIndex: 'factEnd', + }, + ] + }, + { + title: 'Продолжительность бурения', + children: [ + { + title: 'план', + key: 'periodPlan', + dataIndex: 'periodPlan', + }, + { + title: 'факт', + key: 'periodFact', + dataIndex: 'periodFact', + }, + ] + }, + { + title: 'МСП за скв', + children: [ + { + title: 'план', + key: 'rateOfPenetrationPlan', + dataIndex: 'rateOfPenetrationPlan', + }, + { + title: 'факт', + key: 'rateOfPenetrationFact', + dataIndex: 'rateOfPenetrationFact', + }, + ], + }, + { + title: 'Рейсовая скорость за скв', + children: [ + { + title: 'план', + key: 'routeSpeedPlan', + dataIndex: 'routeSpeedPlan', + }, + { + title: 'факт', + key: 'routeSpeedFact', + dataIndex: 'routeSpeedFact', + }, + ], + }, + { + title: 'Секции', + key: 'sections', + dataIndex: 'sections', + render: (item) => (таблица по секциям) + }, + { + title: 'График глубина-день', + render: _ => () + }, + { + title: 'Таблица по операциям', + render: _ => () + }, + { + title: 'Подрядчики', + key: 'companies', + dataIndex: 'companies', + render: (item) => item.map(company => {company.caption}) + }, +]; + +export default function Cluster() { let { id } = useParams() + const [clusterTitle, setClusterTitle] = useState("") + const [wellsStat, setWellsStat] = useState(null) + const [showLoader, setShowLoader] = useState(false) - return(
Куст {id}
) + useEffect(()=>{ + const updateWellsStat = async() => { + setShowLoader(true) + try{ + const msInDay = 1000*60*60*24 + const data = await ClusterService.getStat(id) + const wellsStat = data.wellsStat.map(w=>({...w, + periodPlan: (new Date(w.planEnd) - new Date(w.planStart))/msInDay, + periodFact: (new Date(w.factEnd) - new Date(w.factStart))/msInDay, + })) + setWellsStat(wellsStat) + setClusterTitle(data.caption) + } + catch(ex) { + notify(`Не удалось загрузить статистику по скважинам куста "${id}"`, 'error') + console.log(ex) + } + setShowLoader(false) + } + updateWellsStat() + },[id]) + + return( + +

{clusterTitle}

+ record.id} + /> + ) } \ No newline at end of file