diff --git a/src/pages/Measure/MeasureTable.jsx b/src/pages/Measure/MeasureTable.jsx index eb4714c..5cb1c45 100644 --- a/src/pages/Measure/MeasureTable.jsx +++ b/src/pages/Measure/MeasureTable.jsx @@ -1,5 +1,5 @@ import { useState, useEffect } from 'react' -import { Button, Form, Timeline } from 'antd' +import { Button, Form, Input, Timeline } from 'antd' import moment from 'moment' import { ExclamationCircleOutlined } from '@ant-design/icons' import { View } from './View' @@ -44,12 +44,18 @@ export const MeasureTable = ({idWell, idCategory, title, columns, values, update useEffect(() => { let switchableColumns = [] + isTableEditing && editingActionName !== 'Удалить' - ? switchableColumns = createEditingColumns(columns, () => ) + ? switchableColumns = createEditingColumns(columns, () => ) : switchableColumns = createEditingColumns(columns, null) + if(editingActionName === 'Редактировать') + measuresForm.setFieldsValue(displayedValues.data); + else if(editingActionName === 'Добавить') + measuresForm.resetFields() + setEditingColumns(switchableColumns) - }, [isTableEditing, columns, editingActionName]) + }, [isTableEditing, columns, editingActionName, displayedValues.data, measuresForm]) const buttonsConfig = [ {name:'Добавить', key:'add'}, @@ -60,14 +66,14 @@ export const MeasureTable = ({idWell, idCategory, title, columns, values, update const createButtons = (config, onClickDelegate) => { return (