Страница переименована

This commit is contained in:
goodmice 2021-10-12 15:04:02 +05:00
parent fb364104f7
commit d777b02661
2 changed files with 17 additions and 16 deletions

View File

@ -8,13 +8,13 @@ import {
import LoaderPortal from '../../components/LoaderPortal'
import { invokeWebApiWrapperAsync } from '../../components/factory'
import { EditableTable, SelectFromDictionary } from '../../components/Table'
import { DrillingParamsService } from '../../services/api'
import { DrillParamsService } from '../../services/api'
import { dictionarySectionType, getByKeyOrReturnKey } from './dictionary'
const basePageSize = 160;
export const WellOpeationsParams = ({idWell}) => {
export const WellDrillParams = ({idWell}) => {
const [pageNumAndPageSize, setPageNumAndPageSize] = useState({current:1, pageSize:basePageSize})
const [paginationTotal, setPaginationTotal] = useState(0)
const [params, setParams] = useState([])
@ -24,7 +24,7 @@ export const WellOpeationsParams = ({idWell}) => {
async () => {
const skip = ((pageNumAndPageSize.current - 1) * pageNumAndPageSize.pageSize) || 0
const take = pageNumAndPageSize.pageSize
const paginatedParams = await DrillingParamsService.getParams(idWell, skip, take)
const paginatedParams = await DrillParamsService.getParams(idWell, skip, take)
const params = paginatedParams?.items ?? []
setParams(params)
const total = paginatedParams.count?? paginatedParams.items?.length ?? 0
@ -43,31 +43,31 @@ export const WellOpeationsParams = ({idWell}) => {
width:160,
render:(_, record)=>getByKeyOrReturnKey(dictionarySectionType, record.idWellSectionType)
}),
makeNumericStartEnd('Глубина', 'depth', true),
makeNumericAvgRange('Нагрузка', 'axial_load', true),
makeNumericAvgRange('Давление', 'pressure', true),
makeNumericAvgRange('Момент на ВПС', 'rotor_torque', true),
makeNumericAvgRange('Обороты на ВПС', 'rotor_speed', true),
makeNumericAvgRange('Расход', 'flow', true)
// makeNumericStartEnd('Глубина', 'depth'),
makeNumericAvgRange('Нагрузка', 'axialLoad'),
makeNumericAvgRange('Давление', 'pressure'),
makeNumericAvgRange('Момент на ВПС', 'topDriveTorque'),
makeNumericAvgRange('Обороты на ВПС', 'topDriveSpeed'),
makeNumericAvgRange('Расход', 'flow')
]
const onAdd = async (param) => {
if (!param.id) return
// TODO: Add row
await DrillingParamsService.insertRange(idWell, [param])
await DrillParamsService.saveDrillParams(idWell, param)
updatePrograms()
}
const onEdit = async (param) => {
if (!param.id) return
// TODO: Edit row
await DrillingParamsService.update(idWell, param.id, param)
await DrillParamsService.update(idWell, param.id, param)
updatePrograms()
}
const onDelete = async (param) => {
if (!param.id) return
await DrillingParamsService.delete(idWell, param.id)
await DrillParamsService.delete(idWell, param.id)
updatePrograms()
}
@ -78,7 +78,7 @@ export const WellOpeationsParams = ({idWell}) => {
bordered
columns={columns}
dataSource={params}
onRowAdd={onAdd}
//onRowAdd={onAdd}
onRowEdit={onEdit}
onRowDelete={onDelete}
pagination={{

View File

@ -1,6 +1,7 @@
import {Layout, Menu} from "antd";
import {Switch, Link, Route, Redirect, useParams, useHistory} from "react-router-dom";
import { FolderOutlined } from "@ant-design/icons";
import { WellDrillParams } from './WellDrillParams'
import { WellOperationsEditor } from './WellOperationsEditor'
import { WellSectionsStat } from './WellSectionsStat'
import { Tvd } from './Tvd'
@ -36,7 +37,7 @@ export default function WellOperations({idWell}) {
<Link to={`${rootPath}/fact`}>Факт</Link>
</Menu.Item>
<Menu.Item key={'modes'} icon={<FolderOutlined />}>
<Link to={`${rootPath}/modes`}>Режимы</Link>
<Link to={`${rootPath}/params`}>Режимы</Link>
</Menu.Item>
<ImportExportBar idWell={idWell} onImported={onImported}/>
</Menu>
@ -55,8 +56,8 @@ export default function WellOperations({idWell}) {
<Route path={`${rootPath}/fact`}>
<WellOperationsEditor idWell={idWell} idType={1}/>
</Route>
<Route path={`${rootPath}/modes`}>
<WellOpeationsParams idWell={idWell}/>
<Route path={`${rootPath}/params`}>
<WellDrillParams idWell={idWell}/>
</Route>
<Route path={rootPath}>
<Redirect to={`${rootPath}/plan`}/>