forked from ddrilling/asb_cloud_front
Добавлен столбец длительности НПВ
This commit is contained in:
parent
09ebdd5b46
commit
62e6970653
@ -1,5 +1,5 @@
|
|||||||
import { Descriptions } from 'antd'
|
import { Descriptions } from 'antd'
|
||||||
import { memo, useEffect, useState } from 'react'
|
import { memo, useEffect, useMemo, useState } from 'react'
|
||||||
|
|
||||||
import { makeNumericRender } from '@components/Table'
|
import { makeNumericRender } from '@components/Table'
|
||||||
import { invokeWebApiWrapperAsync } from '@components/factory'
|
import { invokeWebApiWrapperAsync } from '@components/factory'
|
||||||
@ -21,6 +21,8 @@ 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])
|
||||||
|
|
||||||
useEffect(() => invokeWebApiWrapperAsync(
|
useEffect(() => invokeWebApiWrapperAsync(
|
||||||
async () => {
|
async () => {
|
||||||
const [factStartDate, factEndDate] = calcEndDate(operations.fact)
|
const [factStartDate, factEndDate] = calcEndDate(operations.fact)
|
||||||
@ -49,6 +51,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>
|
||||||
</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