From 60480881d6016784560b9ed7ef0256c3d7d79748 Mon Sep 17 00:00:00 2001 From: goodm2ice Date: Thu, 13 Jan 2022 20:41:27 +0500 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B0=20=D1=81=D1=82=D1=80=D0=B0=D0=BD=D0=B8=D1=86=D0=B0?= =?UTF-8?q?=20=D1=81=D0=BE=20=D1=81=D0=BF=D0=B8=D1=81=D0=BA=D0=BE=D0=BC=20?= =?UTF-8?q?=D1=82=D0=B5=D0=BB=D0=B5=D0=BC=D0=B5=D1=82=D1=80=D0=B8=D0=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/AdminPanel/TelemetryController.jsx | 63 ++++++++++++++++++++ src/pages/AdminPanel/index.jsx | 5 ++ 2 files changed, 68 insertions(+) create mode 100644 src/pages/AdminPanel/TelemetryController.jsx diff --git a/src/pages/AdminPanel/TelemetryController.jsx b/src/pages/AdminPanel/TelemetryController.jsx new file mode 100644 index 0000000..2389ffc --- /dev/null +++ b/src/pages/AdminPanel/TelemetryController.jsx @@ -0,0 +1,63 @@ +import { useEffect, useState } from 'react' + +import LoaderPortal from '../../components/LoaderPortal' +import { invokeWebApiWrapperAsync } from '../../components/factory' +import { + defaultPagination, + makeDateSorter, + makeNumericColumn, + makeNumericRender, + makeTextColumn, + Table +} from '../../components/Table' +import { AdminTelemetryService } from '../../services/api' +import { arrayOrDefault } from '../../utils' + +const columns = [ + makeNumericColumn('ID', 'id', null, null, makeNumericRender(0)), + makeTextColumn('UID', 'remoteUid'), + makeTextColumn('Назначена на скважину', 'realWell'), + makeTextColumn('Дата начала бурения', 'drillingStartDate', null, makeDateSorter('drillingStartDate')), + makeTextColumn('Часовой пояс', 'timeZoneId'), + makeTextColumn('Скважина', 'well'), + makeTextColumn('Куст', 'cluster'), + makeTextColumn('Месторождение', 'deposit'), + makeTextColumn('Заказчик', 'customer'), + makeTextColumn('Комментарий', 'comment'), + makeTextColumn('Версия HMI', 'hmiVersion'), + makeTextColumn('Версия САУБ', 'saubPlcVersion'), + makeTextColumn('Версия Спин Мастер', 'spinPlcVersion'), +] + +export const TelemetryController = () => { + const [telemetryData, setTelemetryData] = useState([]) + const [isLoading, setIsLoading] = useState(false) + + useEffect(() => invokeWebApiWrapperAsync( + async () => { + const telemetryData = arrayOrDefault(await AdminTelemetryService.getAll()) + setTelemetryData(telemetryData.map((telemetry) => ({ + ...(telemetry?.info ?? []), + id: telemetry?.id, + remoteUid: telemetry?.remoteUid, + realWell: telemetry?.well?.caption, + }))) + }, + setIsLoading, + `Не удалось загрузить список телеметрии скважин` + ), []) + + return ( + + + + ) +} + +export default TelemetryController diff --git a/src/pages/AdminPanel/index.jsx b/src/pages/AdminPanel/index.jsx index c699e3c..6b05d8e 100644 --- a/src/pages/AdminPanel/index.jsx +++ b/src/pages/AdminPanel/index.jsx @@ -12,6 +12,7 @@ const WellController = lazy(() => import('./WellController')) const RoleController = lazy(() => import('./RoleController')) const CompanyTypeController = lazy(() => import('./CompanyTypeController')) const PermissionController = lazy(() => import('./PermissionController')) +const TelemetryController = lazy(() => import('./TelemetryController')) const VisitLog = lazy(() => import('./VisitLog')) export const AdminPanel = () => { @@ -45,6 +46,9 @@ export const AdminPanel = () => { Разрешения + + Телеметрия + Журнал посещений @@ -62,6 +66,7 @@ export const AdminPanel = () => { +