Улучшена TelemetryView и страница просмотра телеметрий

This commit is contained in:
goodmice 2022-10-11 17:36:00 +05:00
parent 978a26e455
commit 8c2c1b7913
No known key found for this signature in database
GPG Key ID: 63EA771203189CF1
2 changed files with 15 additions and 9 deletions

View File

@ -1,8 +1,9 @@
import { Fragment, memo } from 'react' import { Fragment, memo } from 'react'
import { Tooltip } from 'antd' import { Tooltip } from 'antd'
import { TelemetryDto, TelemetryInfoDto } from '@api'
import { Grid, GridItem } from '@components/Grid' import { Grid, GridItem } from '@components/Grid'
import { formatDate } from '@utils'
import { TelemetryDto, TelemetryInfoDto } from '@api'
export const lables: Record<string, string> = { export const lables: Record<string, string> = {
timeZoneId: 'Временная зона', timeZoneId: 'Временная зона',
@ -30,12 +31,17 @@ export const TelemetryView = memo<TelemetryViewProps>(({ telemetry }) => telemet
overlayInnerStyle={{ width: '400px' }} overlayInnerStyle={{ width: '400px' }}
title={ title={
<Grid> <Grid>
{(Object.keys(telemetry.info) as Array<keyof TelemetryInfoDto>).map((key, i) => ( {(Object.keys(telemetry.info) as Array<keyof TelemetryInfoDto>).map((key, i) => {
<Fragment key={i}> let value = telemetry.info?.[key]
<GridItem row={i+1} col={1}>{lables[key] ?? key}:</GridItem> value = key === 'drillingStartDate' ? formatDate(value) : value
<GridItem row={i+1} col={2}>{telemetry.info?.[key]}</GridItem>
</Fragment> return (
))} <Fragment key={i}>
<GridItem row={i+1} col={1}>{lables[key] ?? key}:</GridItem>
<GridItem row={i+1} col={2}>{value}</GridItem>
</Fragment>
)
})}
</Grid> </Grid>
} }
> >

View File

@ -6,7 +6,7 @@ import { Button, Input } from 'antd'
import { import {
defaultPagination, defaultPagination,
makeColumn, makeColumn,
makeDateSorter, makeDateColumn,
makeNumericColumn, makeNumericColumn,
makeNumericRender, makeNumericRender,
makeTextColumn, makeTextColumn,
@ -53,7 +53,7 @@ const TelemetryController = memo(() => {
makeNumericColumn('ID', 'id', null, null, makeNumericRender(0)), makeNumericColumn('ID', 'id', null, null, makeNumericRender(0)),
makeTextColumn('UID', 'remoteUid'), makeTextColumn('UID', 'remoteUid'),
makeTextColumn('Назначена на скважину', 'realWell'), makeTextColumn('Назначена на скважину', 'realWell'),
makeTextColumn('Дата начала бурения', 'drillingStartDate', null, makeDateSorter('drillingStartDate')), makeDateColumn('Дата начала бурения', 'drillingStartDate'),
makeTextColumn('Часовой пояс', 'timeZoneId'), makeTextColumn('Часовой пояс', 'timeZoneId'),
makeTextColumn('Скважина', 'well'), makeTextColumn('Скважина', 'well'),
makeTextColumn('Куст', 'cluster'), makeTextColumn('Куст', 'cluster'),