Добавлен столбец длительности НПВ

This commit is contained in:
goodmice 2022-04-28 11:18:39 +05:00
parent 09ebdd5b46
commit 62e6970653

View File

@ -1,5 +1,5 @@
import { Descriptions } from 'antd'
import { memo, useEffect, useState } from 'react'
import { memo, useEffect, useMemo, useState } from 'react'
import { makeNumericRender } from '@components/Table'
import { invokeWebApiWrapperAsync } from '@components/factory'
@ -21,6 +21,8 @@ const printDate = (date) => formatDate(date) ?? '-'
export const AdditionalTables = memo(({ operations, xLabel, setIsLoading }) => {
const [additionalData, setAdditionalData] = useState({})
const nptSum = useMemo(() => operations.fact?.reduce((out, row) => out + (row?.durationHours ?? 0), 0), [operations.fact])
useEffect(() => invokeWebApiWrapperAsync(
async () => {
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' }}>
<Item label={'Дата завершения'}>{printDate(additionalData.endDate)}</Item>
<Item label={'Отставание (сут)'}>{numericRender(additionalData.lag)}</Item>
<Item label={'Длительность НПВ (сут)'}>{numericRender(nptSum)}</Item>
</Descriptions>
</div>
<div className={'tvd-bl-table'} style={{ bottom: xLabel === 'day' ? '35px' : '85px' }}>