()
+
+ useEffect(() => {
+ if ((chartRef.current) && (!chart)) {
+ let thisOptions = {}
+ Object.assign(thisOptions, defaultOptions, options)
+
+ let newChart = new Chart(chartRef.current, {
+ type: 'bar',
+ plugins: [ChartDataLabels],
+ options: thisOptions,
+ data: dataParams.data
+ })
+ setChart(newChart)
+
+ return () => chart?.destroy()
+ }
+ }, [chart, options, dataParams])
+
+ useEffect(() => {
+ if (!chart)
+ return
+
+ chart.data = dataParams.data
+ chart.options.aspectRatio = options?.aspectRatio
+ if (dataParams.xStart) {
+ let interval = Number(dataParams.xInterval ?? 600)
+ let start = new Date(dataParams.xStart)
+ let end = new Date(dataParams.xStart)
+ end.setSeconds(end.getSeconds() + interval)
+ let { unit, stepSize } = timeParamsByInterval(interval)
+
+ if (chart.options.scales?.x) {
+ chart.options.scales.x.max = end.getTime()
+ chart.options.scales.x.min = start.getTime()
+ chart.options.scales.x.ticks.display = dataParams.displayLabels ?? true
+ chart.options.scales.x.time.unit = unit
+ chart.options.scales.x.time.stepSize = stepSize
+ }
+ }
+
+ chart.update()
+ }, [chart, dataParams, options])
+
+ return ()
+}
\ No newline at end of file
diff --git a/src/pages/Analysis.jsx b/src/pages/Analysis.jsx
index 17186de..dacb12c 100644
--- a/src/pages/Analysis.jsx
+++ b/src/pages/Analysis.jsx
@@ -1,11 +1,30 @@
-// import {UserOfWells} from "../components/UserOfWells";
+import { AnalysisDepthToDay } from '../components/AnalysisDepthToDay'
+import { AnalysisDepthToInterval } from '../components/AnalysisDepthToInterval'
+import { AnalysisOperationTime } from '../components/AnalysisOperationTime'
+import { Row, Col } from 'antd'
+
+export default function Analysis() {
-export default function Analysis(props) {
return (
-
-
Анализ
- {/**/}
-
-
+ <>
+
+
+
+ График Глубина-день
+
+
+
+ График Глубина за интервал
+
+
+
+
+
+
+ График Операция за время
+
+
+
+ >
)
}
\ No newline at end of file
diff --git a/src/pages/Archive.jsx b/src/pages/Archive.jsx
index 6c5d4f0..16af5f2 100644
--- a/src/pages/Archive.jsx
+++ b/src/pages/Archive.jsx
@@ -15,7 +15,7 @@ import moment from 'moment'
import notify from '../components/notify'
import LoaderPortal from '../components/LoaderPortal'
-const { RangePicker } = DatePicker;
+const { RangePicker } = DatePicker
const SaveObject = (key, obj) => {
let json = JSON.stringify(obj)
diff --git a/src/pages/Messages.jsx b/src/pages/Messages.jsx
index 2f9e92e..9a37f56 100644
--- a/src/pages/Messages.jsx
+++ b/src/pages/Messages.jsx
@@ -47,7 +47,7 @@ const columns = [
];
const filterOptions = [
- {label: 'Авария', value: 1},
+ {label: 'Важное', value: 1},
{label: 'Предупреждение', value: 2},
{label: 'Информация', value: 3},
]
@@ -72,6 +72,7 @@ export default function Messages() {
useEffect(() => {
const GetMessages = async () => {
setLoader(true)
+
try {
let begin = null
let end = null
@@ -85,6 +86,12 @@ export default function Messages() {
categories,
begin,
end)
+ if (paginatedMessages === null){
+ notify(`Данных по скважине "${id}" нет`, 'warning')
+ setLoader(false)
+ return
+ }
+
setMessages(paginatedMessages.items.map(m => {
return {
key: m.id,
@@ -97,9 +104,10 @@ export default function Messages() {
total: paginatedMessages.count,
current: Math.floor(paginatedMessages.skip / pageSize),
})
+
} catch (ex) {
- notify(`Не удалось загрузить сообщения по скважине "${id}"`, 'error')
console.log(ex)
+ notify(`Не удалось загрузить сообщения по скважине "${id}"`, 'error')
}
setLoader(false)
}
@@ -108,7 +116,6 @@ export default function Messages() {
return (
<>
-
Фильтр сообщений