From 43d85ffd7bf479919d941bac98392a4380c50971 Mon Sep 17 00:00:00 2001 From: KharchenkoVV Date: Mon, 2 Aug 2021 18:30:47 +0500 Subject: [PATCH 1/4] =?UTF-8?q?CF2-40:=20=D0=94=D0=BE=D0=B1=D0=B0=D0=B2?= =?UTF-8?q?=D0=BB=D0=B5=D0=BD=D0=BE=20=D1=81=D0=BE=D1=85=D1=80=D0=B0=D0=BD?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D0=B5=20'=D0=9F=D0=BE=D1=81=D0=BB=D0=B5?= =?UTF-8?q?=D0=B4=D0=BD=D0=B8=D1=85=20=D0=B4=D0=B0=D0=BD=D0=BD=D1=8B=D1=85?= =?UTF-8?q?'=20=D0=B2=20=D0=91=D0=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 +- src/components/DrillingFluid.jsx | 53 +++++++------- .../{SludgeDiagram.jsx => MudDiagram.jsx} | 72 +++++++++++++------ src/components/Nnb.jsx | 62 ++++++++++------ src/pages/LastData.jsx | 8 ++- src/services/api/index.ts | 6 ++ src/services/api/models/FluidDataDto.ts | 33 +++++++++ src/services/api/models/MudDiagramDataDto.ts | 28 ++++++++ src/services/api/models/NnbDataDto.ts | 23 ++++++ src/services/api/models/WellSectionDto.ts | 1 + src/services/api/services/FluidService.ts | 52 ++++++++++++++ .../api/services/MudDiagramService.ts | 52 ++++++++++++++ src/services/api/services/NnbDataService.ts | 52 ++++++++++++++ 13 files changed, 374 insertions(+), 70 deletions(-) rename src/components/{SludgeDiagram.jsx => MudDiagram.jsx} (70%) create mode 100644 src/services/api/models/FluidDataDto.ts create mode 100644 src/services/api/models/MudDiagramDataDto.ts create mode 100644 src/services/api/models/NnbDataDto.ts create mode 100644 src/services/api/services/FluidService.ts create mode 100644 src/services/api/services/MudDiagramService.ts create mode 100644 src/services/api/services/NnbDataService.ts diff --git a/package.json b/package.json index 08ccc73..3fefe17 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/components/DrillingFluid.jsx b/src/components/DrillingFluid.jsx index 22e22e7..39c4c61 100644 --- a/src/components/DrillingFluid.jsx +++ b/src/components/DrillingFluid.jsx @@ -1,15 +1,20 @@ import { useState } 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'; -const originData = [ +const originDataPlan = [ { - key: '1', 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: '', hardness: '', chlorides: '', pf: '', mf: '', pm: '', fluidSolidPhase: '', grease: '', calciumCarbonate: '' - }, + } +] + +const originDataFact = [ { - key: '2', 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: '', hardness: '', chlorides: '', pf: '', mf: '', pm: '', fluidSolidPhase: '', grease: '', calciumCarbonate: '' } @@ -53,9 +58,15 @@ const EditableCell = ({ export function DrillingFluid() { + let {id} = useParams() + const [form] = Form.useForm(); - const [data, setData] = useState(originData); const [editingKey, setEditingKey] = useState(''); + const [idCategory, setIdCategory] = useState(8); + const [dataPlan, setDataPlan] = useState(originDataPlan) + const [dataFact, setDataFact] = useState(originDataFact) + + const [loader, setLoader] = useState(false) const isEditing = (row) => row.key === editingKey; @@ -100,7 +111,7 @@ export function DrillingFluid() { save(row)} + onClick={() => form.submit()} style={{ marginRight: 8 }} > Сохранить @@ -135,6 +146,7 @@ export function DrillingFluid() { }); const edit = (row) => { + setIdCategory(row.key) form.setFieldsValue({ ...row, }); @@ -145,30 +157,21 @@ export function DrillingFluid() { setEditingKey(''); }; - const save = async (row) => { - console.log(row) + const save = async (formData) => { try { - // const row = await form.validateFields(); - // const newData = [...data]; - // const index = newData.findIndex((item) => key === item.key); - - // if (index > -1) { - // const item = newData[index]; - // newData.splice(index, 1, { ...item, ...row }); - // setData(newData); - // setEditingKey(''); - // } else { - // newData.push(row); - // setData(newData); - // setEditingKey(''); - // } + setLoader(true) + await FluidService.put(`${id}`, idCategory, formData) + + setLoader(false) + + setEditingKey('') } catch (errInfo) { - //console.log('Validate Failed:', errInfo); + console.log('Validate Failed:', errInfo); } }; return (<> -
+ @@ -45,9 +49,13 @@ 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(originData) + + const [loader, setLoader] = useState(false) const isEditing = (row) => row.key === editingKey; @@ -85,7 +93,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}) @@ -155,29 +163,49 @@ export function SludgeDiagram() { setEditingKey(''); }; - const save = async (key) => { + const save = async (formData) => { + // TODO: Почему-то в formData из всей формы попадает только поле key. Остальное пришлось записывать в params ниже + // В аналогичной модалке DrillingFluid все ок, все поля формы попадают в formData. + const params = { + key: form.getFieldValue('key'), + 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 { - const row = await form.validateFields(); - const newData = [...data]; - const index = newData.findIndex((item) => key === item.key); - - if (index > -1) { - const item = newData[index]; - newData.splice(index, 1, { ...item, ...row }); - setData(newData); - setEditingKey(''); - } else { - newData.push(row); - setData(newData); - setEditingKey(''); - } + setLoader(true) + await MudDiagramService.put(`${id}`, 10, params) + + setLoader(false) + + setEditingKey('') } catch (errInfo) { console.log('Validate Failed:', errInfo); } }; return (<> - +
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}), @@ -127,29 +133,45 @@ export function Nnb() { setEditingKey(''); }; - const save = async (key) => { + const save = async (formData) => { + // TODO: Почему-то в formData из всей формы попадает только поле key. Остальное пришлось записывать в params ниже + // В аналогичной модалке DrillingFluid все ок, все поля формы попадают в formData. + const params = { + key: form.getFieldValue('key'), + 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 { - const row = await form.validateFields(); - const newData = [...data]; - const index = newData.findIndex((item) => key === item.key); - - if (index > -1) { - const item = newData[index]; - newData.splice(index, 1, { ...item, ...row }); - setData(newData); - setEditingKey(''); - } else { - newData.push(row); - setData(newData); - setEditingKey(''); - } + setLoader(true) + await NnbDataService.put(`${id}`, 11, params) + + setLoader(false) + + setEditingKey('') } catch (errInfo) { console.log('Validate Failed:', errInfo); } }; + return (<> - +
diff --git a/src/services/api/index.ts b/src/services/api/index.ts index 452e2b5..bfe7035 100644 --- a/src/services/api/index.ts +++ b/src/services/api/index.ts @@ -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,10 @@ 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 { WellService } from './services/WellService'; diff --git a/src/services/api/models/FluidDataDto.ts b/src/services/api/models/FluidDataDto.ts new file mode 100644 index 0000000..5c893f9 --- /dev/null +++ b/src/services/api/models/FluidDataDto.ts @@ -0,0 +1,33 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* 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; +} \ No newline at end of file diff --git a/src/services/api/models/MudDiagramDataDto.ts b/src/services/api/models/MudDiagramDataDto.ts new file mode 100644 index 0000000..9157450 --- /dev/null +++ b/src/services/api/models/MudDiagramDataDto.ts @@ -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?: string | null; + drillingMud?: number; + sludge?: number; + maxSum?: number; + methane?: number; + ethan?: number; + propane?: number; + butane?: number; + pentane?: number; + mechanicalSpeed?: number; + preliminaryConclusion?: string | null; +} \ No newline at end of file diff --git a/src/services/api/models/NnbDataDto.ts b/src/services/api/models/NnbDataDto.ts new file mode 100644 index 0000000..ff3e4e3 --- /dev/null +++ b/src/services/api/models/NnbDataDto.ts @@ -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; +} \ No newline at end of file diff --git a/src/services/api/models/WellSectionDto.ts b/src/services/api/models/WellSectionDto.ts index 684e7e5..0112361 100644 --- a/src/services/api/models/WellSectionDto.ts +++ b/src/services/api/models/WellSectionDto.ts @@ -3,6 +3,7 @@ /* eslint-disable */ export type WellSectionDto = { + id?: number; sectionType?: string | null; wellDepthPlan?: number; wellDepthFact?: number; diff --git a/src/services/api/services/FluidService.ts b/src/services/api/services/FluidService.ts new file mode 100644 index 0000000..1703362 --- /dev/null +++ b/src/services/api/services/FluidService.ts @@ -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 { + 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 { + const result = await __request({ + method: 'POST', + path: `/api/fluidLastData/${idWell}`, + query: { + 'idCategory': idCategory, + }, + body: requestBody, + }); + return result.body; + } + +} \ No newline at end of file diff --git a/src/services/api/services/MudDiagramService.ts b/src/services/api/services/MudDiagramService.ts new file mode 100644 index 0000000..3e9b9ac --- /dev/null +++ b/src/services/api/services/MudDiagramService.ts @@ -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 { + 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 { + const result = await __request({ + method: 'POST', + path: `/api/mudLastData/${idWell}`, + query: { + 'idCategory': idCategory, + }, + body: requestBody, + }); + return result.body; + } + +} \ No newline at end of file diff --git a/src/services/api/services/NnbDataService.ts b/src/services/api/services/NnbDataService.ts new file mode 100644 index 0000000..ab4d694 --- /dev/null +++ b/src/services/api/services/NnbDataService.ts @@ -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 { + 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 { + const result = await __request({ + method: 'POST', + path: `/api/nnbLastData/${idWell}`, + query: { + 'idCategory': idCategory, + }, + body: requestBody, + }); + return result.body; + } + +} \ No newline at end of file From 1b33b6683f15bbd974b91dd9911befe80566d8ba Mon Sep 17 00:00:00 2001 From: KharchenkoVV Date: Tue, 3 Aug 2021 17:47:46 +0500 Subject: [PATCH 2/4] =?UTF-8?q?CF2-40:=20=D0=94=D0=BE=D0=B1=D0=B0=D0=B2?= =?UTF-8?q?=D0=BB=D0=B5=D0=BD=D0=BE=20=D1=81=D0=BE=D1=85=D1=80=D0=B0=D0=BD?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D0=B5=20'=D0=9F=D0=BE=D1=81=D0=BB=D0=B5?= =?UTF-8?q?=D0=B4=D0=BD=D0=B8=D1=85=20=D0=B4=D0=B0=D0=BD=D0=BD=D1=8B=D1=85?= =?UTF-8?q?'=20=D0=B4=D0=BB=D1=8F=20=D0=B1=D1=83=D1=80=D0=BE=D0=B2=D0=BE?= =?UTF-8?q?=D0=B3=D0=BE=20=D1=80=D0=B0=D1=81=D1=82=D0=B2=D0=BE=D1=80=D0=B0?= =?UTF-8?q?.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../{ => modalWindows}/DrillingFluid.jsx | 89 ++++++++++++++++--- .../{ => modalWindows}/MudDiagram.jsx | 4 +- src/components/{ => modalWindows}/Nnb.jsx | 5 +- src/pages/LastData.jsx | 8 +- src/services/api/models/FluidDataDto.ts | 56 ++++++------ src/services/api/models/MudDiagramDataDto.ts | 4 +- 6 files changed, 116 insertions(+), 50 deletions(-) rename src/components/{ => modalWindows}/DrillingFluid.jsx (72%) rename src/components/{ => modalWindows}/MudDiagram.jsx (98%) rename src/components/{ => modalWindows}/Nnb.jsx (97%) diff --git a/src/components/DrillingFluid.jsx b/src/components/modalWindows/DrillingFluid.jsx similarity index 72% rename from src/components/DrillingFluid.jsx rename to src/components/modalWindows/DrillingFluid.jsx index 39c4c61..65ce6e0 100644 --- a/src/components/DrillingFluid.jsx +++ b/src/components/modalWindows/DrillingFluid.jsx @@ -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} diff --git a/src/components/MudDiagram.jsx b/src/components/modalWindows/MudDiagram.jsx similarity index 98% rename from src/components/MudDiagram.jsx rename to src/components/modalWindows/MudDiagram.jsx index 920ee89..369e9f1 100644 --- a/src/components/MudDiagram.jsx +++ b/src/components/modalWindows/MudDiagram.jsx @@ -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 = [ { diff --git a/src/components/Nnb.jsx b/src/components/modalWindows/Nnb.jsx similarity index 97% rename from src/components/Nnb.jsx rename to src/components/modalWindows/Nnb.jsx index b4389ae..99291d0 100644 --- a/src/components/Nnb.jsx +++ b/src/components/modalWindows/Nnb.jsx @@ -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) diff --git a/src/pages/LastData.jsx b/src/pages/LastData.jsx index 9b3a9c8..543951d 100644 --- a/src/pages/LastData.jsx +++ b/src/pages/LastData.jsx @@ -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() { diff --git a/src/services/api/models/FluidDataDto.ts b/src/services/api/models/FluidDataDto.ts index 5c893f9..b37a561 100644 --- a/src/services/api/models/FluidDataDto.ts +++ b/src/services/api/models/FluidDataDto.ts @@ -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; } \ No newline at end of file diff --git a/src/services/api/models/MudDiagramDataDto.ts b/src/services/api/models/MudDiagramDataDto.ts index 9157450..5847cc7 100644 --- a/src/services/api/models/MudDiagramDataDto.ts +++ b/src/services/api/models/MudDiagramDataDto.ts @@ -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; } \ No newline at end of file From 3e1312fec2fe46bfecb9afe8e0898e7a2922cd34 Mon Sep 17 00:00:00 2001 From: KharchenkoVV Date: Tue, 3 Aug 2021 17:49:33 +0500 Subject: [PATCH 3/4] Some new open api generated entities --- src/services/api/index.ts | 1 + src/services/api/models/WellStatDto.ts | 2 +- .../api/services/WellSectionService.ts | 96 +++++++++++++++++++ 3 files changed, 98 insertions(+), 1 deletion(-) create mode 100644 src/services/api/services/WellSectionService.ts diff --git a/src/services/api/index.ts b/src/services/api/index.ts index bfe7035..b95d881 100644 --- a/src/services/api/index.ts +++ b/src/services/api/index.ts @@ -45,4 +45,5 @@ 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'; diff --git a/src/services/api/models/WellStatDto.ts b/src/services/api/models/WellStatDto.ts index 7293b43..e759605 100644 --- a/src/services/api/models/WellStatDto.ts +++ b/src/services/api/models/WellStatDto.ts @@ -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; diff --git a/src/services/api/services/WellSectionService.ts b/src/services/api/services/WellSectionService.ts new file mode 100644 index 0000000..ba9950e --- /dev/null +++ b/src/services/api/services/WellSectionService.ts @@ -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 { + 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 { + 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 { + 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 { + 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 { + const result = await __request({ + method: 'DELETE', + path: `/api/well/${idWell}/${id}`, + }); + return result.body; + } + +} \ No newline at end of file From 31398b65b4a7da580dddcb1fe7fa8f4afb0de193 Mon Sep 17 00:00:00 2001 From: KharchenkoVV Date: Wed, 4 Aug 2021 14:19:22 +0500 Subject: [PATCH 4/4] CF2-40: Finalized 'Last Data' tables data saving --- src/components/modalWindows/DrillingFluid.jsx | 41 ++++++------- src/components/modalWindows/MudDiagram.jsx | 58 ++++++++++++------- src/components/modalWindows/Nnb.jsx | 51 ++++++++++------ src/pages/LastData.jsx | 6 -- 4 files changed, 89 insertions(+), 67 deletions(-) diff --git a/src/components/modalWindows/DrillingFluid.jsx b/src/components/modalWindows/DrillingFluid.jsx index 65ce6e0..4a4b94b 100644 --- a/src/components/modalWindows/DrillingFluid.jsx +++ b/src/components/modalWindows/DrillingFluid.jsx @@ -1,22 +1,10 @@ import { useState, useEffect } from 'react'; import { useParams } from "react-router-dom"; -import {Table, Input, Form, Popconfirm, Typography } from 'antd' +import { Table, InputNumber, Form, Popconfirm, Typography } from 'antd' import { makeColumn } from '../factory' import { FluidService } from '../../services/api/services/FluidService'; import notify from "../notify" -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 = { - 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, @@ -37,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 }, ]} > - + ) : ( children @@ -61,8 +48,8 @@ export function DrillingFluid() { const [form] = Form.useForm(); const [editingKey, setEditingKey] = useState(''); const [idCategory, setIdCategory] = useState(8); - const [dataPlan, setDataPlan] = useState(originDataPlan) - const [dataFact, setDataFact] = useState(originDataFact) + const [dataPlan, setDataPlan] = useState({}) + const [dataFact, setDataFact] = useState({}) const [isUpdatingData, setIsUpdatingData] = useState(false) const [loader, setLoader] = useState(false) @@ -92,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 => {text}, editable: true}), + makeColumn('Mf', 'mf', { dataIndex: 'mf', align: 'center', className: 'small-font', + render: text => {text}, editable: true}), + makeColumn('Pm', 'pm', { dataIndex: 'pm', align: 'center', className: 'small-font', + render: text => {text}, 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}), @@ -109,7 +99,6 @@ export function DrillingFluid() { return editable ? ( form.submit()} style={{ marginRight: 8 }} > @@ -250,6 +239,12 @@ export function DrillingFluid() { pagination={false} /> +
 
+

+ Дата последнего обновления: +  План: {new Date(dataPlan?.lastUpdate).toLocaleString()}   +  Факт: {new Date(dataFact?.lastUpdate).toLocaleString()}  +

) } \ No newline at end of file diff --git a/src/components/modalWindows/MudDiagram.jsx b/src/components/modalWindows/MudDiagram.jsx index 369e9f1..3776d79 100644 --- a/src/components/modalWindows/MudDiagram.jsx +++ b/src/components/modalWindows/MudDiagram.jsx @@ -1,16 +1,10 @@ -import { useState } from 'react'; +import { useState, useEffect } from 'react'; import { useParams } from "react-router-dom"; -import { Table, Input, Form, Popconfirm, Typography } from 'antd' +import { Table, InputNumber, Input, Form, Popconfirm, Typography } from 'antd' import { makeColumn } from '../factory' -import { MudDiagramService } from '../../services/api/services/MudDiagramService'; +import { MudDiagramService } from '../../services/api/services/MudDiagramService' +import notify from "../notify" -const originData = [ - { - key: '10', probeNumber: '1', probeExtractionDepth: '1', sandstone: '1', siltstone: '1', argillit: '1', brokenArgillit: '1', coal: '1', sand: '1', clay: '1', - camstone: '1', cement: '1', summary: '1', drillingMud: '1', sludge: '1', maxSum: '1', methane: '1', ethane: '1', propane: '1', butane: '1', pentane: '1', - mechanicalSpeed: '1', preliminaryConclusion: '1' - } -] const EditableCell = ({ editing, @@ -22,6 +16,8 @@ const EditableCell = ({ children, ...restProps }) => { + const inputNumber = + const input = return (
@@ -32,13 +28,11 @@ const EditableCell = ({ rules={[ { required: true, - message: '', - pattern: '(-?[0-9]+\d*([.,]\d+)?)$|^(-?0[.,]\d*[0-9]+)$|^0$|^0.0$' - //pattern: '^-?\d+(\.\d{1,2})?$' + message: '' }, ]} > - + {(dataIndex === 'preliminaryConclusion' || dataIndex === 'summary') ? input : inputNumber } ) : ( children @@ -53,7 +47,8 @@ export function SludgeDiagram() { const [form] = Form.useForm(); const [editingKey, setEditingKey] = useState(''); - const [data, setData] = useState(originData) + const [data, setData] = useState({}) + const [isUpdatingData, setIsUpdatingData] = useState(false) const [loader, setLoader] = useState(false) @@ -112,7 +107,6 @@ export function SludgeDiagram() { return editable ? ( save(row.key)} style={{ marginRight: 8 }} > @@ -131,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) @@ -164,10 +178,9 @@ export function SludgeDiagram() { }; const save = async (formData) => { - // TODO: Почему-то в formData из всей формы попадает только поле key. Остальное пришлось записывать в params ниже - // В аналогичной модалке DrillingFluid все ок, все поля формы попадают в formData. + const params = { - key: form.getFieldValue('key'), + key: 10, probeNumber: form.getFieldValue('probeNumber'), probeExtractionDepth: form.getFieldValue('probeExtractionDepth'), sandstone: form.getFieldValue('sandstone'), @@ -196,6 +209,7 @@ export function SludgeDiagram() { setLoader(true) await MudDiagramService.put(`${id}`, 10, params) + setIsUpdatingData(true) setLoader(false) setEditingKey('') @@ -213,12 +227,16 @@ export function SludgeDiagram() { }, }} columns={mergedColumns} - dataSource={data} + dataSource={[data]} size={'small'} bordered={true} pagination={false} /> +
 
+

+ Дата последнего обновления: {new Date(data?.lastUpdate).toLocaleString()} +

) } \ No newline at end of file diff --git a/src/components/modalWindows/Nnb.jsx b/src/components/modalWindows/Nnb.jsx index 99291d0..70f067a 100644 --- a/src/components/modalWindows/Nnb.jsx +++ b/src/components/modalWindows/Nnb.jsx @@ -1,16 +1,10 @@ -import { useState } from 'react' +import { useState, useEffect } from 'react' import { useParams } from "react-router-dom"; -import {Table, Input, Form, Popconfirm, Typography } from 'antd' +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: '11', depth: '', zenithAngle: '', magneticAzimuth: '', trueAzimuth: '', directAzimuth: '', verticalDepth: '', absoluteMark: '', localNorthOffset: '', - localEastOffset: '', outFallOffset: '', offsetAzimuth: '', areaIntensity: '', offsetStopAngle: '', zenithIntensity: '', comment: '', depthPlanFactDifference: '', - distancePlanFactDifference: '' - } -] const EditableCell = ({ editing, @@ -32,12 +26,11 @@ const EditableCell = ({ rules={[ { required: true, - message: '', - pattern: '(-?[1-9]+\d*([.,]\d+)?)$|^(-?0[.,]\d*[1-9]+)$|^0$|^0.0$' + message: '' }, ]} > - + ) : ( children @@ -52,7 +45,7 @@ export function Nnb() { const [form] = Form.useForm(); const [editingKey, setEditingKey] = useState(''); - const [data, setData] = useState(originData) + const [data, setData] = useState({}) const [isUpdatingData, setIsUpdatingData] = useState(false) const [loader, setLoader] = useState(false) @@ -88,7 +81,6 @@ export function Nnb() { return editable ? (
save(row.key)} style={{ marginRight: 8 }} > @@ -107,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; @@ -135,10 +147,8 @@ export function Nnb() { }; const save = async (formData) => { - // TODO: Почему-то в formData из всей формы попадает только поле key. Остальное пришлось записывать в params ниже - // В аналогичной модалке DrillingFluid все ок, все поля формы попадают в formData. const params = { - key: form.getFieldValue('key'), + key: 11, depth: form.getFieldValue('depth'), zenithAngle: form.getFieldValue('zenithAngle'), magneticAzimuth: form.getFieldValue('magneticAzimuth'), @@ -162,6 +172,7 @@ export function Nnb() { setLoader(true) await NnbDataService.put(`${id}`, 11, params) + setIsUpdatingData(true) setLoader(false) setEditingKey('') @@ -180,11 +191,15 @@ export function Nnb() { }, }} columns={mergedColumns} - dataSource={data} + dataSource={[data]} size={'small'} bordered={true} pagination={false} /> +
 
+

+ Дата последнего обновления: {new Date(data?.lastUpdate).toLocaleString()} +

) } \ No newline at end of file diff --git a/src/pages/LastData.jsx b/src/pages/LastData.jsx index 543951d..2ba7c26 100644 --- a/src/pages/LastData.jsx +++ b/src/pages/LastData.jsx @@ -33,8 +33,6 @@ export default function LastData() { ]} > -
 
-

{new Date().toLocaleString()}