From 418e77bf7478798c73ca3b39012b6d82d53556a5 Mon Sep 17 00:00:00 2001 From: Mikhail Chechnev Date: Wed, 11 Jun 2025 22:07:16 +0300 Subject: [PATCH] =?UTF-8?q?WEBAPP:=20=D0=A0=D0=B5=D0=B4=D0=B0=D0=BA=D1=82?= =?UTF-8?q?=D0=BE=D1=80=20=D0=BF=D0=B0=D0=BD=D0=B5=D0=BB=D0=B5=D0=B9=20-?= =?UTF-8?q?=20=D0=BF=D1=80=D0=B8=D0=BC=D0=B5=D0=BD=D1=91=D0=BD=20P8PIndica?= =?UTF-8?q?tor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../panels_editor/components/components.js | 14 ++-- .../components/indicator/view.js | 67 +++---------------- app/panels/panels_editor/panels_editor.js | 8 +-- 3 files changed, 20 insertions(+), 69 deletions(-) diff --git a/app/panels/panels_editor/components/components.js b/app/panels/panels_editor/components/components.js index 632cdf6..5c87a24 100644 --- a/app/panels/panels_editor/components/components.js +++ b/app/panels/panels_editor/components/components.js @@ -11,14 +11,14 @@ const COMPONETNS = [ { name: "Форма", path: "form", - settings2: { + settings: { title: "Параметры формирования", autoApply: true, items: [ { name: "AGENT", caption: "Контрагент", - unitCode: "AGNLIST", + unitCode2: "AGNLIST", unitName: "Контрагенты", showMethod: "main", showMethodName: "main", @@ -29,7 +29,7 @@ const COMPONETNS = [ { name: "DOC_TYPE", caption: "Тип документа", - unitCode: "DOCTYPES", + unitCode2: "DOCTYPES", unitName: "Типы документов", showMethod: "main", showMethodName: "main", @@ -75,10 +75,10 @@ const COMPONETNS = [ { name: "Индикатор", path: "indicator", - settings2: { + settings: { dataSource: { type: "USER_PROC", - userProc: "ИндКолДогКонтрТип sdfg sdfg sfdg sdfg sdfg sdfg ", + userProc: "ИндКолДогКонтрТип", stored: "UDO_P_P8P_AGNCONTR_IND", respArg: "COUT", arguments: [ @@ -95,7 +95,7 @@ const COMPONETNS = [ ] } } - } /*, + }, { name: "Индикатор2", path: "indicator", @@ -119,7 +119,7 @@ const COMPONETNS = [ ] } } - }*/ + } ]; //---------------- diff --git a/app/panels/panels_editor/components/indicator/view.js b/app/panels/panels_editor/components/indicator/view.js index 509075f..82495ad 100644 --- a/app/panels/panels_editor/components/indicator/view.js +++ b/app/panels/panels_editor/components/indicator/view.js @@ -9,7 +9,8 @@ import React from "react"; //Классы React import PropTypes from "prop-types"; //Контроль свойств компонента -import { Paper, Stack, Typography, Icon } from "@mui/material"; //Интерфейсные элементы +import { Paper } from "@mui/material"; //Интерфейсные элементы +import { P8PIndicator } from "../../../../components/p8p_indicator"; //Компонент индикатора import { useComponentDataSource } from "../components_hooks"; //Хуки для данных import { DATA_SOURCE_SHAPE } from "../editors_common"; //Общие объекты компонентов import { COMPONENT_MESSAGE_TYPE, COMPONENT_MESSAGES, ComponentInlineMessage } from "../views_common"; //Общие компоненты представлений @@ -25,56 +26,9 @@ const COMPONENT_ICON = "speed"; //Наименование компонента const COMPONENT_NAME = "Индикатор"; -//Типовые цвета -const COLOR = { - OK: "#00ffaaa0", - OK_CONTR: "white", - ERR: "#ff0000a0", - ERR_CONTR: "white", - WARN: "orange", - WARN_CONTR: "white", - UNDEFINED: "#dcdcdca0", - UNDEFINED_CONTR: "black", - INACTIVE: "#A9A9A9", - INACTIVE_CONTR: "black" -}; - -//Состояния -const INDICATOR_STATE = { - UNDEFINED: "UNDEFINED", - OK: "OK", - ERR: "ERR", - WARN: "WARN" -}; - -//Цвета заливки -const BG_COLOR = { - [INDICATOR_STATE.OK]: COLOR.OK, - [INDICATOR_STATE.ERR]: COLOR.ERR, - [INDICATOR_STATE.WARN]: COLOR.WARN -}; - -//Цвета иконок -const ICON_COLOR = { - [INDICATOR_STATE.OK]: COLOR.OK_CONTR, - [INDICATOR_STATE.ERR]: COLOR.ERR_CONTR, - [INDICATOR_STATE.WARN]: COLOR.WARN_CONTR -}; - //Стили const STYLES = { - CONTAINER: state => ({ - ...(BG_COLOR[state] ? { backgroundColor: BG_COLOR[state] } : {}), - height: "100%", - display: "flex", - flexDirection: "column", - justifyContent: "center", - alignItems: "center", - overflow: "hidden", - padding: "10px" - }), - STACK: { padding: "10px", width: "100%" }, - ICON: state => ({ fontSize: "100px", ...(ICON_COLOR[state] ? { color: ICON_COLOR[state] } : {}) }) + CONTAINER: { height: "100%" } }; //----------- @@ -97,15 +51,14 @@ const Indicator = ({ dataSource = null, values = {} } = {}) => { //Формирование представления return ( - + {haveConfing && haveData ? ( - - - {[undefined, null, ""].includes(indicator.value) ? "н.д." : indicator.value} - {indicator.caption} - - {indicator.icon ? {indicator.icon} : null} - + ) : ( { //При подключении к странице useEffect(() => { - //addComponent(COMPONETNS[0]); - //addComponent(COMPONETNS[3]); - //addComponent(COMPONETNS[4]); + addComponent(COMPONETNS[0]); + addComponent(COMPONETNS[3]); + addComponent(COMPONETNS[4]); //addComponent(COMPONETNS[1]); //addComponent(COMPONETNS[2]); // eslint-disable-next-line react-hooks/exhaustive-deps