Исправлены варнинги. Для графика операции-время добавлен период по умолчанию 1 день

This commit is contained in:
Alexey 2021-07-27 14:05:32 +05:00
parent 0aec1b7379
commit 6014c140b6
3 changed files with 13 additions and 13 deletions

View File

@ -3,6 +3,7 @@ import { useParams } from "react-router-dom"
import notify from "../components/notify" import notify from "../components/notify"
import { useState, useEffect } from 'react' import { useState, useEffect } from 'react'
import { AnalyticsService } from "../services/api" import { AnalyticsService } from "../services/api"
import LoaderPortal from '../components/LoaderPortal'
const lines = [ const lines = [
{ label: "Глубина забоя", yAccessorName: "wellDepth", color: '#f00' }, { label: "Глубина забоя", yAccessorName: "wellDepth", color: '#f00' },
@ -31,11 +32,11 @@ export function AnalysisDepthToDay() {
}, [id]) }, [id])
return ( return (
<> <LoaderPortal show={loader}>
<ChartDepthToDay <ChartDepthToDay
data={depthToDayData} data={depthToDayData}
lines={lines} lines={lines}
/> />
</> </LoaderPortal>
) )
} }

View File

@ -1,10 +1,10 @@
import { useParams } from "react-router-dom" import { useParams } from "react-router-dom"
import { DatePicker } from 'antd'
import notify from "../components/notify" import notify from "../components/notify"
import { useState, useEffect } from 'react' import { useState, useEffect } from 'react'
import { AnalyticsService } from '../services/api' import { AnalyticsService } from '../services/api'
import { ChartDepthToInterval } from './charts/ChartDepthToInterval' import { ChartDepthToInterval } from './charts/ChartDepthToInterval'
import { Select } from 'antd' import { Select } from 'antd'
import LoaderPortal from '../components/LoaderPortal'
const { Option } = Select const { Option } = Select
@ -19,8 +19,6 @@ const timePeriodCollection = [
{ value: '86400', label: '24 часа' } { value: '86400', label: '24 часа' }
] ]
const { RangePicker } = DatePicker
const lines = [{ label: 'График скорость проходки-интервал', yAccessorName: "intervalDepthProgress", xAccessorName: "intervalStartDate", color: '#00f' }] const lines = [{ label: 'График скорость проходки-интервал', yAccessorName: "intervalDepthProgress", xAccessorName: "intervalStartDate", color: '#00f' }]
export function AnalysisDepthToInterval() { export function AnalysisDepthToInterval() {
@ -48,7 +46,7 @@ export function AnalysisDepthToInterval() {
}, [id, chartInterval]) }, [id, chartInterval])
return ( return (
<> <LoaderPortal show={loader}>
<Select defaultValue="600" onChange={setChartInterval}> <Select defaultValue="600" onChange={setChartInterval}>
{children} {children}
</Select> </Select>
@ -56,6 +54,6 @@ export function AnalysisDepthToInterval() {
data={depthToIntervalData} data={depthToIntervalData}
lines={lines} lines={lines}
/> />
</> </LoaderPortal>
) )
} }

View File

@ -5,6 +5,8 @@ import { useState, useEffect } from 'react'
import { AnalyticsService } from '../services/api' import { AnalyticsService } from '../services/api'
import { ChartOperationTime } from './charts/ChartOperationTime' import { ChartOperationTime } from './charts/ChartOperationTime'
import locale from "antd/lib/locale/ru_RU"; import locale from "antd/lib/locale/ru_RU";
import LoaderPortal from '../components/LoaderPortal'
import moment from 'moment'
const { RangePicker } = DatePicker const { RangePicker } = DatePicker
@ -14,10 +16,7 @@ export function AnalysisOperationTime() {
let { id } = useParams() let { id } = useParams()
const [operationTimeData, setOperationTimeData] = useState([]) const [operationTimeData, setOperationTimeData] = useState([])
const [loader, setLoader] = useState(false) const [loader, setLoader] = useState(false)
const [range, setRange] = useState([]) const [range, setRange] = useState([moment().subtract(1,'days'), moment()])
let begin = null
let end = null
const onChangeRange = (range) => { const onChangeRange = (range) => {
setRange(range) setRange(range)
@ -29,6 +28,8 @@ export function AnalysisOperationTime() {
useEffect(() => { useEffect(() => {
setLoader(true) setLoader(true)
let begin = null
let end = null
if (range?.length > 1) { if (range?.length > 1) {
begin = range[0].toISOString() begin = range[0].toISOString()
end = range[1].toISOString() end = range[1].toISOString()
@ -44,7 +45,7 @@ export function AnalysisOperationTime() {
}, [id, range]) }, [id, range])
return ( return (
<> <LoaderPortal show={loader}>
<ConfigProvider locale={locale}> <ConfigProvider locale={locale}>
<RangePicker <RangePicker
showTime showTime
@ -55,6 +56,6 @@ export function AnalysisOperationTime() {
data={operationTimeData} data={operationTimeData}
lines={lines} lines={lines}
/> />
</> </LoaderPortal>
) )
} }