forked from ddrilling/asb_cloud_front
WellStat редактируемое
This commit is contained in:
parent
f0e30a32f8
commit
5d18d73d28
@ -8,7 +8,7 @@ import Analysis from "../pages/Analysis";
|
|||||||
import WellAnalysis from "../pages/WellAnalysis";
|
import WellAnalysis from "../pages/WellAnalysis";
|
||||||
import TelemetryView from "../pages/TelemetryView";
|
import TelemetryView from "../pages/TelemetryView";
|
||||||
import MenuDocuments from "../components/MenuDocuments";
|
import MenuDocuments from "../components/MenuDocuments";
|
||||||
import WellStat from "./WellStat";
|
import WellStat from "./WellStat"
|
||||||
|
|
||||||
const { Content } = Layout
|
const { Content } = Layout
|
||||||
|
|
||||||
@ -83,7 +83,7 @@ export default function Well() {
|
|||||||
<Content className="site-layout-background">
|
<Content className="site-layout-background">
|
||||||
<Switch>
|
<Switch>
|
||||||
<Route path="/well/:id/stat">
|
<Route path="/well/:id/stat">
|
||||||
<WellStat/>
|
<WellStat idWell={id}/>
|
||||||
</Route>
|
</Route>
|
||||||
<Route path="/well/:id/archive">
|
<Route path="/well/:id/archive">
|
||||||
<Archive/>
|
<Archive/>
|
||||||
|
@ -1,44 +1,28 @@
|
|||||||
//import {useParams} from "react-router-dom";
|
|
||||||
//import {Link} from "react-router-dom";
|
|
||||||
import LoaderPortal from '../components/LoaderPortal'
|
import LoaderPortal from '../components/LoaderPortal'
|
||||||
import { useState, useEffect } from "react";
|
import { useState, useEffect } from "react";
|
||||||
// import {ClusterService} from '../services/api'
|
import {makeColumn, makeColumnsPlanFact, RegExpIsFloat} from '../components/factory'
|
||||||
// import notify from '../components/notify'
|
import {WellService} from '../services/api'
|
||||||
import {Table, Tag, Button} from 'antd';
|
import notify from '../components/notify'
|
||||||
|
import { EditableTable } from '../components/EditableTable';
|
||||||
const makeColumn = (title, key) => ({title: title, key: key, dataIndex: key,})
|
|
||||||
|
|
||||||
const makePlanFactColumns = (title, keyPlan, keyFact) =>
|
|
||||||
{
|
|
||||||
let keyPlanLocal = keyPlan
|
|
||||||
let keyFactLocal = keyFact
|
|
||||||
|
|
||||||
if(!keyFact){
|
|
||||||
keyPlanLocal = keyPlan + 'Plan'
|
|
||||||
keyFactLocal = keyPlan + 'Fact'
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
|
||||||
title: title,
|
|
||||||
children: [
|
|
||||||
makeColumn('план', keyPlanLocal),
|
|
||||||
makeColumn('факт', keyFactLocal),
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const columns = [
|
const columns = [
|
||||||
makeColumn('Конструкция секции', 'sectionType'),
|
makeColumn('Конструкция секции', 'sectionType', {editable:true}),
|
||||||
makePlanFactColumns('Глубина, м', 'wellDepth'),
|
makeColumnsPlanFact('Глубина, м', 'wellDepth', {editable:true, formItemRules:[
|
||||||
makePlanFactColumns('Период, д', 'buildDays'),
|
{
|
||||||
makePlanFactColumns('Механическая скорость проходки, м/час', 'rateOfPenetration'),
|
required: true,
|
||||||
makePlanFactColumns('Рейсовая скорость, м/час', 'routeSpeed'),
|
message: `Введите число`,
|
||||||
makePlanFactColumns('Скорость подъема КНБК', 'bhaUpSpeed'),
|
pattern: RegExpIsFloat
|
||||||
makePlanFactColumns('Скорость спуска КНБК', 'bhaDownSpeed'),
|
}]}),
|
||||||
makePlanFactColumns('Скорость спуска обсадной колонны', 'casingDownSpeed'),
|
makeColumnsPlanFact('Период, д', 'buildDays', {editable:true}),
|
||||||
|
makeColumnsPlanFact('Механическая скорость проходки, м/час', 'rateOfPenetration', {editable:true}),
|
||||||
|
makeColumnsPlanFact('Рейсовая скорость, м/час', 'routeSpeed', {editable:true}),
|
||||||
|
makeColumnsPlanFact('Скорость подъема КНБК', 'bhaUpSpeed', {editable:true}),
|
||||||
|
makeColumnsPlanFact('Скорость спуска КНБК', 'bhaDownSpeed', {editable:true}),
|
||||||
|
makeColumnsPlanFact('Скорость спуска обсадной колонны', 'casingDownSpeed', {editable:true}),
|
||||||
]
|
]
|
||||||
|
|
||||||
// const data = [{
|
// const data = [{
|
||||||
|
// key:1,
|
||||||
// sectionType: 'загагулина',
|
// sectionType: 'загагулина',
|
||||||
// wellDepthPlan: 1,
|
// wellDepthPlan: 1,
|
||||||
// wellDepthFact: 1,
|
// wellDepthFact: 1,
|
||||||
@ -56,17 +40,33 @@ const columns = [
|
|||||||
// casingDownSpeedFact: 1,
|
// casingDownSpeedFact: 1,
|
||||||
// }]
|
// }]
|
||||||
|
|
||||||
export default function WellStat({data}){
|
export default function WellStat({idWell}){
|
||||||
const [showLoader, setShowLoader] = useState(false)
|
const [showLoader, setShowLoader] = useState(false)
|
||||||
|
const [data, setData] = useState(null)
|
||||||
|
|
||||||
|
useEffect(()=>{
|
||||||
|
const update = async()=>{
|
||||||
|
setShowLoader(true)
|
||||||
|
try{
|
||||||
|
const data = await WellService.getSections(idWell)
|
||||||
|
setData(data);
|
||||||
|
} catch (ex) {
|
||||||
|
console.log(ex)
|
||||||
|
notify(`Не удалось загрузить секции по скважине "${idWell}"`, 'error')
|
||||||
|
}
|
||||||
|
setShowLoader(false)
|
||||||
|
}
|
||||||
|
update();
|
||||||
|
} ,[idWell])
|
||||||
|
|
||||||
return(
|
return(
|
||||||
<LoaderPortal show={showLoader}>
|
<LoaderPortal show={showLoader}>
|
||||||
<Table
|
<EditableTable
|
||||||
columns={columns}
|
columns={columns}
|
||||||
dataSource={data}
|
dataSource={data}
|
||||||
size={'small'}
|
size={'small'}
|
||||||
bordered
|
bordered
|
||||||
pagination={false}
|
pagination={false}
|
||||||
rowKey={(record) => record.sectionType}
|
/>
|
||||||
/>
|
|
||||||
</LoaderPortal>)
|
</LoaderPortal>)
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user