From 0a0bae2b83c46a7240407cbd4f2d6da67433c095 Mon Sep 17 00:00:00 2001 From: goodmice Date: Fri, 15 Oct 2021 16:02:35 +0500 Subject: [PATCH] =?UTF-8?q?=D0=9A=D0=BE=D0=BB=D0=BE=D0=BD=D0=BA=D0=B8=20?= =?UTF-8?q?=D1=82=D0=B0=D0=B1=D0=BB=D0=B8=D1=86=D1=8B=20=D1=80=D0=B5=D0=B6?= =?UTF-8?q?=D0=B8=D0=BC=D0=BE=D0=B2=20=D0=B2=D1=8B=D0=BD=D0=B5=D1=81=D0=B5?= =?UTF-8?q?=D0=BD=D1=8B=20=D0=B2=20=D0=BA=D0=BE=D0=BD=D1=81=D1=82=D0=B0?= =?UTF-8?q?=D0=BD=D1=82=D1=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../WellCompositeSections.jsx | 47 +++++-------------- src/pages/WellOperations/WellDrillParams.jsx | 29 ++++++------ 2 files changed, 26 insertions(+), 50 deletions(-) diff --git a/src/pages/WellOperations/WellCompositeEditor/WellCompositeSections.jsx b/src/pages/WellOperations/WellCompositeEditor/WellCompositeSections.jsx index e0b9f87..9fac449 100644 --- a/src/pages/WellOperations/WellCompositeEditor/WellCompositeSections.jsx +++ b/src/pages/WellOperations/WellCompositeEditor/WellCompositeSections.jsx @@ -2,13 +2,7 @@ import { LineChartOutlined, ProfileOutlined } from '@ant-design/icons' import { Table, Tag, Button, Badge, Divider, Modal, Row, Col, Popconfirm } from 'antd' import { Link } from 'react-router-dom' import { useState, useEffect } from 'react' -import { - makeColumn, - makeTextColumn, - makeNumericColumnPlanFact, - makeNumericAvgRange, - SelectFromDictionary -} from '../../../components/Table' +import { makeTextColumn, makeNumericColumnPlanFact } from '../../../components/Table' import { calcAndUpdateStatsBySections, makeFilterMinMaxFunction, @@ -19,7 +13,7 @@ import { DrillParamsService, WellCompositeService } from '../../../services/api' import LoaderPortal from '../../../components/LoaderPortal' import WellOperationsTable from '../../Cluster/WellOperationsTable' import { invokeWebApiWrapperAsync } from '../../../components/factory' -import { dictionarySectionType, getByKeyOrReturnKey } from '../dictionary' +import { columns as paramsColumns } from '../WellDrillParams' const filtersMinMax = [ @@ -45,18 +39,16 @@ export const WellCompositeSections = ({idWell, statsWells, selectedSections}) => const [params, setParams] = useState([]) useEffect(() => { - if (selectedWellId > 0) { - invokeWebApiWrapperAsync( - async () => { - const operations = await getOperations(selectedWellId) - - setWellOperations(operations.operations) - }, - setShowLoader, - `Не удалось загрузить операции по скважине '${selectedWellId}'`, - ) - } - }, [selectedWellId]) + if (isOpsModalVisible || selectedWellId <= 0) return + invokeWebApiWrapperAsync( + async () => { + const { operations } = await getOperations(selectedWellId) + setWellOperations(operations) + }, + setShowLoader, + `Не удалось загрузить операции по скважине "${selectedWellId}"`, + ) + }, [selectedWellId, isOpsModalVisible]) useEffect(() => { const rows = [] @@ -162,21 +154,6 @@ export const WellCompositeSections = ({idWell, statsWells, selectedSections}) => }, ] - const paramsColumns = [ - makeColumn('Конструкция секции','idWellSectionType', { - editable:true, - input:, - width:160, - render:(_, record)=>getByKeyOrReturnKey(dictionarySectionType, record.idWellSectionType) - }), - // makeNumericStartEnd('Глубина', 'depth'), - makeNumericAvgRange('Нагрузка', 'axialLoad'), - makeNumericAvgRange('Давление', 'pressure'), - makeNumericAvgRange('Момент на ВПС', 'rotorTorque'), - makeNumericAvgRange('Обороты на ВПС', 'rotorSpeed'), - makeNumericAvgRange('Расход', 'flow') -] - const rowSelection = { selectedRowKeys: selectedWellsKeys, onChange: (keys, items) => invokeWebApiWrapperAsync( diff --git a/src/pages/WellOperations/WellDrillParams.jsx b/src/pages/WellOperations/WellDrillParams.jsx index a36df85..189f5d4 100644 --- a/src/pages/WellOperations/WellDrillParams.jsx +++ b/src/pages/WellOperations/WellDrillParams.jsx @@ -10,6 +10,20 @@ import { EditableTable, SelectFromDictionary } from '../../components/Table' import { DrillParamsService } from '../../services/api' import { dictionarySectionType, getByKeyOrReturnKey } from './dictionary' +export const columns = [ + makeColumn('Конструкция секции','idWellSectionType', { + editable:true, + input:, + width:160, + render:(_, record)=>getByKeyOrReturnKey(dictionarySectionType, record.idWellSectionType) + }), + // makeNumericStartEnd('Глубина', 'depth'), + makeNumericAvgRange('Нагрузка', 'axialLoad'), + makeNumericAvgRange('Давление', 'pressure'), + makeNumericAvgRange('Момент на ВПС', 'rotorTorque'), + makeNumericAvgRange('Обороты на ВПС', 'rotorSpeed'), + makeNumericAvgRange('Расход', 'flow') +] export const WellDrillParams = ({idWell}) => { const [params, setParams] = useState([]) @@ -26,21 +40,6 @@ export const WellDrillParams = ({idWell}) => { useEffect(updateParams, [idWell]) - const columns = [ - makeColumn('Конструкция секции','idWellSectionType', { - editable:true, - input:, - width:160, - render:(_, record)=>getByKeyOrReturnKey(dictionarySectionType, record.idWellSectionType) - }), - // makeNumericStartEnd('Глубина', 'depth'), - makeNumericAvgRange('Нагрузка', 'axialLoad'), - makeNumericAvgRange('Давление', 'pressure'), - makeNumericAvgRange('Момент на ВПС', 'rotorTorque'), - makeNumericAvgRange('Обороты на ВПС', 'rotorSpeed'), - makeNumericAvgRange('Расход', 'flow') - ] - const onAdd = async (param) => { param.idWell = idWell await DrillParamsService.insert(idWell, param)