ru.coon 2.8.12 → 2.8.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/package.json +1 -1
- package/src/uielement/plugin/ExecuteReportPlugin.js +187 -0
- package/src/uielement/plugin/configPanel/executeReport/ExecuteReportPluginConfigPanelFormEditor.js +445 -0
- package/src/uielement/plugin/configPanel/executeReport/ExecuteReportPluginConfigPanelFormEditor.scss +22 -0
- package/src/version.js +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
# Version 2.8.13, [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/33ee197b3f9236825df8a0fca08d2b6d8b873d65)
|
|
2
|
+
* TR-69125 feat: плагин ExecuteReportPlugin ([9950bc], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/9950bce3518c8edb9512d5125c3c0a7bca284c21))
|
|
3
|
+
* update: CHANGELOG.md ([d117f3], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/d117f322365a1d8d5399cb1031edc2a1d9579caf))
|
|
4
|
+
|
|
1
5
|
# Version 2.8.12, [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/89d48dd480147733a75d36a62408ec92070c497a)
|
|
2
6
|
* ## Features
|
|
3
7
|
* <span style='color:green'>feat: HT-10449: Add extra fields to plugin
|
package/package.json
CHANGED
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
Ext.define('Coon.uielement.plugin.ExecuteReportPlugin', {
|
|
2
|
+
extend: 'Ext.AbstractPlugin',
|
|
3
|
+
alias: 'plugin.ExecuteReportPlugin',
|
|
4
|
+
requires: [
|
|
5
|
+
'Coon.log',
|
|
6
|
+
'Coon.Function',
|
|
7
|
+
'Coon.report.component.ErrorWindow'
|
|
8
|
+
],
|
|
9
|
+
configurePanelWizardForFormEditor: 'ExecuteReportPluginConfigPanelFormEditor',
|
|
10
|
+
config: {
|
|
11
|
+
parameters: {},
|
|
12
|
+
handlerName: undefined,
|
|
13
|
+
ctype: undefined,
|
|
14
|
+
confirmExecution: false,
|
|
15
|
+
confirmTitle: 'Сообщение системы',
|
|
16
|
+
confirmText: 'Вы уверены, что хотите выполнить действие?',
|
|
17
|
+
successTitle: 'Операция завершена',
|
|
18
|
+
successText: 'Операция завершена успешно',
|
|
19
|
+
successMessage: false,
|
|
20
|
+
propertyPath: undefined,
|
|
21
|
+
requiredValidView: false,
|
|
22
|
+
requiredValidReference: undefined,
|
|
23
|
+
requiredValidTitle: 'Сообщение системы',
|
|
24
|
+
requiredValidMessage: 'Не все обязательные поля заполнены.',
|
|
25
|
+
saveAnimation: false,
|
|
26
|
+
disabledReference: undefined,
|
|
27
|
+
completeHandler: undefined,
|
|
28
|
+
errorHandler: undefined,
|
|
29
|
+
},
|
|
30
|
+
|
|
31
|
+
init: function(view) {
|
|
32
|
+
this.view = view;
|
|
33
|
+
if (view.getController()) {
|
|
34
|
+
view.getController()[this.handlerName] = Ext.bind(this.handler, this);
|
|
35
|
+
this.vm = view.getController().getViewModel();
|
|
36
|
+
this.disablingElement = this.disabledReference && view.getController().lookup(this.disabledReference);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
if (this.disablingElement) {
|
|
40
|
+
const defaultFocus = view.getDefaultFocus();
|
|
41
|
+
defaultFocus && defaultFocus.setConfig({
|
|
42
|
+
preventRefocus: true,
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
|
|
47
|
+
parsePropertiesToArray: function(paramValue) {
|
|
48
|
+
try {
|
|
49
|
+
const paramObj = JSON5.parse(paramValue);
|
|
50
|
+
const arr = [];
|
|
51
|
+
Object.keys(paramObj).forEach((param) => arr.push({type: param, value: paramObj[param]}));
|
|
52
|
+
return arr;
|
|
53
|
+
} catch (ex) {
|
|
54
|
+
Coon.log.error(ex);
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
|
|
59
|
+
handler: function() {
|
|
60
|
+
if (this.paramsPath && this.vm.get(this.paramsPath)) {
|
|
61
|
+
this.parameters.parameterList = JSON5.stringify(this.vm.get(this.paramsPath));
|
|
62
|
+
}
|
|
63
|
+
const parameters = Ext.decode(Ext.encode(this.parameters));
|
|
64
|
+
return new Promise((resolve, reject) => {
|
|
65
|
+
this.setDisabled(true);
|
|
66
|
+
if (this.ctype) {
|
|
67
|
+
if (this.getRequiredValidView()) {
|
|
68
|
+
const reference = this.getRequiredValidReference();
|
|
69
|
+
const validateView = reference ?
|
|
70
|
+
this.view.getController().lookup(reference) :
|
|
71
|
+
this.view;
|
|
72
|
+
if (!validateView) {
|
|
73
|
+
Coon.log.log('Component with reference "' + reference + '" not found. Nothing to validate');
|
|
74
|
+
reject(new Error('Component with reference "' + reference + '" not found. Nothing to validate'));
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
if (!Coon.Function.validateAllFieldsOnForm(validateView, true)) {
|
|
78
|
+
Ext.Msg.alert(this.getRequiredValidTitle(), this.getRequiredValidMessage());
|
|
79
|
+
this.setDisabled(false);
|
|
80
|
+
reject(new Error(this.getRequiredValidTitle()+ '-' + this.getRequiredValidMessage()));
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
const commandProperties = parameters._commandProperties || {};
|
|
86
|
+
if (parameters._commandProperties) {
|
|
87
|
+
delete parameters._commandProperties;
|
|
88
|
+
}
|
|
89
|
+
if (this.saveAnimation) {
|
|
90
|
+
commandProperties.activeComponent = Coon.Function.getComponentForMasking(this.view);
|
|
91
|
+
}
|
|
92
|
+
const command = Ext.create('command.' + this.ctype, commandProperties);
|
|
93
|
+
const initArguments = [];
|
|
94
|
+
|
|
95
|
+
command.on('complete', function(data) {
|
|
96
|
+
this.processData(data);
|
|
97
|
+
resolve(data);
|
|
98
|
+
}, this);
|
|
99
|
+
|
|
100
|
+
command.processError = !!this.errorHandler;
|
|
101
|
+
command.on('failure', function(e) {
|
|
102
|
+
this.setDisabled(false);
|
|
103
|
+
if (this.errorHandler) {
|
|
104
|
+
try {
|
|
105
|
+
const controller = this.view.getController();
|
|
106
|
+
const callback = controller[this.errorHandler];
|
|
107
|
+
if (typeof callback !== 'function') {
|
|
108
|
+
throw new Error(`No method named '${this.errorHandler}' on ${controller['$className']}`);
|
|
109
|
+
}
|
|
110
|
+
callback.call(this.view, e, this);
|
|
111
|
+
} catch (ex) {
|
|
112
|
+
this.processError(e);
|
|
113
|
+
Coon.log.error(ex);
|
|
114
|
+
}
|
|
115
|
+
} else {
|
|
116
|
+
reject(e);
|
|
117
|
+
}
|
|
118
|
+
}, this);
|
|
119
|
+
|
|
120
|
+
Ext.each(command.inputParameters(), (field) => {
|
|
121
|
+
const paramValue = parameters[field.name];
|
|
122
|
+
if (Ext.isString(paramValue) && paramValue.startsWith('{')) {
|
|
123
|
+
initArguments.push(this.parsePropertiesToArray(paramValue));
|
|
124
|
+
} else {
|
|
125
|
+
initArguments.push(paramValue);
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
const fn = () => command.execute.apply(command, initArguments);
|
|
129
|
+
|
|
130
|
+
if (this.confirmExecution) {
|
|
131
|
+
Ext.Msg.confirm(this.confirmTitle, this.confirmText, (btn) => btn === 'yes' && fn());
|
|
132
|
+
} else {
|
|
133
|
+
fn();
|
|
134
|
+
}
|
|
135
|
+
} else {
|
|
136
|
+
Coon.log.warn('Не определена команда');
|
|
137
|
+
reject(new Error('Не определена команда'));
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
},
|
|
141
|
+
|
|
142
|
+
asyncHandler() {
|
|
143
|
+
return this.handler();
|
|
144
|
+
},
|
|
145
|
+
|
|
146
|
+
processData: function(response) {
|
|
147
|
+
this.setDisabled(false);
|
|
148
|
+
const vm = this.view.getController().getViewModel();
|
|
149
|
+
let data = response;
|
|
150
|
+
if (this.resultMode === 'one') {
|
|
151
|
+
data = response.list ? response.list[0] : undefined;
|
|
152
|
+
} else {
|
|
153
|
+
data = response.list;
|
|
154
|
+
}
|
|
155
|
+
let propertyPath = this.getPropertyPath();
|
|
156
|
+
if (!propertyPath) {
|
|
157
|
+
propertyPath = this.getCtype();
|
|
158
|
+
}
|
|
159
|
+
vm.set(propertyPath, data);
|
|
160
|
+
if (this.successMessage) {
|
|
161
|
+
Ext.Msg.alert(this.successTitle, this.successText);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
if (this.completeHandler) {
|
|
165
|
+
try {
|
|
166
|
+
const controller = this.view.getController();
|
|
167
|
+
const callback = controller[this.completeHandler];
|
|
168
|
+
if (typeof callback !== 'function') {
|
|
169
|
+
throw new Error(`No method named '${this.completeHandler}' on ${controller['$className']}`);
|
|
170
|
+
}
|
|
171
|
+
callback.call(this.view, data);
|
|
172
|
+
} catch (ex) {
|
|
173
|
+
Coon.log.error(ex);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
},
|
|
177
|
+
|
|
178
|
+
setDisabled: function(value) {
|
|
179
|
+
this.disablingElement && Ext.isFunction(this.disablingElement.setDisabled) && this.disablingElement.setDisabled(value);
|
|
180
|
+
},
|
|
181
|
+
|
|
182
|
+
processError(e) {
|
|
183
|
+
Ext.widget('ErrorWindow', {
|
|
184
|
+
autoShow: true,
|
|
185
|
+
}).setFaultInfo(e.message);
|
|
186
|
+
},
|
|
187
|
+
});
|
package/src/uielement/plugin/configPanel/executeReport/ExecuteReportPluginConfigPanelFormEditor.js
ADDED
|
@@ -0,0 +1,445 @@
|
|
|
1
|
+
Ext.define('Coon.uielement.plugin.configPanel.executeCommand.ExecuteReportPluginConfigPanelFormEditor', {
|
|
2
|
+
extend: 'Ext.panel.Panel',
|
|
3
|
+
alias: 'widget.ExecuteReportPluginConfigPanelFormEditor',
|
|
4
|
+
description: 'Выполняет команду GetDynamicReportDataCommand, считывает и возвращает результат выполнения запроса репорта',
|
|
5
|
+
requires: [
|
|
6
|
+
'Coon.uielement.plugin.configPanel.executeCommand.DataMappingPanel'
|
|
7
|
+
],
|
|
8
|
+
cls: 'ExecuteReportPluginConfigPanelFormEditor',
|
|
9
|
+
viewModel: {
|
|
10
|
+
data: {
|
|
11
|
+
parameters: '{}',
|
|
12
|
+
ctype: 'GetDynamicReportDataCommand',
|
|
13
|
+
handlerName: '',
|
|
14
|
+
propertyPath: '',
|
|
15
|
+
paramsPath: '',
|
|
16
|
+
disabledReference: undefined,
|
|
17
|
+
completeHandler: undefined,
|
|
18
|
+
errorHandler: undefined,
|
|
19
|
+
|
|
20
|
+
successMessage: false,
|
|
21
|
+
successTitle: 'Операция завершена',
|
|
22
|
+
successText: 'Операция завершена успешно',
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
confirmExecution: false,
|
|
26
|
+
confirmTitle: 'Сообщение системы',
|
|
27
|
+
confirmText: 'Вы уверены, что хотите выполнить действие?',
|
|
28
|
+
|
|
29
|
+
requiredValidView: false,
|
|
30
|
+
requiredValidReference: '',
|
|
31
|
+
requiredValidTitle: 'Сообщение системы',
|
|
32
|
+
requiredValidMessage: 'Не все обязательные поля заполнены.',
|
|
33
|
+
|
|
34
|
+
saveAnimation: false,
|
|
35
|
+
resultMode: 'array',
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
referenceHolder: true,
|
|
39
|
+
reportParameters: [],
|
|
40
|
+
|
|
41
|
+
layout: {
|
|
42
|
+
type: 'vbox', align: 'stretch',
|
|
43
|
+
},
|
|
44
|
+
getData: function() {
|
|
45
|
+
return this.getConfiguration();
|
|
46
|
+
},
|
|
47
|
+
setData: function(data) {
|
|
48
|
+
data && this.doInit(data);
|
|
49
|
+
},
|
|
50
|
+
doInit: function(config) {
|
|
51
|
+
this.getViewModel().set('description', this.description);
|
|
52
|
+
for (const parameterName in config) {
|
|
53
|
+
if (!config.hasOwnProperty(parameterName) || parameterName === 'ptype') {
|
|
54
|
+
continue;
|
|
55
|
+
}
|
|
56
|
+
this.getViewModel().set(parameterName, config[parameterName]);
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
|
|
60
|
+
getConfiguration: function() {
|
|
61
|
+
const result = {};
|
|
62
|
+
const vm = this.getViewModel();
|
|
63
|
+
|
|
64
|
+
if (this.lookup('parametersRef').rendered && !vm.get('paramsPath')) {
|
|
65
|
+
if (this.lookup('parametersRef').links.editor.isJSON5Valid()) {
|
|
66
|
+
vm.set('parameters.parameterList', this.lookup('parametersRef').getValue());
|
|
67
|
+
} else {
|
|
68
|
+
Ext.Msg.alert('Ошибка', 'В параметрах присутствуют ошибки. Параметры прошлого плагина не сохранены');
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
result['parameters'] = vm.get('parameters');
|
|
72
|
+
result['propertyPath'] = vm.get('propertyPath');
|
|
73
|
+
result['paramsPath'] = vm.get('paramsPath');
|
|
74
|
+
result['handlerName'] = vm.get('handlerName');
|
|
75
|
+
result['ctype'] = vm.get('ctype');
|
|
76
|
+
if (vm.get('confirmExecution')) {
|
|
77
|
+
result['confirmExecution'] = vm.get('confirmExecution');
|
|
78
|
+
result['confirmTitle'] = vm.get('confirmTitle');
|
|
79
|
+
result['confirmText'] = vm.get('confirmText');
|
|
80
|
+
}
|
|
81
|
+
if (vm.get('completeHandler')) {
|
|
82
|
+
result['completeHandler'] = vm.get('completeHandler');
|
|
83
|
+
}
|
|
84
|
+
if (vm.get('errorHandler')) {
|
|
85
|
+
result['errorHandler'] = vm.get('errorHandler');
|
|
86
|
+
}
|
|
87
|
+
if (vm.get('disabledReference')) {
|
|
88
|
+
result['disabledReference'] = vm.get('disabledReference');
|
|
89
|
+
}
|
|
90
|
+
if (vm.get('successMessage')) {
|
|
91
|
+
result['successMessage'] = vm.get('successMessage');
|
|
92
|
+
result['successTitle'] = vm.get('successTitle');
|
|
93
|
+
result['successText'] = vm.get('successText');
|
|
94
|
+
}
|
|
95
|
+
if (vm.get('requiredValidView')) {
|
|
96
|
+
result['requiredValidView'] = vm.get('requiredValidView');
|
|
97
|
+
result['requiredValidTitle'] = vm.get('requiredValidTitle');
|
|
98
|
+
result['requiredValidMessage'] = vm.get('requiredValidMessage');
|
|
99
|
+
result['requiredValidReference'] = vm.get('requiredValidReference') ? vm.get('requiredValidReference'):undefined;
|
|
100
|
+
}
|
|
101
|
+
if (vm.get('saveAnimation')) {
|
|
102
|
+
result['saveAnimation'] = vm.get('saveAnimation');
|
|
103
|
+
}
|
|
104
|
+
if (vm.get('resultMode')) {
|
|
105
|
+
result['resultMode'] = vm.get('resultMode');
|
|
106
|
+
}
|
|
107
|
+
return result;
|
|
108
|
+
},
|
|
109
|
+
|
|
110
|
+
initComponent: function() {
|
|
111
|
+
this.items = [
|
|
112
|
+
{
|
|
113
|
+
xtype: 'pluginDescriptionLabel',
|
|
114
|
+
bind: {
|
|
115
|
+
value: '{description}',
|
|
116
|
+
},
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
xtype: 'comboBtnWrapper',
|
|
120
|
+
combobox: {
|
|
121
|
+
reference: 'handlerCombo',
|
|
122
|
+
xtype: 'BaseComboBox',
|
|
123
|
+
fieldLabel: 'handlerName',
|
|
124
|
+
flex: 1,
|
|
125
|
+
store: 'codeHandlers',
|
|
126
|
+
bind: {
|
|
127
|
+
value: '{handlerName}',
|
|
128
|
+
},
|
|
129
|
+
valueField: 'id',
|
|
130
|
+
displayField: 'id',
|
|
131
|
+
},
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
fieldLabel: 'ReportCd',
|
|
135
|
+
reference: 'reportCd',
|
|
136
|
+
xtype: 'ReportLookupCombo',
|
|
137
|
+
reportId: 'REPORTS',
|
|
138
|
+
valueField: 'CM_REPORT_CD',
|
|
139
|
+
displayField: 'CM_REPORT_CD',
|
|
140
|
+
searchField: 'CM_REPORT_CD',
|
|
141
|
+
editable: true,
|
|
142
|
+
autoLoadData: false,
|
|
143
|
+
bindToModel: {
|
|
144
|
+
CM_REPORT_CD: 'parameters.reportId',
|
|
145
|
+
},
|
|
146
|
+
bind: {
|
|
147
|
+
value: '{parameters.reportId}',
|
|
148
|
+
},
|
|
149
|
+
listeners: {
|
|
150
|
+
change: this.loadReportParameters.bind(this),
|
|
151
|
+
},
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
xtype: 'tabpanel',
|
|
155
|
+
flex: 1,
|
|
156
|
+
items: [
|
|
157
|
+
{
|
|
158
|
+
xtype: 'panel',
|
|
159
|
+
title: 'Параметры',
|
|
160
|
+
tooltip: 'Настройка параметров команды',
|
|
161
|
+
layout: {
|
|
162
|
+
type: 'vbox',
|
|
163
|
+
align: 'stretch',
|
|
164
|
+
},
|
|
165
|
+
scrollable: true,
|
|
166
|
+
items: [
|
|
167
|
+
{
|
|
168
|
+
xtype: 'textfield',
|
|
169
|
+
fieldLabel: 'Путь к объекту во ViewModel с параметрами репорта (приоритетный источник)',
|
|
170
|
+
bind: {
|
|
171
|
+
value: '{paramsPath}',
|
|
172
|
+
},
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
xtype: 'panel',
|
|
176
|
+
flex: 1,
|
|
177
|
+
layout: 'fit',
|
|
178
|
+
tbar: [
|
|
179
|
+
{
|
|
180
|
+
xtype: 'button',
|
|
181
|
+
text: 'Загрузить параметры',
|
|
182
|
+
tooltip: 'Параметры',
|
|
183
|
+
ui: 'blue-text-button-border',
|
|
184
|
+
handler: this.setReportParametersToEditor.bind(this),
|
|
185
|
+
bind: {
|
|
186
|
+
disabled: '{paramsPath}',
|
|
187
|
+
},
|
|
188
|
+
}
|
|
189
|
+
],
|
|
190
|
+
items: [
|
|
191
|
+
{
|
|
192
|
+
xtype: 'UiAceEditorPanel',
|
|
193
|
+
reference: 'parametersRef',
|
|
194
|
+
title: 'Настроить параметры вручную',
|
|
195
|
+
hideSearchPanel: true,
|
|
196
|
+
bind: {
|
|
197
|
+
disabled: '{paramsPath}',
|
|
198
|
+
value: '{parameters.parameterList}',
|
|
199
|
+
},
|
|
200
|
+
}
|
|
201
|
+
],
|
|
202
|
+
}
|
|
203
|
+
],
|
|
204
|
+
},
|
|
205
|
+
{
|
|
206
|
+
xtype: 'panel',
|
|
207
|
+
title: 'Настройки',
|
|
208
|
+
layout: {
|
|
209
|
+
type: 'vbox',
|
|
210
|
+
align: 'stretch',
|
|
211
|
+
},
|
|
212
|
+
scrollable: true,
|
|
213
|
+
items: [
|
|
214
|
+
{
|
|
215
|
+
xtype: 'checkbox',
|
|
216
|
+
boxLabel: 'successMessage',
|
|
217
|
+
boxLabelAlign: 'after',
|
|
218
|
+
padding: '0 0 0 10',
|
|
219
|
+
bind: '{successMessage}',
|
|
220
|
+
},
|
|
221
|
+
{
|
|
222
|
+
xtype: 'textfield',
|
|
223
|
+
fieldLabel: 'successText',
|
|
224
|
+
bind: {
|
|
225
|
+
value: '{successText}',
|
|
226
|
+
visible: '{successMessage}',
|
|
227
|
+
},
|
|
228
|
+
},
|
|
229
|
+
{
|
|
230
|
+
xtype: 'textfield',
|
|
231
|
+
fieldLabel: 'successTitle',
|
|
232
|
+
bind: {
|
|
233
|
+
value: '{successTitle}',
|
|
234
|
+
visible: '{successMessage}',
|
|
235
|
+
},
|
|
236
|
+
},
|
|
237
|
+
{
|
|
238
|
+
xtype: 'checkbox',
|
|
239
|
+
boxLabel: 'confirmExecution',
|
|
240
|
+
boxLabelAlign: 'after',
|
|
241
|
+
padding: '0 0 0 10',
|
|
242
|
+
bind: '{confirmExecution}',
|
|
243
|
+
},
|
|
244
|
+
{
|
|
245
|
+
xtype: 'textfield',
|
|
246
|
+
fieldLabel: 'confirmText',
|
|
247
|
+
bind: {
|
|
248
|
+
value: '{confirmText}',
|
|
249
|
+
visible: '{confirmExecution}',
|
|
250
|
+
},
|
|
251
|
+
},
|
|
252
|
+
{
|
|
253
|
+
xtype: 'checkbox',
|
|
254
|
+
padding: '0 0 0 10',
|
|
255
|
+
boxLabel: 'saveAnimation',
|
|
256
|
+
bind: {
|
|
257
|
+
value: '{saveAnimation}',
|
|
258
|
+
},
|
|
259
|
+
},
|
|
260
|
+
{
|
|
261
|
+
xtype: 'textfield',
|
|
262
|
+
fieldLabel: 'confirmTitle',
|
|
263
|
+
bind: {
|
|
264
|
+
value: '{confirmTitle}',
|
|
265
|
+
visible: '{confirmExecution}',
|
|
266
|
+
},
|
|
267
|
+
},
|
|
268
|
+
{
|
|
269
|
+
xtype: 'checkbox',
|
|
270
|
+
boxLabel: 'нужна ли валидация view[requiredValidView]',
|
|
271
|
+
boxLabelAlign: 'after',
|
|
272
|
+
padding: '0 0 0 10',
|
|
273
|
+
bind: '{requiredValidView}',
|
|
274
|
+
},
|
|
275
|
+
{
|
|
276
|
+
xtype: 'textfield',
|
|
277
|
+
fieldLabel: 'референс компонента для валидации[requiredValidReference]',
|
|
278
|
+
bind: {
|
|
279
|
+
value: '{requiredValidReference}',
|
|
280
|
+
visible: '{requiredValidView}',
|
|
281
|
+
},
|
|
282
|
+
},
|
|
283
|
+
{
|
|
284
|
+
xtype: 'textfield',
|
|
285
|
+
fieldLabel: 'requiredValidMessage',
|
|
286
|
+
bind: {
|
|
287
|
+
value: '{requiredValidMessage}',
|
|
288
|
+
visible: '{requiredValidView}',
|
|
289
|
+
},
|
|
290
|
+
},
|
|
291
|
+
{
|
|
292
|
+
xtype: 'textfield',
|
|
293
|
+
fieldLabel: 'requiredValidTitle',
|
|
294
|
+
bind: {
|
|
295
|
+
value: '{requiredValidTitle}',
|
|
296
|
+
visible: '{requiredValidView}',
|
|
297
|
+
},
|
|
298
|
+
},
|
|
299
|
+
{
|
|
300
|
+
xtype: 'textfield',
|
|
301
|
+
fieldLabel: 'disabledReference',
|
|
302
|
+
bind: '{disabledReference}',
|
|
303
|
+
description: `Здесь при необходимости указывается reference, который при выполнении команды блокируется.
|
|
304
|
+
Частый вариант использования - блокировка повторного нажатия кнопки, которая вызывает выполнение команды. `,
|
|
305
|
+
triggers: {
|
|
306
|
+
help: {
|
|
307
|
+
cls: 'x-fa fa-question helpicon',
|
|
308
|
+
handler: this.showDescription,
|
|
309
|
+
},
|
|
310
|
+
},
|
|
311
|
+
}
|
|
312
|
+
],
|
|
313
|
+
},
|
|
314
|
+
{
|
|
315
|
+
title: 'Отражение результатов',
|
|
316
|
+
scrollable: true,
|
|
317
|
+
tooltip: 'Отражение результатов команды во viewModel',
|
|
318
|
+
layout: {
|
|
319
|
+
type: 'vbox',
|
|
320
|
+
align: 'stretch',
|
|
321
|
+
},
|
|
322
|
+
items: [
|
|
323
|
+
{
|
|
324
|
+
xtype: 'radiogroup',
|
|
325
|
+
fieldLabel: 'Количество строк из результата выполнения отчета, которые надо положить во ViewModel',
|
|
326
|
+
reference: 'resultMode',
|
|
327
|
+
columns: 2,
|
|
328
|
+
simpleValue: true,
|
|
329
|
+
bind: '{resultMode}',
|
|
330
|
+
items: [
|
|
331
|
+
{boxLabel: 'Одна строка', name: 'resultMode', inputValue: 'one'},
|
|
332
|
+
{boxLabel: 'Все строки', name: 'resultMode', inputValue: 'array', checked: true}
|
|
333
|
+
],
|
|
334
|
+
},
|
|
335
|
+
{
|
|
336
|
+
xtype: 'textfield',
|
|
337
|
+
fieldLabel: 'completeHandler',
|
|
338
|
+
bind: '{completeHandler}',
|
|
339
|
+
},
|
|
340
|
+
{
|
|
341
|
+
xtype: 'textfield',
|
|
342
|
+
fieldLabel: 'errorHandler',
|
|
343
|
+
bind: '{errorHandler}',
|
|
344
|
+
},
|
|
345
|
+
{
|
|
346
|
+
xtype: 'textfield',
|
|
347
|
+
fieldLabel: 'propertyPath',
|
|
348
|
+
bind: {
|
|
349
|
+
value: '{propertyPath}',
|
|
350
|
+
},
|
|
351
|
+
}
|
|
352
|
+
],
|
|
353
|
+
}
|
|
354
|
+
],
|
|
355
|
+
}
|
|
356
|
+
];
|
|
357
|
+
this.callParent();
|
|
358
|
+
},
|
|
359
|
+
|
|
360
|
+
showDescription: function(cmp) {
|
|
361
|
+
Ext.Msg.alert('Описание свойства', cmp.description);
|
|
362
|
+
},
|
|
363
|
+
|
|
364
|
+
/**
|
|
365
|
+
* Считывание параметров репорта. Запускается при открытии редактора или смене репорта
|
|
366
|
+
*/
|
|
367
|
+
loadReportParameters: function() {
|
|
368
|
+
const reportId = this.lookup('reportCd').getValue();
|
|
369
|
+
|
|
370
|
+
if (reportId) {
|
|
371
|
+
const command = Ext.create('command.GetReportCommand');
|
|
372
|
+
|
|
373
|
+
command.on('complete', function(bean) {
|
|
374
|
+
const reportParameters = bean['parameters'];
|
|
375
|
+
if (reportParameters) {
|
|
376
|
+
this.reportParameters = this.parseReportParameters(reportParameters);
|
|
377
|
+
}
|
|
378
|
+
}, this);
|
|
379
|
+
|
|
380
|
+
command.execute(reportId);
|
|
381
|
+
}
|
|
382
|
+
},
|
|
383
|
+
|
|
384
|
+
/**
|
|
385
|
+
* Вывод параметров текущего репорта в редактор
|
|
386
|
+
*/
|
|
387
|
+
setReportParametersToEditor: function() {
|
|
388
|
+
const vm = this.getViewModel();
|
|
389
|
+
const currentParameters = this.lookup('parametersRef').getValue() ? JSON5.parse(this.lookup('parametersRef').getValue()) : {};
|
|
390
|
+
this.reportParameters.forEach((param) => {
|
|
391
|
+
if (!currentParameters.hasOwnProperty(param['name'])) {
|
|
392
|
+
currentParameters[param['name']] = '';
|
|
393
|
+
}
|
|
394
|
+
});
|
|
395
|
+
const stringParam = JSON5.stringify(currentParameters, {
|
|
396
|
+
space: 4,
|
|
397
|
+
quote: '\'',
|
|
398
|
+
});
|
|
399
|
+
|
|
400
|
+
vm.set('parameters.parameterList', stringParam);
|
|
401
|
+
this.checkParameters(currentParameters);
|
|
402
|
+
},
|
|
403
|
+
|
|
404
|
+
/**
|
|
405
|
+
* Преобразование параметров репорта из структуры, которую вернула команда, в массив объектов
|
|
406
|
+
* @param [{Object}] reportParameters
|
|
407
|
+
*/
|
|
408
|
+
parseReportParameters: function(reportParameters) {
|
|
409
|
+
const params = [];
|
|
410
|
+
reportParameters.forEach((param) => {
|
|
411
|
+
params.push({name: param['reportParameterCd'], required: param['requiredSwitch']});
|
|
412
|
+
});
|
|
413
|
+
return params;
|
|
414
|
+
},
|
|
415
|
+
|
|
416
|
+
/**
|
|
417
|
+
* Проверка текущих параметров. Не должно быть параметров, которые не определены у репорта
|
|
418
|
+
* @param {Object} currentParameters
|
|
419
|
+
*/
|
|
420
|
+
checkParameters: function(currentParameters) {
|
|
421
|
+
const reportId = this.lookup('reportCd').getValue();
|
|
422
|
+
const wrongParameters = Object.keys(currentParameters)
|
|
423
|
+
.filter((name) => !this.reportParameters.find((parameter) => parameter['name'] === name));
|
|
424
|
+
let goodParametersStr = this.reportParameters
|
|
425
|
+
.reduce((acc, cur) => {
|
|
426
|
+
const required = cur.required ? 'обязательный' : 'не обязательный';
|
|
427
|
+
acc.push(`<li> ${cur.name} - ${required} </li>`);
|
|
428
|
+
return acc;
|
|
429
|
+
}, [])
|
|
430
|
+
.join('<br>');
|
|
431
|
+
|
|
432
|
+
if (wrongParameters.length) {
|
|
433
|
+
const paramsString = `<span class="wrong-parameters"> ${wrongParameters.join(', ')} </span>`;
|
|
434
|
+
goodParametersStr = `<ul class="wrong-parameters"> ${goodParametersStr} </ul>`;
|
|
435
|
+
Ext.Msg.show({
|
|
436
|
+
title: 'Внимание!',
|
|
437
|
+
message: `Следующие параметры: <br> ${paramsString} <br> не являются параметрами репорта ${reportId}.
|
|
438
|
+
<p>Список параметров репорта: ${goodParametersStr}</p>
|
|
439
|
+
`,
|
|
440
|
+
buttons: Ext.Msg.YES,
|
|
441
|
+
cls: 'ExecuteReportPluginConfigPanelFormEditor',
|
|
442
|
+
});
|
|
443
|
+
}
|
|
444
|
+
},
|
|
445
|
+
});
|
package/src/uielement/plugin/configPanel/executeReport/ExecuteReportPluginConfigPanelFormEditor.scss
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
.ExecuteReportPluginConfigPanelFormEditor {
|
|
2
|
+
$required-flag-color: dynamic(#bf1313);
|
|
3
|
+
font-size: 12px;
|
|
4
|
+
margin: 5px;
|
|
5
|
+
.required-flag {
|
|
6
|
+
font-size: 18px;
|
|
7
|
+
color: $required-flag-color;
|
|
8
|
+
}
|
|
9
|
+
span.code {
|
|
10
|
+
color: green;
|
|
11
|
+
font-family: "Lucida Console", "Courier New", monospace;
|
|
12
|
+
}
|
|
13
|
+
.x-form-trigger-default.helpicon {
|
|
14
|
+
background-color: white;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.wrong-parameters {
|
|
18
|
+
color: green;
|
|
19
|
+
font-style: italic;
|
|
20
|
+
font-family: "Lucida Console", "Courier New", monospace;
|
|
21
|
+
}
|
|
22
|
+
}
|
package/src/version.js
CHANGED