forked from ddrilling/asb_cloud_front
Колонки таблицы режимов вынесены в константу
This commit is contained in:
parent
3bcc70e89b
commit
0a0bae2b83
@ -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:<SelectFromDictionary dictionary={dictionarySectionType}/>,
|
||||
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(
|
||||
|
@ -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:<SelectFromDictionary dictionary={dictionarySectionType}/>,
|
||||
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:<SelectFromDictionary dictionary={dictionarySectionType}/>,
|
||||
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)
|
||||
|
Loading…
Reference in New Issue
Block a user