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

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

View File

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