From ae8e5ac81346d61d1c5b2d4417418817e763b555 Mon Sep 17 00:00:00 2001 From: Alexey Date: Tue, 27 Jul 2021 16:17:14 +0500 Subject: [PATCH 1/2] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=BE=20=D0=BE=D1=82=D0=BA=D1=80=D1=8B=D1=82=D0=B8=D0=B5?= =?UTF-8?q?=20=D0=B3=D1=80=D0=B0=D1=84=D0=B8=D0=BA=D0=B0=20=D0=B3=D0=BB?= =?UTF-8?q?=D1=83=D0=B1=D0=B8=D0=BD=D0=B0-=D0=B4=D0=B5=D0=BD=D1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/AnalysisDepthToDay.jsx | 10 +- .../modalWindows/ModalChartDepthToday.jsx | 25 ++ src/pages/Analysis.jsx | 8 +- src/pages/Cluster.jsx | 233 +++++++++--------- src/pages/Well.jsx | 2 +- 5 files changed, 152 insertions(+), 126 deletions(-) create mode 100644 src/components/modalWindows/ModalChartDepthToday.jsx diff --git a/src/components/AnalysisDepthToDay.jsx b/src/components/AnalysisDepthToDay.jsx index 9577cb0..6bae9c5 100644 --- a/src/components/AnalysisDepthToDay.jsx +++ b/src/components/AnalysisDepthToDay.jsx @@ -1,5 +1,4 @@ import { ChartDepthToDay } from './charts/ChartDepthToDay' -import { useParams } from "react-router-dom" import notify from "../components/notify" import { useState, useEffect } from 'react' import { AnalyticsService } from "../services/api" @@ -10,8 +9,7 @@ const lines = [ { label: "Положение инструмента", yAccessorName: "bitDepth", color: '#ff0' } ] -export function AnalysisDepthToDay() { - let { id } = useParams() +export function AnalysisDepthToDay({idWell}) { const [depthToDayData, setDepthToDayData] = useState([]) const [loader, setLoader] = useState(false) @@ -21,15 +19,15 @@ export function AnalysisDepthToDay() { useEffect(() => { setLoader(true) - AnalyticsService.getWellDepthToDay(id) + AnalyticsService.getWellDepthToDay(idWell) .then(handleReceiveDepthToDayData) .catch(error => { - notify(`Не удалось получить данные для Анализа Глубина-День по скважине "${id}"`, + notify(`Не удалось получить данные для Анализа Глубина-День по скважине "${idWell}"`, 'warning') console.log(error) }) .finally(setLoader(false)) - }, [id]) + }, [idWell]) return ( diff --git a/src/components/modalWindows/ModalChartDepthToday.jsx b/src/components/modalWindows/ModalChartDepthToday.jsx new file mode 100644 index 0000000..2117ff3 --- /dev/null +++ b/src/components/modalWindows/ModalChartDepthToday.jsx @@ -0,0 +1,25 @@ +import { useState } from 'react' +import { AnalysisDepthToDay } from '../AnalysisDepthToDay' +import { Button, Modal } from 'antd' + +export default function ModalChartDepthToDay({idWell}) { + const [chartVisible, setChartVisible] = useState(false) + + return (<> + + setChartVisible(false)} + onCancel={() => setChartVisible(false)} + width={1800} + okText='Ок' + cancelText='Отмена' + > + + + ) +} \ No newline at end of file diff --git a/src/pages/Analysis.jsx b/src/pages/Analysis.jsx index dacb12c..4033654 100644 --- a/src/pages/Analysis.jsx +++ b/src/pages/Analysis.jsx @@ -3,7 +3,7 @@ import { AnalysisDepthToInterval } from '../components/AnalysisDepthToInterval' import { AnalysisOperationTime } from '../components/AnalysisOperationTime' import { Row, Col } from 'antd' -export default function Analysis() { +export default function Analysis({idWell}) { return ( <> @@ -11,18 +11,18 @@ export default function Analysis() {

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

- +

График Глубина за интервал

- +
 

График Операция за время

- +
diff --git a/src/pages/Cluster.jsx b/src/pages/Cluster.jsx index 74855b2..9361b5d 100644 --- a/src/pages/Cluster.jsx +++ b/src/pages/Cluster.jsx @@ -1,143 +1,146 @@ -import {useParams} from "react-router-dom"; -import {Link} from "react-router-dom"; +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 { ClusterService } from '../services/api' import notify from '../components/notify' -import {Table, Tag, Button} from 'antd'; +import { Table, Tag, Button } from 'antd'; +import ModalChartDepthToDay from '../components/modalWindows/ModalChartDepthToday' -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() { +export default function Cluster() { let { id } = useParams() const [clusterTitle, setClusterTitle] = useState("") const [wellsStat, setWellsStat] = useState(null) const [showLoader, setShowLoader] = useState(false) - useEffect(()=>{ - const updateWellsStat = async() => { + useEffect(() => { + const updateWellsStat = async () => { setShowLoader(true) - try{ - const msInDay = 1000*60*60*24 + 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, + 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) { + catch (ex) { notify(`Не удалось загрузить статистику по скважинам куста "${id}"`, 'error') console.log(ex) } setShowLoader(false) } updateWellsStat() - },[id]) + }, [id]) - return( + 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: (_, item) => () + }, + { + title: 'Таблица по операциям', + render: _ => () + }, + { + title: 'Подрядчики', + key: 'companies', + dataIndex: 'companies', + render: (item) => item.map(company => {company.caption}) + }, + ]; + + return (

{clusterTitle}

record.id} - /> + columns={columns} + dataSource={wellsStat} + size={'small'} + bordered + pagination={false} + rowKey={(record) => record.id} + /> ) } \ No newline at end of file diff --git a/src/pages/Well.jsx b/src/pages/Well.jsx index 3845f4d..f9e012a 100644 --- a/src/pages/Well.jsx +++ b/src/pages/Well.jsx @@ -95,7 +95,7 @@ export default function Well() { - + From fed76c12fc2ca944fe7d60981b2896c4942b02c3 Mon Sep 17 00:00:00 2001 From: Alexey Date: Tue, 27 Jul 2021 16:17:14 +0500 Subject: [PATCH 2/2] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=BE=20=D0=BE=D1=82=D0=BA=D1=80=D1=8B=D1=82=D0=B8=D0=B5?= =?UTF-8?q?=20=D0=B3=D1=80=D0=B0=D1=84=D0=B8=D0=BA=D0=B0=20=D0=B3=D0=BB?= =?UTF-8?q?=D1=83=D0=B1=D0=B8=D0=BD=D0=B0-=D0=B4=D0=B5=D0=BD=D1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/AnalysisDepthToDay.jsx | 10 +- .../modalWindows/ModalChartDepthToday.jsx | 25 ++ src/pages/Analysis.jsx | 8 +- src/pages/Cluster.jsx | 233 +++++++++--------- src/pages/Well.jsx | 2 +- 5 files changed, 152 insertions(+), 126 deletions(-) create mode 100644 src/components/modalWindows/ModalChartDepthToday.jsx diff --git a/src/components/AnalysisDepthToDay.jsx b/src/components/AnalysisDepthToDay.jsx index 9577cb0..6bae9c5 100644 --- a/src/components/AnalysisDepthToDay.jsx +++ b/src/components/AnalysisDepthToDay.jsx @@ -1,5 +1,4 @@ import { ChartDepthToDay } from './charts/ChartDepthToDay' -import { useParams } from "react-router-dom" import notify from "../components/notify" import { useState, useEffect } from 'react' import { AnalyticsService } from "../services/api" @@ -10,8 +9,7 @@ const lines = [ { label: "Положение инструмента", yAccessorName: "bitDepth", color: '#ff0' } ] -export function AnalysisDepthToDay() { - let { id } = useParams() +export function AnalysisDepthToDay({idWell}) { const [depthToDayData, setDepthToDayData] = useState([]) const [loader, setLoader] = useState(false) @@ -21,15 +19,15 @@ export function AnalysisDepthToDay() { useEffect(() => { setLoader(true) - AnalyticsService.getWellDepthToDay(id) + AnalyticsService.getWellDepthToDay(idWell) .then(handleReceiveDepthToDayData) .catch(error => { - notify(`Не удалось получить данные для Анализа Глубина-День по скважине "${id}"`, + notify(`Не удалось получить данные для Анализа Глубина-День по скважине "${idWell}"`, 'warning') console.log(error) }) .finally(setLoader(false)) - }, [id]) + }, [idWell]) return ( diff --git a/src/components/modalWindows/ModalChartDepthToday.jsx b/src/components/modalWindows/ModalChartDepthToday.jsx new file mode 100644 index 0000000..2117ff3 --- /dev/null +++ b/src/components/modalWindows/ModalChartDepthToday.jsx @@ -0,0 +1,25 @@ +import { useState } from 'react' +import { AnalysisDepthToDay } from '../AnalysisDepthToDay' +import { Button, Modal } from 'antd' + +export default function ModalChartDepthToDay({idWell}) { + const [chartVisible, setChartVisible] = useState(false) + + return (<> + + setChartVisible(false)} + onCancel={() => setChartVisible(false)} + width={1800} + okText='Ок' + cancelText='Отмена' + > + + + ) +} \ No newline at end of file diff --git a/src/pages/Analysis.jsx b/src/pages/Analysis.jsx index dacb12c..4033654 100644 --- a/src/pages/Analysis.jsx +++ b/src/pages/Analysis.jsx @@ -3,7 +3,7 @@ import { AnalysisDepthToInterval } from '../components/AnalysisDepthToInterval' import { AnalysisOperationTime } from '../components/AnalysisOperationTime' import { Row, Col } from 'antd' -export default function Analysis() { +export default function Analysis({idWell}) { return ( <> @@ -11,18 +11,18 @@ export default function Analysis() {

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

- +

График Глубина за интервал

- +
 

График Операция за время

- + diff --git a/src/pages/Cluster.jsx b/src/pages/Cluster.jsx index 74855b2..9361b5d 100644 --- a/src/pages/Cluster.jsx +++ b/src/pages/Cluster.jsx @@ -1,143 +1,146 @@ -import {useParams} from "react-router-dom"; -import {Link} from "react-router-dom"; +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 { ClusterService } from '../services/api' import notify from '../components/notify' -import {Table, Tag, Button} from 'antd'; +import { Table, Tag, Button } from 'antd'; +import ModalChartDepthToDay from '../components/modalWindows/ModalChartDepthToday' -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() { +export default function Cluster() { let { id } = useParams() const [clusterTitle, setClusterTitle] = useState("") const [wellsStat, setWellsStat] = useState(null) const [showLoader, setShowLoader] = useState(false) - useEffect(()=>{ - const updateWellsStat = async() => { + useEffect(() => { + const updateWellsStat = async () => { setShowLoader(true) - try{ - const msInDay = 1000*60*60*24 + 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, + 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) { + catch (ex) { notify(`Не удалось загрузить статистику по скважинам куста "${id}"`, 'error') console.log(ex) } setShowLoader(false) } updateWellsStat() - },[id]) + }, [id]) - return( + 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: (_, item) => () + }, + { + title: 'Таблица по операциям', + render: _ => () + }, + { + title: 'Подрядчики', + key: 'companies', + dataIndex: 'companies', + render: (item) => item.map(company => {company.caption}) + }, + ]; + + return (

{clusterTitle}

record.id} - /> + columns={columns} + dataSource={wellsStat} + size={'small'} + bordered + pagination={false} + rowKey={(record) => record.id} + /> ) } \ No newline at end of file diff --git a/src/pages/Well.jsx b/src/pages/Well.jsx index 3845f4d..f9e012a 100644 --- a/src/pages/Well.jsx +++ b/src/pages/Well.jsx @@ -95,7 +95,7 @@ export default function Well() { - +