forked from ddrilling/asb_cloud_front
CF2-40: Добавлено сохранение 'Последних данных' для бурового раствора.
This commit is contained in:
parent
9392ba4508
commit
1b33b6683f
@ -1,24 +1,22 @@
|
|||||||
import { useState } from 'react';
|
import { useState, useEffect } from 'react';
|
||||||
import { useParams } from "react-router-dom";
|
import { useParams } from "react-router-dom";
|
||||||
import {Table, Input, Form, Popconfirm, Typography } from 'antd'
|
import {Table, Input, Form, Popconfirm, Typography } from 'antd'
|
||||||
import { makeColumn } from './factory'
|
import { makeColumn } from '../factory'
|
||||||
import { FluidService } from '../services/api/services/FluidService';
|
import { FluidService } from '../../services/api/services/FluidService';
|
||||||
|
import notify from "../notify"
|
||||||
|
|
||||||
const originDataPlan = [
|
const originDataPlan = {
|
||||||
{
|
|
||||||
key: '8', name: 'План', temperature: '', density: '', conditionalViscosity: '', r300: '', r600: '', r3r6: '', dnsDpa: '', plasticViscocity: '',
|
key: '8', name: 'План', temperature: '', density: '', conditionalViscosity: '', r300: '', r600: '', r3r6: '', dnsDpa: '', plasticViscocity: '',
|
||||||
snsDpa: '', r3r649С: '', dns49Cdpa: '', plasticViscocity49c: '', sns49Cdpa: '', mbt: '', sand: '', filter: '', crust: '', ktk: '', ph: '',
|
snsDpa: '', r3r649С: '', dns49Cdpa: '', plasticViscocity49c: '', sns49Cdpa: '', mbt: '', sand: '', filter: '', crust: '', ktk: '', ph: '',
|
||||||
hardness: '', chlorides: '', pf: '', mf: '', pm: '', fluidSolidPhase: '', grease: '', calciumCarbonate: ''
|
hardness: '', chlorides: '', pf: '', mf: '', pm: '', fluidSolidPhase: '', grease: '', calciumCarbonate: ''
|
||||||
}
|
}
|
||||||
]
|
|
||||||
|
|
||||||
const originDataFact = [
|
|
||||||
{
|
const originDataFact = {
|
||||||
key: '9', name: 'Факт', temperature: '', density: '', conditionalViscosity: '', r300: '', r600: '', r3r6: '', dnsDpa: '', plasticViscocity: '',
|
key: '9', name: 'Факт', temperature: '', density: '', conditionalViscosity: '', r300: '', r600: '', r3r6: '', dnsDpa: '', plasticViscocity: '',
|
||||||
snsDpa: '', r3r649С: '', dns49Cdpa: '', plasticViscocity49c: '', sns49Cdpa: '', mbt: '', sand: '', filter: '', crust: '', ktk: '', ph: '',
|
snsDpa: '', r3r649С: '', dns49Cdpa: '', plasticViscocity49c: '', sns49Cdpa: '', mbt: '', sand: '', filter: '', crust: '', ktk: '', ph: '',
|
||||||
hardness: '', chlorides: '', pf: '', mf: '', pm: '', fluidSolidPhase: '', grease: '', calciumCarbonate: ''
|
hardness: '', chlorides: '', pf: '', mf: '', pm: '', fluidSolidPhase: '', grease: '', calciumCarbonate: ''
|
||||||
}
|
}
|
||||||
];
|
|
||||||
|
|
||||||
const EditableCell = ({
|
const EditableCell = ({
|
||||||
editing,
|
editing,
|
||||||
@ -65,10 +63,11 @@ export function DrillingFluid() {
|
|||||||
const [idCategory, setIdCategory] = useState(8);
|
const [idCategory, setIdCategory] = useState(8);
|
||||||
const [dataPlan, setDataPlan] = useState(originDataPlan)
|
const [dataPlan, setDataPlan] = useState(originDataPlan)
|
||||||
const [dataFact, setDataFact] = useState(originDataFact)
|
const [dataFact, setDataFact] = useState(originDataFact)
|
||||||
|
const [isUpdatingData, setIsUpdatingData] = useState(false)
|
||||||
|
|
||||||
const [loader, setLoader] = useState(false)
|
const [loader, setLoader] = useState(false)
|
||||||
|
|
||||||
const isEditing = (row) => row.key === editingKey;
|
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'}),
|
||||||
@ -129,6 +128,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;
|
||||||
@ -158,10 +189,44 @@ export function DrillingFluid() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const save = async (formData) => {
|
const save = async (formData) => {
|
||||||
|
|
||||||
|
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 {
|
||||||
setLoader(true)
|
setLoader(true)
|
||||||
await FluidService.put(`${id}`, idCategory, formData)
|
await FluidService.put(`${id}`, idCategory, params)
|
||||||
|
|
||||||
|
setIsUpdatingData(true)
|
||||||
setLoader(false)
|
setLoader(false)
|
||||||
|
|
||||||
setEditingKey('')
|
setEditingKey('')
|
||||||
@ -179,7 +244,7 @@ export function DrillingFluid() {
|
|||||||
},
|
},
|
||||||
}}
|
}}
|
||||||
columns={mergedColumns}
|
columns={mergedColumns}
|
||||||
dataSource={[dataPlan[0], dataFact[0]]}
|
dataSource={[dataPlan, dataFact]}
|
||||||
size={'small'}
|
size={'small'}
|
||||||
bordered={true}
|
bordered={true}
|
||||||
pagination={false}
|
pagination={false}
|
@ -1,8 +1,8 @@
|
|||||||
import { useState } from 'react';
|
import { useState } from 'react';
|
||||||
import { useParams } from "react-router-dom";
|
import { useParams } from "react-router-dom";
|
||||||
import { Table, Input, Form, Popconfirm, Typography } from 'antd'
|
import { Table, Input, Form, Popconfirm, Typography } from 'antd'
|
||||||
import { makeColumn } from './factory'
|
import { makeColumn } from '../factory'
|
||||||
import { MudDiagramService } from '../services/api/services/MudDiagramService';
|
import { MudDiagramService } from '../../services/api/services/MudDiagramService';
|
||||||
|
|
||||||
const originData = [
|
const originData = [
|
||||||
{
|
{
|
@ -1,8 +1,8 @@
|
|||||||
import { useState } from 'react'
|
import { useState } from 'react'
|
||||||
import { useParams } from "react-router-dom";
|
import { useParams } from "react-router-dom";
|
||||||
import {Table, Input, Form, Popconfirm, Typography } from 'antd'
|
import {Table, Input, Form, Popconfirm, Typography } from 'antd'
|
||||||
import { makeColumn } from './factory'
|
import { makeColumn } from '../factory'
|
||||||
import { NnbDataService } from '../services/api/services/NnbDataService';
|
import { NnbDataService } from '../../services/api/services/NnbDataService';
|
||||||
|
|
||||||
const originData = [
|
const originData = [
|
||||||
{
|
{
|
||||||
@ -53,6 +53,7 @@ export function Nnb() {
|
|||||||
const [form] = Form.useForm();
|
const [form] = Form.useForm();
|
||||||
const [editingKey, setEditingKey] = useState('');
|
const [editingKey, setEditingKey] = useState('');
|
||||||
const [data, setData] = useState(originData)
|
const [data, setData] = useState(originData)
|
||||||
|
const [isUpdatingData, setIsUpdatingData] = useState(false)
|
||||||
|
|
||||||
const [loader, setLoader] = useState(false)
|
const [loader, setLoader] = useState(false)
|
||||||
|
|
@ -1,11 +1,9 @@
|
|||||||
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, useEffect} from "react";
|
import {useState, useEffect} from "react";
|
||||||
import {useParams} from "react-router-dom"
|
import {SludgeDiagram} from "../components/modalWindows/MudDiagram";
|
||||||
import {SludgeDiagram} from "../components/MudDiagram";
|
import {Nnb} from "../components/modalWindows/Nnb"
|
||||||
import {Nnb} from "../components/Nnb"
|
|
||||||
import Disposition from "../components/Disposition";
|
import Disposition from "../components/Disposition";
|
||||||
import notify from "../components/notify"
|
|
||||||
|
|
||||||
|
|
||||||
export default function LastData() {
|
export default function LastData() {
|
||||||
|
@ -3,31 +3,33 @@
|
|||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
|
|
||||||
export type FluidDataDto = {
|
export type FluidDataDto = {
|
||||||
temperature?: string | null;
|
key?: number;
|
||||||
density?: string | null;
|
name?: string | null;
|
||||||
conditionalViscosity?: string | null;
|
temperature?: number;
|
||||||
r300?: string | null;
|
density?: number;
|
||||||
r600?: string | null;
|
conditionalViscosity?: number;
|
||||||
r3r6?: string | null;
|
r300?: number;
|
||||||
dnsDpa?: string | null;
|
r600?: number;
|
||||||
plasticViscocity?: string | null;
|
r3r6?: number;
|
||||||
snsDpa?: string | null;
|
dnsDpa?: number;
|
||||||
'r3r649С'?: string | null;
|
plasticViscocity?: number;
|
||||||
dns49Cdpa?: string | null;
|
snsDpa?: number;
|
||||||
plasticViscocity49c?: string | null;
|
'r3r649С'?: number;
|
||||||
sns49Cdpa?: string | null;
|
dns49Cdpa?: number;
|
||||||
mbt?: string | null;
|
plasticViscocity49c?: number;
|
||||||
sand?: string | null;
|
sns49Cdpa?: number;
|
||||||
filtering?: string | null;
|
mbt?: number;
|
||||||
crust?: string | null;
|
sand?: number;
|
||||||
ktk?: string | null;
|
filtering?: number;
|
||||||
ph?: string | null;
|
crust?: number;
|
||||||
hardness?: string | null;
|
ktk?: number;
|
||||||
chlorides?: string | null;
|
ph?: number;
|
||||||
pf?: string | null;
|
hardness?: number;
|
||||||
mf?: string | null;
|
chlorides?: number;
|
||||||
pm?: string | null;
|
pf?: number;
|
||||||
fluidSolidPhase?: string | null;
|
mf?: number;
|
||||||
grease?: string | null;
|
pm?: number;
|
||||||
calciumCarbonate?: string | null;
|
fluidSolidPhase?: number;
|
||||||
|
grease?: number;
|
||||||
|
calciumCarbonate?: number;
|
||||||
}
|
}
|
@ -14,7 +14,7 @@ export type MudDiagramDataDto = {
|
|||||||
clay?: number;
|
clay?: number;
|
||||||
camstone?: number;
|
camstone?: number;
|
||||||
cement?: number;
|
cement?: number;
|
||||||
summary?: string | null;
|
summary?: number;
|
||||||
drillingMud?: number;
|
drillingMud?: number;
|
||||||
sludge?: number;
|
sludge?: number;
|
||||||
maxSum?: number;
|
maxSum?: number;
|
||||||
@ -24,5 +24,5 @@ export type MudDiagramDataDto = {
|
|||||||
butane?: number;
|
butane?: number;
|
||||||
pentane?: number;
|
pentane?: number;
|
||||||
mechanicalSpeed?: number;
|
mechanicalSpeed?: number;
|
||||||
preliminaryConclusion?: string | null;
|
preliminaryConclusion?: number;
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user