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

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