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 { Table, Tag, Button, Badge, Divider, Modal, Row, Col, Popconfirm } from 'antd'
|
||||||
import { Link } from 'react-router-dom'
|
import { Link } from 'react-router-dom'
|
||||||
import { useState, useEffect } from 'react'
|
import { useState, useEffect } from 'react'
|
||||||
import {
|
import { makeTextColumn, makeNumericColumnPlanFact } from '../../../components/Table'
|
||||||
makeColumn,
|
|
||||||
makeTextColumn,
|
|
||||||
makeNumericColumnPlanFact,
|
|
||||||
makeNumericAvgRange,
|
|
||||||
SelectFromDictionary
|
|
||||||
} from '../../../components/Table'
|
|
||||||
import {
|
import {
|
||||||
calcAndUpdateStatsBySections,
|
calcAndUpdateStatsBySections,
|
||||||
makeFilterMinMaxFunction,
|
makeFilterMinMaxFunction,
|
||||||
@ -19,7 +13,7 @@ import { DrillParamsService, WellCompositeService } from '../../../services/api'
|
|||||||
import LoaderPortal from '../../../components/LoaderPortal'
|
import LoaderPortal from '../../../components/LoaderPortal'
|
||||||
import WellOperationsTable from '../../Cluster/WellOperationsTable'
|
import WellOperationsTable from '../../Cluster/WellOperationsTable'
|
||||||
import { invokeWebApiWrapperAsync } from '../../../components/factory'
|
import { invokeWebApiWrapperAsync } from '../../../components/factory'
|
||||||
import { dictionarySectionType, getByKeyOrReturnKey } from '../dictionary'
|
import { columns as paramsColumns } from '../WellDrillParams'
|
||||||
|
|
||||||
|
|
||||||
const filtersMinMax = [
|
const filtersMinMax = [
|
||||||
@ -45,18 +39,16 @@ export const WellCompositeSections = ({idWell, statsWells, selectedSections}) =>
|
|||||||
const [params, setParams] = useState([])
|
const [params, setParams] = useState([])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (selectedWellId > 0) {
|
if (isOpsModalVisible || selectedWellId <= 0) return
|
||||||
invokeWebApiWrapperAsync(
|
invokeWebApiWrapperAsync(
|
||||||
async () => {
|
async () => {
|
||||||
const operations = await getOperations(selectedWellId)
|
const { operations } = await getOperations(selectedWellId)
|
||||||
|
setWellOperations(operations)
|
||||||
setWellOperations(operations.operations)
|
|
||||||
},
|
},
|
||||||
setShowLoader,
|
setShowLoader,
|
||||||
`Не удалось загрузить операции по скважине '${selectedWellId}'`,
|
`Не удалось загрузить операции по скважине "${selectedWellId}"`,
|
||||||
)
|
)
|
||||||
}
|
}, [selectedWellId, isOpsModalVisible])
|
||||||
}, [selectedWellId])
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const rows = []
|
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 = {
|
const rowSelection = {
|
||||||
selectedRowKeys: selectedWellsKeys,
|
selectedRowKeys: selectedWellsKeys,
|
||||||
onChange: (keys, items) => invokeWebApiWrapperAsync(
|
onChange: (keys, items) => invokeWebApiWrapperAsync(
|
||||||
|
@ -10,6 +10,20 @@ import { EditableTable, SelectFromDictionary } from '../../components/Table'
|
|||||||
import { DrillParamsService } from '../../services/api'
|
import { DrillParamsService } from '../../services/api'
|
||||||
import { dictionarySectionType, getByKeyOrReturnKey } from './dictionary'
|
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}) => {
|
export const WellDrillParams = ({idWell}) => {
|
||||||
const [params, setParams] = useState([])
|
const [params, setParams] = useState([])
|
||||||
@ -26,21 +40,6 @@ export const WellDrillParams = ({idWell}) => {
|
|||||||
|
|
||||||
useEffect(updateParams, [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) => {
|
const onAdd = async (param) => {
|
||||||
param.idWell = idWell
|
param.idWell = idWell
|
||||||
await DrillParamsService.insert(idWell, param)
|
await DrillParamsService.insert(idWell, param)
|
||||||
|
Loading…
Reference in New Issue
Block a user