forked from ddrilling/asb_cloud_front
Merge branch 'master' of https://bitbucket.org/frolovng/asb_cloud_front_react
This commit is contained in:
commit
40efe38210
@ -32,7 +32,7 @@
|
||||
"react_test": "react-scripts test",
|
||||
"eject": "react-scripts eject"
|
||||
},
|
||||
"proxy": "http://127.0.0.1:5000",
|
||||
"proxy": "http://localhost:5000",
|
||||
"eslintConfig": {
|
||||
"extends": [
|
||||
"react-app",
|
||||
|
@ -1,19 +1,10 @@
|
||||
import { useState } from 'react';
|
||||
import {Table, Input, Form, Popconfirm, Typography } from 'antd'
|
||||
import { makeColumn } from './factory'
|
||||
import { useState, useEffect } from 'react';
|
||||
import { useParams } from "react-router-dom";
|
||||
import { Table, InputNumber, Form, Popconfirm, Typography } from 'antd'
|
||||
import { makeColumn } from '../factory'
|
||||
import { FluidService } from '../../services/api/services/FluidService';
|
||||
import notify from "../notify"
|
||||
|
||||
const originData = [
|
||||
{
|
||||
key: '1', name: 'План', temperature: '', density: '', conditionalViscosity: '', r300: '', r600: '', r3r6: '', dnsDpa: '', plasticViscocity: '',
|
||||
snsDpa: '', r3r649С: '', dns49Cdpa: '', plasticViscocity49c: '', sns49Cdpa: '', mbt: '', sand: '', filter: '', crust: '', ktk: '', ph: '',
|
||||
hardness: '', chlorides: '', pf: '', mf: '', pm: '', fluidSolidPhase: '', grease: '', calciumCarbonate: ''
|
||||
},
|
||||
{
|
||||
key: '2', name: 'Факт', temperature: '', density: '', conditionalViscosity: '', r300: '', r600: '', r3r6: '', dnsDpa: '', plasticViscocity: '',
|
||||
snsDpa: '', r3r649С: '', dns49Cdpa: '', plasticViscocity49c: '', sns49Cdpa: '', mbt: '', sand: '', filter: '', crust: '', ktk: '', ph: '',
|
||||
hardness: '', chlorides: '', pf: '', mf: '', pm: '', fluidSolidPhase: '', grease: '', calciumCarbonate: ''
|
||||
}
|
||||
];
|
||||
|
||||
const EditableCell = ({
|
||||
editing,
|
||||
@ -34,14 +25,13 @@ const EditableCell = ({
|
||||
style={{ margin: 0 }}
|
||||
rules={[
|
||||
{
|
||||
type: 'number',
|
||||
required: true,
|
||||
message: '',
|
||||
pattern: '(-?[0-9]+\d*([.,]\d+)?)$|^(-?0[.,]\d*[0-9]+)$|^0$|^0.0$'
|
||||
//pattern: '^-?\d+(\.\d{1,2})?$'
|
||||
message: null
|
||||
},
|
||||
]}
|
||||
>
|
||||
<Input size="small" />
|
||||
<InputNumber size="small" style={{width:"auto"}} />
|
||||
</Form.Item>
|
||||
) : (
|
||||
children
|
||||
@ -53,11 +43,18 @@ const EditableCell = ({
|
||||
|
||||
|
||||
export function DrillingFluid() {
|
||||
const [form] = Form.useForm();
|
||||
const [data, setData] = useState(originData);
|
||||
const [editingKey, setEditingKey] = useState('');
|
||||
let {id} = useParams()
|
||||
|
||||
const isEditing = (row) => row.key === editingKey;
|
||||
const [form] = Form.useForm();
|
||||
const [editingKey, setEditingKey] = useState('');
|
||||
const [idCategory, setIdCategory] = useState(8);
|
||||
const [dataPlan, setDataPlan] = useState({})
|
||||
const [dataFact, setDataFact] = useState({})
|
||||
const [isUpdatingData, setIsUpdatingData] = useState(false)
|
||||
|
||||
const [loader, setLoader] = useState(false)
|
||||
|
||||
const isEditing = (row) => row?.key === editingKey;
|
||||
|
||||
const columns = [
|
||||
makeColumn('Наименование', 'name', { dataIndex: 'name', align: 'center', className: 'small-font'}),
|
||||
@ -82,9 +79,12 @@ export function DrillingFluid() {
|
||||
makeColumn('pH', 'ph', { dataIndex: 'ph', align: 'center', className: 'small-font', editable: true}),
|
||||
makeColumn('Жесткость, мг/л', 'hardness', { dataIndex: 'hardness', align: 'center', className: 'small-font', editable: true}),
|
||||
makeColumn('Хлориды, мг/л', 'chlorides', { dataIndex: 'chlorides', align: 'center', className: 'small-font', editable: true}),
|
||||
makeColumn('PF', 'pf', { dataIndex: 'pf', align: 'center', className: 'small-font', editable: true}),
|
||||
makeColumn('Mf', 'mf', { dataIndex: 'mf', align: 'center', className: 'small-font', editable: true}),
|
||||
makeColumn('Pm', 'pm', { dataIndex: 'pm', align: 'center', className: 'small-font', editable: true}),
|
||||
makeColumn('PF', 'pf', { dataIndex: 'pf', align: 'center', className: 'small-font',
|
||||
render: text => <span style={{marginLeft: '12px', marginRight: '12px'}}>{text}</span>, editable: true}),
|
||||
makeColumn('Mf', 'mf', { dataIndex: 'mf', align: 'center', className: 'small-font',
|
||||
render: text => <span style={{marginLeft: '12px', marginRight: '12px'}}>{text}</span>, editable: true}),
|
||||
makeColumn('Pm', 'pm', { dataIndex: 'pm', align: 'center', className: 'small-font',
|
||||
render: text => <span style={{marginLeft: '12px', marginRight: '12px'}}>{text}</span>, editable: true}),
|
||||
makeColumn('Твердая фаза раствора, %', 'fluidSolidPhase', { dataIndex: 'fluidSolidPhase', align: 'center', className: 'small-font', editable: true}),
|
||||
makeColumn('Смазка, %', 'grease', { dataIndex: 'grease', align: 'center', className: 'small-font', editable: true}),
|
||||
makeColumn('Карбонат кальция, кг/м³', 'calciumCarbonate', { dataIndex: 'calciumCarbonate', align: 'center', className: 'small-font', editable: true}),
|
||||
@ -99,8 +99,7 @@ export function DrillingFluid() {
|
||||
return editable ? (
|
||||
<span>
|
||||
<a
|
||||
href="javascript:;"
|
||||
onClick={() => save(row)}
|
||||
onClick={() => form.submit()}
|
||||
style={{ marginRight: 8 }}
|
||||
>
|
||||
Сохранить
|
||||
@ -118,6 +117,38 @@ export function DrillingFluid() {
|
||||
}
|
||||
];
|
||||
|
||||
useEffect(() => {
|
||||
const update = async () => {
|
||||
setLoader(true)
|
||||
|
||||
try {
|
||||
let response = await FluidService.get(id, 8)
|
||||
response.key = 8
|
||||
response.name = 'План'
|
||||
setDataPlan(response)
|
||||
}
|
||||
catch (ex) {
|
||||
notify(`Не удалось загрузить плановые данные бурового раствора по скважине "${id}"`, 'error')
|
||||
console.log(ex)
|
||||
}
|
||||
|
||||
try {
|
||||
let response = await FluidService.get(id, 9)
|
||||
response.key = 9
|
||||
response.name = 'Факт'
|
||||
setDataFact(response)
|
||||
}
|
||||
catch (ex) {
|
||||
notify(`Не удалось загрузить фактические данные бурового раствора по скважине "${id}"`, 'error')
|
||||
console.log(ex)
|
||||
}
|
||||
|
||||
setIsUpdatingData(false)
|
||||
setLoader(false)
|
||||
}
|
||||
update()
|
||||
}, [isUpdatingData])
|
||||
|
||||
const mergedColumns = columns.map((col) => {
|
||||
if (!col.editable) {
|
||||
return col;
|
||||
@ -135,6 +166,7 @@ export function DrillingFluid() {
|
||||
});
|
||||
|
||||
const edit = (row) => {
|
||||
setIdCategory(row.key)
|
||||
form.setFieldsValue({
|
||||
...row,
|
||||
});
|
||||
@ -145,30 +177,55 @@ export function DrillingFluid() {
|
||||
setEditingKey('');
|
||||
};
|
||||
|
||||
const save = async (row) => {
|
||||
console.log(row)
|
||||
try {
|
||||
// const row = await form.validateFields();
|
||||
// const newData = [...data];
|
||||
// const index = newData.findIndex((item) => key === item.key);
|
||||
const save = async (formData) => {
|
||||
|
||||
// if (index > -1) {
|
||||
// const item = newData[index];
|
||||
// newData.splice(index, 1, { ...item, ...row });
|
||||
// setData(newData);
|
||||
// setEditingKey('');
|
||||
// } else {
|
||||
// newData.push(row);
|
||||
// setData(newData);
|
||||
// setEditingKey('');
|
||||
// }
|
||||
const params = {
|
||||
key: form.getFieldValue('key'),
|
||||
name: idCategory === 8 ? 'План' : 'Факт',
|
||||
temperature: form.getFieldValue('temperature'),
|
||||
density: form.getFieldValue('density'),
|
||||
conditionalViscosity: form.getFieldValue('conditionalViscosity'),
|
||||
r300: form.getFieldValue('r300'),
|
||||
r600: form.getFieldValue('r600'),
|
||||
r3r6: form.getFieldValue('r3r6'),
|
||||
dnsDpa: form.getFieldValue('dnsDpa'),
|
||||
plasticViscocity: form.getFieldValue('plasticViscocity'),
|
||||
snsDpa: form.getFieldValue('snsDpa'),
|
||||
r3r649С: form.getFieldValue('r3r649С'),
|
||||
dns49Cdpa: form.getFieldValue('dns49Cdpa'),
|
||||
plasticViscocity49c: form.getFieldValue('plasticViscocity49c'),
|
||||
sns49Cdpa: form.getFieldValue('sns49Cdpa'),
|
||||
mbt: form.getFieldValue('mbt'),
|
||||
sand: form.getFieldValue('sand'),
|
||||
filtering: form.getFieldValue('filtering'),
|
||||
crust: form.getFieldValue('crust'),
|
||||
ktk: form.getFieldValue('ktk'),
|
||||
ph: form.getFieldValue('ph'),
|
||||
hardness: form.getFieldValue('hardness'),
|
||||
chlorides: form.getFieldValue('chlorides'),
|
||||
pf: form.getFieldValue('pf'),
|
||||
mf: form.getFieldValue('mf'),
|
||||
pm: form.getFieldValue('pm'),
|
||||
fluidSolidPhase: form.getFieldValue('fluidSolidPhase'),
|
||||
grease: form.getFieldValue('grease'),
|
||||
calciumCarbonate: form.getFieldValue('calciumCarbonate')
|
||||
}
|
||||
|
||||
try {
|
||||
setLoader(true)
|
||||
await FluidService.put(`${id}`, idCategory, params)
|
||||
|
||||
setIsUpdatingData(true)
|
||||
setLoader(false)
|
||||
|
||||
setEditingKey('')
|
||||
} catch (errInfo) {
|
||||
//console.log('Validate Failed:', errInfo);
|
||||
console.log('Validate Failed:', errInfo);
|
||||
}
|
||||
};
|
||||
|
||||
return (<>
|
||||
<Form form={form} component={false}>
|
||||
<Form form={form} component={false} onFinish={save}>
|
||||
<Table
|
||||
components={{
|
||||
body: {
|
||||
@ -176,12 +233,18 @@ export function DrillingFluid() {
|
||||
},
|
||||
}}
|
||||
columns={mergedColumns}
|
||||
dataSource={data}
|
||||
dataSource={[dataPlan, dataFact]}
|
||||
size={'small'}
|
||||
bordered={true}
|
||||
pagination={false}
|
||||
/>
|
||||
</Form>
|
||||
<div> </div>
|
||||
<p style={{textAlign: "right"}}>
|
||||
Дата последнего обновления:
|
||||
<b>План:</b> <b>{new Date(dataPlan?.lastUpdate).toLocaleString()}</b>
|
||||
<b>Факт:</b> <b>{new Date(dataFact?.lastUpdate).toLocaleString()}</b>
|
||||
</p>
|
||||
</>
|
||||
)
|
||||
}
|
@ -1,13 +1,10 @@
|
||||
import { useState } from 'react';
|
||||
import {Table, Input, Form, Popconfirm, Typography } from 'antd'
|
||||
import { makeColumn } from './factory'
|
||||
import { useState, useEffect } from 'react';
|
||||
import { useParams } from "react-router-dom";
|
||||
import { Table, InputNumber, Input, Form, Popconfirm, Typography } from 'antd'
|
||||
import { makeColumn } from '../factory'
|
||||
import { MudDiagramService } from '../../services/api/services/MudDiagramService'
|
||||
import notify from "../notify"
|
||||
|
||||
const originData = [
|
||||
{
|
||||
key: '1', probeNumber: '', probeExtractionDepth: '', sandstone: '', siltstone: '', argillit: '', brokenArgillit: '', coal: '', sand: '', clay: '',
|
||||
camstone: '', cement: '', summary: '', drillingMud: '', sludge: '', sludge: '', maxSum: '', methan: '', ethan: '', propan: '', butan: '', pentan: ''
|
||||
}
|
||||
]
|
||||
|
||||
const EditableCell = ({
|
||||
editing,
|
||||
@ -19,6 +16,8 @@ const EditableCell = ({
|
||||
children,
|
||||
...restProps
|
||||
}) => {
|
||||
const inputNumber = <InputNumber size="small" style={{width:"auto"}} />
|
||||
const input = <Input size="small" style={{width:"auto"}} />
|
||||
return (
|
||||
<td {...restProps} style={{paddingLeft: 2, paddingRight: 2}}>
|
||||
<div style={{width: '100%', display: 'flex', justifyContent: 'center'}}>
|
||||
@ -29,12 +28,11 @@ const EditableCell = ({
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
message: '',
|
||||
pattern: '(-?[1-9]+\d*([.,]\d+)?)$|^(-?0[.,]\d*[1-9]+)$|^0$|^0.0$'
|
||||
message: ''
|
||||
},
|
||||
]}
|
||||
>
|
||||
<Input size="small" />
|
||||
{(dataIndex === 'preliminaryConclusion' || dataIndex === 'summary') ? input : inputNumber }
|
||||
</Form.Item>
|
||||
) : (
|
||||
children
|
||||
@ -45,9 +43,14 @@ const EditableCell = ({
|
||||
};
|
||||
|
||||
export function SludgeDiagram() {
|
||||
let {id} = useParams()
|
||||
|
||||
const [form] = Form.useForm();
|
||||
const [data, setData] = useState(originData);
|
||||
const [editingKey, setEditingKey] = useState('');
|
||||
const [data, setData] = useState({})
|
||||
const [isUpdatingData, setIsUpdatingData] = useState(false)
|
||||
|
||||
const [loader, setLoader] = useState(false)
|
||||
|
||||
const isEditing = (row) => row.key === editingKey;
|
||||
|
||||
@ -85,7 +88,7 @@ export function SludgeDiagram() {
|
||||
children: [
|
||||
makeColumn('Сумма УВ мах. (абс%)', 'maxSum', { dataIndex: 'maxSum', align: 'center', className: 'lightpurple-background', editable: true}),
|
||||
makeColumn('С1 метан (отн%)', 'methane', { dataIndex: 'methane', align: 'center', className: 'lightpurple-background', editable: true}),
|
||||
makeColumn('С2 этан (отн%)', 'ethan', { dataIndex: 'ethan', align: 'center', className: 'lightpurple-background', editable: true}),
|
||||
makeColumn('С2 этан (отн%)', 'ethane', { dataIndex: 'ethane', align: 'center', className: 'lightpurple-background', editable: true}),
|
||||
makeColumn('С3 пропан (отн%)', 'propane', { dataIndex: 'propane', align: 'center', className: 'lightpurple-background', editable: true}),
|
||||
makeColumn('С4 бутан (отн%)', 'butane', { dataIndex: 'butane', align: 'center', className: 'lightpurple-background', editable: true}),
|
||||
makeColumn('С5 пентан (отн%)', 'pentane', { dataIndex: 'pentane', align: 'center', className: 'lightpurple-background', editable: true})
|
||||
@ -104,7 +107,6 @@ export function SludgeDiagram() {
|
||||
return editable ? (
|
||||
<span>
|
||||
<a
|
||||
href="javascript:;"
|
||||
onClick={() => save(row.key)}
|
||||
style={{ marginRight: 8 }}
|
||||
>
|
||||
@ -123,6 +125,26 @@ export function SludgeDiagram() {
|
||||
}
|
||||
];
|
||||
|
||||
useEffect(() => {
|
||||
const update = async () => {
|
||||
setLoader(true)
|
||||
|
||||
try {
|
||||
let response = await MudDiagramService.get(id, 10)
|
||||
response.key = 10
|
||||
setData(response)
|
||||
}
|
||||
catch (ex) {
|
||||
notify(`Не удалось загрузить данные шламограммы по скважине "${id}"`, 'error')
|
||||
console.log(ex)
|
||||
}
|
||||
|
||||
setIsUpdatingData(false)
|
||||
setLoader(false)
|
||||
}
|
||||
update()
|
||||
}, [isUpdatingData])
|
||||
|
||||
const mapColumns = (col) => {
|
||||
if(col.children)
|
||||
col.children = col.children.map(mapColumns)
|
||||
@ -155,29 +177,49 @@ export function SludgeDiagram() {
|
||||
setEditingKey('');
|
||||
};
|
||||
|
||||
const save = async (key) => {
|
||||
try {
|
||||
const row = await form.validateFields();
|
||||
const newData = [...data];
|
||||
const index = newData.findIndex((item) => key === item.key);
|
||||
const save = async (formData) => {
|
||||
|
||||
if (index > -1) {
|
||||
const item = newData[index];
|
||||
newData.splice(index, 1, { ...item, ...row });
|
||||
setData(newData);
|
||||
setEditingKey('');
|
||||
} else {
|
||||
newData.push(row);
|
||||
setData(newData);
|
||||
setEditingKey('');
|
||||
}
|
||||
const params = {
|
||||
key: 10,
|
||||
probeNumber: form.getFieldValue('probeNumber'),
|
||||
probeExtractionDepth: form.getFieldValue('probeExtractionDepth'),
|
||||
sandstone: form.getFieldValue('sandstone'),
|
||||
siltstone: form.getFieldValue('siltstone'),
|
||||
argillit: form.getFieldValue('argillit'),
|
||||
brokenArgillit: form.getFieldValue('brokenArgillit'),
|
||||
coal: form.getFieldValue('coal'),
|
||||
sand: form.getFieldValue('sand'),
|
||||
clay: form.getFieldValue('clay'),
|
||||
camstone: form.getFieldValue('camstone'),
|
||||
cement: form.getFieldValue('cement'),
|
||||
summary: form.getFieldValue('summary'),
|
||||
drillingMud: form.getFieldValue('drillingMud'),
|
||||
sludge: form.getFieldValue('sludge'),
|
||||
maxSum: form.getFieldValue('maxSum'),
|
||||
methane: form.getFieldValue('methane'),
|
||||
ethane: form.getFieldValue('ethane'),
|
||||
propane: form.getFieldValue('propane'),
|
||||
butane: form.getFieldValue('butane'),
|
||||
pentane: form.getFieldValue('pentane'),
|
||||
mechanicalSpeed: form.getFieldValue('mechanicalSpeed'),
|
||||
preliminaryConclusion: form.getFieldValue('preliminaryConclusion'),
|
||||
}
|
||||
|
||||
try {
|
||||
setLoader(true)
|
||||
await MudDiagramService.put(`${id}`, 10, params)
|
||||
|
||||
setIsUpdatingData(true)
|
||||
setLoader(false)
|
||||
|
||||
setEditingKey('')
|
||||
} catch (errInfo) {
|
||||
console.log('Validate Failed:', errInfo);
|
||||
}
|
||||
};
|
||||
|
||||
return (<>
|
||||
<Form form={form} component={false}>
|
||||
<Form form={form} component={false} onFinish={save}>
|
||||
<Table
|
||||
components={{
|
||||
body: {
|
||||
@ -185,12 +227,16 @@ export function SludgeDiagram() {
|
||||
},
|
||||
}}
|
||||
columns={mergedColumns}
|
||||
dataSource={data}
|
||||
dataSource={[data]}
|
||||
size={'small'}
|
||||
bordered={true}
|
||||
pagination={false}
|
||||
/>
|
||||
</Form>
|
||||
<div> </div>
|
||||
<p style={{textAlign: "right"}}>
|
||||
Дата последнего обновления: <b>{new Date(data?.lastUpdate).toLocaleString()}</b>
|
||||
</p>
|
||||
</>
|
||||
)
|
||||
}
|
@ -1,14 +1,10 @@
|
||||
import { useState } from 'react'
|
||||
import {Table, Input, Form, Popconfirm, Typography } from 'antd'
|
||||
import { makeColumn } from './factory'
|
||||
import { useState, useEffect } from 'react'
|
||||
import { useParams } from "react-router-dom";
|
||||
import {Table, InputNumber, Form, Popconfirm, Typography } from 'antd'
|
||||
import { makeColumn } from '../factory'
|
||||
import { NnbDataService } from '../../services/api/services/NnbDataService';
|
||||
import notify from "../notify"
|
||||
|
||||
const originData = [
|
||||
{
|
||||
key: '1', depth: '', zenithAngle: '', magneticAzimuth: '', trueAzimuth: '', directAzimuth: '', verticalDepth: '', absoluteMark: '', localNorthOffset: '',
|
||||
localEastOffset: '', outFallOffset: '', offsetAzimuth: '', areaIntensity: '', offsetStopAngle: '', zenithIntensity: '', comment: '', depthPlanFactDifference: '',
|
||||
distancePlanFactDifference: ''
|
||||
}
|
||||
]
|
||||
|
||||
const EditableCell = ({
|
||||
editing,
|
||||
@ -30,12 +26,11 @@ const EditableCell = ({
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
message: '',
|
||||
pattern: '(-?[1-9]+\d*([.,]\d+)?)$|^(-?0[.,]\d*[1-9]+)$|^0$|^0.0$'
|
||||
message: ''
|
||||
},
|
||||
]}
|
||||
>
|
||||
<Input size="small" />
|
||||
<InputNumber size="small" style={{width:"auto"}} />
|
||||
</Form.Item>
|
||||
) : (
|
||||
children
|
||||
@ -46,17 +41,22 @@ const EditableCell = ({
|
||||
};
|
||||
|
||||
export function Nnb() {
|
||||
let {id} = useParams()
|
||||
|
||||
const [form] = Form.useForm();
|
||||
const [data, setData] = useState(originData);
|
||||
const [editingKey, setEditingKey] = useState('');
|
||||
const [data, setData] = useState({})
|
||||
const [isUpdatingData, setIsUpdatingData] = useState(false)
|
||||
|
||||
const [loader, setLoader] = useState(false)
|
||||
|
||||
const isEditing = (row) => row.key === editingKey;
|
||||
|
||||
const columns = [
|
||||
makeColumn('Глубина по стволу, м', 'depth', { dataIndex: 'depth', align: 'center', editable: true}),
|
||||
makeColumn('Зенитный угол, град', 'zenithAngle', { dataIndex: 'zenithAngle', align: 'center', editable: true}),
|
||||
makeColumn('Азимут магнитный, град', 'trueAzimuth', { dataIndex: 'trueAzimuth', align: 'center', editable: true}),
|
||||
makeColumn('Азимут истинный, град', 'conditionalViscosity', { dataIndex: 'conditionalViscosity', align: 'center', editable: true}),
|
||||
makeColumn('Азимут магнитный, град', 'magneticAzimuth', { dataIndex: 'magneticAzimuth', align: 'center', editable: true}),
|
||||
makeColumn('Азимут истинный, град', 'trueAzimuth', { dataIndex: 'trueAzimuth', align: 'center', editable: true}),
|
||||
makeColumn('Азимут дирекц., град', 'directAzimuth', { dataIndex: 'directAzimuth', align: 'center', editable: true}),
|
||||
makeColumn('Глубина по вертикали, м', 'verticalDepth', { dataIndex: 'verticalDepth', align: 'center', editable: true}),
|
||||
makeColumn('Абсолютная отметка, м', 'absoluteMark', { dataIndex: 'absoluteMark', align: 'center', editable: true}),
|
||||
@ -81,7 +81,6 @@ export function Nnb() {
|
||||
return editable ? (
|
||||
<span>
|
||||
<a
|
||||
href="javascript:;"
|
||||
onClick={() => save(row.key)}
|
||||
style={{ marginRight: 8 }}
|
||||
>
|
||||
@ -100,6 +99,26 @@ export function Nnb() {
|
||||
}
|
||||
];
|
||||
|
||||
useEffect(() => {
|
||||
const update = async () => {
|
||||
setLoader(true)
|
||||
|
||||
try {
|
||||
let response = await NnbDataService.get(id,11)
|
||||
response.key = 11
|
||||
setData(response)
|
||||
}
|
||||
catch (ex) {
|
||||
notify(`Не удалось загрузить данные ННБ по скважине "${id}"`, 'error')
|
||||
console.log(ex)
|
||||
}
|
||||
|
||||
setIsUpdatingData(false)
|
||||
setLoader(false)
|
||||
}
|
||||
update()
|
||||
}, [isUpdatingData])
|
||||
|
||||
const mergedColumns = columns.map((col) => {
|
||||
if (!col.editable) {
|
||||
return col;
|
||||
@ -127,29 +146,44 @@ export function Nnb() {
|
||||
setEditingKey('');
|
||||
};
|
||||
|
||||
const save = async (key) => {
|
||||
try {
|
||||
const row = await form.validateFields();
|
||||
const newData = [...data];
|
||||
const index = newData.findIndex((item) => key === item.key);
|
||||
const save = async (formData) => {
|
||||
const params = {
|
||||
key: 11,
|
||||
depth: form.getFieldValue('depth'),
|
||||
zenithAngle: form.getFieldValue('zenithAngle'),
|
||||
magneticAzimuth: form.getFieldValue('magneticAzimuth'),
|
||||
trueAzimuth: form.getFieldValue('trueAzimuth'),
|
||||
directAzimuth: form.getFieldValue('directAzimuth'),
|
||||
verticalDepth: form.getFieldValue('verticalDepth'),
|
||||
absoluteMark: form.getFieldValue('absoluteMark'),
|
||||
localNorthOffset: form.getFieldValue('localNorthOffset'),
|
||||
localEastOffset: form.getFieldValue('localEastOffset'),
|
||||
outFallOffset: form.getFieldValue('outFallOffset'),
|
||||
offsetAzimuth: form.getFieldValue('offsetAzimuth'),
|
||||
areaIntensity: form.getFieldValue('areaIntensity'),
|
||||
offsetStopAngle: form.getFieldValue('offsetStopAngle'),
|
||||
zenithIntensity: form.getFieldValue('zenithIntensity'),
|
||||
comment: form.getFieldValue('comment'),
|
||||
depthPlanFactDifference: form.getFieldValue('depthPlanFactDifference'),
|
||||
distancePlanFactDifference: form.getFieldValue('distancePlanFactDifference')
|
||||
}
|
||||
|
||||
if (index > -1) {
|
||||
const item = newData[index];
|
||||
newData.splice(index, 1, { ...item, ...row });
|
||||
setData(newData);
|
||||
setEditingKey('');
|
||||
} else {
|
||||
newData.push(row);
|
||||
setData(newData);
|
||||
setEditingKey('');
|
||||
}
|
||||
try {
|
||||
setLoader(true)
|
||||
await NnbDataService.put(`${id}`, 11, params)
|
||||
|
||||
setIsUpdatingData(true)
|
||||
setLoader(false)
|
||||
|
||||
setEditingKey('')
|
||||
} catch (errInfo) {
|
||||
console.log('Validate Failed:', errInfo);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
return (<>
|
||||
<Form form={form} component={false}>
|
||||
<Form form={form} component={false} onFinish={save}>
|
||||
<Table
|
||||
components={{
|
||||
body: {
|
||||
@ -157,11 +191,15 @@ export function Nnb() {
|
||||
},
|
||||
}}
|
||||
columns={mergedColumns}
|
||||
dataSource={data}
|
||||
dataSource={[data]}
|
||||
size={'small'}
|
||||
bordered={true}
|
||||
pagination={false}
|
||||
/>
|
||||
</Form>
|
||||
<div> </div>
|
||||
<p style={{textAlign: "right"}}>
|
||||
Дата последнего обновления: <b>{new Date(data?.lastUpdate).toLocaleString()}</b>
|
||||
</p>
|
||||
</>)
|
||||
}
|
@ -1,16 +1,18 @@
|
||||
import {Button, Modal, Checkbox } from "antd";
|
||||
import {DrillingFluid} from "../components/DrillingFluid";
|
||||
import {useState} from "react";
|
||||
import {SludgeDiagram} from "../components/SludgeDiagram";
|
||||
import {Nnb} from "../components/Nnb"
|
||||
import {DrillingFluid} from "../components/modalWindows/DrillingFluid";
|
||||
import {useState, useEffect} from "react";
|
||||
import {SludgeDiagram} from "../components/modalWindows/MudDiagram";
|
||||
import {Nnb} from "../components/modalWindows/Nnb"
|
||||
import Disposition from "../components/Disposition";
|
||||
|
||||
|
||||
export default function LastData() {
|
||||
|
||||
const [tableVisible, setCementTableVisible] = useState(false)
|
||||
const [tableSludgeVisible, setTableSludgeVisible] = useState(false)
|
||||
const [tableNNBVisible, setTableNNBVisible] = useState(false)
|
||||
const [dispositionVisible, setDispositionVisible] = useState(false)
|
||||
const [loader, setLoader] = useState(false)
|
||||
|
||||
return (
|
||||
<>
|
||||
@ -31,8 +33,6 @@ export default function LastData() {
|
||||
]}
|
||||
>
|
||||
<DrillingFluid/>
|
||||
<div> </div>
|
||||
<p style={{textAlign: "right"}}><b>{new Date().toLocaleString()}</b></p>
|
||||
</Modal>
|
||||
<Button type="primary" onClick={() => setTableSludgeVisible(true)} style={{marginLeft: "5px"}}>
|
||||
Шламограмма
|
||||
@ -50,8 +50,6 @@ export default function LastData() {
|
||||
]}
|
||||
>
|
||||
<SludgeDiagram/>
|
||||
<div> </div>
|
||||
<p style={{textAlign: "right"}}><b>{new Date().toLocaleString()}</b></p>
|
||||
</Modal>
|
||||
<Button type="primary" onClick={() => setTableNNBVisible(true)} style={{marginLeft: "5px"}}>
|
||||
ННБ
|
||||
@ -69,8 +67,6 @@ export default function LastData() {
|
||||
]}
|
||||
>
|
||||
<Nnb/>
|
||||
<div> </div>
|
||||
<p style={{textAlign: "right"}}><b>{new Date().toLocaleString()}</b></p>
|
||||
</Modal>
|
||||
<Button type="primary" onClick={() => setDispositionVisible(true)} style={{marginLeft: "5px"}}>
|
||||
Распоряжение
|
||||
|
@ -14,8 +14,11 @@ export type { DepositDto } from './models/DepositDto';
|
||||
export type { EventDto } from './models/EventDto';
|
||||
export type { FilePropertiesDto } from './models/FilePropertiesDto';
|
||||
export type { FilePropertiesDtoPaginationContainer } from './models/FilePropertiesDtoPaginationContainer';
|
||||
export type { FluidDataDto } from './models/FluidDataDto';
|
||||
export type { MessageDto } from './models/MessageDto';
|
||||
export type { MessageDtoPaginationContainer } from './models/MessageDtoPaginationContainer';
|
||||
export type { MudDiagramDataDto } from './models/MudDiagramDataDto';
|
||||
export type { NnbDataDto } from './models/NnbDataDto';
|
||||
export type { TelemetryInfoDto } from './models/TelemetryInfoDto';
|
||||
export type { TelemetryMessageDto } from './models/TelemetryMessageDto';
|
||||
export type { TelemetryOperationDto } from './models/TelemetryOperationDto';
|
||||
@ -36,7 +39,11 @@ export { ClusterService } from './services/ClusterService';
|
||||
export { DataService } from './services/DataService';
|
||||
export { DepositService } from './services/DepositService';
|
||||
export { FileService } from './services/FileService';
|
||||
export { FluidService } from './services/FluidService';
|
||||
export { MessageService } from './services/MessageService';
|
||||
export { MudDiagramService } from './services/MudDiagramService';
|
||||
export { NnbDataService } from './services/NnbDataService';
|
||||
export { ReportService } from './services/ReportService';
|
||||
export { TelemetryService } from './services/TelemetryService';
|
||||
export { WellSectionService } from './services/WellSectionService';
|
||||
export { WellService } from './services/WellService';
|
||||
|
35
src/services/api/models/FluidDataDto.ts
Normal file
35
src/services/api/models/FluidDataDto.ts
Normal file
@ -0,0 +1,35 @@
|
||||
/* istanbul ignore file */
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
|
||||
export type FluidDataDto = {
|
||||
key?: number;
|
||||
name?: string | null;
|
||||
temperature?: number;
|
||||
density?: number;
|
||||
conditionalViscosity?: number;
|
||||
r300?: number;
|
||||
r600?: number;
|
||||
r3r6?: number;
|
||||
dnsDpa?: number;
|
||||
plasticViscocity?: number;
|
||||
snsDpa?: number;
|
||||
'r3r649С'?: number;
|
||||
dns49Cdpa?: number;
|
||||
plasticViscocity49c?: number;
|
||||
sns49Cdpa?: number;
|
||||
mbt?: number;
|
||||
sand?: number;
|
||||
filtering?: number;
|
||||
crust?: number;
|
||||
ktk?: number;
|
||||
ph?: number;
|
||||
hardness?: number;
|
||||
chlorides?: number;
|
||||
pf?: number;
|
||||
mf?: number;
|
||||
pm?: number;
|
||||
fluidSolidPhase?: number;
|
||||
grease?: number;
|
||||
calciumCarbonate?: number;
|
||||
}
|
28
src/services/api/models/MudDiagramDataDto.ts
Normal file
28
src/services/api/models/MudDiagramDataDto.ts
Normal file
@ -0,0 +1,28 @@
|
||||
/* istanbul ignore file */
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
|
||||
export type MudDiagramDataDto = {
|
||||
probeNumber?: number;
|
||||
probeExtractionDepth?: number;
|
||||
sandstone?: number;
|
||||
siltstone?: number;
|
||||
argillit?: number;
|
||||
brokenArgillit?: number;
|
||||
coal?: number;
|
||||
sand?: number;
|
||||
clay?: number;
|
||||
camstone?: number;
|
||||
cement?: number;
|
||||
summary?: number;
|
||||
drillingMud?: number;
|
||||
sludge?: number;
|
||||
maxSum?: number;
|
||||
methane?: number;
|
||||
ethan?: number;
|
||||
propane?: number;
|
||||
butane?: number;
|
||||
pentane?: number;
|
||||
mechanicalSpeed?: number;
|
||||
preliminaryConclusion?: number;
|
||||
}
|
23
src/services/api/models/NnbDataDto.ts
Normal file
23
src/services/api/models/NnbDataDto.ts
Normal file
@ -0,0 +1,23 @@
|
||||
/* istanbul ignore file */
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
|
||||
export type NnbDataDto = {
|
||||
depth?: number;
|
||||
zenithAngle?: number;
|
||||
trueAzimuth?: number;
|
||||
conditionalViscosity?: number;
|
||||
directAzimuth?: number;
|
||||
verticalDepth?: number;
|
||||
absoluteMark?: number;
|
||||
localNorthOffset?: number;
|
||||
localEastOffset?: number;
|
||||
outFallOffset?: number;
|
||||
offsetAzimuth?: number;
|
||||
areaIntensity?: number;
|
||||
offsetStopAngle?: number;
|
||||
zenithIntensity?: number;
|
||||
comment?: number;
|
||||
depthPlanFactDifference?: number;
|
||||
distancePlanFactDifference?: number;
|
||||
}
|
@ -3,6 +3,7 @@
|
||||
/* eslint-disable */
|
||||
|
||||
export type WellSectionDto = {
|
||||
id?: number;
|
||||
sectionType?: string | null;
|
||||
wellDepthPlan?: number;
|
||||
wellDepthFact?: number;
|
||||
|
@ -9,10 +9,10 @@ export type WellStatDto = {
|
||||
caption?: string | null;
|
||||
cluster?: string | null;
|
||||
deposit?: string | null;
|
||||
id?: number;
|
||||
latitude?: number | null;
|
||||
longitude?: number | null;
|
||||
wellType?: string | null;
|
||||
id?: number;
|
||||
planStart?: string | null;
|
||||
planEnd?: string | null;
|
||||
factStart?: string | null;
|
||||
|
52
src/services/api/services/FluidService.ts
Normal file
52
src/services/api/services/FluidService.ts
Normal file
@ -0,0 +1,52 @@
|
||||
/* istanbul ignore file */
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
import type { FluidDataDto } from '../models/FluidDataDto';
|
||||
import { request as __request } from '../core/request';
|
||||
|
||||
export class FluidService {
|
||||
|
||||
/**
|
||||
* @param idWell
|
||||
* @param idCategory
|
||||
* @returns any Success
|
||||
* @throws ApiError
|
||||
*/
|
||||
public static async get(
|
||||
idWell: number,
|
||||
idCategory?: number,
|
||||
): Promise<any> {
|
||||
const result = await __request({
|
||||
method: 'GET',
|
||||
path: `/api/fluidLastData/${idWell}`,
|
||||
query: {
|
||||
'idCategory': idCategory,
|
||||
},
|
||||
});
|
||||
return result.body;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param idWell
|
||||
* @param idCategory
|
||||
* @param requestBody
|
||||
* @returns any Success
|
||||
* @throws ApiError
|
||||
*/
|
||||
public static async put(
|
||||
idWell: number,
|
||||
idCategory?: number,
|
||||
requestBody?: FluidDataDto,
|
||||
): Promise<any> {
|
||||
const result = await __request({
|
||||
method: 'POST',
|
||||
path: `/api/fluidLastData/${idWell}`,
|
||||
query: {
|
||||
'idCategory': idCategory,
|
||||
},
|
||||
body: requestBody,
|
||||
});
|
||||
return result.body;
|
||||
}
|
||||
|
||||
}
|
52
src/services/api/services/MudDiagramService.ts
Normal file
52
src/services/api/services/MudDiagramService.ts
Normal file
@ -0,0 +1,52 @@
|
||||
/* istanbul ignore file */
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
import type { MudDiagramDataDto } from '../models/MudDiagramDataDto';
|
||||
import { request as __request } from '../core/request';
|
||||
|
||||
export class MudDiagramService {
|
||||
|
||||
/**
|
||||
* @param idWell
|
||||
* @param idCategory
|
||||
* @returns any Success
|
||||
* @throws ApiError
|
||||
*/
|
||||
public static async get(
|
||||
idWell: number,
|
||||
idCategory?: number,
|
||||
): Promise<any> {
|
||||
const result = await __request({
|
||||
method: 'GET',
|
||||
path: `/api/mudLastData/${idWell}`,
|
||||
query: {
|
||||
'idCategory': idCategory,
|
||||
},
|
||||
});
|
||||
return result.body;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param idWell
|
||||
* @param idCategory
|
||||
* @param requestBody
|
||||
* @returns any Success
|
||||
* @throws ApiError
|
||||
*/
|
||||
public static async put(
|
||||
idWell: number,
|
||||
idCategory?: number,
|
||||
requestBody?: MudDiagramDataDto,
|
||||
): Promise<any> {
|
||||
const result = await __request({
|
||||
method: 'POST',
|
||||
path: `/api/mudLastData/${idWell}`,
|
||||
query: {
|
||||
'idCategory': idCategory,
|
||||
},
|
||||
body: requestBody,
|
||||
});
|
||||
return result.body;
|
||||
}
|
||||
|
||||
}
|
52
src/services/api/services/NnbDataService.ts
Normal file
52
src/services/api/services/NnbDataService.ts
Normal file
@ -0,0 +1,52 @@
|
||||
/* istanbul ignore file */
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
import type { NnbDataDto } from '../models/NnbDataDto';
|
||||
import { request as __request } from '../core/request';
|
||||
|
||||
export class NnbDataService {
|
||||
|
||||
/**
|
||||
* @param idWell
|
||||
* @param idCategory
|
||||
* @returns any Success
|
||||
* @throws ApiError
|
||||
*/
|
||||
public static async get(
|
||||
idWell: number,
|
||||
idCategory?: number,
|
||||
): Promise<any> {
|
||||
const result = await __request({
|
||||
method: 'GET',
|
||||
path: `/api/nnbLastData/${idWell}`,
|
||||
query: {
|
||||
'idCategory': idCategory,
|
||||
},
|
||||
});
|
||||
return result.body;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param idWell
|
||||
* @param idCategory
|
||||
* @param requestBody
|
||||
* @returns any Success
|
||||
* @throws ApiError
|
||||
*/
|
||||
public static async put(
|
||||
idWell: number,
|
||||
idCategory?: number,
|
||||
requestBody?: NnbDataDto,
|
||||
): Promise<any> {
|
||||
const result = await __request({
|
||||
method: 'POST',
|
||||
path: `/api/nnbLastData/${idWell}`,
|
||||
query: {
|
||||
'idCategory': idCategory,
|
||||
},
|
||||
body: requestBody,
|
||||
});
|
||||
return result.body;
|
||||
}
|
||||
|
||||
}
|
96
src/services/api/services/WellSectionService.ts
Normal file
96
src/services/api/services/WellSectionService.ts
Normal file
@ -0,0 +1,96 @@
|
||||
/* istanbul ignore file */
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
import type { WellSectionDto } from '../models/WellSectionDto';
|
||||
import { request as __request } from '../core/request';
|
||||
|
||||
export class WellSectionService {
|
||||
|
||||
/**
|
||||
* @param idWell
|
||||
* @returns any Success
|
||||
* @throws ApiError
|
||||
*/
|
||||
public static async getAll(
|
||||
idWell: string,
|
||||
): Promise<any> {
|
||||
const result = await __request({
|
||||
method: 'GET',
|
||||
path: `/api/well/${idWell}`,
|
||||
});
|
||||
return result.body;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param idWell
|
||||
* @param requestBody
|
||||
* @returns any Success
|
||||
* @throws ApiError
|
||||
*/
|
||||
public static async insert(
|
||||
idWell: string,
|
||||
requestBody?: WellSectionDto,
|
||||
): Promise<any> {
|
||||
const result = await __request({
|
||||
method: 'POST',
|
||||
path: `/api/well/${idWell}`,
|
||||
body: requestBody,
|
||||
});
|
||||
return result.body;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param id
|
||||
* @param idWell
|
||||
* @returns any Success
|
||||
* @throws ApiError
|
||||
*/
|
||||
public static async get(
|
||||
id: number,
|
||||
idWell: string,
|
||||
): Promise<any> {
|
||||
const result = await __request({
|
||||
method: 'GET',
|
||||
path: `/api/well/${idWell}/${id}`,
|
||||
});
|
||||
return result.body;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param id
|
||||
* @param idWell
|
||||
* @param requestBody
|
||||
* @returns any Success
|
||||
* @throws ApiError
|
||||
*/
|
||||
public static async put(
|
||||
id: number,
|
||||
idWell: string,
|
||||
requestBody?: WellSectionDto,
|
||||
): Promise<any> {
|
||||
const result = await __request({
|
||||
method: 'PUT',
|
||||
path: `/api/well/${idWell}/${id}`,
|
||||
body: requestBody,
|
||||
});
|
||||
return result.body;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param id
|
||||
* @param idWell
|
||||
* @returns any Success
|
||||
* @throws ApiError
|
||||
*/
|
||||
public static async delete(
|
||||
id: number,
|
||||
idWell: string,
|
||||
): Promise<any> {
|
||||
const result = await __request({
|
||||
method: 'DELETE',
|
||||
path: `/api/well/${idWell}/${id}`,
|
||||
});
|
||||
return result.body;
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user