Платформа 3V/Отчет/6. Дополнительные действия в отчете/Подключение кнопок к отчету

Материал из 3v-wiki
Перейти к навигации Перейти к поиску

Общее описание

Для того, чтобы подключить кнопку к отчету необходимо в настройка блока "view": {} добавить:

"buttons": [ ],
 1 "buttons": [
 2       {
 3         "buttons": [
 4           {
 5             "actionsOnClick": {
 6               "formula": {
 7                 "expression": "'/rih-navigator/cards/2645'",
 8                 "operands": [],
 9                 "code": null,
10                 "id": 0,
11                 "name": null
12               },
13               "openTarget": "SameWindow",
14               "discriminator": "PivotButtonHyperlinkActionDto",
15               "needRefresh": false
16             },
17             "discriminator": "PivotButtonDto",
18             "id": "custom3",
19             "text": "Создать Объект КВ",
20             "hint": null,
21             "confirmationMessage": null,
22             "styles": {
23               "defaultId": 0,
24               "pressedId": null,
25               "hoverId": null
26             }
27           },
28           {
29             "actionsOnClick": {
30               "formula": {
31                 "expression": "'/rih-navigator/cards/2651?2=%5B2%5D'",
32                 "operands": [],
33                 "code": null,
34                 "id": 0,
35                 "name": null
36               },
37               "openTarget": "SameWindow",
38               "discriminator": "PivotButtonHyperlinkActionDto",
39               "needRefresh": false
40             },
41             "discriminator": "PivotButtonDto",
42             "id": "custom4",
43             "text": "Создать НИОКР",
44             "hint": null,
45             "confirmationMessage": null,
46             "styles": {
47               "defaultId": 0,
48               "pressedId": null,
49               "hoverId": null
50             }
51           }
52         ],
53         "discriminator": "PivotGroupingButtonDto",
54         "id": "CopyButton213231",
55         "text": "+ Создать",
56         "hint": null,
57         "confirmationMessage": null,
58         "styles": {
59           "defaultId": 46,
60           "pressedId": null,
61           "hoverId": null
62         },
63         "accessOptions": {
64           "subjectIds": [
65             "faip.inv_create_invproject"
66           ]
67         }
68       }
69     ],
Параметр Описание
"openTarget": "SameWindow"/"NewTab" Открыть в том же окне / Открыть в новом окне
"needRefresh": false/true
"text": "" Наименование кнопки
"hint": null Текст отображаемый над кнопкой при наведении курсора на кнопку
"confirmationMessage": null, Текст отображаемый в диалоговом окне подтверждения
"defaultId": 46 Идентификатор стиля по умолчанию
"pressedId": 47, Идентификатор стиля при наведении
"hoverId": 47 Идентификатор стиля в нажатом состоянии
"accessOptions": null Настройки доступа
"icon": null Иконка для кнопки

Типы кнопок

Обычная кнопка

Простая кнопка в пивоте.jpg











JSON серверной карточки
  1 "buttons": [
  2       {
  3         "actionsOnClick": {
  4           "requestType": "Get",
  5           "formula": {
  6             "expression": "",
  7             "operands": [
  8               {
  9                 "value": "PivotInstanceId",
 10                 "discriminator": "PredefinedPivotOperandDto",
 11                 "code": null,
 12                 "id": 0,
 13                 "name": null
 14               }
 15             ],
 16             "code": null,
 17             "id": 0,
 18             "name": null
 19           },
 20           "discriminator": "PivotButtonExecuteHttpRequestActionDto",
 21           "needRefresh": true
 22         },
 23         "discriminator": "PivotButtonDto",
 24         "id": "CreateVersion",
 25         "text": "Создать версию",
 26         "hint": null,
 27         "confirmationMessage": null,
 28         "styles": {
 29           "defaultId": 53,
 30           "pressedId": 47,
 31           "hoverId": 52
 32         },
 33         "accessOptions": {
 34           "subjectIds": [
 35             "faip.inv_create_invproject"
 36           ]
 37         }
 38       },
 39       {
 40         "actionsOnClick": {
 41           "requestType": "Get",
 42           "formula": {
 43             "expression": "",
 44             "operands": [
 45               {
 46                 "value": "PivotInstanceId",
 47                 "discriminator": "PredefinedPivotOperandDto",
 48                 "code": null,
 49                 "id": 0,
 50                 "name": null
 51               }
 52             ],
 53             "code": null,
 54             "id": 0,
 55             "name": null
 56           },
 57           "discriminator": "PivotButtonExecuteHttpRequestActionDto",
 58           "needRefresh": true
 59         },
 60         "discriminator": "PivotButtonDto",
 61         "id": "DeleteButton",
 62         "text": "Удалить",
 63         "hint": null,
 64         "confirmationMessage": "Вы действительно хотите удалить выбранные документы?",
 65         "styles": {
 66           "defaultId": 55,
 67           "pressedId": null,
 68           "hoverId": 56
 69         },
 70         "accessOptions": {
 71           "subjectIds": [
 72             "faip.inv_create_invproject"
 73           ]
 74         }
 75       },
 76       {
 77         "actionsOnClick": {
 78           "requestType": "Get",
 79           "formula": {
 80             "expression": "",
 81             "operands": [
 82               {
 83                 "value": "PivotInstanceId",
 84                 "discriminator": "PredefinedPivotOperandDto",
 85                 "code": null,
 86                 "id": 0,
 87                 "name": null
 88               }
 89             ],
 90             "code": null,
 91             "id": 0,
 92             "name": null
 93           },
 94           "discriminator": "PivotButtonExecuteHttpRequestActionDto",
 95           "needRefresh": true
 96         },
 97         "discriminator": "PivotButtonDto",
 98         "id": "custom22",
 99         "text": "Направить на согласование",
100         "hint": null,
101         "confirmationMessage": null,
102         "icon": {
103           "type": "svg",
104           "data": "<svg width='16' height='16' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'><path fill-rule='evenodd' clip-rule='evenodd' d='M0 2.5C0 1.11929 1.11929 0 2.5 0H11.5C12.8807 0 14 1.11929 14 2.5V7H13V2.5C13 1.67157 12.3284 1 11.5 1H2.5C1.67157 1 1 1.67157 1 2.5V13.5C1 14.3284 1.67157 15 2.5 15H8V16H2.5C1.11929 16 0 14.8807 0 13.5V2.5Z' fill='#344556'/><rect width='3.40206' height='0.969705' rx='0.484852' transform='matrix(-0.692266 -0.721643 -0.735122 0.677935 12.568 15.3372)' fill='#344556'/><rect width='0.96414' height='7.80429' rx='0.48207' transform='matrix(-0.870241 -0.492626 -0.50741 0.861705 16.0591 9.2749)' fill='#344556'/><rect x='3' y='3' width='3' height='1' fill='#344556'/><rect x='3' y='5' width='5' height='1' fill='#344556'/></svg>"
105         },
106         "accessOptions": {
107           "subjectIds": [
108             "PMS.task.route_settings.run_process"
109           ]
110         }
111       }
112     ],

Кнопка с выпадающим списком

Кнопка в пивоте.jpg











JSON серверной карточки
 1 "buttons": [
 2       {
 3         "buttons": [
 4           {
 5             "actionsOnClick": {
 6               "formula": {
 7                 "expression": "'/rih-navigator/cards/2645'",
 8                 "operands": [],
 9                 "code": null,
10                 "id": 0,
11                 "name": null
12               },
13               "openTarget": "SameWindow",
14               "discriminator": "PivotButtonHyperlinkActionDto",
15               "needRefresh": false
16             },
17             "discriminator": "PivotButtonDto",
18             "id": "custom3",
19             "text": "Создать Объект КВ",
20             "hint": null,
21             "confirmationMessage": null,
22             "styles": {
23               "defaultId": 0,
24               "pressedId": null,
25               "hoverId": null
26             }
27           },
28           {
29             "actionsOnClick": {
30               "formula": {
31                 "expression": "'/rih-navigator/cards/2651?2=%5B2%5D'",
32                 "operands": [],
33                 "code": null,
34                 "id": 0,
35                 "name": null
36               },
37               "openTarget": "SameWindow",
38               "discriminator": "PivotButtonHyperlinkActionDto",
39               "needRefresh": false
40             },
41             "discriminator": "PivotButtonDto",
42             "id": "custom4",
43             "text": "Создать НИОКР",
44             "hint": null,
45             "confirmationMessage": null,
46             "styles": {
47               "defaultId": 0,
48               "pressedId": null,
49               "hoverId": null
50             }
51           }
52         ],
53         "discriminator": "PivotGroupingButtonDto",
54         "id": "CopyButton213231",
55         "text": "+ Создать",
56         "hint": null,
57         "confirmationMessage": null,
58         "styles": {
59           "defaultId": 46,
60           "pressedId": null,
61           "hoverId": null
62         },
63         "accessOptions": {
64           "subjectIds": [
65             "faip.inv_create_invproject"
66           ]
67         }
68       }
69     ],

Настроить действия на кнопку

Открыть карточку


JSON серверной карточки
 1 "buttons": [
 2       {
 3         "actionsOnClick": {
 4           "formula": {
 5             "expression": "'/rih-navigator/cards/2531'",
 6             "operands": [
 7               {
 8                 "parameterId": 1,
 9                 "discriminator": "ParameterFormulaOperandDto",
10                 "code": null,
11                 "id": 1,
12                 "name": null
13               }
14             ],
15             "code": null,
16             "id": 0,
17             "name": null
18           },
19           "openTarget": "SameWindow",
20           "discriminator": "PivotButtonHyperlinkActionDto",
21           "needRefresh": false
22         },
23         "discriminator": "PivotButtonDto",
24         "id": "custom2",
25         "text": "Сформировать ФАИП",
26         "hint": null,
27         "confirmationMessage": null,
28         "styles": {
29           "defaultId": 46,
30           "pressedId": 47,
31           "hoverId": 47
32         },
33         "accessOptions": {
34           "subjectIds": [
35             "faip.faip_create_consolidatedreport"
36           ]
37         }
38       }
39     ],

Запустить методику


JSON серверной карточки
 1 "buttons": [
 2       {
 3         "actionsOnClick": {
 4           "requestType": "Get",
 5           "formula": {
 6             "expression": "'/engine/api/Calculation/16359'",
 7             "operands": [],
 8             "code": null,
 9             "id": 0,
10             "name": null
11           },
12           "discriminator": "PivotButtonExecuteHttpRequestActionDto",
13           "needRefresh": false
14         },
15         "discriminator": "PivotButtonDto",
16         "id": "custom1",
17         "text": "Execute Method",
18         "hint": null,
19         "confirmationMessage": null,
20         "styles": {
21           "defaultId": 1,
22           "pressedId": 8,
23           "hoverId": 4
24         },
25         "accessOptions": {
26           "subjectIds": [
27             "Test Role"
28           ]
29         }
30       }
31     ],

Открыть ссылку


JSON серверной карточки
 1 "buttons": [
 2             {
 3         "actionsOnClick": {
 4           "formula": {
 5             "expression": "'https://yandex.ru/'",
 6             "operands": [],
 7             "code": null,
 8             "id": 0,
 9             "name": null
10           },
11           "openTarget": "NewTab",
12           "discriminator": "PivotButtonHyperlinkActionDto",
13           "needRefresh": false
14         },
15         "discriminator": "PivotButtonDto",
16         "id": "custom2",
17         "text": "Go to yandex",
18         "hint": null,
19         "confirmationMessage": null,
20         "styles": {
21           "defaultId": 4,
22           "pressedId": 5,
23           "hoverId": 6
24         }
25       }
26     ],