2021-07-19 17:28:09 +05:00
|
|
|
|
import { useParams } from "react-router-dom"
|
2021-07-20 16:15:44 +05:00
|
|
|
|
import { DatePicker } from 'antd'
|
2021-07-19 17:28:09 +05:00
|
|
|
|
import notify from "../components/notify"
|
|
|
|
|
import { useState, useEffect } from 'react'
|
2021-07-20 16:15:44 +05:00
|
|
|
|
import { AnalyticsService } from '../services/api'
|
2021-07-19 17:28:09 +05:00
|
|
|
|
import { ChartDepthToInterval } from './charts/ChartDepthToInterval'
|
2021-07-20 16:15:44 +05:00
|
|
|
|
import { Select } from 'antd'
|
2021-07-19 17:28:09 +05:00
|
|
|
|
|
2021-07-20 16:15:44 +05:00
|
|
|
|
const { Option } = Select
|
|
|
|
|
|
|
|
|
|
const timePeriodCollection = [
|
|
|
|
|
{ value: '60', label: '1 минута' },
|
|
|
|
|
{ value: '300', label: '5 минут' },
|
|
|
|
|
{ value: '600', label: '10 минут' },
|
|
|
|
|
{ value: '1800', label: '30 минут' },
|
|
|
|
|
{ value: '3600', label: '1 час' },
|
|
|
|
|
{ value: '21600', label: '6 часов' },
|
|
|
|
|
{ value: '43200', label: '12 часов' },
|
|
|
|
|
{ value: '86400', label: '24 часа' }
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
const { RangePicker } = DatePicker
|
|
|
|
|
|
|
|
|
|
const lines = [{ label: 'График скорость проходки-интервал', yAccessorName: "intervalDepthProgress", xAccessorName: "intervalStartDate", color: '#00f' }]
|
2021-07-19 17:28:09 +05:00
|
|
|
|
|
|
|
|
|
export function AnalysisDepthToInterval() {
|
|
|
|
|
let { id } = useParams()
|
|
|
|
|
const [depthToIntervalData, setDepthToIntervalData] = useState([])
|
|
|
|
|
const [loader, setLoader] = useState(false)
|
2021-07-20 16:15:44 +05:00
|
|
|
|
const [chartInterval, setChartInterval] = useState(600)
|
|
|
|
|
|
|
|
|
|
const children = timePeriodCollection.map((line) => <Option key={line.value}>{line.label}</Option>)
|
2021-07-19 17:28:09 +05:00
|
|
|
|
|
|
|
|
|
const handleReceiveDepthToIntervalData = (data) => {
|
|
|
|
|
setDepthToIntervalData(data)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
setLoader(true)
|
2021-07-20 16:15:44 +05:00
|
|
|
|
AnalyticsService.getWellDepthToInterval(id, chartInterval)
|
2021-07-19 17:28:09 +05:00
|
|
|
|
.then(handleReceiveDepthToIntervalData)
|
|
|
|
|
.catch(error => {
|
|
|
|
|
notify(`Не удалось получить данные для Анализа Глубина-День по скважине "${id}"`,
|
|
|
|
|
'warning')
|
|
|
|
|
console.log(error)
|
|
|
|
|
})
|
|
|
|
|
.finally(setLoader(false))
|
2021-07-20 16:15:44 +05:00
|
|
|
|
}, [id, chartInterval])
|
2021-07-19 17:28:09 +05:00
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<>
|
2021-07-20 16:15:44 +05:00
|
|
|
|
<Select defaultValue="600" onChange={setChartInterval}>
|
|
|
|
|
{children}
|
|
|
|
|
</Select>
|
2021-07-19 17:28:09 +05:00
|
|
|
|
<ChartDepthToInterval
|
|
|
|
|
data={depthToIntervalData}
|
2021-07-20 16:15:44 +05:00
|
|
|
|
lines={lines}
|
2021-07-19 17:28:09 +05:00
|
|
|
|
/>
|
|
|
|
|
</>
|
|
|
|
|
)
|
|
|
|
|
}
|