save(row.key)}
style={{ marginRight: 8 }}
>
@@ -100,6 +99,26 @@ export function Nnb() {
}
];
+ useEffect(() => {
+ const update = async () => {
+ setLoader(true)
+
+ try {
+ let response = await NnbDataService.get(id,11)
+ response.key = 11
+ setData(response)
+ }
+ catch (ex) {
+ notify(`Не удалось загрузить данные ННБ по скважине "${id}"`, 'error')
+ console.log(ex)
+ }
+
+ setIsUpdatingData(false)
+ setLoader(false)
+ }
+ update()
+ }, [isUpdatingData])
+
const mergedColumns = columns.map((col) => {
if (!col.editable) {
return col;
@@ -127,29 +146,44 @@ export function Nnb() {
setEditingKey('');
};
- const save = async (key) => {
+ 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 {
- 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)
+
+ setIsUpdatingData(true)
+ setLoader(false)
+
+ setEditingKey('')
} catch (errInfo) {
console.log('Validate Failed:', errInfo);
}
};
+
return (<>
-
+
+
+ Дата последнего обновления: {new Date(data?.lastUpdate).toLocaleString()}
+
>)
}
\ No newline at end of file
diff --git a/src/pages/LastData.jsx b/src/pages/LastData.jsx
index bafc3a5..2ba7c26 100644
--- a/src/pages/LastData.jsx
+++ b/src/pages/LastData.jsx
@@ -1,16 +1,18 @@
import {Button, Modal, Checkbox } from "antd";
-import {DrillingFluid} from "../components/DrillingFluid";
-import {useState} from "react";
-import {SludgeDiagram} from "../components/SludgeDiagram";
-import {Nnb} from "../components/Nnb"
+import {DrillingFluid} from "../components/modalWindows/DrillingFluid";
+import {useState, useEffect} from "react";
+import {SludgeDiagram} from "../components/modalWindows/MudDiagram";
+import {Nnb} from "../components/modalWindows/Nnb"
import Disposition from "../components/Disposition";
export default function LastData() {
+
const [tableVisible, setCementTableVisible] = useState(false)
const [tableSludgeVisible, setTableSludgeVisible] = useState(false)
const [tableNNBVisible, setTableNNBVisible] = useState(false)
const [dispositionVisible, setDispositionVisible] = useState(false)
+ const [loader, setLoader] = useState(false)
return (
<>
@@ -31,8 +33,6 @@ export default function LastData() {
]}
>
-
- {new Date().toLocaleString()}