From c90e3bde423cb3e57d1408ac17fd3e02c6e74f42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A4=D1=80=D0=BE=D0=BB=D0=BE=D0=B2?= Date: Wed, 18 Aug 2021 18:01:46 +0500 Subject: [PATCH] WellOperations get and display. --- src/pages/Well.jsx | 51 +++++----------- src/pages/WellOperations.jsx | 53 +++++++++++++++++ src/pages/WellOperationsEditor.jsx | 93 ++++++++++++++++++++++++++++++ 3 files changed, 161 insertions(+), 36 deletions(-) create mode 100644 src/pages/WellOperations.jsx create mode 100644 src/pages/WellOperationsEditor.jsx diff --git a/src/pages/Well.jsx b/src/pages/Well.jsx index c9ba159..25554cb 100644 --- a/src/pages/Well.jsx +++ b/src/pages/Well.jsx @@ -2,16 +2,13 @@ import { Layout, Menu } from "antd"; import { FolderOutlined, FundViewOutlined } from "@ant-design/icons"; import { Link, Redirect, Route, Switch, useParams } from "react-router-dom"; import TelemetryView from "./TelemetryView"; -import Messages from "../pages/Messages"; +import Messages from "./Messages"; import Report from "./Report"; -import Archive from "../pages/Archive"; -import Analysis from "../pages/Analysis"; -import WellAnalysis from "../pages/WellAnalysis"; -import Documents from "../pages/Documents"; -import LastData from '../pages/LastData' +import Archive from "./Archive"; +import Documents from "./Documents"; +import LastData from './LastData' import { makeMenuItems } from "./Documents/menuItems"; -import WellStat from "./WellStat"; -import Smbo from "./Smbo"; +import WellOperations from "./WellOperations"; const { Content } = Layout; @@ -26,33 +23,27 @@ export default function Well() { }> - Мониторинг + Мониторинг }> - Сообщения + Сообщения }> - Рапорт - - }> - Анализ + Рапорт }> - + Операции по скважине - }> - Статистика - }> - Архив + Архив Документы @@ -62,11 +53,8 @@ export default function Well() { > {makeMenuItems(rootPath)} - }> - СМБО - }> - Последние данные + Последние данные @@ -82,14 +70,8 @@ export default function Well() { - - - - - - - - + + @@ -97,14 +79,11 @@ export default function Well() { - - - - + diff --git a/src/pages/WellOperations.jsx b/src/pages/WellOperations.jsx new file mode 100644 index 0000000..bf444e0 --- /dev/null +++ b/src/pages/WellOperations.jsx @@ -0,0 +1,53 @@ +import {Layout, Menu} from "antd"; +import {Switch, Link, Route, Redirect, useParams} from "react-router-dom"; +import { FolderOutlined } from "@ant-design/icons"; +import WellOperationsEditor from './WellOperationsEditor' + +const { Content } = Layout + +export default function WellOperations({idWell}) { + let {tab} = useParams() + const rootPath = `/well/${idWell}/operations`; + + return(<> + + }> + TVD + + }> + Секции + + }> + План + + }> + Факт + + + + + + +
sss
+
+ +
sss
+
+ + + + +
sss
+
+ + + +
+
+
+ ) +} \ No newline at end of file diff --git a/src/pages/WellOperationsEditor.jsx b/src/pages/WellOperationsEditor.jsx new file mode 100644 index 0000000..c9199bd --- /dev/null +++ b/src/pages/WellOperationsEditor.jsx @@ -0,0 +1,93 @@ +import { useState, useEffect } from 'react' +import { Input, DatePicker } from 'antd' +import { EditableTable } from "../components/EditableTable" +import LoaderPortal from '../components/LoaderPortal' +import { makeColumn, RegExpIsFloat, invokeWebApiWrapperAsync } from '../components/factory' +import { WellOperationService} from '../services/api' + +const numericColumnOptions = { + editable: true, + initialValue: 0, + formItemRules: [ + { + required: true, + message: `Введите число`, + pattern: RegExpIsFloat, + }, + ], +}; + +const TypeSelector = + +const DataListSectionTypes = + + + + + + + + +const columns = [ + makeColumn('Конструкция секции','wellSectionTypeName', {editable:true, input:TypeSelector}), + makeColumn('Операция','categoryName', {editable:true, input:TypeSelector}), + makeColumn('Доп. инфо','info', {editable:true}), + makeColumn('Глубина забоя','wellDepth', numericColumnOptions), + makeColumn('Время начала','startDate', {editable:true, input:}), + makeColumn('Продолжительность','durationHours', numericColumnOptions), + makeColumn('Комментарий','comment', {editable:true}), +] + +const basePageSize = 32; + +export default function WellOperationsEditor({idWell, type}){ + const [pageNumAndPageSize, setPageNumAndPageSize] = useState({current:1, pageSize:basePageSize}) + const [paginationTotal, setPaginationTotal] = useState(0) + const [operations, setOperations] = useState([]) + const [showLoader, setShowLoader] = useState(false) + + const updateOperations = () => invokeWebApiWrapperAsync( + async () => { + const skip = ((pageNumAndPageSize.current - 1) * pageNumAndPageSize.pageSize) || 0 + const take = pageNumAndPageSize.pageSize + const paginatedOperations = await WellOperationService.getOperations(idWell, type, undefined, undefined, undefined, undefined, skip, take ) + setOperations(paginatedOperations?.items??[]) + const total = paginatedOperations.count?? paginatedOperations.items?.length ?? 0 + setPaginationTotal(total) + }, + setShowLoader, + 'Не удалось загрузить список операций по скважине' + ) + + useEffect(updateOperations, [idWell, type, pageNumAndPageSize]) + + const onAdd = (newOperation) => { + + } + + const onEdit= (newOperation) => { + + } + + const onDelete= (newOperation) => { + + } + + return + setPageNumAndPageSize({current: page, pageSize: pageSize}) + }} + /> + {DataListSectionTypes} + +} \ No newline at end of file