From 21f1912dd99340d1d5140be005dd31babb014c22 Mon Sep 17 00:00:00 2001 From: goodmice Date: Wed, 13 Oct 2021 16:32:39 +0500 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B0=20=D1=81=D1=82=D1=80=D0=B0=D0=BD=D0=B8=D1=86=D0=B0?= =?UTF-8?q?=20=D0=BA=D0=BE=D0=BC=D0=BF=D0=BE=D0=B7=D0=B8=D1=82=D0=BD=D0=BE?= =?UTF-8?q?=D0=B9=20=D1=81=D0=BA=D0=B2=D0=B0=D0=B6=D0=B8=D0=BD=D1=8B=20?= =?UTF-8?q?=D1=81=D0=BE=20=D1=81=D0=B2=D0=BE=D0=B4=D0=BA=D0=BE=D0=B9=20?= =?UTF-8?q?=D0=BF=D0=BE=20=D1=81=D0=BA=D0=B2=D0=B0=D0=B6=D0=B8=D0=BD=D0=B0?= =?UTF-8?q?=D0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../WellCompositeEditor/WellCompositeInfo.jsx | 25 ++++ .../WellCompositeEditor/index.jsx | 115 ++++++++++++++++++ src/pages/WellOperations/index.jsx | 9 +- 3 files changed, 148 insertions(+), 1 deletion(-) create mode 100644 src/pages/WellOperations/WellCompositeEditor/WellCompositeInfo.jsx create mode 100644 src/pages/WellOperations/WellCompositeEditor/index.jsx diff --git a/src/pages/WellOperations/WellCompositeEditor/WellCompositeInfo.jsx b/src/pages/WellOperations/WellCompositeEditor/WellCompositeInfo.jsx new file mode 100644 index 0000000..e35e227 --- /dev/null +++ b/src/pages/WellOperations/WellCompositeEditor/WellCompositeInfo.jsx @@ -0,0 +1,25 @@ +import { useEffect, useState } from "react" +import { invokeWebApiWrapperAsync } from "../../../components/factory" +import LoaderPortal from "../../../components/LoaderPortal"; +import { WellOperationStatService } from "../../../services/api"; +import ClusterWells from "../../Cluster/ClusterWells"; + +export const WellCompositeInfo = ({idWell, selectedIdWells}) => { + const [showLoader, setShowLoader] = useState(false); + const [statsWells, setStatsWells] = useState([]); + + useEffect(() => invokeWebApiWrapperAsync( + async () => { + const operations = await WellOperationStatService.getWellsStat(selectedIdWells) + setStatsWells(operations) + }, + setShowLoader, + 'Не удалось загрузить список операции по скважинам' + ), [selectedIdWells]) + + return ( + + + + ) +} diff --git a/src/pages/WellOperations/WellCompositeEditor/index.jsx b/src/pages/WellOperations/WellCompositeEditor/index.jsx new file mode 100644 index 0000000..03774b9 --- /dev/null +++ b/src/pages/WellOperations/WellCompositeEditor/index.jsx @@ -0,0 +1,115 @@ +import { Layout, Menu, TreeSelect } from 'antd' +import { useState, useEffect } from 'react' +import { Redirect, Route, Switch, Link, useParams } from 'react-router-dom' +import { DepositService } from '../../../services/api' +import { invokeWebApiWrapperAsync } from '../../../components/factory' +import LoaderPortal from '../../../components/LoaderPortal' +import { WellCompositeInfo } from './WellCompositeInfo' +import { WellCompositeSections } from './WellCompositeSections' +import WellOperationsTable from '../../Cluster/WellOperationsTable' + +const { Content } = Layout + +export const WellCompositeEditor = ({idWell}) => { + const { tab } = useParams() + const rootPath = `/well/${idWell}/operations/composite`; + + const [wellsTree, setWellsTree] = useState([]) + const [showLoader, setShowLoader] = useState(false) + const [selectedWells, setSelectedWells] = useState([]) + const [selectedIdWells, setSelectedIdWells] = useState([]) + + useEffect(() => invokeWebApiWrapperAsync( + async () => { + const deposits = await DepositService.getDeposits() + const wellsTree = deposits.map((deposit, dIdx) => ({ + title: deposit.caption, + key: `${dIdx}`, + value: `${dIdx}`, + children: deposit.clusters.map((cluster, cIdx) => ({ + title: cluster.caption, + key: `${dIdx}-${cIdx}`, + value: `${dIdx}-${cIdx}`, + children: cluster.wells.map(well => ({ + title: well.caption, + key: `${dIdx}-${cIdx}-${well.id}`, + value: `${dIdx}-${cIdx}-${well.id}`, + })), + })) + })) + setWellsTree(wellsTree) + }, + setShowLoader, + 'Не удалось загрузить список скважин' + ), [idWell]) + + const expandIdx = (idx) => { + const res = /^(\d+)(?:-(\d+))?(?:-(\d+))?$/g.exec(idx) + + if (res === null) return undefined + if (res[1] && res[2] && res[3]) + return parseInt(res[3]) + + const depositIdx = parseInt(res[1]) + if (res[2]) { + const clusterIdx = parseInt(res[2]) + return wellsTree[depositIdx].children[clusterIdx].children.map(well => expandIdx(well.key)).flat() + } + + return wellsTree[depositIdx].children.map(cluster => expandIdx(cluster.key)).flat() + } + + const onWellChanged = (value) => { + setSelectedWells(value) + setSelectedIdWells(value.map(item => expandIdx(item)).flat()) + } + + return ( + +
+ Скважины: + + + + Сводка по скважинам + + + Сводка по секциям + + +
+ + + + + + + + + + + + + + + +
+ ) +} \ No newline at end of file diff --git a/src/pages/WellOperations/index.jsx b/src/pages/WellOperations/index.jsx index cdecf44..9e8aefc 100644 --- a/src/pages/WellOperations/index.jsx +++ b/src/pages/WellOperations/index.jsx @@ -2,8 +2,9 @@ import {Layout, Menu} from "antd"; import {Switch, Link, Route, Redirect, useParams, useHistory} from "react-router-dom"; import { FolderOutlined } from "@ant-design/icons"; import { WellDrillParams } from './WellDrillParams' -import { WellOperationsEditor } from './WellOperationsEditor' import { WellSectionsStat } from './WellSectionsStat' +import { WellCompositeEditor } from './WellCompositeEditor' +import { WellOperationsEditor } from './WellOperationsEditor' import { Tvd } from './Tvd' import { ImportExportBar } from "./ImportExportBar"; @@ -39,6 +40,9 @@ export default function WellOperations({idWell}) { }> Режимы + }> + Композитная скважина + @@ -59,6 +63,9 @@ export default function WellOperations({idWell}) { + + +