Стилистические исправления страница Операции

This commit is contained in:
goodmice 2022-05-05 17:47:15 +05:00
parent 45bd384eaf
commit e75d75cb5f
4 changed files with 20 additions and 22 deletions

View File

@ -33,19 +33,17 @@ export const OperationsChart = memo(({ data, yDomain, width, height, bottom = 30
useEffect(() => d3.select(axisY.current).call(d3.axisLeft(y)), [axisY, y]) // Рисуем ось Y useEffect(() => d3.select(axisY.current).call(d3.axisLeft(y)), [axisY, y]) // Рисуем ось Y
return ( return (
<> <div className={'page-left'} ref={setRef}>
<div className={'page-left'} ref={setRef}> <svg width={width ?? '100%'} height={height ?? '100%'}>
<svg width={width ?? '100%'} height={height ?? '100%'}> <g ref={axisX} className={'axis x'} transform={`translate(${left}, ${h - bottom})`} />
<g ref={axisX} className={'axis x'} transform={`translate(${left}, ${h - bottom})`} /> <g ref={axisY} className={'axis y'} transform={`translate(${left}, ${top})`} />
<g ref={axisY} className={'axis y'} transform={`translate(${left}, ${top})`} /> <g transform={`translate(${left}, ${top})`} stroke={color}>
<g transform={`translate(${left}, ${top})`} stroke={color}> {lines.map(({ x, y }, i) => (
{lines.map(({ x, y }, i) => ( <line key={i} x1={x} y1={h - bottom - top} x2={x} y2={y} />
<line key={i} x1={x} y1={h - bottom - top} x2={x} y2={y} /> ))}
))} </g>
</g> </svg>
</svg> </div>
</div>
</>
) )
}) })

View File

@ -1,14 +1,14 @@
import { memo } from 'react' import { memo } from 'react'
import { Table, makeTextColumn, makeNumericColumn, makeDateColumn } from '@components/Table' import { Table, makeTextColumn, makeNumericColumn, makeDateColumn, makeNumericRender } from '@components/Table'
import '@styles/detected_operations.less' import '@styles/detected_operations.less'
export const columns = [ export const columns = [
makeTextColumn('Пользователь', 'telemetryUserName', null, null, null, { width: 200 }), makeTextColumn('Пользователь', 'telemetryUserName', null, null, null, { width: 200 }),
makeDateColumn('Дата начала', 'dateStart', null, undefined, { width: 150 }), makeDateColumn('Дата начала', 'dateStart', null, undefined, { width: 150 }),
makeNumericColumn('Продолжительность (мин)', 'durationMinutes', null, null, null, 150), makeNumericColumn('Продолжительность (мин)', 'durationMinutes', null, null, makeNumericRender(2), 150),
makeNumericColumn('Глубина (м)', 'depthStart', null, null, null, 100), makeNumericColumn('Глубина (м)', 'depthStart', null, null, makeNumericRender(1), 100),
] ]
export const OperationsTable = memo(({ data, height, ...other }) => ( export const OperationsTable = memo(({ data, height, ...other }) => (

View File

@ -1,6 +1,6 @@
import moment from 'moment'
import { InputNumber } from 'antd'
import { memo, useCallback, useContext, useEffect, useState } from 'react' import { memo, useCallback, useContext, useEffect, useState } from 'react'
import { InputNumber } from 'antd'
import moment from 'moment'
import { IdWellContext } from '@asb/context' import { IdWellContext } from '@asb/context'
import LoaderPortal from '@components/LoaderPortal' import LoaderPortal from '@components/LoaderPortal'
@ -17,7 +17,7 @@ import '@styles/detected_operations.less'
export const Operations = memo(() => { export const Operations = memo(() => {
const [isLoading, setIsLoading] = useState(false) const [isLoading, setIsLoading] = useState(false)
const [dateRange, setDateRange] = useState([]) const [dateRange, setDateRange] = useState([])
const [yDomain, setYDomain] = useState(10) const [yDomain, setYDomain] = useState(20)
const [dates, setDates] = useState() const [dates, setDates] = useState()
const [data, setData] = useState([]) const [data, setData] = useState([])
@ -62,11 +62,11 @@ export const Operations = memo(() => {
<DateRangeWrapper <DateRangeWrapper
value={dates} value={dates}
onChange={setDates} onChange={setDates}
disabled={isLoading}
disabledDate={disabledDates} disabledDate={disabledDates}
disabledTime={disabledTimes} disabledTime={disabledTimes}
style={{ marginRight: '10px' }} style={{ marginRight: '10px' }}
showTime={{ hideDisabledOptions: true }} showTime={{ hideDisabledOptions: true }}
disabled={isLoading}
/> />
<InputNumber <InputNumber
min={1} min={1}
@ -80,7 +80,7 @@ export const Operations = memo(() => {
</div> </div>
<LoaderPortal show={isLoading}> <LoaderPortal show={isLoading}>
<div className={'page-main'}> <div className={'page-main'}>
<OperationsChart data={data} yDomain={yDomain} height={'50vh'} /> <OperationsChart data={data} height={'50vh'} yDomain={yDomain} />
<OperationsTable data={data} height={'20vh'} /> <OperationsTable data={data} height={'20vh'} />
</div> </div>
</LoaderPortal> </LoaderPortal>

View File

@ -29,7 +29,7 @@ export const Telemetry = memo(() => {
<PrivateMenu.Link key={'messages'} icon={<AlertOutlined/>} title={'Сообщения'} /> <PrivateMenu.Link key={'messages'} icon={<AlertOutlined/>} title={'Сообщения'} />
<PrivateMenu.Link key={'archive'} icon={<DatabaseOutlined />} title={'Архив'} /> <PrivateMenu.Link key={'archive'} icon={<DatabaseOutlined />} title={'Архив'} />
<PrivateMenu.Link key={'dashboard_nnb'} title={'ННБ'} /> <PrivateMenu.Link key={'dashboard_nnb'} title={'ННБ'} />
<PrivateMenu.Link key={'operations'} title={'Отмеченные операции'} /> <PrivateMenu.Link key={'operations'} title={'Операции'} />
</PrivateMenu> </PrivateMenu>
<Layout> <Layout>