This commit is contained in:
Фролов 2021-08-09 09:45:43 +05:00
commit 40efe38210
15 changed files with 614 additions and 125 deletions

View File

@ -32,7 +32,7 @@
"react_test": "react-scripts test", "react_test": "react-scripts test",
"eject": "react-scripts eject" "eject": "react-scripts eject"
}, },
"proxy": "http://127.0.0.1:5000", "proxy": "http://localhost:5000",
"eslintConfig": { "eslintConfig": {
"extends": [ "extends": [
"react-app", "react-app",

View File

@ -1,19 +1,10 @@
import { useState } from 'react'; import { useState, useEffect } from 'react';
import {Table, Input, Form, Popconfirm, Typography } from 'antd' import { useParams } from "react-router-dom";
import { makeColumn } from './factory' 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 = ({ const EditableCell = ({
editing, editing,
@ -34,14 +25,13 @@ const EditableCell = ({
style={{ margin: 0 }} style={{ margin: 0 }}
rules={[ rules={[
{ {
type: 'number',
required: true, required: true,
message: '', message: null
pattern: '(-?[0-9]+\d*([.,]\d+)?)$|^(-?0[.,]\d*[0-9]+)$|^0$|^0.0$'
//pattern: '^-?\d+(\.\d{1,2})?$'
}, },
]} ]}
> >
<Input size="small" /> <InputNumber size="small" style={{width:"auto"}} />
</Form.Item> </Form.Item>
) : ( ) : (
children children
@ -53,11 +43,18 @@ const EditableCell = ({
export function DrillingFluid() { export function DrillingFluid() {
const [form] = Form.useForm(); let {id} = useParams()
const [data, setData] = useState(originData);
const [editingKey, setEditingKey] = useState('');
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 = [ const columns = [
makeColumn('Наименование', 'name', { dataIndex: 'name', align: 'center', className: 'small-font'}), 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('pH', 'ph', { dataIndex: 'ph', align: 'center', className: 'small-font', editable: true}),
makeColumn('Жесткость, мг/л', 'hardness', { dataIndex: 'hardness', 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('Хлориды, мг/л', 'chlorides', { dataIndex: 'chlorides', align: 'center', className: 'small-font', editable: true}),
makeColumn('PF', 'pf', { dataIndex: 'pf', align: 'center', className: 'small-font', editable: true}), makeColumn('PF', 'pf', { dataIndex: 'pf', align: 'center', className: 'small-font',
makeColumn('Mf', 'mf', { dataIndex: 'mf', align: 'center', className: 'small-font', editable: true}), render: text => <span style={{marginLeft: '12px', marginRight: '12px'}}>{text}</span>, editable: true}),
makeColumn('Pm', 'pm', { dataIndex: 'pm', align: 'center', className: 'small-font', 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('Твердая фаза раствора, %', 'fluidSolidPhase', { dataIndex: 'fluidSolidPhase', align: 'center', className: 'small-font', editable: true}),
makeColumn('Смазка, %', 'grease', { dataIndex: 'grease', 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}), makeColumn('Карбонат кальция, кг/м³', 'calciumCarbonate', { dataIndex: 'calciumCarbonate', align: 'center', className: 'small-font', editable: true}),
@ -99,8 +99,7 @@ export function DrillingFluid() {
return editable ? ( return editable ? (
<span> <span>
<a <a
href="javascript:;" onClick={() => form.submit()}
onClick={() => save(row)}
style={{ marginRight: 8 }} 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) => { const mergedColumns = columns.map((col) => {
if (!col.editable) { if (!col.editable) {
return col; return col;
@ -135,6 +166,7 @@ export function DrillingFluid() {
}); });
const edit = (row) => { const edit = (row) => {
setIdCategory(row.key)
form.setFieldsValue({ form.setFieldsValue({
...row, ...row,
}); });
@ -145,30 +177,55 @@ export function DrillingFluid() {
setEditingKey(''); setEditingKey('');
}; };
const save = async (row) => { const save = async (formData) => {
console.log(row)
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 { try {
// const row = await form.validateFields(); setLoader(true)
// const newData = [...data]; await FluidService.put(`${id}`, idCategory, params)
// const index = newData.findIndex((item) => key === item.key);
setIsUpdatingData(true)
// if (index > -1) { setLoader(false)
// const item = newData[index];
// newData.splice(index, 1, { ...item, ...row }); setEditingKey('')
// setData(newData);
// setEditingKey('');
// } else {
// newData.push(row);
// setData(newData);
// setEditingKey('');
// }
} catch (errInfo) { } catch (errInfo) {
//console.log('Validate Failed:', errInfo); console.log('Validate Failed:', errInfo);
} }
}; };
return (<> return (<>
<Form form={form} component={false}> <Form form={form} component={false} onFinish={save}>
<Table <Table
components={{ components={{
body: { body: {
@ -176,12 +233,18 @@ export function DrillingFluid() {
}, },
}} }}
columns={mergedColumns} columns={mergedColumns}
dataSource={data} dataSource={[dataPlan, dataFact]}
size={'small'} size={'small'}
bordered={true} bordered={true}
pagination={false} pagination={false}
/> />
</Form> </Form>
<div>&nbsp;</div>
<p style={{textAlign: "right"}}>
Дата последнего обновления:
&nbsp;<b>План:</b>&nbsp;<b>{new Date(dataPlan?.lastUpdate).toLocaleString()}</b> &nbsp;
&nbsp;<b>Факт:</b>&nbsp;<b>{new Date(dataFact?.lastUpdate).toLocaleString()}</b>&nbsp;
</p>
</> </>
) )
} }

View File

@ -1,13 +1,10 @@
import { useState } from 'react'; import { useState, useEffect } from 'react';
import {Table, Input, Form, Popconfirm, Typography } from 'antd' import { useParams } from "react-router-dom";
import { makeColumn } from './factory' 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 = ({ const EditableCell = ({
editing, editing,
@ -19,6 +16,8 @@ const EditableCell = ({
children, children,
...restProps ...restProps
}) => { }) => {
const inputNumber = <InputNumber size="small" style={{width:"auto"}} />
const input = <Input size="small" style={{width:"auto"}} />
return ( return (
<td {...restProps} style={{paddingLeft: 2, paddingRight: 2}}> <td {...restProps} style={{paddingLeft: 2, paddingRight: 2}}>
<div style={{width: '100%', display: 'flex', justifyContent: 'center'}}> <div style={{width: '100%', display: 'flex', justifyContent: 'center'}}>
@ -29,12 +28,11 @@ const EditableCell = ({
rules={[ rules={[
{ {
required: true, required: true,
message: '', message: ''
pattern: '(-?[1-9]+\d*([.,]\d+)?)$|^(-?0[.,]\d*[1-9]+)$|^0$|^0.0$'
}, },
]} ]}
> >
<Input size="small" /> {(dataIndex === 'preliminaryConclusion' || dataIndex === 'summary') ? input : inputNumber }
</Form.Item> </Form.Item>
) : ( ) : (
children children
@ -45,9 +43,14 @@ const EditableCell = ({
}; };
export function SludgeDiagram() { export function SludgeDiagram() {
let {id} = useParams()
const [form] = Form.useForm(); const [form] = Form.useForm();
const [data, setData] = useState(originData);
const [editingKey, setEditingKey] = useState(''); 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 isEditing = (row) => row.key === editingKey;
@ -85,7 +88,7 @@ export function SludgeDiagram() {
children: [ children: [
makeColumn('Сумма УВ мах. (абс%)', 'maxSum', { dataIndex: 'maxSum', align: 'center', className: 'lightpurple-background', editable: true}), makeColumn('Сумма УВ мах. (абс%)', 'maxSum', { dataIndex: 'maxSum', align: 'center', className: 'lightpurple-background', editable: true}),
makeColumn('С1 метан (отн%)', 'methane', { dataIndex: 'methane', 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('С3 пропан (отн%)', 'propane', { dataIndex: 'propane', align: 'center', className: 'lightpurple-background', editable: true}),
makeColumn('С4 бутан (отн%)', 'butane', { dataIndex: 'butane', 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}) makeColumn('С5 пентан (отн%)', 'pentane', { dataIndex: 'pentane', align: 'center', className: 'lightpurple-background', editable: true})
@ -104,7 +107,6 @@ export function SludgeDiagram() {
return editable ? ( return editable ? (
<span> <span>
<a <a
href="javascript:;"
onClick={() => save(row.key)} onClick={() => save(row.key)}
style={{ marginRight: 8 }} 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) => { const mapColumns = (col) => {
if(col.children) if(col.children)
col.children = col.children.map(mapColumns) col.children = col.children.map(mapColumns)
@ -155,29 +177,49 @@ export function SludgeDiagram() {
setEditingKey(''); setEditingKey('');
}; };
const save = async (key) => { const save = async (formData) => {
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 { try {
const row = await form.validateFields(); setLoader(true)
const newData = [...data]; await MudDiagramService.put(`${id}`, 10, params)
const index = newData.findIndex((item) => key === item.key);
setIsUpdatingData(true)
if (index > -1) { setLoader(false)
const item = newData[index];
newData.splice(index, 1, { ...item, ...row }); setEditingKey('')
setData(newData);
setEditingKey('');
} else {
newData.push(row);
setData(newData);
setEditingKey('');
}
} catch (errInfo) { } catch (errInfo) {
console.log('Validate Failed:', errInfo); console.log('Validate Failed:', errInfo);
} }
}; };
return (<> return (<>
<Form form={form} component={false}> <Form form={form} component={false} onFinish={save}>
<Table <Table
components={{ components={{
body: { body: {
@ -185,12 +227,16 @@ export function SludgeDiagram() {
}, },
}} }}
columns={mergedColumns} columns={mergedColumns}
dataSource={data} dataSource={[data]}
size={'small'} size={'small'}
bordered={true} bordered={true}
pagination={false} pagination={false}
/> />
</Form> </Form>
<div>&nbsp;</div>
<p style={{textAlign: "right"}}>
Дата последнего обновления: <b>{new Date(data?.lastUpdate).toLocaleString()}</b>
</p>
</> </>
) )
} }

View File

@ -1,14 +1,10 @@
import { useState } from 'react' import { useState, useEffect } from 'react'
import {Table, Input, Form, Popconfirm, Typography } from 'antd' import { useParams } from "react-router-dom";
import { makeColumn } from './factory' 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 = ({ const EditableCell = ({
editing, editing,
@ -30,12 +26,11 @@ const EditableCell = ({
rules={[ rules={[
{ {
required: true, required: true,
message: '', message: ''
pattern: '(-?[1-9]+\d*([.,]\d+)?)$|^(-?0[.,]\d*[1-9]+)$|^0$|^0.0$'
}, },
]} ]}
> >
<Input size="small" /> <InputNumber size="small" style={{width:"auto"}} />
</Form.Item> </Form.Item>
) : ( ) : (
children children
@ -46,17 +41,22 @@ const EditableCell = ({
}; };
export function Nnb() { export function Nnb() {
let {id} = useParams()
const [form] = Form.useForm(); const [form] = Form.useForm();
const [data, setData] = useState(originData);
const [editingKey, setEditingKey] = useState(''); 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 isEditing = (row) => row.key === editingKey;
const columns = [ const columns = [
makeColumn('Глубина по стволу, м', 'depth', { dataIndex: 'depth', align: 'center', editable: true}), makeColumn('Глубина по стволу, м', 'depth', { dataIndex: 'depth', align: 'center', editable: true}),
makeColumn('Зенитный угол, град', 'zenithAngle', { dataIndex: 'zenithAngle', align: 'center', editable: true}), makeColumn('Зенитный угол, град', 'zenithAngle', { dataIndex: 'zenithAngle', align: 'center', editable: true}),
makeColumn('Азимут магнитный, град', 'trueAzimuth', { dataIndex: 'trueAzimuth', align: 'center', editable: true}), makeColumn('Азимут магнитный, град', 'magneticAzimuth', { dataIndex: 'magneticAzimuth', align: 'center', editable: true}),
makeColumn('Азимут истинный, град', 'conditionalViscosity', { dataIndex: 'conditionalViscosity', align: 'center', editable: true}), makeColumn('Азимут истинный, град', 'trueAzimuth', { dataIndex: 'trueAzimuth', align: 'center', editable: true}),
makeColumn('Азимут дирекц., град', 'directAzimuth', { dataIndex: 'directAzimuth', align: 'center', editable: true}), makeColumn('Азимут дирекц., град', 'directAzimuth', { dataIndex: 'directAzimuth', align: 'center', editable: true}),
makeColumn('Глубина по вертикали, м', 'verticalDepth', { dataIndex: 'verticalDepth', align: 'center', editable: true}), makeColumn('Глубина по вертикали, м', 'verticalDepth', { dataIndex: 'verticalDepth', align: 'center', editable: true}),
makeColumn('Абсолютная отметка, м', 'absoluteMark', { dataIndex: 'absoluteMark', align: 'center', editable: true}), makeColumn('Абсолютная отметка, м', 'absoluteMark', { dataIndex: 'absoluteMark', align: 'center', editable: true}),
@ -81,7 +81,6 @@ export function Nnb() {
return editable ? ( return editable ? (
<span> <span>
<a <a
href="javascript:;"
onClick={() => save(row.key)} onClick={() => save(row.key)}
style={{ marginRight: 8 }} 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) => { const mergedColumns = columns.map((col) => {
if (!col.editable) { if (!col.editable) {
return col; return col;
@ -127,29 +146,44 @@ export function Nnb() {
setEditingKey(''); setEditingKey('');
}; };
const save = async (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')
}
try { try {
const row = await form.validateFields(); setLoader(true)
const newData = [...data]; await NnbDataService.put(`${id}`, 11, params)
const index = newData.findIndex((item) => key === item.key);
setIsUpdatingData(true)
if (index > -1) { setLoader(false)
const item = newData[index];
newData.splice(index, 1, { ...item, ...row }); setEditingKey('')
setData(newData);
setEditingKey('');
} else {
newData.push(row);
setData(newData);
setEditingKey('');
}
} catch (errInfo) { } catch (errInfo) {
console.log('Validate Failed:', errInfo); console.log('Validate Failed:', errInfo);
} }
}; };
return (<> return (<>
<Form form={form} component={false}> <Form form={form} component={false} onFinish={save}>
<Table <Table
components={{ components={{
body: { body: {
@ -157,11 +191,15 @@ export function Nnb() {
}, },
}} }}
columns={mergedColumns} columns={mergedColumns}
dataSource={data} dataSource={[data]}
size={'small'} size={'small'}
bordered={true} bordered={true}
pagination={false} pagination={false}
/> />
</Form> </Form>
<div>&nbsp;</div>
<p style={{textAlign: "right"}}>
Дата последнего обновления: <b>{new Date(data?.lastUpdate).toLocaleString()}</b>
</p>
</>) </>)
} }

View File

@ -1,16 +1,18 @@
import {Button, Modal, Checkbox } from "antd"; import {Button, Modal, Checkbox } from "antd";
import {DrillingFluid} from "../components/DrillingFluid"; import {DrillingFluid} from "../components/modalWindows/DrillingFluid";
import {useState} from "react"; import {useState, useEffect} from "react";
import {SludgeDiagram} from "../components/SludgeDiagram"; import {SludgeDiagram} from "../components/modalWindows/MudDiagram";
import {Nnb} from "../components/Nnb" import {Nnb} from "../components/modalWindows/Nnb"
import Disposition from "../components/Disposition"; import Disposition from "../components/Disposition";
export default function LastData() { export default function LastData() {
const [tableVisible, setCementTableVisible] = useState(false) const [tableVisible, setCementTableVisible] = useState(false)
const [tableSludgeVisible, setTableSludgeVisible] = useState(false) const [tableSludgeVisible, setTableSludgeVisible] = useState(false)
const [tableNNBVisible, setTableNNBVisible] = useState(false) const [tableNNBVisible, setTableNNBVisible] = useState(false)
const [dispositionVisible, setDispositionVisible] = useState(false) const [dispositionVisible, setDispositionVisible] = useState(false)
const [loader, setLoader] = useState(false)
return ( return (
<> <>
@ -31,8 +33,6 @@ export default function LastData() {
]} ]}
> >
<DrillingFluid/> <DrillingFluid/>
<div>&nbsp;</div>
<p style={{textAlign: "right"}}><b>{new Date().toLocaleString()}</b></p>
</Modal> </Modal>
<Button type="primary" onClick={() => setTableSludgeVisible(true)} style={{marginLeft: "5px"}}> <Button type="primary" onClick={() => setTableSludgeVisible(true)} style={{marginLeft: "5px"}}>
Шламограмма Шламограмма
@ -50,8 +50,6 @@ export default function LastData() {
]} ]}
> >
<SludgeDiagram/> <SludgeDiagram/>
<div>&nbsp;</div>
<p style={{textAlign: "right"}}><b>{new Date().toLocaleString()}</b></p>
</Modal> </Modal>
<Button type="primary" onClick={() => setTableNNBVisible(true)} style={{marginLeft: "5px"}}> <Button type="primary" onClick={() => setTableNNBVisible(true)} style={{marginLeft: "5px"}}>
ННБ ННБ
@ -69,8 +67,6 @@ export default function LastData() {
]} ]}
> >
<Nnb/> <Nnb/>
<div>&nbsp;</div>
<p style={{textAlign: "right"}}><b>{new Date().toLocaleString()}</b></p>
</Modal> </Modal>
<Button type="primary" onClick={() => setDispositionVisible(true)} style={{marginLeft: "5px"}}> <Button type="primary" onClick={() => setDispositionVisible(true)} style={{marginLeft: "5px"}}>
Распоряжение Распоряжение

View File

@ -14,8 +14,11 @@ export type { DepositDto } from './models/DepositDto';
export type { EventDto } from './models/EventDto'; export type { EventDto } from './models/EventDto';
export type { FilePropertiesDto } from './models/FilePropertiesDto'; export type { FilePropertiesDto } from './models/FilePropertiesDto';
export type { FilePropertiesDtoPaginationContainer } from './models/FilePropertiesDtoPaginationContainer'; export type { FilePropertiesDtoPaginationContainer } from './models/FilePropertiesDtoPaginationContainer';
export type { FluidDataDto } from './models/FluidDataDto';
export type { MessageDto } from './models/MessageDto'; export type { MessageDto } from './models/MessageDto';
export type { MessageDtoPaginationContainer } from './models/MessageDtoPaginationContainer'; 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 { TelemetryInfoDto } from './models/TelemetryInfoDto';
export type { TelemetryMessageDto } from './models/TelemetryMessageDto'; export type { TelemetryMessageDto } from './models/TelemetryMessageDto';
export type { TelemetryOperationDto } from './models/TelemetryOperationDto'; export type { TelemetryOperationDto } from './models/TelemetryOperationDto';
@ -36,7 +39,11 @@ export { ClusterService } from './services/ClusterService';
export { DataService } from './services/DataService'; export { DataService } from './services/DataService';
export { DepositService } from './services/DepositService'; export { DepositService } from './services/DepositService';
export { FileService } from './services/FileService'; export { FileService } from './services/FileService';
export { FluidService } from './services/FluidService';
export { MessageService } from './services/MessageService'; export { MessageService } from './services/MessageService';
export { MudDiagramService } from './services/MudDiagramService';
export { NnbDataService } from './services/NnbDataService';
export { ReportService } from './services/ReportService'; export { ReportService } from './services/ReportService';
export { TelemetryService } from './services/TelemetryService'; export { TelemetryService } from './services/TelemetryService';
export { WellSectionService } from './services/WellSectionService';
export { WellService } from './services/WellService'; export { WellService } from './services/WellService';

View 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;
}

View 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;
}

View 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;
}

View File

@ -3,6 +3,7 @@
/* eslint-disable */ /* eslint-disable */
export type WellSectionDto = { export type WellSectionDto = {
id?: number;
sectionType?: string | null; sectionType?: string | null;
wellDepthPlan?: number; wellDepthPlan?: number;
wellDepthFact?: number; wellDepthFact?: number;

View File

@ -9,10 +9,10 @@ export type WellStatDto = {
caption?: string | null; caption?: string | null;
cluster?: string | null; cluster?: string | null;
deposit?: string | null; deposit?: string | null;
id?: number;
latitude?: number | null; latitude?: number | null;
longitude?: number | null; longitude?: number | null;
wellType?: string | null; wellType?: string | null;
id?: number;
planStart?: string | null; planStart?: string | null;
planEnd?: string | null; planEnd?: string | null;
factStart?: string | null; factStart?: string | null;

View 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;
}
}

View 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;
}
}

View 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;
}
}

View 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;
}
}