diff --git a/src/pages/Measure/MeasureTable.jsx b/src/pages/Measure/MeasureTable.jsx
index 9ce6710..103ada1 100644
--- a/src/pages/Measure/MeasureTable.jsx
+++ b/src/pages/Measure/MeasureTable.jsx
@@ -1,7 +1,7 @@
import { useState, useEffect } from 'react'
import { Button, Form, Input, Timeline } from 'antd'
import moment from 'moment'
-import { ExclamationCircleOutlined } from '@ant-design/icons'
+import { CheckSquareOutlined } from '@ant-design/icons'
import { View } from './View'
import LoaderPortal from '../../components/LoaderPortal'
import { MeasureService } from '../../services/api'
@@ -22,10 +22,10 @@ export const MeasureTable = ({idWell, idCategory, title, columns, values, update
const [measuresForm] = Form.useForm();
const createEditingColumns = (cols, renderDelegate) =>
- cols.map(col =>
- ({ render: renderDelegate,
- ...col
- })
+ cols.map(col =>
+ ({ render: renderDelegate,
+ ...col
+ })
)
useEffect(() => {
@@ -93,7 +93,10 @@ export const MeasureTable = ({idWell, idCategory, title, columns, values, update
{editingActionName} данные?
-
@@ -122,7 +131,15 @@ export const MeasureTable = ({idWell, idCategory, title, columns, values, update
}
setShowLoader(true)
- await MeasureService.insert(idWell, measureParams)
+
+ if(editingActionName === 'Добавить') {
+ await MeasureService.insert(idWell, measureParams)
+ } else if (editingActionName === 'Редактировать') {
+ measureParams.id = displayedValues.id
+ measureParams.timestamp = displayedValues.timestamp
+ await MeasureService.update(idWell, measureParams)
+ }
+
setIsTableEditing(false)
updateMeasuresFunc()
setShowLoader(false)
@@ -145,16 +162,16 @@ export const MeasureTable = ({idWell, idCategory, title, columns, values, update
{values.map((item, index) =>
setSelectedTimeLineId(item.id)}
dot={item?.id === displayedValues?.id
- ?
+ ?
: null}
>
- {moment.utc(item.timestamp).local().format(format)}
+
+ {moment.utc(item.timestamp).local().format(format)}
+
)}
diff --git a/src/pages/Measure/View.jsx b/src/pages/Measure/View.jsx
index 16a9c80..0763514 100644
--- a/src/pages/Measure/View.jsx
+++ b/src/pages/Measure/View.jsx
@@ -6,6 +6,7 @@ const renderSwitchableColumn = (column, itm) => {
if(column.render) {
return (
{
)
}
- return {itm[column.dataIndex]}
+ return {itm[column.dataIndex]}
}
export const View = ({columns, item}) => {
if (!item || !columns?.length)
- return
+ return
const colsCount = 3
const viewItems = columns.map( (column, i) => {
@@ -29,6 +30,7 @@ export const View = ({columns, item}) => {
return <>
{
{renderSwitchableColumn(column, item)}
diff --git a/src/pages/Measure/columnsCommon.js b/src/pages/Measure/columnsCommon.js
index 7d458b5..5e7a616 100644
--- a/src/pages/Measure/columnsCommon.js
+++ b/src/pages/Measure/columnsCommon.js
@@ -42,4 +42,10 @@ export const numericColumnOptions = {
export const textColumnOptions = {
editable:true,
input:,
- width:'20rem'}
\ No newline at end of file
+ width:'20rem',
+ formItemRules: [
+ {
+ required: true,
+ message: `Введите текст`
+ },
+ ],}
\ No newline at end of file
diff --git a/src/pages/Measure/index.jsx b/src/pages/Measure/index.jsx
index b96e1fb..8fa4dee 100644
--- a/src/pages/Measure/index.jsx
+++ b/src/pages/Measure/index.jsx
@@ -19,12 +19,16 @@ export default function Measure({idWell}){
const updateCurrentValues = () => invokeWebApiWrapperAsync(async()=>{
const measures = await MeasureService.getHisory(idWell)
+ setIsMeasuresUpdating(false)
const fluids = measures.filter(el => el.idCategory === 1)
+ drillingFluidDefaultData.timestamp = new Date().toISOString()
setFluidValues(fluids.length ? fluids : [drillingFluidDefaultData])
const muds = measures.filter(el => el.idCategory === 2)
+ mudDiagramDefaultData.timestamp = new Date().toISOString()
setMudValues(muds.length ? muds : [mudDiagramDefaultData])
const nnbs = measures.filter(el => el.idCategory === 3)
+ nnbDefaultData.timestamp = new Date().toISOString()
setNnbValues(nnbs.length ? nnbs : [nnbDefaultData])
}
,setShowLoader
@@ -40,7 +44,7 @@ export default function Measure({idWell}){
title='Замер бурового раствора'
columns={columnsDrillingFluid}
values={fluidValues}
- updateMeasuresDelegate = {() => setIsMeasuresUpdating(true)}
+ updateMeasuresFunc = {() => setIsMeasuresUpdating(true)}
/>
setIsMeasuresUpdating(true)}
+ updateMeasuresFunc = {() => setIsMeasuresUpdating(true)}
/>
setIsMeasuresUpdating(true)}
+ updateMeasuresFunc = {() => setIsMeasuresUpdating(true)}
/>
>
diff --git a/src/styles/measure.css b/src/styles/measure.css
index cba5009..a4b5320 100644
--- a/src/styles/measure.css
+++ b/src/styles/measure.css
@@ -20,17 +20,12 @@ input {
cursor: pointer;
}
-.last-measure-button {
- height: 10px;
- color: red;
+.selected-timeline {
+ font-weight: bold;
}
-.last-measure-button:hover {
- cursor: pointer;
-}
-
-.m-5px-auto {
- margin: 5px auto;
+.m-5px {
+ margin: 5px 5px;
}
.mt-12px {