СЭД «ДЕЛО»
Руководство пользователя
×

6.4.1.11 FieldButton – кнопка

{
                        "type": "FieldButton",
                        "name": "SendButton",
                        "onClick": {
                              "TestSendEmail": {
                                    "EmailProfile": "EmailProfile",
                                    "ToAddress": "To"
                              }
                        }
}
Поле с кнопкой поддерживает метод, позволяющий сделать тестовую отправку сообщения. 
Если требуется проверить отправку email сообщения, необходимо в "onClick" указать, что требуется выполнить метод "TestSendEmail", со следующими параметрами "EmailProfile": "EmailProfile", "ToAddress": "To". Параметры "EmailProfile", "ToAddress" фиксированные, в них указывается имя поля, из которого нужно получить соответствующее значение. Поле, указанное для "EmailProfile" должно быть типа FieldProfile с выбором профиля электронной почты. Поле для "ToAddress" должно содержать email адрес получателя. Пример полной конфигурации с данным методом кнопки указан ниже. Также, данная конфигурация содержится в примере ФЗ в дистрибутиве системы в архиве «APISamples.zip» (проект Eos.Delo.Samples.Daemons).
Пример конфигурации с кнопкой тестовой отправки email:
{  "title": "Тестовая отправка Email",  "jobContext": {    "fields": [
      {    
            "label": "Профиль эл. почты",
            "name": "EmailProfile",
            "type": "FieldProfile",
            "required": true,
            "selectProfile": {
                  "namespace": "Eos.Platform.Settings.Email",
                  "typename": "CommonCfg",
                  "propertyProfileName": "ProfileName"
            }
      },
      {
        "label": "Почтовый адрес администратора",
        "name": "Admin",
        "type": "FieldText",
        "required": true,
        "requiredMessage": "Обязательное поле"
      },
      {
        "type": "FieldButton",
        "name": "TestSendButton",
        "onClick": {
          "TestSendEmail": {
            "EmailProfile": "EmailProfile",
            "ToAddress": "Admin"
          }
        }
      }
    ],
    "rows": [
      {
        "cells": [
          {
            "fields": [ "EmailProfile" ],
            "width": 24
          }
        ]
      },
      {
        "cells": [
          {
            "fields": [ "Admin" ],
            "width": 24
          }
        ]
      },
      {
        "cells": [
          {
            "fields": [ "TestSendButton" ],
            "width": 24
          }
        ]
      }
    ],
    "defaultValues": {}
  }
}
Пример конфигурационного файла:
{  "title": "Получение всех видов параметров",
  "commonContext": {
    "fields": [
      {
        "label": "Интервал запуска",
        "name": "Periodicity",
        "type": "FieldInteger",
        "required": true,
        "max": 99,
        "min": 1
      }
    ],
    "rows": [
      {
        "cells": [
          {
            "fields": [ "Periodicity" ],
            "width": 12
          }
        ]
      }
    ],
    "defaultValues": { "Periodicity": 1 }
  },
  "jobContext": {
    "fields": [
      {
        "label": "Организация",
        "name": "Organization",
        "required": true,
        "type": "FieldAutoComplete",
        "multiple": false,
        "chooseClassif": {
          "classif": "ORGANIZ_CL",
          "multi": false,
          "returnDue": true
        }
      },
      {
        "name": "RegistrationOnly",
        "type": "FieldCheckbox",
        "description": "Отправлять только при регистрации РК"
      },
      {
        "label": "Тип",
        "name": "Type",
        "type": "FieldEnum",
        "required": true,
        "options": [
          {
            "value": 1,
            "label": "Оригинал"
          },
          {
            "value": 2,
            "label": "Любой экземпляр"
          },
          {
            "value": 3,
            "label": "Копия"
          }
        ]
      },
      {
        "label": "Метод авторизации",
        "name": "AuthorizationMethod",
        "type": "FieldEnum",
        "required": true,
        "options": [
          {
            "value": "NONE",
            "label": "Авторизация не требуется"
          },
          {
            "value": "LOGIN",
            "label": "Авторизация логин/пароль"
          },
          {
            "value": "NTLM",
            "label": "Авторизация Windows"
          }
        ],
        "onChange": [
          {
            "action": "disableField",
            "field": "SmtpUsername",
            "value": "NONE"
          },
          {
            "action": "disableField",
            "field": "SmtpPassword",
            "value": "NONE"
          },
          {
            "action": "enableField",
            "field": "SmtpUsername",
            "value": "LOGIN"
          },
          {
            "action": "enableField",
            "field": "SmtpPassword",
            "value": "LOGIN"
          },
          {
            "action": "enableField",
            "field": "SmtpUsername",
            "value": "NTLM"
          },
          {
            "action": "enableField",
            "field": "SmtpPassword",
            "value": "NTLM"
          }
        ]
      },
      {
        "label": "Типы",
        "name": "Types",
        "type": "FieldEnum",
        "enumType": "multiple",
        "options": [
          {
            "value": 1,
            "label": "Тип 1"
          },
          {
            "value": 2,
            "label": "Тип 2"
          },
          {
            "value": 3,
            "label": "Тип 3"
          }
        ]
      },
      {
        "label": "Начиная с даты",
        "name": "StartDate",
        "type": "FieldDateTime",
        "minDate": "2021",
        "maxDate": "05.25.22"
      },
      {
        "label": "Название папки",
        "name": "Folder",
        "type": "FieldText",
        "required": true
      },
      {
        "label": "Время",
        "name": "Time",
        "required": true,
        "type": "FieldTimePicker"
      },
      {
        "label": "Пароль",
        "name": "Password",
        "type": "FieldPassword",
        "required": true
      },
      {
        "label": "Профиль эл. почты",
        "name": "EmailProfile",
        "type": "FieldProfile",
        "required": true,
        "selectProfile": {
          "namespace": "Eos.Platform.Settings.Email",
          "typename": "CommonCfg",
          "propertyProfileName": "ProfileName"
        }
      },
      {
        "label": "Профиль криптографии",
        "name": "CryptoProfile",
        "type": "FieldProfile",
        "required": true,
        "selectProfile": {
          "namespace": "Eos.Delo.Settings.Cryptography",
          "typename": "CryptographyCfg",
          "propertyProfileName": "ProfileName"
        }
      },
      {
        "label": "Хранилище",
        "name": "Storage",
        "type": "FieldStorage",
        "required": true
      }
    ],
    "rows": [
      {
        "cells": [
          {
            "fields": [ "Organization" ],
            "width": 24
          }
        ]
      },
      {
        "cells": [
          {
            "fields": [ "RegistrationOnly" ],
            "width": 24
          }
        ]
      },
      {
        "cells": [
          {
            "fields": [ "Type" ],
            "width": 24
          }
        ]
      },
      {
        "cells": [
          {
            "fields": [ "AuthorizationMethod" ],
            "width": 24
          }
        ]
      },
      {
        "cells": [
          {
            "fields": [ "Types" ],
            "width": 24
          }
        ]
      },
      {
        "cells": [
          {
            "fields": [ "StartDate" ],
            "width": 24
          }
        ]
      },
      {
        "cells": [
          {
            "fields": [ "Storage" ],
            "width": 12
          },
          {
            "fields": [ "Folder" ],
            "width": 12
          }
        ]
      },
      {
        "cells": [
          {
            "fields": [ "Time" ],
            "width": 24
          }
        ]
      },
      {
        "cells": [
          {
            "fields": [ "Password" ],
            "width": 24
          }
        ]
      },
      {
        "cells": [
          {
            "fields": [ "EmailProfile" ],
            "width": 24
          }
        ]
      },
      {
        "cells": [
          {
            "fields": [ "CryptoProfile" ],
            "width": 24
          }
        ]
      }
    ],
    "defaultValues": {
      "Folder": "NewFolder",
      "Type": 1,
      "AuthorizationMethod": "NONE",
      "Types": [ 1, 2 ],
      "StartDate": "10.09.2022",
      "Time": "13:55"
    }
  }
}
Объект "rows" содержит список строк, в данном примере в общих настройках одна строка, в экземплярных – несколько.
Объект "cells" – содержит список столбцов. Каждый столбец содержит список полей "fields", и ширину "width". При "width": 24 – столбец занимает всю строку, "width":12 – половину строки, "width":6 – четверть строки.
Например, чтобы поле выбора хранилищ "Storage", и название папки "Folder" находились в одной строке, двух соседних столбцах и занимали по половине строки:
"rows": [ 
          { "cells": [{"fields": ["Storage"], "width": 12},{"fields": ["Folder"], "width": 12}] }
       ]
Регистрируемые классы конфигураций для примера выше:
using Eos.Platform.AppSettings.Abstractions;
using System.Collections.Generic;
namespace Eos.Delo.Settings.TestDaemons
{
    public class CheckParamsDefaultCfg
    {
        public long Periodicity { get; init; }
    }
 
    public class CheckParamsJobCfg
    {
        public string Organization { get; init; }
        public bool RegistrationOnly { get; init; }
        public long Type { get; init; }
        public string AuthorizationMethod { get; init; }
        public IReadOnlyList<long> Types { get; init; }
        public string StartDate { get; init; }
        public string Folder { get; init; }
        public string Time { get; init; }
        public Secret Password { get; init; }
        public string EmailProfile { get; init; }
        public string CryptoProfile { get; init; }
        public string Storage { get; init; }
    }
 
Пример получения параметров с получением значения пароля:
protected override void FillParams()
{
    commonCfg = GetDefaultAppSettingsParams<CheckParamsDefaultCfg>();
    jobCfg = GetJobAppSettingsParams<CheckParamsJobCfg>();
 
    InContext((context, serviceProvider) => {
        var secretStore = serviceProvider.GetRequiredService<ISecretStore>();
        _password = secretStore.GetValueAsync(jobCfg.Password).Result;
    });
}
 
Примеры конфигурационных файлов также можно посмотреть в дистрибутиве системы в архиве «APISamples.zip» (проект Eos.Delo.Samples.Daemons, папка Setup).
Онлайн помощь создана в Dr.Explain