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)