diff --git a/package.json b/package.json index 709c113..5d3a0a0 100644 --- a/package.json +++ b/package.json @@ -33,7 +33,7 @@ "react_test": "react-scripts test", "eject": "react-scripts eject" }, - "proxy": "http://127.0.0.1:5000", + "proxy": "http://192.168.1.70:5000", "eslintConfig": { "extends": [ "react-app", diff --git a/src/images/DempherOff.png b/src/images/DempherOff.png new file mode 100644 index 0000000..c179c94 Binary files /dev/null and b/src/images/DempherOff.png differ diff --git a/src/images/DempherOn.png b/src/images/DempherOn.png new file mode 100644 index 0000000..f4d9b4b Binary files /dev/null and b/src/images/DempherOn.png differ diff --git a/src/images/SpinDisabled.png b/src/images/SpinDisabled.png new file mode 100644 index 0000000..c19ce75 Binary files /dev/null and b/src/images/SpinDisabled.png differ diff --git a/src/images/SpinEnabled.png b/src/images/SpinEnabled.png new file mode 100644 index 0000000..d888ddc Binary files /dev/null and b/src/images/SpinEnabled.png differ diff --git a/src/pages/TelemetryView.jsx b/src/pages/TelemetryView.jsx index 94f460f..9273b09 100644 --- a/src/pages/TelemetryView.jsx +++ b/src/pages/TelemetryView.jsx @@ -8,11 +8,15 @@ import {CustomColumn} from '../components/CustomColumn' import {UserOfWells} from '../components/UserOfWells' import {ModeDisplay} from '../components/ModeDisplay' import {Display} from '../components/Display' +import SpinPicEnabled from "../images/SpinEnabled.png" +import SpinPicDisabled from "../images/SpinDisabled.png" +import MomentStabPicEnabled from "../images/DempherOn.png" +import MomentStabPicDisabled from "../images/DempherOff.png" import moment from 'moment' import {Subscribe} from '../services/signalr' import {DataService, MessageService} from '../services/api' import '../styles/message.css' -import notify from "../components/notify"; +import notify from "../components/notify" const {Option} = Select @@ -30,6 +34,8 @@ const blockSpeedGroup = { yDisplay: false, linePv: {label: "blockSpeed", units: 'м/ч', xAccessorName: "blockSpeed", yAccessorName: "date", color: '#0a0'}, lineSp: {label: "blockSpeedSp", units: 'м/ч', xAccessorName: "blockSpeedSp", yAccessorName: "date", color: '#0a0'}, + lineAvg: {label: "blockSpeedAvg", units: 'м/ч', xAccessorName: "blockSpeed", yAccessorName: "date", color: '#38C3FF', calc:(v) => 14, dash}, + lineMax: {label: "blockSpeedMax", units: 'м/ч', xAccessorName: "blockSpeed", yAccessorName: "date", color: '#38C3FF', calc:(v) => 23, dash}, } const pressureGroup = { @@ -60,7 +66,7 @@ const axialLoadGroup = { } const hookWeightGroup = { - label: "Ввес на крюке", + label: "Вес на крюке", yDisplay: false, linePv: {label: "hookWeight", units: 'т', xAccessorName: "hookWeight", yAccessorName: "date", color: '#0aa'}, lineIdle: { @@ -114,7 +120,7 @@ const rotorTorqueGroup = { const paramsGroups = [blockHeightGroup, blockSpeedGroup, pressureGroup, axialLoadGroup, hookWeightGroup, rotorTorqueGroup] -export const Column = ({lineGroup, data, interval}) => { +export const Column = ({lineGroup, data, interval, showBorder}) => { let lines = [lineGroup.linePv] if (lineGroup.lineSp) @@ -123,6 +129,12 @@ export const Column = ({lineGroup, data, interval}) => { if (lineGroup.lineOther) lines.push(lineGroup.lineOther) + if (lineGroup.lineAvg) + lines.push(lineGroup.lineAvg) + + if (lineGroup.lineMax) + lines.push(lineGroup.lineMax) + let dataLast = null let pv = null if (data?.length > 0) { @@ -133,10 +145,12 @@ export const Column = ({lineGroup, data, interval}) => { return ( <> - +
+ +
{ // Словарь категорий для строк таблицы const categoryDictionary = { - 1: {title: 'Авария'}, + 1: {title: 'Важное'}, 2: {title: 'Предупреждение'}, 3: {title: 'Информация'}, } @@ -183,13 +197,26 @@ const columns = [ }, ]; +const intervalSteps = [ + {label: '10 минут', value: 600}, + {label: '30 минут', value: 1800}, + {label: '1 час', value: 3600}, + {label: '6 часов', value: 21600}, + {label: '12 часов', value: 43200}, + {label: '1 день', value: 86400}, +] + +const defaultInterval = intervalSteps[0]["value"] // поменять тут TODO + export default function TelemetryView(props) { let {id} = useParams() const [saubData, setSaubData] = useState([]) - const [chartInterval, setChartInterval] = useState(600) + const [chartInterval, setChartInterval] = useState(defaultInterval) const [messages, setMessages] = useState([]) - const [loader, setLoader] = useState(false) // , setLoader + const [loader, setLoader] = useState(false) + + const periods = intervalSteps.map((line) => ) const handleReceiveDataSaub = (data) => { if (data) { @@ -247,28 +274,27 @@ export default function TelemetryView(props) {   Интервал:  - + {periods}   + + +

MSE

- + - + - {paramsGroups.map(group => + {paramsGroups.map((group, index) => - + )} diff --git a/src/services/api/index.ts b/src/services/api/index.ts index 9371e5f..fae9c9d 100644 --- a/src/services/api/index.ts +++ b/src/services/api/index.ts @@ -12,6 +12,7 @@ export type { DataSaubBaseDto } from './models/DataSaubBaseDto'; export type { DatesRangeDto } from './models/DatesRangeDto'; export type { DepositDto } from './models/DepositDto'; export type { EventDto } from './models/EventDto'; +export type { FilePropertiesDto } from './models/FilePropertiesDto'; export type { MessageDto } from './models/MessageDto'; export type { MessageDtoPaginationContainer } from './models/MessageDtoPaginationContainer'; export type { OperationDto } from './models/OperationDto'; @@ -32,6 +33,7 @@ export { AuthService } from './services/AuthService'; export { ClusterService } from './services/ClusterService'; export { DataService } from './services/DataService'; export { DepositService } from './services/DepositService'; +export { FileService } from './services/FileService'; export { MessageService } from './services/MessageService'; export { ReportService } from './services/ReportService'; export { TelemetryService } from './services/TelemetryService'; diff --git a/src/services/api/models/ClusterDto.ts b/src/services/api/models/ClusterDto.ts index 82b801d..ec20834 100644 --- a/src/services/api/models/ClusterDto.ts +++ b/src/services/api/models/ClusterDto.ts @@ -2,10 +2,13 @@ /* tslint:disable */ /* eslint-disable */ +import type { WellDto } from './WellDto'; + export type ClusterDto = { id?: number; caption?: string | null; description?: string | null; latitude?: number | null; longitude?: number | null; + wells?: Array | null; } \ No newline at end of file diff --git a/src/services/api/models/ClusterStatDto.ts b/src/services/api/models/ClusterStatDto.ts index dc711bb..911a264 100644 --- a/src/services/api/models/ClusterStatDto.ts +++ b/src/services/api/models/ClusterStatDto.ts @@ -2,6 +2,7 @@ /* tslint:disable */ /* eslint-disable */ +import type { WellDto } from './WellDto'; import type { WellStatDto } from './WellStatDto'; export type ClusterStatDto = { @@ -10,5 +11,6 @@ export type ClusterStatDto = { description?: string | null; latitude?: number | null; longitude?: number | null; + wells?: Array | null; wellsStat?: Array | null; } \ No newline at end of file diff --git a/src/services/api/models/DepositDto.ts b/src/services/api/models/DepositDto.ts index 0cbaeec..c142448 100644 --- a/src/services/api/models/DepositDto.ts +++ b/src/services/api/models/DepositDto.ts @@ -2,10 +2,13 @@ /* tslint:disable */ /* eslint-disable */ +import type { ClusterDto } from './ClusterDto'; + export type DepositDto = { id?: number; - name?: string | null; + caption?: string | null; description?: string | null; latitude?: number | null; longitude?: number | null; + clusters?: Array | null; } \ No newline at end of file diff --git a/src/services/api/models/FilePropertiesDto.ts b/src/services/api/models/FilePropertiesDto.ts new file mode 100644 index 0000000..59ed185 --- /dev/null +++ b/src/services/api/models/FilePropertiesDto.ts @@ -0,0 +1,11 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +export type FilePropertiesDto = { + id?: number; + name?: string | null; + idCategory?: number; + uploadDate?: string; + userName?: string | null; +} \ No newline at end of file diff --git a/src/services/api/models/WellDto.ts b/src/services/api/models/WellDto.ts index e33d86b..d681ec5 100644 --- a/src/services/api/models/WellDto.ts +++ b/src/services/api/models/WellDto.ts @@ -7,7 +7,6 @@ export type WellDto = { cluster?: string | null; deposit?: string | null; id?: number; - lastData?: any; latitude?: number | null; longitude?: number | null; wellType?: string | null; diff --git a/src/services/api/models/WellStatDto.ts b/src/services/api/models/WellStatDto.ts index 18176e6..7293b43 100644 --- a/src/services/api/models/WellStatDto.ts +++ b/src/services/api/models/WellStatDto.ts @@ -10,7 +10,6 @@ export type WellStatDto = { cluster?: string | null; deposit?: string | null; id?: number; - lastData?: any; latitude?: number | null; longitude?: number | null; wellType?: string | null; diff --git a/src/services/api/services/AnalyticsService.ts b/src/services/api/services/AnalyticsService.ts index a3913d0..8c52822 100644 --- a/src/services/api/services/AnalyticsService.ts +++ b/src/services/api/services/AnalyticsService.ts @@ -14,9 +14,9 @@ export class AnalyticsService { * @param wellId id скважины * @param skip для пагинации кол-во записей пропустить * @param take для пагинации кол-во записей - * @param categoryids - * @param begin - * @param end + * @param categoryIds список категорий + * @param begin дата начала + * @param end окончание * @returns OperationDtoPaginationContainer Success * @throws ApiError */ @@ -24,7 +24,7 @@ export class AnalyticsService { wellId: number, skip: number, take: number = 32, -categoryids?: Array, +categoryIds?: Array, begin?: string, end?: string, ): Promise { @@ -34,7 +34,7 @@ end?: string, query: { 'skip': skip, 'take': take, - 'categoryids': categoryids, + 'categoryIds': categoryIds, 'begin': begin, 'end': end, }, diff --git a/src/services/api/services/FileService.ts b/src/services/api/services/FileService.ts new file mode 100644 index 0000000..bcfade8 --- /dev/null +++ b/src/services/api/services/FileService.ts @@ -0,0 +1,80 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +import type { FilePropertiesDto } from '../models/FilePropertiesDto'; +import { request as __request } from '../core/request'; + +export class FileService { + + /** + * Сохраняет переданные файлы и информацию о них + * @param wellId id скважины + * @param idCategory id категории файла + * @param idUser id отправившего файл пользователя + * @param requestBody + * @returns number Success + * @throws ApiError + */ + public static async saveFiles( +wellId: number, +idCategory?: number, +idUser?: number, +requestBody?: any, +): Promise { + const result = await __request({ + method: 'POST', + path: `/api/files/${wellId}/files`, + query: { + 'idCategory': idCategory, + 'idUser': idUser, + }, + body: requestBody, + }); + return result.body; + } + + /** + * Возвращает информацию о файлах для скважины в выбраной категории + * @param wellId id скважины + * @param idCategory id категории файла + * @returns FilePropertiesDto Success + * @throws ApiError + */ + public static async getFilesInfo( +wellId: number, +idCategory?: number, +): Promise> { + const result = await __request({ + method: 'GET', + path: `/api/files/${wellId}/filesInfo`, + query: { + 'idCategory': idCategory, + }, + }); + return result.body; + } + + /** + * Возвращает файл с диска на сервере + * @param wellId id скважины + * @param fileName + * @param fileId id запрашиваемого файла + * @returns string Success + * @throws ApiError + */ + public static async getFile( +wellId: number, +fileName: string, +fileId?: number, +): Promise { + const result = await __request({ + method: 'GET', + path: `/api/files/${wellId}/${fileName}`, + query: { + 'fileId': fileId, + }, + }); + return result.body; + } + +} \ No newline at end of file