2021-07-28 17:45:41 +05:00
|
|
|
|
import LoaderPortal from '../components/LoaderPortal'
|
|
|
|
|
import { useState, useEffect } from "react";
|
2021-07-30 16:14:56 +05:00
|
|
|
|
import {makeColumn, makeColumnsPlanFact, RegExpIsFloat} from '../components/factory'
|
2021-08-11 17:39:27 +05:00
|
|
|
|
import {WellSectionService} from '../services/api'
|
2021-07-30 16:14:56 +05:00
|
|
|
|
import notify from '../components/notify'
|
|
|
|
|
import { EditableTable } from '../components/EditableTable';
|
2021-07-28 17:45:41 +05:00
|
|
|
|
|
|
|
|
|
const columns = [
|
2021-07-30 16:14:56 +05:00
|
|
|
|
makeColumn('Конструкция секции', 'sectionType', {editable:true}),
|
|
|
|
|
makeColumnsPlanFact('Глубина, м', 'wellDepth', {editable:true, formItemRules:[
|
|
|
|
|
{
|
|
|
|
|
required: true,
|
|
|
|
|
message: `Введите число`,
|
|
|
|
|
pattern: RegExpIsFloat
|
|
|
|
|
}]}),
|
|
|
|
|
makeColumnsPlanFact('Период, д', 'buildDays', {editable:true}),
|
|
|
|
|
makeColumnsPlanFact('Механическая скорость проходки, м/час', 'rateOfPenetration', {editable:true}),
|
|
|
|
|
makeColumnsPlanFact('Рейсовая скорость, м/час', 'routeSpeed', {editable:true}),
|
|
|
|
|
makeColumnsPlanFact('Скорость подъема КНБК', 'bhaUpSpeed', {editable:true}),
|
|
|
|
|
makeColumnsPlanFact('Скорость спуска КНБК', 'bhaDownSpeed', {editable:true}),
|
|
|
|
|
makeColumnsPlanFact('Скорость спуска обсадной колонны', 'casingDownSpeed', {editable:true}),
|
2021-07-28 17:45:41 +05:00
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
// const data = [{
|
2021-07-30 16:14:56 +05:00
|
|
|
|
// key:1,
|
2021-07-28 17:45:41 +05:00
|
|
|
|
// sectionType: 'загагулина',
|
|
|
|
|
// wellDepthPlan: 1,
|
|
|
|
|
// wellDepthFact: 1,
|
|
|
|
|
// buildDaysPlan: 1,
|
|
|
|
|
// buildDaysFact: 1,
|
|
|
|
|
// rateOfPenetrationPlan: 4,
|
|
|
|
|
// rateOfPenetrationFact: 3,
|
|
|
|
|
// routeSpeedPlan: 2,
|
|
|
|
|
// routeSpeedFact: 1,
|
|
|
|
|
// bhaUpSpeedPlan: 1,
|
|
|
|
|
// bhaUpSpeedFact: 1,
|
|
|
|
|
// bhaDownSpeedPlan: 1,
|
|
|
|
|
// bhaDownSpeedFact: 1,
|
|
|
|
|
// casingDownSpeedPlan: 1,
|
|
|
|
|
// casingDownSpeedFact: 1,
|
|
|
|
|
// }]
|
|
|
|
|
|
2021-07-30 16:14:56 +05:00
|
|
|
|
export default function WellStat({idWell}){
|
2021-07-28 17:45:41 +05:00
|
|
|
|
const [showLoader, setShowLoader] = useState(false)
|
2021-08-11 17:39:27 +05:00
|
|
|
|
const [data, setData] = useState({})
|
2021-07-30 16:14:56 +05:00
|
|
|
|
|
|
|
|
|
useEffect(()=>{
|
|
|
|
|
const update = async()=>{
|
|
|
|
|
setShowLoader(true)
|
|
|
|
|
try{
|
2021-08-11 17:39:27 +05:00
|
|
|
|
const data = await WellSectionService.getAll(idWell,0,1024)
|
2021-07-30 16:14:56 +05:00
|
|
|
|
setData(data);
|
|
|
|
|
} catch (ex) {
|
|
|
|
|
console.log(ex)
|
|
|
|
|
notify(`Не удалось загрузить секции по скважине "${idWell}"`, 'error')
|
2021-08-11 17:39:27 +05:00
|
|
|
|
} finally{
|
|
|
|
|
setShowLoader(false)
|
2021-07-30 16:14:56 +05:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
update();
|
|
|
|
|
} ,[idWell])
|
|
|
|
|
|
2021-08-02 11:09:55 +05:00
|
|
|
|
const onChange = (newData) =>{
|
|
|
|
|
setData(newData)
|
|
|
|
|
}
|
|
|
|
|
|
2021-07-28 17:45:41 +05:00
|
|
|
|
return(
|
|
|
|
|
<LoaderPortal show={showLoader}>
|
2021-07-30 16:14:56 +05:00
|
|
|
|
<EditableTable
|
|
|
|
|
columns={columns}
|
2021-08-11 17:39:27 +05:00
|
|
|
|
dataSource={data.items}
|
2021-07-30 16:14:56 +05:00
|
|
|
|
size={'small'}
|
|
|
|
|
bordered
|
|
|
|
|
pagination={false}
|
2021-08-02 11:09:55 +05:00
|
|
|
|
onChange={onChange}
|
|
|
|
|
onRowAdd={()=>{}}
|
|
|
|
|
onRowEdit={()=>{}}
|
|
|
|
|
onRowDelete={()=>{}}
|
2021-07-30 16:14:56 +05:00
|
|
|
|
/>
|
2021-07-28 17:45:41 +05:00
|
|
|
|
</LoaderPortal>)
|
|
|
|
|
}
|