2021-08-17 13:01:13 +05:00
|
|
|
|
import { Table, Select, DatePicker } from "antd";
|
2021-08-18 11:40:46 +05:00
|
|
|
|
import { TelemetryAnalyticsService } from "../src/services/api";
|
2021-08-17 10:44:41 +05:00
|
|
|
|
import { useState, useEffect } from "react";
|
|
|
|
|
import { useParams } from "react-router-dom";
|
2021-08-18 11:40:46 +05:00
|
|
|
|
import notify from "../src/components/notify";
|
|
|
|
|
import LoaderPortal from "../src/components/LoaderPortal";
|
2021-08-17 10:44:41 +05:00
|
|
|
|
import moment from "moment";
|
|
|
|
|
import "../styles/message.css";
|
2021-07-21 16:53:33 +05:00
|
|
|
|
|
2021-08-17 10:44:41 +05:00
|
|
|
|
const { Option } = Select;
|
|
|
|
|
const pageSize = 26;
|
|
|
|
|
const { RangePicker } = DatePicker;
|
2021-07-21 16:53:33 +05:00
|
|
|
|
|
|
|
|
|
const columns = [
|
2021-08-17 10:44:41 +05:00
|
|
|
|
{
|
|
|
|
|
title: "Название операции",
|
|
|
|
|
key: "name",
|
|
|
|
|
dataIndex: "name",
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: "Дата начала операции",
|
|
|
|
|
key: "beginDate",
|
|
|
|
|
dataIndex: "beginDate",
|
|
|
|
|
render: (item) => moment.utc(item).local().format("DD MMM YYYY, HH:mm:ss"),
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: "Дата окончания операции",
|
|
|
|
|
key: "endDate",
|
|
|
|
|
dataIndex: "endDate",
|
|
|
|
|
render: (item) => moment.utc(item).local().format("DD MMM YYYY, HH:mm:ss"),
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: "Глубина скважины в начале операции",
|
|
|
|
|
key: "beginWellDepth",
|
|
|
|
|
dataIndex: "startWellDepth",
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: "Глубина скважины в конце операции",
|
|
|
|
|
key: "endWellDepth",
|
|
|
|
|
dataIndex: "endWellDepth",
|
|
|
|
|
},
|
2021-07-21 16:53:33 +05:00
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
const filterOptions = [
|
2021-08-17 10:44:41 +05:00
|
|
|
|
{ label: "Невозможно определить операцию", value: 1 },
|
|
|
|
|
{ label: "Роторное бурение", value: 2 },
|
|
|
|
|
{ label: "Слайдирование", value: 3 },
|
|
|
|
|
{ label: "Подъем с проработкой", value: 4 },
|
|
|
|
|
{ label: "Спуск с проработкой", value: 5 },
|
|
|
|
|
{ label: "Подъем с промывкой", value: 6 },
|
|
|
|
|
{ label: "Спуск с промывкой", value: 7 },
|
|
|
|
|
{ label: "Спуск в скважину", value: 8 },
|
|
|
|
|
{ label: "Спуск с вращением", value: 9 },
|
|
|
|
|
{ label: "Подъем из скважины", value: 10 },
|
|
|
|
|
{ label: "Подъем с вращением", value: 11 },
|
|
|
|
|
{ label: "Промывка в покое", value: 12 },
|
|
|
|
|
{ label: "Промывка с вращением", value: 13 },
|
|
|
|
|
{ label: "Удержание в клиньях", value: 14 },
|
|
|
|
|
{ label: "Неподвижное состояние", value: 15 },
|
|
|
|
|
{ label: "Вращение без циркуляции", value: 16 },
|
|
|
|
|
{ label: "На поверхности", value: 17 },
|
|
|
|
|
];
|
2021-07-21 16:53:33 +05:00
|
|
|
|
|
2021-08-18 11:40:46 +05:00
|
|
|
|
export default function WellTelemetryAnalysis() {
|
2021-08-17 10:44:41 +05:00
|
|
|
|
let { id } = useParams();
|
2021-07-21 16:53:33 +05:00
|
|
|
|
|
2021-08-17 10:44:41 +05:00
|
|
|
|
const [page, setPage] = useState(1);
|
|
|
|
|
const [range, setRange] = useState([]);
|
|
|
|
|
const [categories, setCategories] = useState([]);
|
|
|
|
|
const [pagination, setPagination] = useState(null);
|
|
|
|
|
const [operations, setOperations] = useState([]);
|
2021-07-21 16:53:33 +05:00
|
|
|
|
|
2021-08-17 10:44:41 +05:00
|
|
|
|
const [loader, setLoader] = useState(false);
|
2021-07-21 16:53:33 +05:00
|
|
|
|
|
2021-08-17 10:44:41 +05:00
|
|
|
|
const children = filterOptions.map((line) => (
|
|
|
|
|
<Option key={line.value}>{line.label}</Option>
|
|
|
|
|
));
|
2021-07-21 16:53:33 +05:00
|
|
|
|
|
2021-08-17 10:44:41 +05:00
|
|
|
|
const onChangeRange = (range) => {
|
|
|
|
|
setRange(range);
|
|
|
|
|
};
|
2021-07-21 16:53:33 +05:00
|
|
|
|
|
2021-08-17 10:44:41 +05:00
|
|
|
|
useEffect(() => {
|
|
|
|
|
const GetOperations = async () => {
|
|
|
|
|
setLoader(true);
|
|
|
|
|
try {
|
|
|
|
|
let begin = null;
|
|
|
|
|
let end = null;
|
|
|
|
|
if (range?.length > 1) {
|
|
|
|
|
begin = range[0].toISOString();
|
|
|
|
|
end = range[1].toISOString();
|
|
|
|
|
}
|
2021-07-21 16:53:33 +05:00
|
|
|
|
|
2021-08-17 10:44:41 +05:00
|
|
|
|
await TelemetryAnalyticsService.getOperationsByWell(
|
|
|
|
|
`${id}`,
|
|
|
|
|
(page - 1) * pageSize,
|
|
|
|
|
pageSize,
|
|
|
|
|
categories,
|
|
|
|
|
begin,
|
|
|
|
|
end
|
|
|
|
|
).then((paginatedOperations) => {
|
|
|
|
|
setOperations(
|
|
|
|
|
paginatedOperations?.items.map((o) => {
|
|
|
|
|
return {
|
|
|
|
|
key: o.id,
|
|
|
|
|
begin: o.date,
|
|
|
|
|
...o,
|
|
|
|
|
};
|
|
|
|
|
})
|
|
|
|
|
);
|
2021-07-21 16:53:33 +05:00
|
|
|
|
|
2021-08-17 10:44:41 +05:00
|
|
|
|
setPagination({
|
|
|
|
|
total: paginatedOperations?.count,
|
|
|
|
|
current: Math.floor(paginatedOperations?.skip / pageSize),
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
} catch (ex) {
|
|
|
|
|
notify(`Не удалось загрузить операции по скважине "${id}"`, "error");
|
|
|
|
|
console.log(ex);
|
|
|
|
|
}
|
|
|
|
|
setLoader(false);
|
|
|
|
|
};
|
|
|
|
|
GetOperations();
|
|
|
|
|
}, [id, categories, range, page]);
|
2021-07-21 16:53:33 +05:00
|
|
|
|
|
2021-08-17 10:44:41 +05:00
|
|
|
|
return (
|
|
|
|
|
<>
|
|
|
|
|
<div className="filter-group">
|
|
|
|
|
<h3 className="filter-group-heading">Фильтр операций</h3>
|
|
|
|
|
<Select
|
|
|
|
|
mode="multiple"
|
|
|
|
|
allowClear
|
|
|
|
|
placeholder="Фильтр операций"
|
|
|
|
|
className="filter-selector"
|
|
|
|
|
value={categories}
|
|
|
|
|
onChange={setCategories}
|
|
|
|
|
>
|
|
|
|
|
{children}
|
|
|
|
|
</Select>
|
2021-08-17 13:01:13 +05:00
|
|
|
|
<RangePicker
|
|
|
|
|
showTime
|
|
|
|
|
placeholder={["Дата начала операции", "Дата окончания операции"]}
|
|
|
|
|
onChange={onChangeRange}
|
|
|
|
|
/>
|
2021-08-17 10:44:41 +05:00
|
|
|
|
</div>
|
|
|
|
|
<LoaderPortal show={loader}>
|
2021-07-21 16:53:33 +05:00
|
|
|
|
<Table
|
|
|
|
|
columns={columns}
|
|
|
|
|
dataSource={operations}
|
2021-08-17 10:44:41 +05:00
|
|
|
|
size={"small"}
|
2021-07-21 16:53:33 +05:00
|
|
|
|
pagination={{
|
|
|
|
|
pageSize: pageSize,
|
|
|
|
|
showSizeChanger: false,
|
|
|
|
|
total: pagination?.total,
|
|
|
|
|
current: page,
|
2021-08-17 10:44:41 +05:00
|
|
|
|
onChange: (page) => setPage(page),
|
2021-07-21 16:53:33 +05:00
|
|
|
|
}}
|
|
|
|
|
rowKey={(record) => record.id}
|
|
|
|
|
/>
|
2021-08-17 10:44:41 +05:00
|
|
|
|
</LoaderPortal>
|
|
|
|
|
</>
|
|
|
|
|
);
|
|
|
|
|
}
|