@nixweb/nixloc-ui 0.0.124 → 0.0.127
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/docs/src/component/template/ViewTemplateReportPreview.drawio +210 -0
- package/package.json +3 -1
- package/src/component/forms/Button.vue +7 -6
- package/src/component/forms/CheckboxGroup.vue +7 -4
- package/src/component/forms/CheckboxSimple.vue +17 -2
- package/src/component/forms/DateTime.vue +15 -29
- package/src/component/forms/EditorHtml.vue +8 -5
- package/src/component/forms/FileUpload.vue +7 -11
- package/src/component/forms/ImageUpload.vue +222 -0
- package/src/component/forms/InputDecimal.vue +10 -9
- package/src/component/forms/InputNumber.vue +20 -15
- package/src/component/forms/InputPassword.vue +1 -1
- package/src/component/forms/InputText.vue +3 -3
- package/src/component/forms/Modal.vue +9 -4
- package/src/component/forms/Select.vue +12 -9
- package/src/component/forms/SelectStatic.vue +8 -1
- package/src/component/layout/Menu.vue +4 -3
- package/src/component/layout/Panel.vue +0 -2
- package/src/component/layout/{Scrollbar.vue → ScrollBar.vue} +4 -5
- package/src/component/layout/Tag.vue +3 -3
- package/src/component/layout/Wizard.vue +11 -13
- package/src/component/shared/BodyReport.vue +186 -0
- package/src/component/shared/Confirmation.vue +2 -2
- package/src/component/shared/DocumentEditor.vue +1 -1
- package/src/component/shared/ExportExcel.vue +1 -8
- package/src/component/shared/{HeaderPrint.vue → HeaderReport.vue} +3 -3
- package/src/component/shared/HorizontalFilter.vue +1 -1
- package/src/component/shared/Loading.vue +1 -1
- package/src/component/shared/Messages.vue +2 -4
- package/src/component/shared/Pagination.vue +4 -5
- package/src/component/shared/{LegendaParametro.vue → ParameterLegend.vue} +25 -29
- package/src/component/shared/ProgressBar.vue +2 -1
- package/src/component/shared/SaveCancel.vue +20 -4
- package/src/component/shared/Search.vue +16 -16
- package/src/component/shared/SelectOption.vue +137 -0
- package/src/component/shared/Table.vue +33 -22
- package/src/component/shared/TableButton.vue +3 -3
- package/src/component/shared/TableTotalRecords.vue +9 -10
- package/src/component/shared/Toast.vue +2 -2
- package/src/component/shared/VerticalFilter.vue +2 -50
- package/src/component/shared/query-builder/AddRule.vue +49 -55
- package/src/component/shared/query-builder/ConvertToOdata.js +39 -42
- package/src/component/shared/query-builder/DynamicComponent.vue +16 -15
- package/src/component/shared/query-builder/DynamicComponentList.vue +62 -0
- package/src/component/shared/query-builder/Fields.vue +32 -66
- package/src/component/shared/query-builder/QueryBuilder.vue +12 -12
- package/src/component/shared/query-builder/Rules.vue +2 -14
- package/src/component/shared/query-builder/SelectRule.vue +15 -15
- package/src/component/shared/query-builder/Tags.vue +24 -8
- package/src/component/template/{ListViewWithHandlerData.vue → ListViewWithDataHandler.vue} +30 -23
- package/src/component/template/{AddEditReport.vue → ReportCreateUpdate.vue} +31 -20
- package/src/component/template/ViewTemplateConfiguration.vue +6 -12
- package/src/component/template/ViewTemplateDocumentView.vue +21 -25
- package/src/component/template/ViewTemplateReportList.vue +39 -57
- package/src/component/template/ViewTemplateReportPreview.vue +238 -354
- package/src/component/template/ViewTemplateReportPreviewCOPIASEGURANCA.vue +497 -0
- package/src/component/template/ViewTemplateSelectOption.vue +60 -0
- package/src/component/template/ViewTemplateWithTable.vue +21 -14
- package/src/component/template/model/Report.js +2 -2
- package/src/component/value-objects/Address.js +11 -0
- package/src/component/value-objects/{Endereco.vue → Address.vue} +39 -40
- package/src/component/value-objects/{DadosContato.js → Contact.js} +2 -2
- package/src/component/value-objects/{DadosContato.vue → Contact.vue} +17 -17
- package/src/component/value-objects/Person.js +10 -0
- package/src/component/value-objects/{DadosPessoa.vue → Person.vue} +35 -35
- package/src/store/modules/generic.js +17 -11
- package/src/store/modules/report.js +124 -113
- package/src/store/modules/user.js +3 -0
- package/docs/src/component/template/ModeloRelatorioView.drawio +0 -160
- package/src/component/shared/query-builder/ListDynamicComponent.vue +0 -42
- package/src/component/value-objects/DadosPessoa.js +0 -10
- package/src/component/value-objects/Endereco.js +0 -11
|
@@ -3,92 +3,81 @@ import ConvertToOdata from "@nixweb/nixloc-ui/src/component/shared/query-builder
|
|
|
3
3
|
export default {
|
|
4
4
|
namespaced: true,
|
|
5
5
|
state: {
|
|
6
|
-
report: {
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
report: { id: "", fields: [], rules: [], },
|
|
7
|
+
selectedFields: {},
|
|
8
|
+
selectedRules: [],
|
|
9
|
+
finalQueryFormatOData: {
|
|
10
|
+
fields: [], totalization: [],
|
|
9
11
|
},
|
|
10
|
-
query_builder: { rules: [] },
|
|
11
|
-
optionTable: {
|
|
12
|
-
initialValue: [],
|
|
13
|
-
options: []
|
|
14
|
-
},
|
|
15
|
-
optionsInitValue: [],
|
|
16
|
-
queryOData: {
|
|
17
|
-
fields: [],
|
|
18
|
-
totalization: [],
|
|
19
|
-
},
|
|
20
|
-
selectedField: [],
|
|
21
|
-
campoOrdenado: {},
|
|
22
|
-
query: [],
|
|
23
|
-
totalization: [],
|
|
24
12
|
tags: []
|
|
25
13
|
},
|
|
26
14
|
getters: {
|
|
27
15
|
headerTable: (state) => {
|
|
28
16
|
let list = [];
|
|
29
17
|
state.report.fields.forEach(function (field) {
|
|
30
|
-
if (field.
|
|
18
|
+
if (field.selected) list.push(field);
|
|
31
19
|
});
|
|
32
20
|
return list;
|
|
33
21
|
},
|
|
34
|
-
|
|
35
|
-
//
|
|
36
|
-
|
|
37
|
-
initialValue: [],
|
|
38
|
-
options: []
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
var hasInitValue = state.optionsInitValue.length;
|
|
22
|
+
fields: (state) => {
|
|
23
|
+
// esse getter serve somente para carregar informações no component Fields
|
|
24
|
+
var fields = { selected: [], options: [], sort: { content: "", id: "asc" }, orderBy: "" };
|
|
42
25
|
|
|
43
|
-
state.report.fields.forEach(function (
|
|
44
|
-
let option = { text:
|
|
45
|
-
|
|
26
|
+
state.report.fields.forEach(function (value) {
|
|
27
|
+
let option = { text: value.title, value: value.field };
|
|
28
|
+
fields.options.push(option);
|
|
46
29
|
|
|
47
|
-
|
|
48
|
-
|
|
30
|
+
// se o relatório for o padrão, carrega as info default
|
|
31
|
+
if (state.report.id == undefined) {
|
|
32
|
+
if (value.selected)
|
|
33
|
+
fields.selected.push(value.field);
|
|
49
34
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
35
|
+
if (value.orderBy) {
|
|
36
|
+
fields.sort = { content: value.title, id: value.field };
|
|
37
|
+
fields.orderBy = value.orderBy;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
fields.selected = state.selectedFields.selected;
|
|
42
|
+
fields.sort = state.selectedFields.sort;
|
|
43
|
+
fields.orderBy = state.selectedFields.orderBy;
|
|
44
|
+
}
|
|
53
45
|
|
|
54
|
-
return state.optionTable;
|
|
55
|
-
},
|
|
56
|
-
requiredRules: (state) => {
|
|
57
|
-
var filter = state.report.rules.filter(item => item.isRequired == true);
|
|
58
|
-
return filter;
|
|
59
|
-
},
|
|
60
|
-
regraObrigatoriaJaAdicionada: (state) => (rule) => {
|
|
61
|
-
return false;
|
|
62
|
-
},
|
|
63
|
-
selectedRules: (state) => {
|
|
64
|
-
let rules = [];
|
|
65
|
-
state.report.rules.forEach(function (rule) {
|
|
66
|
-
if (rule.value != null && rule.value != "" && rule.value != undefined)
|
|
67
|
-
rules.push(rule);
|
|
68
46
|
});
|
|
69
|
-
return
|
|
70
|
-
},
|
|
71
|
-
hasSelectedField: (state) => (field, value) => {
|
|
72
|
-
var hasField = value.find((item) => {
|
|
73
|
-
if (field == value) return true;
|
|
74
|
-
});
|
|
75
|
-
return hasField;
|
|
47
|
+
return fields;
|
|
76
48
|
},
|
|
77
49
|
oDataOrderBy: (state) => {
|
|
78
|
-
let orderBy =
|
|
79
|
-
|
|
50
|
+
let orderBy = "";
|
|
51
|
+
if (state.selectedFields.sort != undefined)
|
|
52
|
+
orderBy = `$orderby=${state.selectedFields.sort.id} ${state.selectedFields.orderBy}`;
|
|
53
|
+
return orderBy;
|
|
80
54
|
},
|
|
81
55
|
oDataSelect: (state) => {
|
|
56
|
+
let selectedFields = [];
|
|
57
|
+
|
|
58
|
+
// verifica os campos obrigatórios por default "requiredOData"
|
|
59
|
+
state.report.fields.forEach(value => {
|
|
60
|
+
if (value.requiredOData)
|
|
61
|
+
selectedFields.push(value.field);
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
// verifica os campos selecionados pelo usuário
|
|
65
|
+
if (state.selectedFields.selected != undefined) {
|
|
66
|
+
state.selectedFields.selected.forEach(function (field) {
|
|
67
|
+
selectedFields.push(field);
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
|
|
82
71
|
let query = "";
|
|
83
72
|
let indexQuery = 0;
|
|
84
73
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
}
|
|
74
|
+
// remove itens duplicados e monta a query select
|
|
75
|
+
[...new Set(selectedFields)].forEach(field => {
|
|
76
|
+
if (indexQuery == 0) query += `$select=${field}`;
|
|
77
|
+
if (indexQuery > 0) query += `,${field}`;
|
|
78
|
+
indexQuery++;
|
|
91
79
|
});
|
|
80
|
+
|
|
92
81
|
return query;
|
|
93
82
|
},
|
|
94
83
|
oDataFilter: (state) => {
|
|
@@ -96,10 +85,10 @@ export default {
|
|
|
96
85
|
let totalization = "";
|
|
97
86
|
let indexQuery = 0;
|
|
98
87
|
let indexTotalization = 0;
|
|
99
|
-
var size = state.
|
|
88
|
+
var size = state.finalQueryFormatOData.fields.length;
|
|
100
89
|
var andOr = [];
|
|
101
90
|
|
|
102
|
-
state.
|
|
91
|
+
state.finalQueryFormatOData.fields.forEach(function (rule) {
|
|
103
92
|
if (rule.type == "field") {
|
|
104
93
|
if (indexQuery == 0 && size > 0) query += `$filter=${rule.formatOdata}`;
|
|
105
94
|
|
|
@@ -109,8 +98,8 @@ export default {
|
|
|
109
98
|
}
|
|
110
99
|
indexQuery++;
|
|
111
100
|
|
|
112
|
-
|
|
113
|
-
|
|
101
|
+
// verifica no array se o último item é o "and", se sim será necessário inserir "(" depois do filter = e ")" antes do "and"
|
|
102
|
+
// para que o oData consiga efetuar a query corretamente
|
|
114
103
|
if (andOr[andOr.length - 1] == "and") {
|
|
115
104
|
|
|
116
105
|
let initIndex = query.indexOf("=");
|
|
@@ -130,24 +119,25 @@ export default {
|
|
|
130
119
|
return { query, totalization };
|
|
131
120
|
},
|
|
132
121
|
tags: (state) => {
|
|
133
|
-
|
|
134
122
|
state.tags = [];
|
|
135
123
|
let description = "";
|
|
136
124
|
|
|
137
|
-
state.
|
|
138
|
-
|
|
125
|
+
state.finalQueryFormatOData.fields.forEach(function (rule) {
|
|
126
|
+
description = "";
|
|
127
|
+
|
|
128
|
+
if (rule.typeField == "dateTime") {
|
|
139
129
|
description = `${rule.value[0]} - ${rule.value[1]}`;
|
|
140
130
|
}
|
|
141
131
|
|
|
142
|
-
if (rule.
|
|
132
|
+
if (rule.typeField == "select") {
|
|
143
133
|
description = rule.value.content;
|
|
144
134
|
}
|
|
145
135
|
|
|
146
|
-
if (rule.
|
|
136
|
+
if (rule.typeField == "text" || rule.typeField == "numeric") {
|
|
147
137
|
description = `${rule.operator} "${rule.value}"`;
|
|
148
138
|
}
|
|
149
139
|
|
|
150
|
-
if (rule.
|
|
140
|
+
if (rule.typeField == "checkbox") {
|
|
151
141
|
rule.options.forEach(function (option) {
|
|
152
142
|
rule.value.forEach(function (value) {
|
|
153
143
|
if (option.value == value) {
|
|
@@ -159,52 +149,57 @@ export default {
|
|
|
159
149
|
|
|
160
150
|
let tag = { id: rule.id, title: rule.title, value: description };
|
|
161
151
|
state.tags.push(tag);
|
|
152
|
+
|
|
162
153
|
});
|
|
163
154
|
return state.tags;
|
|
164
|
-
|
|
155
|
+
|
|
156
|
+
},
|
|
157
|
+
rulesIsValid: (state) => {
|
|
158
|
+
let isValid = false;
|
|
159
|
+
let rulesRequired = state.report.rules.filter(x => x.isRequired);
|
|
160
|
+
let rulesRequiredSelected = state.selectedRules.filter(x => x.isRequired);
|
|
161
|
+
|
|
162
|
+
if (rulesRequired.length == rulesRequiredSelected.length)
|
|
163
|
+
isValid = true;
|
|
164
|
+
|
|
165
|
+
return isValid;
|
|
166
|
+
},
|
|
167
|
+
rulesRequired: (state) => {
|
|
168
|
+
return state.report.rules.filter(x => x.isRequired);
|
|
169
|
+
},
|
|
165
170
|
},
|
|
166
171
|
mutations: {
|
|
167
|
-
|
|
168
|
-
state.
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
state.report.
|
|
172
|
+
updateSelectedFields: (state, selectedFields) => {
|
|
173
|
+
state.selectedFields = selectedFields;
|
|
174
|
+
// após selecionar o campo, atualiza tambem quais campos deverão aparecer no report
|
|
175
|
+
// se foi selecionado é marcado como selected = true
|
|
176
|
+
state.report.fields.forEach(function (value) {
|
|
177
|
+
var hasSelected = selectedFields.selected.find((selected) => {
|
|
178
|
+
if (value.field == selected) return true;
|
|
179
|
+
});
|
|
180
|
+
if (value.field === hasSelected) {
|
|
181
|
+
value.selected = true;
|
|
182
|
+
} else {
|
|
183
|
+
value.selected = false;
|
|
184
|
+
}
|
|
185
|
+
});
|
|
172
186
|
},
|
|
173
187
|
addSelectedRules: (state, selectedRule) => {
|
|
174
|
-
state.
|
|
188
|
+
state.selectedRules.push(selectedRule);
|
|
175
189
|
},
|
|
176
190
|
removeSelectedRule: (state, id) => {
|
|
177
|
-
var filter = state.
|
|
191
|
+
var filter = state.selectedRules.filter((item) => {
|
|
178
192
|
return id != item.id;
|
|
179
193
|
})
|
|
180
|
-
state.
|
|
181
|
-
},
|
|
182
|
-
updateSelectedField: (state, value) => {
|
|
183
|
-
state.selectedField = value;
|
|
194
|
+
state.selectedRules = filter;
|
|
184
195
|
},
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
atualizaFiltroSelecionado: (state, value) => {
|
|
189
|
-
state.filtroSelecionado = value;
|
|
190
|
-
},
|
|
191
|
-
atualizaCampoOrdenado: (state, value) => {
|
|
192
|
-
state.campoOrdenado = value;
|
|
193
|
-
},
|
|
194
|
-
removeFiltroSelecionado: (state, id) => {
|
|
195
|
-
var filter = state.filtroSelecionado.children.filter((x) => {
|
|
196
|
-
return x.query.id != id;
|
|
197
|
-
});
|
|
198
|
-
state.filtroSelecionado.children = filter;
|
|
199
|
-
},
|
|
200
|
-
convertRulesToOdata: (state, rules) => {
|
|
201
|
-
state.queryOData = {
|
|
202
|
-
fields: [],
|
|
203
|
-
totalization: [],
|
|
204
|
-
};
|
|
196
|
+
mountFinalQueryFormatOData: (state, selectedRules) => {
|
|
197
|
+
// aqui faz a conversão das regras selecionadas no padrão do query-builder para o formato oData carregando no objeto finalQueryFormatOData
|
|
198
|
+
// para ser consumido nos getters oDataSelect e oDataFilter
|
|
205
199
|
|
|
206
|
-
|
|
200
|
+
state.finalQueryFormatOData = { fields: [], totalization: [] };
|
|
207
201
|
|
|
202
|
+
selectedRules.forEach(function (rule) {
|
|
208
203
|
/* if (key.query.choices && key.query.type == "totalization") {
|
|
209
204
|
key.query.choices.forEach(function (value) {
|
|
210
205
|
let obj = {
|
|
@@ -220,27 +215,43 @@ export default {
|
|
|
220
215
|
|
|
221
216
|
if (rule.value != null && rule.value != "" && rule.value != undefined) {
|
|
222
217
|
|
|
223
|
-
let convertToOdata = new
|
|
224
|
-
let formatOdata = convertToOdata.
|
|
218
|
+
let convertToOdata = new ConvertToOdata();
|
|
219
|
+
let formatOdata = convertToOdata.convertRule(rule);
|
|
225
220
|
|
|
226
221
|
let ruleOdata = {
|
|
227
222
|
id: rule.id,
|
|
228
223
|
title: rule.title,
|
|
229
224
|
type: rule.type,
|
|
230
|
-
|
|
225
|
+
typeField: rule.typeField,
|
|
231
226
|
options: rule.options,
|
|
232
227
|
operator: rule.operator,
|
|
233
|
-
|
|
228
|
+
selected: rule.selected,
|
|
234
229
|
isRequired: rule.isRequired,
|
|
235
230
|
formatOdata: formatOdata,
|
|
236
231
|
andOr: rule.andOr,
|
|
237
232
|
value: rule.value,
|
|
238
233
|
};
|
|
239
234
|
|
|
240
|
-
state.
|
|
235
|
+
state.finalQueryFormatOData.fields.push(ruleOdata);
|
|
241
236
|
}
|
|
242
237
|
});
|
|
243
|
-
}
|
|
244
|
-
|
|
238
|
+
},
|
|
245
239
|
},
|
|
240
|
+
actions: {
|
|
241
|
+
addReport: async function (context, report) {
|
|
242
|
+
context.state.report = report;
|
|
243
|
+
context.state.selectedFields = context.getters.fields;
|
|
244
|
+
},
|
|
245
|
+
addInitialReportCustom: async function (context, report) {
|
|
246
|
+
context.state.selectedFields = report.selectedFields;
|
|
247
|
+
context.state.selectedRules = report.selectedRules;
|
|
248
|
+
context.commit('mountFinalQueryFormatOData', report.selectedRules);
|
|
249
|
+
context.commit('updateSelectedFields', report.selectedFields);
|
|
250
|
+
},
|
|
251
|
+
removeInitialReportCustom: async function (context) {
|
|
252
|
+
context.state.selectedFields = {};
|
|
253
|
+
context.state.selectedRules = [];
|
|
254
|
+
context.state.finalQueryFormatOData.fields = [];
|
|
255
|
+
}
|
|
256
|
+
}
|
|
246
257
|
}
|