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

View File

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