From 47ebddeb3faab6f66552a8ad596c5642e257a9e1 Mon Sep 17 00:00:00 2001 From: Alexey Date: Fri, 23 Jul 2021 17:15:33 +0500 Subject: [PATCH] =?UTF-8?q?=D0=9D=D0=BE=D1=80=D0=BC=D0=B0=D0=BB=D1=8C?= =?UTF-8?q?=D0=BD=D1=8B=D0=B5=20=D1=81=D1=82=D0=B8=D0=BB=D0=B8=20=D0=B4?= =?UTF-8?q?=D0=BB=D1=8F=20=D0=9C=D0=BD=D0=B5=D0=BC=D0=BE=D1=81=D1=85=D0=B5?= =?UTF-8?q?=D0=BC=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 +- src/images/DempherOff.png | Bin 0 -> 974 bytes src/images/DempherOn.png | Bin 0 -> 1223 bytes src/images/SpinDisabled.png | Bin 0 -> 1566 bytes src/images/SpinEnabled.png | Bin 0 -> 1903 bytes src/pages/TelemetryView.jsx | 66 ++++++++++----- src/services/api/index.ts | 2 + src/services/api/models/ClusterDto.ts | 3 + src/services/api/models/ClusterStatDto.ts | 2 + src/services/api/models/DepositDto.ts | 5 +- src/services/api/models/FilePropertiesDto.ts | 11 +++ src/services/api/models/WellDto.ts | 1 - src/services/api/models/WellStatDto.ts | 1 - src/services/api/services/AnalyticsService.ts | 10 +-- src/services/api/services/FileService.ts | 80 ++++++++++++++++++ 15 files changed, 154 insertions(+), 29 deletions(-) create mode 100644 src/images/DempherOff.png create mode 100644 src/images/DempherOn.png create mode 100644 src/images/SpinDisabled.png create mode 100644 src/images/SpinEnabled.png create mode 100644 src/services/api/models/FilePropertiesDto.ts create mode 100644 src/services/api/services/FileService.ts 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 0000000000000000000000000000000000000000..c179c94db2f5f82497894cee5f2e9c22ad78c14c GIT binary patch literal 974 zcmV;<12O!GP)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!~g&e!~vBn4jTXf02y>eSaefwW^{L9 za%BK_cXuvnZfkR6VQ^(GZ*pgw?mQX*00TZrL_t(oN9~tcODjPTMk{gO6(K5$#sx)1 zP25l)^xwNh5JeK)al`$=xZ`rKr|i*~^i0NUuK3`A5T?5_^HufN)sw)V7vzT!G~Yjh zUomcEcxHQhTh7nVB@hTm>Qq5Nfjm4sn5$Rv^77>J@=_)zC(X#$$PjaKaw5ma$I{;3 zE>BNSI#yIvB(t-#GB!3Q_xJZY77PY8_U!CThKGk${8!0XCbW@pX=$lcR8;8a;^IQD zkB*Ms#>&dd^plp$m#}&!{Q(;r8!G1T@bJT2E`>l=11~Hr=tFOAZuEL)W=6mN2i9du zrN6&l1_uXKOehqRk&zKI^BSAW>STz)h?vu%u&_{)$)x(ExVTt%l|z1hzQ*z!cAy_H zyc@2^0mC~xJ8IhJ=VvJ|FPFZ)KI^Wzy1J6Z#YL?krgnqfx4ynEqoboAl5(($;Rj^O zuBxl6lji1TGh>JC9*@UWXe1IbqnXUj&1t2h(Wn{uh}FQAm6a-liqO=^C>zAy-Q8)G zY;10BYK#|FF;oMic6N4ZwruU`>1o;8+Ink*=@7?K5}VHBt zdSrZjTpAl2wL)~_m6eqY!y>Y^wN)!aHB%uTv$wUixh4aiVjRf2rKLrW15C`rc6WER zS`K84d8rPbb3il#Ny`A?ong{-(C zRiGNx)z#Vv*)_GbwI=Ev%+G^4{rC3vv_*7xcbi#nT*Vw59BA)YT3XU&!4DG?6VlPq zAtfaxCdv*c{_X9po@IC~wTXIRjp95yJw4SM;*p`DA!%r6FtgdATl3n1NAQ|otYTOO zZb(KnvqU1HuMwYNU|>L#_zYGtbV*9h?g@v(+RWIVu~<1FzKA$1$V%FE!Yy0Nh zsj8|{Q_^czS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HcmV?d00001 diff --git a/src/images/SpinDisabled.png b/src/images/SpinDisabled.png new file mode 100644 index 0000000000000000000000000000000000000000..c19ce753eff8c51396d5aed589ff23e789e0313d GIT binary patch literal 1566 zcmV+(2I2XMP)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!~g&e!~vBn4jTXf02y>eSaefwW^{L9 za%BK_cXuvnZfkR6VQ^(GZ*pgw?mQX*00oXoL_t(oN6nXcR~kta#UCIjilXAKF{nr5 zL``%u-~S6FQ}r zW%jqWB-Gq2k%k6|G&V|@dpHu2U^pxi3OQB|bgFz_3dN%2b2%xLN>bo{dv_;80|OFj zX>knwQIpJRDkZ6OT0%iY#MBsb&$H;<#DqjTI*gs%-^NhOoXN1Ga`N#^19)=c_@ zdlpl%yWYNi9B?6s8p&9eau=B}Wr3ALFST$w)XdB8s9f}cRQmFaMQ-h zid;c7&SG7Oghbh~W{jr#`T4n=qEv_}C&{3S_jzxAeqQ3Zd~AB!87!lM%nHU4cJuDz zM`y$Vi!H9MG9NXAOsZJu3G94xds{NtPoYqY+pQq|>z8~#K9*0^s1UK_h9_pS>?{kn zLHuoFbA8A1hL^E^ZVjLf*8iA6>elm z@eKZdr?J2y^=MDoWWC32V+W z89n;Bl`QERRVfJO>pbi{V6J;&NBbW)N{s28LA>EcnG9&c!1kk1pc>iPIhpoSTsrTx zSuV~x8*8$X#X}}Wlxs%W=p}g1I9K${dI|Qa=FM!dfqC7ya;mg;kZyR$w8!I;y`iBlJ}=p9k6Js{BZ2*}V9Y%eW626`2o zLS*;%ZyBIWv{=>pmT|4}Jw8?3Lq>yY0CkR38LJ>gdHFrZ#3h6lIKR%c)Vtk=3RhI> zjpb$8VZnaVdWgQp#x6aQMv6^RQQ1O}cJs6l+Eh*0hb6eDqV7=Q(~u27UXxSPx5#gW zCcy{|SgfbVJiC#G$al^p-;MxOk^$EQ-WqMhFoD-kV`P9LY1BxJj+#eRkz#psc`0!YMnwVJ#c$uFn+!^FZu!BNjN*_MF-6pm(zA5ao9HLYF0u3v zeTZLUWMh4C(eycg(V!I|wM_6g5qncrK3Se6qu7Jc0fdG)WiL>mgbTvBQ5UF&W88Si zdnN|SniOQB6uK#GsH*hORmmvS&nW`Zd;>ALo+o{{qi<}?vG79Ou?(3Ai>keTRkq{8 z5e;UZtHGO1K1gV=xh4rgYM-6vo$6|1(?!JWlWSyTq$UwXO)@up+TJjs%BP*4UP@?9 z3!rtj{Gct(v#1`fCG7N_0PacgrBM%Rx@qh4XDK0bBfAZA>BqnMbmeyofgHwV1`xZz zojRTQ=;v9R^a7WD_|MX=25Ph+)ye2zb;w&6>X@shGJg^^W9Cod6_FA74`m#wm`U_c Qy#N3J07*qoM6N<$g2U15asU7T literal 0 HcmV?d00001 diff --git a/src/images/SpinEnabled.png b/src/images/SpinEnabled.png new file mode 100644 index 0000000000000000000000000000000000000000..d888ddc4f0f58ba6d79553496596e272b4e17823 GIT binary patch literal 1903 zcmV-#2ax!QP)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!~g&e!~vBn4jTXf02y>eSaefwW^{L9 za%BK_cXuvnZfkR6VQ^(GZ*pgw?mQX*00!SlL_t(oN6nXea8%VD$G^MTO?Hzd7zl>E zz@TO0`amRPfJn;}(T>_;c?(Vp{i9A%Yf(pJY#s11I@5w3(4o|EkYou3Q7H*dLv|3! z0tp}qLIA0Gun9>vFY?%Avzy)h_1t@Zc=wWIH%>bpJ~O#Dzwi0od%ycT=bm$qjs&$3G zi_O#5A;FTwNy8J>%-_Dr$8#6AA<>wCP$+~TLI{L{7!VJ0J>fv+?RRn}FrhFHoq9ja z`dGy1^w5jH0EKW*Y%0nZ?&GYH8P%9c-#;I*Mw5JV3AgV$wprI=&HXFo_y%527seJX zK!&KCPN$Q#c7Hc2=I%gt%H47tiKt^H(C@)GW1^^t;<-QQ!>sr_hZvDCTW-V7`(Ab0jZmYLl`0CXVaXbr{wsBvQ31-Y2>VP%5g*jM3z0XC}rP1jh4ICArE*Eny3Vi?hA98^&wnY} zvnlW3Q?#pkA62!Sr|On!I#lDJ-+cM1XuF5v>@%pU;cLD~i)nWbEiQSMBP~PB+_7%~ z%_~~PQ5b_nN&mP1dA&9)t|^ermM@%ii*a}<(7*g(MC?! zNmf*H4=feGY9^7-&q`z-KD1ig>plv3y{xF{><`eNDzqItDgS*$3O z)*Z#E-t#ESdmm!L3RkL`px#*C+(8(2~Kb^4>&b@dQODjGA6mI^#RL2E?f%?p3W z42umplXF=a9e=T{MPYLZFer^=mB-TNz~yTK27Ih2Xv|dg{2MvrZ5*kTb)CaAKU%`k z=y^Kpaq$E_N*a%{qHuqbRUGxW*juXzjA}-_;9l|}E#Y<+6q>I$iWN+UX-QLA89j-K z$>JD;%e_|>fk`n*I?(D;zX5>nSVAN~J#6ZX|pJNSi^7#itI{3wM5)K6h<+ILU zkk2bn~h;fLT4ibDXC5+*7!{&~YI1U<@`t-t zps=X~V$NV?bgcho8*Jt&NKQ&+Md7IXG)($IR)#XH8HqPeY!(+!rR|j;%klPe`SQ&q6Qkh)(H%JlmdO7% zwO^H2YTIW&m*bI$xK(-4`4--*E5L>+YjCi=939k;G~F0{z3@}c7@qge?7+tQ-SXDv zjmazV`)@x$wmB1*o-DrU{nZlDjD%hE^V&;WkrbNWU8Ki$k3BNNq(#6v|Z;RnY@1i z$Y}gNw@vJ!dKZ?7#ZB4NMIu7c6i#0|gH!!AV$T#rUvNOYHC|W@W>^m|=fzcJ+2QAL zE!YijK;#9y@**oOyw6t*o%n_$YGvkqwhY~dAhOJ 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