Скрыт столбец планового НПВ; отображение НПВ изменено на часы

This commit is contained in:
goodmice 2022-04-28 12:06:13 +05:00
parent 62e6970653
commit 107016ba5e

View File

@ -1,5 +1,5 @@
import { Link, useLocation } from 'react-router-dom'
import { useState, useEffect, memo, useMemo } from 'react'
import { useState, useEffect, memo, useMemo, useCallback } from 'react'
import { Tag, Button, Modal } from 'antd'
import { LineChartOutlined, ProfileOutlined } from '@ant-design/icons'
@ -11,6 +11,7 @@ import {
makeNumericColumnPlanFact,
Table,
makeNumericRender,
makeNumericColumn,
} from '@components/Table'
import { CompanyView } from '@components/views'
import LoaderPortal from '@components/LoaderPortal'
@ -36,6 +37,7 @@ const DAY_IN_MS = 86_400_000
const ONLINE_DEADTIME = 600_000
const getDate = (str) => isRawDate(str) ? new Date(str).toLocaleString() : '-'
const numericRender = makeNumericRender(1)
export const ClusterWells = memo(({ statsWells }) => {
const [selectedWellId, setSelectedWellId] = useState(0)
@ -127,38 +129,23 @@ export const ClusterWells = memo(({ statsWells }) => {
makeColumn('начало', 'factStart', { sorter: makeDateSorter('factStart'), render: getDate }),
makeColumn('окончание', 'factEnd', { sorter: makeDateSorter('factEnd'), render: getDate }),
]),
makeNumericColumnPlanFact('Продолжительность, сут', 'period', filtersMinMax, makeFilterMinMaxFunction, makeNumericRender(1)),
makeNumericColumnPlanFact('МСП, м/ч', 'rateOfPenetration', filtersMinMax, makeFilterMinMaxFunction, makeNumericRender(1)),
makeNumericColumnPlanFact('Рейсовая скорость, м/ч', 'routeSpeed', filtersMinMax, makeFilterMinMaxFunction, makeNumericRender(1)),
makeNumericColumnPlanFact('НПВ, сут', 'notProductiveTime', filtersMinMax, makeFilterMinMaxFunction, makeNumericRender(1)),
{
title: 'TVD',
key: 'tvd',
render: (value) => <Button onClick={()=> {
setSelectedWellId(value.id)
setIsTVDModalVisible(true)
}}><LineChartOutlined /></Button>,
align: 'center'
},
{
title: 'Операции',
key: 'operations',
render: (value) => <Button onClick={()=> {
setSelectedWellId(value.id)
setIsOpsModalVisible(true)
}}><ProfileOutlined /></Button>,
align: 'center'
},
{
title: 'Участники',
key: 'companies',
dataIndex: 'companies',
makeNumericColumnPlanFact('Продолжительность, сут', 'period', filtersMinMax, makeFilterMinMaxFunction, numericRender),
makeNumericColumnPlanFact('МСП, м/ч', 'rateOfPenetration', filtersMinMax, makeFilterMinMaxFunction, numericRender),
makeNumericColumnPlanFact('Рейсовая скорость, м/ч', 'routeSpeed', filtersMinMax, makeFilterMinMaxFunction, numericRender),
makeNumericColumn('НПВ, ч', 'notProductiveTimeFact', filtersMinMax, makeFilterMinMaxFunction, (npt) => numericRender(npt * 24)),
makeColumn('TVD', 'tvd', { align: 'center', render: (_, value) => (
<Button onClick={() => { setSelectedWellId(value?.id); setIsTVDModalVisible(true) }} children={<LineChartOutlined />} />
) }),
makeColumn('Операции', 'operations', { align: 'center', render: (_, value) => (
<Button onClick={() => { setSelectedWellId(value?.id); setIsOpsModalVisible(true) }} children={<ProfileOutlined />} />
) }),
makeColumn('Участники', 'companies', {
render: (item) => item?.map((company) => (
<Tag key={company.caption} color='blue'>
<Tag key={company.caption} color={'blue'}>
<CompanyView company={company} />
</Tag>
)) ?? '-',
},
}),
], [location.pathname])
return (
@ -181,7 +168,7 @@ export const ClusterWells = memo(({ statsWells }) => {
width={1500}
footer={null}
>
<Tvd idWell={selectedWellId} />
<Tvd style={{ minHeight: '600px' }} idWell={selectedWellId} />
</Modal>
<Modal