CF2-49: Added default values for 'Measure' table

This commit is contained in:
KharchenkoVV 2021-10-07 11:52:52 +05:00
parent d562b910ca
commit 00ed56c8b1
5 changed files with 114 additions and 11 deletions

View File

@ -10,7 +10,7 @@ import '../../styles/measure.css'
const format='YYYY.MM.DD HH:mm'
export const MeasureTable = ({idWell, idCategory, title, columns, values, updateMeasures}) => {
export const MeasureTable = ({idWell, idCategory, title, columns, values, updateMeasuresFunc}) => {
const [showLoader, setShowLoader] = useState(false);
const [selectedTimeLineId, setSelectedTimeLineId] = useState(0)
@ -72,6 +72,9 @@ export const MeasureTable = ({idWell, idCategory, title, columns, values, update
key={conf.key}
className='w-100'
onClick={onClickDelegate}
disabled={conf.key !== 'add' && displayedValues.isDefaultData
? true
: false}
>
{conf.name}
</Button>
@ -94,7 +97,7 @@ export const MeasureTable = ({idWell, idCategory, title, columns, values, update
if(editingActionName === 'Удалить'){
setShowLoader(true)
await MeasureService.markAsDelete(idWell, displayedValues.id)
updateMeasures()
updateMeasuresFunc()
setShowLoader(false)
setIsTableEditing(false)
} else {
@ -121,7 +124,7 @@ export const MeasureTable = ({idWell, idCategory, title, columns, values, update
setShowLoader(true)
await MeasureService.insert(idWell, measureParams)
setIsTableEditing(false)
updateMeasures()
updateMeasuresFunc()
setShowLoader(false)
}

View File

@ -31,3 +31,41 @@ export const columnsDrillingFluid = [
makeColumn(v("Смазка, %"), "grease",numericColumnOptions),
makeColumn(v("Карбонат кальция, кг/м³"), "calciumCarbonate",numericColumnOptions),
];
export const drillingFluidDefaultData = {
idWell: 0,
key: 'drillingFluidDefaultData',
idCategory: 0,
timestamp: new Date().toISOString(),
isDefaultData: true,
data: {
"name": 0,
"temperature": 0,
"density": 0,
"conditionalViscosity": 0,
"r300": 0,
"r600": 0,
"r3r6": 0,
"dnsDpa": 0,
"plasticViscocity": 0,
"snsDpa": 0,
"r3r649С": 0,
"dns49Cdpa": 0,
"plasticViscocity49c": 0,
"sns49Cdpa": 0,
"mbt": 0,
"sand": 0,
"filtering": 0,
"crust": 0,
"ktk": 0,
"ph": 0,
"hardness": 0,
"chlorides": 0,
"pf": 0,
"mf": 0,
"pm": 0,
"fluidSolidPhase": 0,
"grease": 0,
"calciumCarbonate": 0
}
}

View File

@ -1,9 +1,12 @@
import { useState, useEffect } from 'react'
import { columnsMudDiagram} from './columnsMudDiagram'
import { columnsDrillingFluid} from './columnsDrillingFluid'
import { columnsMudDiagram} from './mudDiagramData'
import { mudDiagramDefaultData} from './mudDiagramData'
import { columnsDrillingFluid} from './drillingFluidData'
import { drillingFluidDefaultData} from './drillingFluidData'
import { columnsNnb } from './nnbData'
import { nnbDefaultData } from './nnbData'
import { invokeWebApiWrapperAsync } from '../../components/factory'
import { MeasureService } from '../../services/api'
import { columnsNnb } from './columnsNnb'
import LoaderPortal from '../../components/LoaderPortal'
import { MeasureTable } from './MeasureTable'
@ -18,11 +21,11 @@ export default function Measure({idWell}){
const measures = await MeasureService.getHisory(idWell)
const fluids = measures.filter(el => el.idCategory === 1)
setFluidValues(fluids ?? [])
setFluidValues(fluids.length ? fluids : [drillingFluidDefaultData])
const muds = measures.filter(el => el.idCategory === 2)
setMudValues(muds ?? [])
setMudValues(muds.length ? muds : [mudDiagramDefaultData])
const nnbs = measures.filter(el => el.idCategory === 3)
setNnbValues(nnbs ?? [])
setNnbValues(nnbs.length ? nnbs : [nnbDefaultData])
}
,setShowLoader
,`Не удалось загрузить последние данные по скважине ${idWell}`)

View File

@ -24,4 +24,36 @@ export const columnsMudDiagram = [
makeColumn(v('С5 пентан (отн%)'), 'pentane', numericColumnOptions),
makeColumn(v('Мех. скорость'), 'mechanicalSpeed', numericColumnOptions),
makeColumn('Предварительное заключение о насыщении по ГК', 'preliminaryConclusion', textColumnOptions),
]
]
export const mudDiagramDefaultData = {
idWell: 0,
key: 'mudDiagramDefaultData',
idCategory: 0,
timestamp: new Date().toISOString(),
isDefaultData: true,
data: {
"probeNumber": 0,
"probeExtractionDepth": 0,
"sandstone": 0,
"siltstone": 0,
"argillit": 0,
"brokenArgillit": 0,
"coal": 0,
"sand": 0,
"clay": 0,
"camstone": 0,
"cement": 0,
"summary": '-',
"drillingMud": 0,
"sludge": 0,
"maxSum": 0,
"methane": 0,
"ethane": 0,
"propane": 0,
"butane": 0,
"pentane": 0,
"mechanicalSpeed": 0,
"preliminaryConclusion": '-'
}
}

View File

@ -19,4 +19,31 @@ export const columnsNnb = [
makeColumn(v('Комментарий'), 'comment', numericColumnOptions),
makeColumn(v('Разница вертикальных глубин\nмежду планом и фактом'), 'depthPlanFactDifference', numericColumnOptions),
makeColumn(v('Расстояние в пространстве\nмежду планом и фактом'), 'distancePlanFactDifference', numericColumnOptions),
];
];
export const nnbDefaultData = {
idWell: 0,
key: 'nnbDefaultData',
idCategory: 0,
timestamp: new Date().toISOString(),
isDefaultData: true,
data: {
"depth": 0,
"zenithAngle": 0,
"magneticAzimuth": 0,
"trueAzimuth": 0,
"directAzimuth": 0,
"verticalDepth": 0,
"absoluteMark": 0,
"localNorthOffset": 0,
"localEastOffset": 0,
"outFallOffset": 0,
"offsetAzimuth": 0,
"areaIntensity": '-',
"offsetStopAngle": 0,
"zenithIntensity": 0,
"comment": '-',
"depthPlanFactDifference": 0,
"distancePlanFactDifference": 0
}
}