From 5a6931cb43340dc21342fecd0c719f1f6a115c67 Mon Sep 17 00:00:00 2001 From: goodmice Date: Mon, 6 Dec 2021 10:17:14 +0500 Subject: [PATCH] =?UTF-8?q?=D0=A3=D0=B4=D0=B0=D0=BB=D0=B5=D0=BD=D0=B0=20?= =?UTF-8?q?=D1=81=D1=82=D0=B0=D1=80=D0=B0=D1=8F=20=D1=81=D1=82=D1=80=D0=B0?= =?UTF-8?q?=D0=BD=D0=B8=D1=86=D0=B0=20=D0=BC=D0=BE=D0=BD=D0=B8=D1=82=D0=BE?= =?UTF-8?q?=D1=80=D0=B8=D0=BD=D0=B3=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/TelemetryView/index_backup.jsx | 238 ----------------------- 1 file changed, 238 deletions(-) delete mode 100644 src/pages/TelemetryView/index_backup.jsx diff --git a/src/pages/TelemetryView/index_backup.jsx b/src/pages/TelemetryView/index_backup.jsx deleted file mode 100644 index ae89ea9..0000000 --- a/src/pages/TelemetryView/index_backup.jsx +++ /dev/null @@ -1,238 +0,0 @@ -import {useState, useEffect} from 'react' -import {Row, Col, Select} from 'antd' - -import {Column} from './Column' -import {CustomColumn} from './CustomColumn' -import ActiveMessagesOnline from './ActiveMessagesOnline' -import {ModeDisplay} from "./ModeDisplay" -import {UserOfWell} from './UserOfWells' - -import LoaderPortal from '../../components/LoaderPortal' -import {Subscribe} from '../../services/signalr' -import {TelemetryDataSaubService, TelemetryDataSpinService} from '../../services/api' -import {invokeWebApiWrapperAsync} from '../../components/factory' - -import MomentStabPicEnabled from "../../images/DempherOn.png" -import MomentStabPicDisabled from "../../images/DempherOff.png" -import SpinPicEnabled from "../../images/SpinEnabled.png" -import SpinPicDisabled from "../../images/SpinDisabled.png" - -import '../../styles/message.css' - -const {Option} = Select - -const dash = [7, 3] - -const blockHeightGroup = { - label: "Высота блока", - yDisplay: false, - linePv: {label: "blockPosition", units: 'м', xAccessorName: "blockPosition", yAccessorName: "date", color: '#333'}, - lineOther: { - label: "wellDepth", - units: 'м', - xAccessorName: "wellDepth", - yAccessorName: "date", - color: '#333', - showLine: false, - xConstValue: 30 - }, -} - -const blockSpeedGroup = { - label: "Скорость блока", - yDisplay: false, - linePv: {label: "blockSpeed", units: 'м/ч', xAccessorName: "blockSpeed", yAccessorName: "date", color: '#0a0'}, - lineSp: {label: "blockSpeedSp", units: 'м/ч', xAccessorName: "blockSpeedSp", yAccessorName: "date", color: '#0a0'}, -} - -const pressureGroup = { - label: "Давление", - yDisplay: false, - linePv: {label: "pressure", units: 'атм', xAccessorName: "pressure", yAccessorName: "date", color: '#c00'}, - lineSp: {label: "pressureSp", units: 'атм', xAccessorName: "pressureSp", yAccessorName: "date", color: '#c00'}, - lineIdle: {label: "pressureIdle", units: 'атм', xAccessorName: "pressureIdle", yAccessorName: "date", color: '#c00'}, - linesOther: [ - { - label: "мекс. перепад", - units: 'атм', - xAccessorName: "pressureDeltaLimitMax", - yAccessorName: "date", - color: '#c00' - }, - ], -} - -const axialLoadGroup = { - label: "Осевая нагрузка", - yDisplay: false, - linePv: {label: "axialLoad", units: 'т', xAccessorName: "axialLoad", yAccessorName: "date", color: '#00a'}, - lineSp: {label: "axialLoadSp", units: 'т', xAccessorName: "axialLoadSp", yAccessorName: "date", color: '#00a', dash}, - linesOther: [ - {label: "axialLoadLimitMax", units: 'т', xAccessorName: "axialLoadLimitMax", yAccessorName: "date", color: '#00a'}, - ], -} - -const hookWeightGroup = { - label: "Вес на крюке", - yDisplay: false, - linePv: {label: "hookWeight", units: 'т', xAccessorName: "hookWeight", yAccessorName: "date", color: '#0aa'}, - lineIdle: { - label: "hookWeightIdle", - units: 'т', - xAccessorName: "hookWeightIdle", - yAccessorName: "date", - color: '#0aa', - dash - }, - linesOther: [ - { - label: "hookWeightLimitMin", - units: 'т', - xAccessorName: "hookWeightLimitMin", - yAccessorName: "date", - color: '#0aa' - }, - { - label: "hookWeightLimitMax", - units: 'т', - xAccessorName: "hookWeightLimitMax", - yAccessorName: "date", - color: '#0aa' - }, - ], -} - -const rotorTorqueGroup = { - label: "Момент на роторе", - yDisplay: false, - linePv: {label: "rotorTorque", units: 'кН·м', xAccessorName: "rotorTorque", yAccessorName: "date", color: '#a0a'}, - lineSp: {label: "rotorTorqueSp", units: 'кН·м', xAccessorName: "rotorTorqueSp", yAccessorName: "date", color: '#a0a'}, - lineIdle: { - label: "rotorTorqueIdle", - units: 'кН·м', - xAccessorName: "rotorTorqueIdle", - yAccessorName: "date", - color: '#a0a' - }, - linesOther: [ - { - label: "rotorTorqueLimitMax", - units: 'кН·м', - xAccessorName: "rotorTorqueLimitMax", - yAccessorName: "date", - color: '#a0a' - }, - ], -} - -const paramsGroups = [blockHeightGroup, blockSpeedGroup, pressureGroup, axialLoadGroup, hookWeightGroup, rotorTorqueGroup] - -const timePeriodCollection = [ - {value: '60', label: '1 минута'}, - {value: '300', label: '5 минут'}, - {value: '600', label: '10 минут'}, - {value: '1800', label: '30 минут'}, - {value: '3600', label: '1 час'}, - {value: '21600', label: '6 часов'}, - {value: '43200', label: '12 часов'}, - {value: '86400', label: '24 часа'} -] - -const defaultChartInterval = '600' - -const getLast = (data) => - Array.isArray(data) ? data.slice(-1)[0] : data - -const isMseEnabled = (dataSaub) => { - const lastData = getLast(dataSaub) - return (lastData?.mseState && 2) > 0 -} - -const isTorqueStabEnabled = (dataSpin) => { - const lastData = getLast(dataSpin) - return lastData?.state === 7 -} - -const isSpinEnabled = (dataSpin) => { - const lastData = getLast(dataSpin) - return lastData?.state > 0 && lastData?.state !== 6 -} - -export default function TelemetryView({idWell}) { - const [dataSaub, setDataSaub] = useState([]) - const [dataSpin, setDataSpin] = useState([]) - const [chartInterval, setChartInterval] = useState(defaultChartInterval) - const [showLoader, setShowLoader] = useState(false) - - const options = timePeriodCollection.map((line) => ) - - const handleDataSaub = (data) => { - if (data) { - setDataSaub(data) - } - } - - const handleDataSpin = (data) => { - if (data) { - setDataSpin(data) - } - } - - useEffect(() => { - invokeWebApiWrapperAsync( - async () => { - const dataSaub = await TelemetryDataSaubService.getData(idWell, null, chartInterval) - const dataSpin = await TelemetryDataSpinService.getData(idWell, null, chartInterval) - handleDataSaub(dataSaub) - handleDataSpin(dataSpin) - }, - setShowLoader, - `Не удалось получить данные по скважине "${idWell}"`, - ) - const unsubscribeSaub = Subscribe('hubs/telemetry', 'ReceiveDataSaub', `well_${idWell}`, handleDataSaub) - const unsubscribeSpin = Subscribe('hubs/telemetry', 'ReceiveDataSpin', `well_${idWell}`, handleDataSpin) - return () => { - unsubscribeSaub() - unsubscribeSpin() - } - }, [idWell, chartInterval]) - - const colSpan = 24 / (paramsGroups.length) - - return ( - - - - -   - - Интервал:  - - -   - TorqueMaster - SpinMaster -

MSE

- - - -
- - - - - - - {paramsGroups.map((group, index) => - - - )} - - - - -
) -} \ No newline at end of file