From 5755b41abc2415d5e0655879fa6c471b25d28ec2 Mon Sep 17 00:00:00 2001 From: KharchenkoVV Date: Mon, 4 Oct 2021 18:06:42 +0500 Subject: [PATCH] CF2-49: Main changes for new Measures table display --- src/pages/Measure/MeasureTable2.jsx | 73 +++++++++++++++++--------- src/pages/Measure/View.jsx | 47 +++++++++-------- src/pages/Measure/columnsMudDiagram.js | 42 ++++++--------- src/pages/Measure/index.jsx | 69 ++++++++++++++++++------ src/styles/index.css | 4 ++ src/styles/measure.css | 32 +++++++++++ 6 files changed, 176 insertions(+), 91 deletions(-) create mode 100644 src/styles/measure.css diff --git a/src/pages/Measure/MeasureTable2.jsx b/src/pages/Measure/MeasureTable2.jsx index 621e711..f543a2d 100644 --- a/src/pages/Measure/MeasureTable2.jsx +++ b/src/pages/Measure/MeasureTable2.jsx @@ -7,16 +7,17 @@ import { invokeWebApiWrapperAsync } from '../../components/factory' import { MeasureService } from '../../services/api' import { Editor } from './Editor' import TimelineItem from 'antd/lib/timeline/TimelineItem' -//import { View } from './View' +import { View } from './View' +import '../../styles/measure.css' const format='YYYY.MM.DD HH:mm' -export const MeasureTable2 = ({idWell, idCategory, title, columns}) => { +export const MeasureTable2 = ({idWell, idCategory, title, columns, currentValues}) => { const [showLoader, setShowLoader] = useState(false) const [showEditor, setShowEditor] = useState(false) const [history, setHistory] = useState([]) - const update = () => invokeWebApiWrapperAsync(async()=>{ + const updateHistory = () => invokeWebApiWrapperAsync(async()=>{ const data = await MeasureService.getHisory(idWell, idCategory) const story = data?.map( i=> ({ id: i.id, @@ -27,23 +28,41 @@ export const MeasureTable2 = ({idWell, idCategory, title, columns}) => { setHistory(story??[]) } , setShowLoader - , "не удалось загрузить") + , `Не удалось загрузить последние данные по скважине ${idWell}`) - useEffect(update, [idWell, idCategory]) + useEffect(updateHistory, [idWell, idCategory]) - return -

{title}

-   - - - {history.map(item=>{item.timestamp})} - - {/* */} - + +   +

{title}

+   +
+
+ + {history.map((item, index)=> + setShowEditor(true)} + value={item} + > +

{item.timestamp}

+
)} +
+
+
+ +
+
+ { onCancel={() => setShowEditor(false)} width="95%" footer={null} - > - - -
+ > + +
+
+ } \ No newline at end of file diff --git a/src/pages/Measure/View.jsx b/src/pages/Measure/View.jsx index ca3e838..7c19ec3 100644 --- a/src/pages/Measure/View.jsx +++ b/src/pages/Measure/View.jsx @@ -9,30 +9,35 @@ export const View = ({columns, item}) => { const viewItems = columns.map( (column, i) => { const row = Math.floor(i / colsCount) + 1 const colb = i % colsCount + return <> - - {column.title} - - - - {column.render ? column.render(item[column.dataIndex]) : item[column.dataIndex]} - + {column.title} + + + {column.render ? column.render(item[column.dataIndex]) : item[column.dataIndex]} + }) - return - {viewItems} - + return <> + + {viewItems} + + } \ No newline at end of file diff --git a/src/pages/Measure/columnsMudDiagram.js b/src/pages/Measure/columnsMudDiagram.js index 5a82670..c759786 100644 --- a/src/pages/Measure/columnsMudDiagram.js +++ b/src/pages/Measure/columnsMudDiagram.js @@ -4,36 +4,24 @@ import {v, numericColumnOptions, textColumnOptions} from './columnsCommon' export const columnsMudDiagram = [ makeColumn(v('N пробы'), 'probeNumber', numericColumnOptions), makeColumn(v('Глубина отбора пробы'), 'probeExtractionDepth', numericColumnOptions), - { - title: 'Литология', - key: 'lithology', - children: [ - makeColumn(v('Песчаник (%)'), 'sandstone', numericColumnOptions), - makeColumn(v('Алевролит (%)'), 'siltstone', numericColumnOptions), - makeColumn(v('Аргиллит (%)'), 'argillit', numericColumnOptions), - makeColumn(v('Аргиллит бит. (%)'), 'brokenArgillit', numericColumnOptions), - makeColumn(v('Уголь (%)'), 'coal', numericColumnOptions), - makeColumn(v('Песок (%)'), 'sand', numericColumnOptions), - makeColumn(v('Глина (%)'), 'clay', numericColumnOptions), - makeColumn(v('Известняк (%)'), 'camstone', numericColumnOptions), - makeColumn(v('Цемент (%)'), 'cement', numericColumnOptions), - ] - }, + makeColumn(v('Песчаник (%)'), 'sandstone', numericColumnOptions), + makeColumn(v('Алевролит (%)'), 'siltstone', numericColumnOptions), + makeColumn(v('Аргиллит (%)'), 'argillit', numericColumnOptions), + makeColumn(v('Аргиллит бит. (%)'), 'brokenArgillit', numericColumnOptions), + makeColumn(v('Уголь (%)'), 'coal', numericColumnOptions), + makeColumn(v('Песок (%)'), 'sand', numericColumnOptions), + makeColumn(v('Глина (%)'), 'clay', numericColumnOptions), + makeColumn(v('Известняк (%)'), 'camstone', numericColumnOptions), + makeColumn(v('Цемент (%)'), 'cement', numericColumnOptions), makeColumn('Краткое описание', 'summary', textColumnOptions), makeColumn(v('ЛБА бурового раствора'), 'drillingMud', numericColumnOptions), makeColumn(v('ЛБА (шлама)'), 'sludge', numericColumnOptions), - { - title: 'Газопоказания', - key: 'gasIndications', - children: [ - makeColumn(v('Сумма УВ мах. (абс%)'), 'maxSum', numericColumnOptions), - makeColumn(v('С1 метан (отн%)'), 'methane', numericColumnOptions), - makeColumn(v('С2 этан (отн%)'), 'ethane', numericColumnOptions), - makeColumn(v('С3 пропан (отн%)'), 'propane', numericColumnOptions), - makeColumn(v('С4 бутан (отн%)'), 'butane', numericColumnOptions), - makeColumn(v('С5 пентан (отн%)'), 'pentane', numericColumnOptions), - ] - }, + makeColumn(v('Сумма УВ мах. (абс%)'), 'maxSum', numericColumnOptions), + makeColumn(v('С1 метан (отн%)'), 'methane', numericColumnOptions), + makeColumn(v('С2 этан (отн%)'), 'ethane', numericColumnOptions), + makeColumn(v('С3 пропан (отн%)'), 'propane', numericColumnOptions), + makeColumn(v('С4 бутан (отн%)'), 'butane', numericColumnOptions), + makeColumn(v('С5 пентан (отн%)'), 'pentane', numericColumnOptions), makeColumn(v('Мех. скорость'), 'mechanicalSpeed', numericColumnOptions), makeColumn('Предварительное заключение о насыщении по ГК', 'preliminaryConclusion', textColumnOptions), ] \ No newline at end of file diff --git a/src/pages/Measure/index.jsx b/src/pages/Measure/index.jsx index 105926c..129b78d 100644 --- a/src/pages/Measure/index.jsx +++ b/src/pages/Measure/index.jsx @@ -1,25 +1,60 @@ +import { useState, useEffect } from 'react' import { columnsMudDiagram} from './columnsMudDiagram' import { columnsDrillingFluid} from './columnsDrillingFluid' +import { invokeWebApiWrapperAsync } from '../../components/factory' +import { MeasureService } from '../../services/api' import { columnsNnb } from './columnsNnb' -import { MeasureTable } from './MeasureTable' -//import { MeasureTable2 } from './MeasureTable2' +import LoaderPortal from '../../components/LoaderPortal' +//import moment from 'moment' +//import { MeasureTable } from './MeasureTable' +import { MeasureTable2 } from './MeasureTable2' + +const format='YYYY.MM.DD HH:mm' export default function Measure({idWell}){ + const [showLoader, setShowLoader] = useState(false) + const [currentFluidValues, setCurrentFluidValues] = useState([]) + const [currentMudValues, setCurrentMudValues] = useState([]) + const [currentNnbValues, setCurrentNnbValues] = useState([]) + + const updateCurrentValues = () => invokeWebApiWrapperAsync(async()=>{ + const data = await MeasureService.getAllLast(idWell) + + const fluidValues = data?.find(value => value.idCategory === 1) + setCurrentFluidValues(fluidValues ?? []) + const mudValues = data?.find(value => value.idCategory === 2) + setCurrentMudValues(mudValues ?? []) + const nnbValues = data?.find(value => value.idCategory === 3) + setCurrentNnbValues(nnbValues ?? []) + } + ,setShowLoader + ,`Не удалось загрузить последние данные по скважине ${idWell}`) + + useEffect(updateCurrentValues, [idWell]) + return <> - - - + + + + + } \ No newline at end of file diff --git a/src/styles/index.css b/src/styles/index.css index ae77b2e..bf9acb7 100644 --- a/src/styles/index.css +++ b/src/styles/index.css @@ -19,6 +19,10 @@ body { display: none; } +.w-15 { + width: 15% +} + .w-100 { width: 100% } diff --git a/src/styles/measure.css b/src/styles/measure.css new file mode 100644 index 0000000..77824cc --- /dev/null +++ b/src/styles/measure.css @@ -0,0 +1,32 @@ +.measure-dates { + width: 15%; + overflow-y: scroll; +} + +.measure-button { + display: flex; + margin-top: 8px; + width: 95%; + height: 30px; + border: 1px solid black; + border-radius: 5px; +} + +.measure-button:hover { + cursor: pointer; +} + +.last-measure-button { + display: flex; + margin-top: 8px; + background-color: #DCDCDC; + width: 95%; + height: 30px; + border: 1px solid black; + border-radius: 5px; +} + +.last-measure-button:hover { + cursor: pointer; + background-color: #D3D3D3; +} \ No newline at end of file