Исправлены варнинги. Для графика операции-время добавлен период по умолчанию 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 { useState, useEffect } from 'react'
import { AnalyticsService } from "../services/api"
import LoaderPortal from '../components/LoaderPortal'
const lines = [
{ label: "Глубина забоя", yAccessorName: "wellDepth", color: '#f00' },
@ -31,11 +32,11 @@ export function AnalysisDepthToDay() {
}, [id])
return (
<>
<LoaderPortal show={loader}>
<ChartDepthToDay
data={depthToDayData}
lines={lines}
/>
</>
</LoaderPortal>
)
}

View File

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

View File

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