diff --git a/src/pages/Deposit.jsx b/src/pages/Deposit.jsx index e30076f..629c832 100644 --- a/src/pages/Deposit.jsx +++ b/src/pages/Deposit.jsx @@ -1,14 +1,14 @@ import { Map, Overlay } from "pigeon-maps" -import pointer from '../images/pointer.svg' -import {Link} from "react-router-dom"; +import { PointerIcon } from '../components/PointerIcon' +import { Link } from "react-router-dom"; import LoaderPortal from '../components/LoaderPortal' import { useState, useEffect } from "react"; -import {ClusterService} from '../services/api' +import { ClusterService } from '../services/api' import { invokeWebApiWrapperAsync } from "../components/factory" const calcViewParams = (clusters) => { if ((!clusters) || clusters.length === 0) - return {center:[60.81226, 70.0562], zoom: 5} + return { center: [60.81226, 70.0562], zoom: 5 } const center = clusters.reduce((sum, cluster) => { sum[0] += (cluster.latitude / clusters.length) @@ -27,44 +27,44 @@ const calcViewParams = (clusters) => { // zoom min = 1 (mega far) // 4 - full Russia (161.6 deg) // 13.5 - Khanty-Mansiysk - let zoom = 5 + 5/maxDeg - zoom = zoom < 5 ? 5: zoom - zoom = zoom > 15 ? 15: zoom + let zoom = 5 + 5 / (maxDeg + 0.5) + zoom = zoom < 5 ? 5 : zoom + zoom = zoom > 15 ? 15 : zoom - return {center, zoom} + return { center, zoom } } export default function Deposit() { const [clustersData, setClustersData] = useState([]) const [showLoader, setShowLoader] = useState(false) - useEffect(()=>invokeWebApiWrapperAsync(async()=>{ + useEffect(() => invokeWebApiWrapperAsync(async () => { const data = await ClusterService.getClusters() setClustersData(data) }, - setShowLoader, - `Не удалось загрузить список кустов`), - []) + setShowLoader, + `Не удалось загрузить список кустов`), + []) const viewParams = calcViewParams(clustersData) - const markers = clustersData.map(cluster => - - - + - {cluster.caption} - - ) return (
- {markers} + {clustersData.map(cluster => + + + + {cluster.caption} + + + )}
- ); + ) } diff --git a/src/services/api/index.ts b/src/services/api/index.ts index 22666fb..36b4c1c 100644 --- a/src/services/api/index.ts +++ b/src/services/api/index.ts @@ -42,6 +42,7 @@ export type { WellOperationCategoryDto } from './models/WellOperationCategoryDto export type { WellOperationDto } from './models/WellOperationDto'; export type { WellOperationDtoPaginationContainer } from './models/WellOperationDtoPaginationContainer'; export type { WellOperationDtoPlanFactPredictBase } from './models/WellOperationDtoPlanFactPredictBase'; +export type { WellParamsDto } from './models/WellParamsDto'; export { AdminClusterService } from './services/AdminClusterService'; export { AdminCompanyService } from './services/AdminCompanyService'; diff --git a/src/services/api/models/StatWellDto.ts b/src/services/api/models/StatWellDto.ts index 56eb1aa..9e2353f 100644 --- a/src/services/api/models/StatWellDto.ts +++ b/src/services/api/models/StatWellDto.ts @@ -10,6 +10,8 @@ export type StatWellDto = { id?: number; caption?: string | null; wellType?: string | null; + state?: string | null; + lastTelemetryDate?: string; sections?: Array | null; total?: StatOperationsDtoPlanFactBase; companies?: Array | null; diff --git a/src/services/api/models/UserDto.ts b/src/services/api/models/UserDto.ts index c8761f9..748389f 100644 --- a/src/services/api/models/UserDto.ts +++ b/src/services/api/models/UserDto.ts @@ -10,6 +10,9 @@ export type UserDto = { name?: string | null; surname?: string | null; patronymic?: string | null; + email?: string | null; + phone?: string | null; + position?: string | null; id?: number; idCompany?: number | null; idRole?: number | null; diff --git a/src/services/api/models/UserTokenDto.ts b/src/services/api/models/UserTokenDto.ts index 6e3321d..c7a5f92 100644 --- a/src/services/api/models/UserTokenDto.ts +++ b/src/services/api/models/UserTokenDto.ts @@ -8,6 +8,9 @@ export type UserTokenDto = { name?: string | null; surname?: string | null; patronymic?: string | null; + email?: string | null; + phone?: string | null; + position?: string | null; id?: number; companyName?: string | null; roleName?: string | null; diff --git a/src/services/api/models/WellDto.ts b/src/services/api/models/WellDto.ts index bdb4e1d..c1ad790 100644 --- a/src/services/api/models/WellDto.ts +++ b/src/services/api/models/WellDto.ts @@ -12,6 +12,7 @@ export type WellDto = { latitude?: number | null; longitude?: number | null; wellType?: string | null; + idState?: number; lastTelemetryDate?: string; telemetry?: TelemetryDto; } diff --git a/src/services/api/models/WellParamsDto.ts b/src/services/api/models/WellParamsDto.ts new file mode 100644 index 0000000..4f01852 --- /dev/null +++ b/src/services/api/models/WellParamsDto.ts @@ -0,0 +1,11 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +export type WellParamsDto = { + caption?: string | null; + latitude?: number | null; + longitude?: number | null; + idWellType?: number; + idState?: number; +} diff --git a/src/services/api/services/WellService.ts b/src/services/api/services/WellService.ts index 42f08a6..c5ff465 100644 --- a/src/services/api/services/WellService.ts +++ b/src/services/api/services/WellService.ts @@ -2,11 +2,13 @@ /* tslint:disable */ /* eslint-disable */ import type { WellDto } from '../models/WellDto'; +import type { WellParamsDto } from '../models/WellParamsDto'; import { request as __request } from '../core/request'; export class WellService { /** + * Возвращает список доступных скважин * @returns WellDto Success * @throws ApiError */ @@ -19,6 +21,31 @@ export class WellService { } /** + * Редактирует указанные поля скважины + * @param idWell Id скважины + * @param requestBody Объект параметров скважины. + * IdWellType: 1 - Наклонно-направленная, 2 - Горизонтальная. + * State: 0 - Неизвестно, 1 - В работе, 2 - Завершена. + * @returns number Success + * @throws ApiError + */ + public static async updateWell( + idWell?: number, + requestBody?: WellParamsDto, + ): Promise { + const result = await __request({ + method: 'PUT', + path: `/api/well`, + query: { + 'idWell': idWell, + }, + body: requestBody, + }); + return result.body; + } + + /** + * Возвращает список скважин, передающих телеметрию в данный момент * @returns WellDto Success * @throws ApiError */