diff --git a/src/components/Table/index.tsx b/src/components/Table/index.tsx index 4db7c1f..1f2d4ea 100644 --- a/src/components/Table/index.tsx +++ b/src/components/Table/index.tsx @@ -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, diff --git a/src/pages/WellOperations/DrillProcessFlow.jsx b/src/pages/WellOperations/DrillProcessFlow.jsx new file mode 100644 index 0000000..a046117 --- /dev/null +++ b/src/pages/WellOperations/DrillProcessFlow.jsx @@ -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: , + 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 ( + + + + ) +} diff --git a/src/pages/WellOperations/index.jsx b/src/pages/WellOperations/index.jsx index cb5283d..389fb4d 100644 --- a/src/pages/WellOperations/index.jsx +++ b/src/pages/WellOperations/index.jsx @@ -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}) { }> Факт + }> + РТК + }> Режимы @@ -60,6 +71,9 @@ export default function WellOperations({idWell}) { + + +