diff --git a/src/pages/Cluster/ClusterWells.jsx b/src/pages/Cluster/ClusterWells.jsx index 6cabc16..4674a9f 100644 --- a/src/pages/Cluster/ClusterWells.jsx +++ b/src/pages/Cluster/ClusterWells.jsx @@ -71,7 +71,8 @@ export default function ClusterWells({statsWells}) { notProductiveTimePlan: well.total?.plan?.nonProductiveHours, notProductiveTimeFact: well.total?.fact?.nonProductiveHours, companies: well.companies, - lastTelemetryDate: well.lastTelemetryDate + lastTelemetryDate: well.lastTelemetryDate, + idState: well.idState } }) @@ -97,7 +98,7 @@ export default function ClusterWells({statsWells}) { (_, item) => ( ) @@ -301,6 +302,27 @@ export default function TelemetryView({ idWell }) { } }, [idWell, chartInterval]) + useEffect(() => invokeWebApiWrapperAsync( + async () => { + const well = await WellService.get(idWell) + setWellData(well ?? {}) + }, + setShowLoader, + `Не удалось загрузить данные по скважине "${idWell}"` + ), [idWell]) + + const onStatusChanged = (value) => { + invokeWebApiWrapperAsync( + async () => { + const well = {...wellData, idState: value} + await WellService.updateWell(idWell, well) + setWellData(well) + }, + setShowLoader, + `Не удалось задать состояние скважины "${idWell}"` + ) + } + return ( @@ -313,6 +335,14 @@ export default function TelemetryView({ idWell }) { {options} +
+ Статус:  + +
  {'TorqueMaster'} {'SpinMaster'} diff --git a/src/services/api/models/StatWellDto.ts b/src/services/api/models/StatWellDto.ts index 9e2353f..0ef8103 100644 --- a/src/services/api/models/StatWellDto.ts +++ b/src/services/api/models/StatWellDto.ts @@ -10,6 +10,7 @@ export type StatWellDto = { id?: number; caption?: string | null; wellType?: string | null; + idState?: number; state?: string | null; lastTelemetryDate?: string; sections?: Array | null; diff --git a/src/services/api/models/WellDto.ts b/src/services/api/models/WellDto.ts index c1ad790..ebc03bc 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; + idWellType?: number; idState?: number; lastTelemetryDate?: string; telemetry?: TelemetryDto; diff --git a/src/services/api/services/WellService.ts b/src/services/api/services/WellService.ts index c5ff465..d71b14c 100644 --- a/src/services/api/services/WellService.ts +++ b/src/services/api/services/WellService.ts @@ -44,6 +44,25 @@ export class WellService { return result.body; } + /** + * Возвращает информацию о требуемой скважине + * @param idWell Id требуемой скважины + * @returns WellDto Success + * @throws ApiError + */ + public static async get( + idWell?: number, + ): Promise { + const result = await __request({ + method: 'GET', + path: `/api/well/getWell`, + query: { + 'idWell': idWell, + }, + }); + return result.body; + } + /** * Возвращает список скважин, передающих телеметрию в данный момент * @returns WellDto Success