forked from ddrilling/asb_cloud_front
Исправлены ошибки отображения и посчётов нпв
This commit is contained in:
parent
6262507366
commit
ec5b5e427b
@ -132,7 +132,7 @@ export const ClusterWells = memo(({ statsWells }) => {
|
|||||||
makeNumericColumnPlanFact('Продолжительность, сут', 'period', filtersMinMax, makeFilterMinMaxFunction, numericRender),
|
makeNumericColumnPlanFact('Продолжительность, сут', 'period', filtersMinMax, makeFilterMinMaxFunction, numericRender),
|
||||||
makeNumericColumnPlanFact('МСП, м/ч', 'rateOfPenetration', filtersMinMax, makeFilterMinMaxFunction, numericRender),
|
makeNumericColumnPlanFact('МСП, м/ч', 'rateOfPenetration', filtersMinMax, makeFilterMinMaxFunction, numericRender),
|
||||||
makeNumericColumnPlanFact('Рейсовая скорость, м/ч', 'routeSpeed', filtersMinMax, makeFilterMinMaxFunction, numericRender),
|
makeNumericColumnPlanFact('Рейсовая скорость, м/ч', 'routeSpeed', filtersMinMax, makeFilterMinMaxFunction, numericRender),
|
||||||
makeNumericColumn('НПВ, ч', 'notProductiveTimeFact', filtersMinMax, makeFilterMinMaxFunction, (npt) => numericRender(npt * 24)),
|
makeNumericColumn('НПВ, ч', 'notProductiveTimeFact', filtersMinMax, makeFilterMinMaxFunction, numericRender),
|
||||||
makeColumn('TVD', 'tvd', { align: 'center', render: (_, value) => (
|
makeColumn('TVD', 'tvd', { align: 'center', render: (_, value) => (
|
||||||
<Button onClick={() => { setSelectedWellId(value?.id); setIsTVDModalVisible(true) }} children={<LineChartOutlined />} />
|
<Button onClick={() => { setSelectedWellId(value?.id); setIsTVDModalVisible(true) }} children={<LineChartOutlined />} />
|
||||||
) }),
|
) }),
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { memo, useCallback, useEffect, useState } from 'react'
|
import { memo, useCallback, useEffect, useMemo, useState } from 'react'
|
||||||
|
|
||||||
import { Grid, GridItem } from '@components/Grid'
|
import { Grid, GridItem } from '@components/Grid'
|
||||||
import { makeDateSorter } from '@components/Table'
|
import { makeDateSorter } from '@components/Table'
|
||||||
@ -31,17 +31,33 @@ const RemoveSimilar = (input, accessor) => {
|
|||||||
|
|
||||||
const addPointData = (point) => ({ depth: point.wellDepth })
|
const addPointData = (point) => ({ depth: point.wellDepth })
|
||||||
|
|
||||||
|
const ChartValues = memo(({ pv }) => pv?.map((v, idx) => {
|
||||||
|
const text = `${v.value?.toFixed(2) ?? '--'} ${v.unit}`
|
||||||
|
return (
|
||||||
|
<GridItem
|
||||||
|
key={idx}
|
||||||
|
row={idx + 1}
|
||||||
|
col={1}
|
||||||
|
className={'monitoring_value'}
|
||||||
|
style={{ color: v.color, padding: '0 4px' }}
|
||||||
|
data-before={text}
|
||||||
|
children={text}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}))
|
||||||
|
|
||||||
export const MonitoringColumn = memo(({ lineGroup, data, flowChartData, interval, showBorder, style, headerHeight, pointCount = 2048, additionalLabels }) => {
|
export const MonitoringColumn = memo(({ lineGroup, data, flowChartData, interval, showBorder, style, headerHeight, pointCount = 2048, additionalLabels }) => {
|
||||||
const [dataStore, setDataStore] = useState([])
|
const [dataStore, setDataStore] = useState([])
|
||||||
const [lineGroupWithoutShapes, setLineGroupWithoutShapes] = useState([])
|
const dataLast = useMemo(() => data?.[data.length - 1], [data])
|
||||||
const dataLast = data?.[data.length - 1]
|
const yStart = useMemo(() => new Date((dataLast?.date ? +new Date(dataLast.date) : Date.now()) - interval * 0.97), [dataLast, interval])
|
||||||
const yStart = new Date((dataLast?.date ? +new Date(dataLast.date) : Date.now()) - interval * 0.97)
|
const pv = useMemo(() => lineGroup.filter(line => line.showLabels).map(line => ({
|
||||||
let pv = lineGroup.filter(line => line.showLabels).map(line => ({
|
|
||||||
color: line.color,
|
color: line.color,
|
||||||
label: line.label,
|
label: line.label,
|
||||||
unit: line.units,
|
unit: line.units,
|
||||||
value: dataLast?.[line.xAccessorName]
|
value: dataLast?.[line.xAccessorName]
|
||||||
}))
|
})), [lineGroup, dataLast])
|
||||||
|
|
||||||
|
const lineGroupWithoutShapes = useMemo(() => lineGroup.filter(cfg => !cfg.isShape), [lineGroup])
|
||||||
|
|
||||||
const postParsing = useCallback((data) => {
|
const postParsing = useCallback((data) => {
|
||||||
lineGroupWithoutShapes.forEach(lineCfg => {
|
lineGroupWithoutShapes.forEach(lineCfg => {
|
||||||
@ -67,10 +83,6 @@ export const MonitoringColumn = memo(({ lineGroup, data, flowChartData, interval
|
|||||||
})
|
})
|
||||||
}, [data, pointCount])
|
}, [data, pointCount])
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
setLineGroupWithoutShapes(lineGroup.filter(cfg => !cfg.isShape))
|
|
||||||
}, [lineGroup])
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div style={style}>
|
<div style={style}>
|
||||||
<Grid style={{ height: headerHeight, boxShadow: showBorder ? 'inset 0px 0px 0px 3px black' : '', margin: 0 }}>
|
<Grid style={{ height: headerHeight, boxShadow: showBorder ? 'inset 0px 0px 0px 3px black' : '', margin: 0 }}>
|
||||||
@ -80,20 +92,7 @@ export const MonitoringColumn = memo(({ lineGroup, data, flowChartData, interval
|
|||||||
</Grid>
|
</Grid>
|
||||||
<div style={{ position: 'relative' }}>
|
<div style={{ position: 'relative' }}>
|
||||||
<Grid className={'display_chart_values'}>
|
<Grid className={'display_chart_values'}>
|
||||||
{pv?.map((v, idx) => {
|
<ChartValues pv={pv} />
|
||||||
const text = `${v.value?.toFixed(2) ?? '--'} ${v.unit}`
|
|
||||||
return (
|
|
||||||
<GridItem
|
|
||||||
key={idx}
|
|
||||||
row={idx + 1}
|
|
||||||
col={1}
|
|
||||||
className={'monitoring_value'}
|
|
||||||
style={{ color: v.color, padding: '0 4px' }}
|
|
||||||
data-before={text}
|
|
||||||
children={text}
|
|
||||||
/>
|
|
||||||
)
|
|
||||||
})}
|
|
||||||
{additionalLabels?.map((label, idx) => (
|
{additionalLabels?.map((label, idx) => (
|
||||||
<GridItem
|
<GridItem
|
||||||
key={idx}
|
key={idx}
|
||||||
|
@ -21,7 +21,10 @@ const printDate = (date) => formatDate(date) ?? '-'
|
|||||||
export const AdditionalTables = memo(({ operations, xLabel, setIsLoading }) => {
|
export const AdditionalTables = memo(({ operations, xLabel, setIsLoading }) => {
|
||||||
const [additionalData, setAdditionalData] = useState({})
|
const [additionalData, setAdditionalData] = useState({})
|
||||||
|
|
||||||
const nptSum = useMemo(() => operations.fact?.reduce((out, row) => out + (row?.durationHours ?? 0), 0), [operations.fact])
|
const nptSum = useMemo(() => operations.fact
|
||||||
|
?.filter((row) => row.isNPT)
|
||||||
|
.reduce((out, row) => out + (row?.durationHours ?? 0), 0)
|
||||||
|
, [operations.fact])
|
||||||
|
|
||||||
useEffect(() => invokeWebApiWrapperAsync(
|
useEffect(() => invokeWebApiWrapperAsync(
|
||||||
async () => {
|
async () => {
|
||||||
@ -51,7 +54,7 @@ export const AdditionalTables = memo(({ operations, xLabel, setIsLoading }) => {
|
|||||||
<Descriptions bordered column={1} size={'small'} style={{ backgroundColor: 'white' }}>
|
<Descriptions bordered column={1} size={'small'} style={{ backgroundColor: 'white' }}>
|
||||||
<Item label={'Дата завершения'}>{printDate(additionalData.endDate)}</Item>
|
<Item label={'Дата завершения'}>{printDate(additionalData.endDate)}</Item>
|
||||||
<Item label={'Отставание (сут)'}>{numericRender(additionalData.lag)}</Item>
|
<Item label={'Отставание (сут)'}>{numericRender(additionalData.lag)}</Item>
|
||||||
<Item label={'Длительность НПВ (сут)'}>{numericRender(nptSum)}</Item>
|
<Item label={'Длительность НПВ (ч)'}>{numericRender(nptSum)}</Item>
|
||||||
</Descriptions>
|
</Descriptions>
|
||||||
</div>
|
</div>
|
||||||
<div className={'tvd-bl-table'} style={{ bottom: xLabel === 'day' ? '35px' : '85px' }}>
|
<div className={'tvd-bl-table'} style={{ bottom: xLabel === 'day' ? '35px' : '85px' }}>
|
||||||
|
Loading…
Reference in New Issue
Block a user