From 673fc6c4afd13810a175a6144c558fad4e93b517 Mon Sep 17 00:00:00 2001 From: KharchenkoVV Date: Sun, 29 Aug 2021 14:43:02 +0500 Subject: [PATCH] Added TVD to modal window in ClusterWells table --- src/pages/Cluster/ClusterWells.jsx | 79 ++++++++++++++++++++++++++---- src/pages/WellOperations/Tvd.jsx | 1 - 2 files changed, 69 insertions(+), 11 deletions(-) diff --git a/src/pages/Cluster/ClusterWells.jsx b/src/pages/Cluster/ClusterWells.jsx index 9af52e3..088ebe5 100644 --- a/src/pages/Cluster/ClusterWells.jsx +++ b/src/pages/Cluster/ClusterWells.jsx @@ -1,7 +1,7 @@ import { useParams } from "react-router-dom"; import { Link } from "react-router-dom"; import { useState, useEffect } from "react"; -import { Table, Tag, Button } from "antd"; +import { Table, Tag, Button, Modal } from "antd"; import { makeTextColumn, makeGroupColumn, @@ -9,6 +9,9 @@ import { makeNumericColumnPlanFact, calcAndUpdateStatsBySections, } from "../../components/Table"; +import { invokeWebApiWrapperAsync } from '../../components/factory'; +import { WellOperationStatService } from '../../services/api'; +import DepthToDay from '../../components/charts/DepthToDay'; const filtersMinMax = [ { @@ -35,6 +38,43 @@ const filtersWellsType = [ export default function ClusterWells({ clusterData }) { let { id } = useParams(); const [wellsStat, setWellsStat] = useState([]); + const [selectedWellId, setSelectedWellId] = useState(0); + const [isModalVisible, setIsModalVisible] = useState(false) + const [dataPlan, setDataPlan] = useState([]); + const [dataFact, setDataFact] = useState([]); + const [dataForecast, setDataForecast] = useState([]); + + useEffect(() => { + invokeWebApiWrapperAsync( + async () => { + const operations = await WellOperationStatService.getTvd(selectedWellId); + + const planData = operations.map(el => { + return {key: el.plan?.id, depth: el.plan?.wellDepth, date: el.plan?.startDate} + }).filter(el => el.key) + + setDataPlan(planData) + + const factData = operations.map(el => { + return {key: el.fact?.id, depth: el.fact?.wellDepth, date: el.fact?.startDate} + }).filter(el => el.key) + + setDataFact(factData) + + const predictData = operations.map(el => { + return {key: el.predict?.id, depth: el.predict?.wellDepth, date: el.predict?.startDate} + }).filter(el => el.key) + + setDataForecast(predictData) + }, + null, + `Не удалось загрузить операции по скважине "${selectedWellId}"`, + ); + }, [selectedWellId]); + + const closeModal = () => { + setIsModalVisible(false) + } calcAndUpdateStatsBySections(wellsStat ?? [], [ "factStart", @@ -97,7 +137,10 @@ export default function ClusterWells({ clusterData }) { makeNumericColumnPlanFact("НПВ, сут", "notProductiveTime", filtersMinMax), { title: "График глубина-день", - render: (_, item) => , + render: (_, item) => , }, { title: "Таблица по операциям", @@ -113,13 +156,29 @@ export default function ClusterWells({ clusterData }) { ]; return ( - record.id} - /> +
+
record.id} + /> + + + + + ); } diff --git a/src/pages/WellOperations/Tvd.jsx b/src/pages/WellOperations/Tvd.jsx index 037569b..8b47b12 100644 --- a/src/pages/WellOperations/Tvd.jsx +++ b/src/pages/WellOperations/Tvd.jsx @@ -40,7 +40,6 @@ export const TVD = ({ idWell }) => {

График Глубина-день