Добавлена страница РТК

This commit is contained in:
goodmice 2021-10-18 12:00:03 +05:00
parent 0f5a00041e
commit 5689700c6d
3 changed files with 104 additions and 1 deletions

View File

@ -157,6 +157,19 @@ export const makeNumericStartEnd = (
makeNumericColumn('конец', dataIndex + 'End', filters, filterDelegate, renderDelegate, width, makeNumericColumnOptions(fixed, dataIndex + 'End'))
])
export const makeNumericMinMax = (
title: string,
dataIndex: string,
fixed: number,
filters: object[],
filterDelegate: (key: string | number) => any,
renderDelegate: (_: any, row: object) => any,
width: string,
) => makeGroupColumn(title, [
makeNumericColumn('мин', dataIndex + 'Min', filters, filterDelegate, renderDelegate, width, makeNumericColumnOptions(fixed, dataIndex + 'Min')),
makeNumericColumn('макс', dataIndex + 'Max', filters, filterDelegate, renderDelegate, width, makeNumericColumnOptions(fixed, dataIndex + 'Max')),
])
export const makeNumericAvgRange = (
title: string,
dataIndex: string,

View File

@ -0,0 +1,76 @@
import { useState, useEffect } from 'react'
import {
makeColumn,
makeNumericMinMax
} from '../../components/Table'
import LoaderPortal from '../../components/LoaderPortal'
import { invokeWebApiWrapperAsync } from '../../components/factory'
import { EditableTable, SelectFromDictionary } from '../../components/Table'
import { DrillFlowChartService } from '../../services/api'
import { dictionarySectionType, getByKeyOrReturnKey } from './dictionary'
const columns = [
makeColumn('Конструкция секции','idWellSectionType', {
editable: true,
input: <SelectFromDictionary dictionary={dictionarySectionType}/>,
width: 160,
render: (_, record)=>getByKeyOrReturnKey(dictionarySectionType, record.idWellSectionType)
}),
makeNumericMinMax('Глубина', 'depth'),
makeNumericMinMax('Нагрузка', 'axialLoad'),
makeNumericMinMax('Давление', 'pressure'),
makeNumericMinMax('Момент на ВСП', 'rotorTorque'),
makeNumericMinMax('Обороты на ВСП', 'rotorSpeed'),
makeNumericMinMax('Расход', 'flow')
]
export const DrillProcessFlow = ({idWell}) => {
const [flows, setFlows] = useState([])
const [showLoader, setShowLoader] = useState(false)
const updateFlows = () => invokeWebApiWrapperAsync(
async () => {
const flows = await DrillFlowChartService.get(idWell)
setFlows(Array.isArray(flows) ? flows : [])
},
setShowLoader,
'Не удалось загрузить режимно-технологическую карту скважины'
)
useEffect(updateFlows, [idWell])
const onAdd = async (param) => {
param.idWell = idWell
await DrillFlowChartService.insert(idWell, param)
updateFlows()
}
const onEdit = async (param) => {
if (!param.id) return
param.idWell = idWell
await DrillFlowChartService.update(idWell, param.id, param)
updateFlows()
}
const onDelete = async (param) => {
if (!param.id) return
await DrillFlowChartService.delete(idWell, param.id)
updateFlows()
}
return (
<LoaderPortal show={showLoader}>
<EditableTable
size={'small'}
bordered
columns={columns}
dataSource={flows}
onRowAdd={onAdd}
onRowEdit={onEdit}
onRowDelete={onDelete}
pagination={false}
/>
</LoaderPortal>
)
}

View File

@ -1,12 +1,20 @@
import {Layout, Menu} from "antd";
import {Switch, Link, Route, Redirect, useParams, useHistory} from "react-router-dom";
import { DeploymentUnitOutlined, LineChartOutlined, BuildOutlined, TableOutlined, ControlOutlined } from "@ant-design/icons";
import {
BarChartOutlined,
BuildOutlined,
ControlOutlined,
DeploymentUnitOutlined,
LineChartOutlined,
TableOutlined,
} from "@ant-design/icons";
import { WellDrillParams } from './WellDrillParams'
import { WellSectionsStat } from './WellSectionsStat'
import { WellCompositeEditor } from './WellCompositeEditor'
import { WellOperationsEditor } from './WellOperationsEditor'
import { Tvd } from './Tvd'
import { ImportExportBar } from "./ImportExportBar";
import { DrillProcessFlow } from "./DrillProcessFlow";
const { Content } = Layout
@ -37,6 +45,9 @@ export default function WellOperations({idWell}) {
<Menu.Item key="fact" icon={<TableOutlined />}>
<Link to={`${rootPath}/fact`}>Факт</Link>
</Menu.Item>
<Menu.Item key="dfc" icon={<BarChartOutlined />}>
<Link to={`${rootPath}/dfc`}>РТК</Link>
</Menu.Item>
<Menu.Item key="params" icon={<ControlOutlined />}>
<Link to={`${rootPath}/params`}>Режимы</Link>
</Menu.Item>
@ -60,6 +71,9 @@ export default function WellOperations({idWell}) {
<Route path={`${rootPath}/fact`}>
<WellOperationsEditor idWell={idWell} idType={1}/>
</Route>
<Route path={`${rootPath}/dfc`}>
<DrillProcessFlow idWell={idWell} />
</Route>
<Route path={`${rootPath}/params`}>
<WellDrillParams idWell={idWell}/>
</Route>