CF2-40: Добавлено сохранение 'Последних данных' для бурового раствора.

This commit is contained in:
KharchenkoVV 2021-08-03 17:47:46 +05:00
parent 9392ba4508
commit 1b33b6683f
6 changed files with 116 additions and 50 deletions

View File

@ -1,24 +1,22 @@
import { useState } from 'react';
import { useState, useEffect } from 'react';
import { useParams } from "react-router-dom";
import {Table, Input, Form, Popconfirm, Typography } from 'antd'
import { makeColumn } from './factory'
import { FluidService } from '../services/api/services/FluidService';
import { makeColumn } from '../factory'
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: '',
snsDpa: '', r3r649С: '', dns49Cdpa: '', plasticViscocity49c: '', sns49Cdpa: '', mbt: '', sand: '', filter: '', crust: '', ktk: '', ph: '',
hardness: '', chlorides: '', pf: '', mf: '', pm: '', fluidSolidPhase: '', grease: '', calciumCarbonate: ''
}
]
const originDataFact = [
{
const originDataFact = {
key: '9', 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,
@ -65,10 +63,11 @@ export function DrillingFluid() {
const [idCategory, setIdCategory] = useState(8);
const [dataPlan, setDataPlan] = useState(originDataPlan)
const [dataFact, setDataFact] = useState(originDataFact)
const [isUpdatingData, setIsUpdatingData] = useState(false)
const [loader, setLoader] = useState(false)
const isEditing = (row) => row.key === editingKey;
const isEditing = (row) => row?.key === editingKey;
const columns = [
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) => {
if (!col.editable) {
return col;
@ -158,10 +189,44 @@ export function DrillingFluid() {
};
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 {
setLoader(true)
await FluidService.put(`${id}`, idCategory, formData)
await FluidService.put(`${id}`, idCategory, params)
setIsUpdatingData(true)
setLoader(false)
setEditingKey('')
@ -179,7 +244,7 @@ export function DrillingFluid() {
},
}}
columns={mergedColumns}
dataSource={[dataPlan[0], dataFact[0]]}
dataSource={[dataPlan, dataFact]}
size={'small'}
bordered={true}
pagination={false}

View File

@ -1,8 +1,8 @@
import { useState } from 'react';
import { useParams } from "react-router-dom";
import { Table, Input, Form, Popconfirm, Typography } from 'antd'
import { makeColumn } from './factory'
import { MudDiagramService } from '../services/api/services/MudDiagramService';
import { makeColumn } from '../factory'
import { MudDiagramService } from '../../services/api/services/MudDiagramService';
const originData = [
{

View File

@ -1,8 +1,8 @@
import { useState } from 'react'
import { useParams } from "react-router-dom";
import {Table, Input, Form, Popconfirm, Typography } from 'antd'
import { makeColumn } from './factory'
import { NnbDataService } from '../services/api/services/NnbDataService';
import { makeColumn } from '../factory'
import { NnbDataService } from '../../services/api/services/NnbDataService';
const originData = [
{
@ -53,6 +53,7 @@ export function Nnb() {
const [form] = Form.useForm();
const [editingKey, setEditingKey] = useState('');
const [data, setData] = useState(originData)
const [isUpdatingData, setIsUpdatingData] = useState(false)
const [loader, setLoader] = useState(false)

View File

@ -1,11 +1,9 @@
import {Button, Modal, Checkbox } from "antd";
import {DrillingFluid} from "../components/DrillingFluid";
import {DrillingFluid} from "../components/modalWindows/DrillingFluid";
import {useState, useEffect} from "react";
import {useParams} from "react-router-dom"
import {SludgeDiagram} from "../components/MudDiagram";
import {Nnb} from "../components/Nnb"
import {SludgeDiagram} from "../components/modalWindows/MudDiagram";
import {Nnb} from "../components/modalWindows/Nnb"
import Disposition from "../components/Disposition";
import notify from "../components/notify"
export default function LastData() {

View File

@ -3,31 +3,33 @@
/* eslint-disable */
export type FluidDataDto = {
temperature?: string | null;
density?: string | null;
conditionalViscosity?: string | null;
r300?: string | null;
r600?: string | null;
r3r6?: string | null;
dnsDpa?: string | null;
plasticViscocity?: string | null;
snsDpa?: string | null;
'r3r649С'?: string | null;
dns49Cdpa?: string | null;
plasticViscocity49c?: string | null;
sns49Cdpa?: string | null;
mbt?: string | null;
sand?: string | null;
filtering?: string | null;
crust?: string | null;
ktk?: string | null;
ph?: string | null;
hardness?: string | null;
chlorides?: string | null;
pf?: string | null;
mf?: string | null;
pm?: string | null;
fluidSolidPhase?: string | null;
grease?: string | null;
calciumCarbonate?: string | null;
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

@ -14,7 +14,7 @@ export type MudDiagramDataDto = {
clay?: number;
camstone?: number;
cement?: number;
summary?: string | null;
summary?: number;
drillingMud?: number;
sludge?: number;
maxSum?: number;
@ -24,5 +24,5 @@ export type MudDiagramDataDto = {
butane?: number;
pentane?: number;
mechanicalSpeed?: number;
preliminaryConclusion?: string | null;
preliminaryConclusion?: number;
}