@nixweb/nixloc-ui 0.0.121 → 0.0.124
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/ModeloRelatorioView.drawio +2 -2
- package/docs/src/store/modulos/relatorio.drawio +2 -2
- package/package.json +77 -77
- package/public/styles/app.css +1 -1
- package/src/component/forms/{Botao.vue → Button.vue} +53 -57
- package/src/component/forms/CheckboxGroup.vue +63 -0
- package/src/component/forms/{CheckboxUnico.vue → CheckboxSimple.vue} +8 -8
- package/src/component/forms/{Cor.vue → Color.vue} +9 -9
- package/src/component/forms/DateTime.vue +55 -55
- package/src/component/forms/{BotaoDropdown.vue → Dropdown.vue} +58 -58
- package/src/component/forms/EditorHtml.vue +123 -0
- package/src/component/forms/FileUpload.vue +189 -0
- package/src/component/forms/InputDecimal.vue +137 -0
- package/src/component/forms/InputNumber.vue +149 -0
- package/src/component/forms/InputPassword.vue +135 -0
- package/src/component/forms/InputText.vue +157 -0
- package/src/component/forms/Modal.vue +15 -15
- package/src/component/forms/RadioGroup.vue +50 -0
- package/src/component/forms/Select.vue +337 -0
- package/src/component/forms/SelectStatic.vue +120 -0
- package/src/component/forms/TextArea.vue +126 -0
- package/src/component/forms/Toggle.vue +13 -13
- package/src/component/layout/{Conta.vue → Account.vue} +28 -28
- package/src/component/layout/{Alerta.vue → Alert.vue} +22 -22
- package/src/component/layout/Badge.vue +23 -23
- package/src/component/layout/{BarraFixa.vue → FixedBar.vue} +16 -16
- package/src/component/layout/{Topo.vue → Header.vue} +5 -5
- package/src/component/layout/{CarregandoTelaInteira.vue → LoadingFullPage.vue} +3 -3
- package/src/component/layout/Menu.vue +66 -66
- package/src/component/layout/{Moldura.vue → Molded.vue} +4 -4
- package/src/component/layout/Panel.vue +142 -0
- package/src/component/layout/Popover.vue +1 -1
- package/src/component/layout/{BarraRolagem.vue → Scrollbar.vue} +9 -11
- package/src/component/layout/Tag.vue +15 -15
- package/src/component/layout/Wizard.vue +3 -3
- package/src/component/shared/{CodigoEditor.vue → CodeEditor.vue} +25 -25
- package/src/component/shared/Collapse.vue +131 -0
- package/src/component/shared/Confirmation.vue +80 -0
- package/src/component/shared/{DocumentoEditor.vue → DocumentEditor.vue} +10 -16
- package/src/component/shared/{DocumentoPreview.vue → DocumentPreview.vue} +2 -2
- package/src/component/shared/ExportExcel.vue +67 -0
- package/src/component/shared/{ExportarPDF.vue → ExportPDF.vue} +18 -18
- package/src/component/shared/HeaderPrint.vue +36 -0
- package/src/component/shared/HorizontalFilter.vue +59 -0
- package/src/component/shared/LegendaParametro.vue +22 -22
- package/src/component/shared/{Carregando.vue → Loading.vue} +16 -16
- package/src/component/shared/LoadingMoreButton.vue +23 -0
- package/src/component/shared/Messages.vue +83 -0
- package/src/component/shared/{Paginacao.vue → Pagination.vue} +12 -12
- package/src/component/shared/ProgressBar.vue +21 -0
- package/src/component/shared/{BotaoConsulta.vue → QueryButton.vue} +16 -16
- package/src/component/shared/SaveCancel.vue +56 -0
- package/src/component/shared/{Pesquisa.vue → Search.vue} +46 -46
- package/src/component/shared/Table.vue +243 -0
- package/src/component/shared/TableButton.vue +36 -0
- package/src/component/shared/{Registro.vue → TableTotalRecords.vue} +7 -7
- package/src/component/shared/{ResumoTabela.vue → TableTotalization.vue} +12 -8
- package/src/component/shared/Tip.vue +42 -0
- package/src/component/shared/Toast.vue +7 -7
- package/src/component/shared/{FiltroVertical.vue → VerticalFilter.vue} +24 -24
- package/src/component/shared/query-builder/AddRule.vue +187 -0
- package/src/component/shared/query-builder/ConvertToOdata.js +80 -0
- package/src/component/shared/query-builder/DynamicComponent.vue +107 -0
- package/src/component/shared/query-builder/Fields.vue +127 -0
- package/src/component/shared/query-builder/ListDynamicComponent.vue +42 -0
- package/src/component/shared/query-builder/QueryBuilder.vue +25 -120
- package/src/component/shared/query-builder/{Filtro.vue → Rules.vue} +13 -18
- package/src/component/shared/query-builder/SelectRule.vue +96 -0
- package/src/component/shared/query-builder/Tags.vue +14 -14
- package/src/component/shared/query-builder/{Rodape.vue → Totalization.vue} +10 -10
- package/src/component/template/AddEditReport.vue +106 -0
- package/src/component/template/ListViewWithHandlerData.vue +231 -0
- package/src/component/template/ViewTemplateConfiguration.vue +69 -0
- package/src/component/template/ViewTemplateDocumentView.vue +227 -0
- package/src/component/template/ViewTemplateReportList.vue +230 -0
- package/src/component/template/ViewTemplateReportPreview.vue +500 -0
- package/src/component/template/ViewTemplateWithSalveCancel.vue +32 -0
- package/src/component/template/ViewTemplateWithTable.vue +49 -0
- package/src/component/template/model/Report.js +6 -0
- package/src/component/value-objects/DadosContato.vue +34 -35
- package/src/component/value-objects/DadosPessoa.vue +58 -58
- package/src/component/value-objects/Endereco.vue +96 -97
- package/src/config/dicas.js +1 -1
- package/src/config/token.js +2 -2
- package/src/store/modules/generic.js +489 -0
- package/src/store/modules/report.js +246 -0
- package/src/store/modules/user.js +38 -0
- package/src/store/modules/validation.js +39 -0
- package/src/store/store.js +4 -4
- package/src/component/forms/ArquivoUpload.vue +0 -199
- package/src/component/forms/CheckboxMultiplo.vue +0 -63
- package/src/component/forms/Decimal.vue +0 -137
- package/src/component/forms/Escolher.vue +0 -335
- package/src/component/forms/EscolherEstatico.vue +0 -139
- package/src/component/forms/Numero.vue +0 -153
- package/src/component/forms/Opcoes.vue +0 -51
- package/src/component/forms/Senha.vue +0 -139
- package/src/component/forms/Texto.vue +0 -161
- package/src/component/forms/TextoArea.vue +0 -126
- package/src/component/forms/TextoEditor.vue +0 -123
- package/src/component/layout/Painel.vue +0 -142
- package/src/component/shared/BotaoCarregarMais.vue +0 -23
- package/src/component/shared/CabecalhoImpressao.vue +0 -36
- package/src/component/shared/Confirmacao.vue +0 -80
- package/src/component/shared/Dica.vue +0 -42
- package/src/component/shared/EsconderMostrar.vue +0 -131
- package/src/component/shared/ExportarExcel.vue +0 -67
- package/src/component/shared/FiltroHorizontal.vue +0 -59
- package/src/component/shared/Mensagem.vue +0 -86
- package/src/component/shared/Progresso.vue +0 -21
- package/src/component/shared/SalvarCancelar.vue +0 -56
- package/src/component/shared/Tabela.vue +0 -275
- package/src/component/shared/TabelaBotao.vue +0 -36
- package/src/component/shared/query-builder/Campo.vue +0 -116
- package/src/component/shared/query-builder/ConverteParaOdata.js +0 -77
- package/src/component/shared/query-builder/components/CustomSelect.vue +0 -115
- package/src/component/shared/query-builder/components/QueryBuilderChildren.vue +0 -46
- package/src/component/shared/query-builder/components/QueryBuilderGroup.vue +0 -151
- package/src/component/shared/query-builder/components/QueryBuilderRule.vue +0 -81
- package/src/component/shared/query-builder/layouts/Bootstrap/BootstrapGroup.vue +0 -120
- package/src/component/shared/query-builder/layouts/Bootstrap/BootstrapRule.vue +0 -187
- package/src/component/shared/query-builder/main.js +0 -81
- package/src/component/template/ModeloAdicionarModificarView.vue +0 -32
- package/src/component/template/ModeloDocumentoView.vue +0 -227
- package/src/component/template/ModeloLista.vue +0 -231
- package/src/component/template/ModeloRelatorioListaView.vue +0 -227
- package/src/component/template/ModeloRelatorioView.vue +0 -489
- package/src/component/template/ModeloSubView.vue +0 -69
- package/src/component/template/ModeloView.vue +0 -49
- package/src/component/template/Relatorio.js +0 -10
- package/src/component/template/RelatorioAdicionarModificar.vue +0 -106
- package/src/store/modulos/generic.js +0 -494
- package/src/store/modulos/relatorio.js +0 -204
- package/src/store/modulos/usuario.js +0 -38
- package/src/store/modulos/validation.js +0 -39
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
import ConvertToOdata from "@nixweb/nixloc-ui/src/component/shared/query-builder/ConvertToOdata.js";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
namespaced: true,
|
|
5
|
+
state: {
|
|
6
|
+
report: {
|
|
7
|
+
fields: [],
|
|
8
|
+
rules: [],
|
|
9
|
+
},
|
|
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
|
+
tags: []
|
|
25
|
+
},
|
|
26
|
+
getters: {
|
|
27
|
+
headerTable: (state) => {
|
|
28
|
+
let list = [];
|
|
29
|
+
state.report.fields.forEach(function (field) {
|
|
30
|
+
if (field.show) list.push(field);
|
|
31
|
+
});
|
|
32
|
+
return list;
|
|
33
|
+
},
|
|
34
|
+
optionTable: (state) => {
|
|
35
|
+
// optionsInitValue é quando vem da query salva pelo usuário
|
|
36
|
+
state.optionTable = {
|
|
37
|
+
initialValue: [],
|
|
38
|
+
options: []
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
var hasInitValue = state.optionsInitValue.length;
|
|
42
|
+
|
|
43
|
+
state.report.fields.forEach(function (field) {
|
|
44
|
+
let option = { text: field.title, value: field.value };
|
|
45
|
+
state.optionTable.options.push(option);
|
|
46
|
+
|
|
47
|
+
if (field.show && hasInitValue == 0)
|
|
48
|
+
state.optionTable.initialValue.push(option);
|
|
49
|
+
|
|
50
|
+
if (hasInitValue > 0)
|
|
51
|
+
state.optionTable.initialValue = state.optionsInitValue;
|
|
52
|
+
});
|
|
53
|
+
|
|
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
|
+
});
|
|
69
|
+
return rules;
|
|
70
|
+
},
|
|
71
|
+
hasSelectedField: (state) => (field, value) => {
|
|
72
|
+
var hasField = value.find((item) => {
|
|
73
|
+
if (field == value) return true;
|
|
74
|
+
});
|
|
75
|
+
return hasField;
|
|
76
|
+
},
|
|
77
|
+
oDataOrderBy: (state) => {
|
|
78
|
+
let orderBy = `$orderby=${state.campoOrdenado.id} ${state.campoOrdenado.ordenar}`;
|
|
79
|
+
return "";
|
|
80
|
+
},
|
|
81
|
+
oDataSelect: (state) => {
|
|
82
|
+
let query = "";
|
|
83
|
+
let indexQuery = 0;
|
|
84
|
+
|
|
85
|
+
state.queryOData.fields.forEach(function (rule) {
|
|
86
|
+
if (rule.show || rule.isRequired) {
|
|
87
|
+
if (indexQuery == 0) query += `$select=${rule.formatOdata}`;
|
|
88
|
+
if (indexQuery > 0) query += `,${rule.formatOdata}`;
|
|
89
|
+
indexQuery++;
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
return query;
|
|
93
|
+
},
|
|
94
|
+
oDataFilter: (state) => {
|
|
95
|
+
let query = "";
|
|
96
|
+
let totalization = "";
|
|
97
|
+
let indexQuery = 0;
|
|
98
|
+
let indexTotalization = 0;
|
|
99
|
+
var size = state.queryOData.fields.length;
|
|
100
|
+
var andOr = [];
|
|
101
|
+
|
|
102
|
+
state.queryOData.fields.forEach(function (rule) {
|
|
103
|
+
if (rule.type == "field") {
|
|
104
|
+
if (indexQuery == 0 && size > 0) query += `$filter=${rule.formatOdata}`;
|
|
105
|
+
|
|
106
|
+
if (indexQuery > 0 && size > 0) {
|
|
107
|
+
query += ` ${rule.andOr} ${rule.formatOdata}`;
|
|
108
|
+
andOr.push(rule.andOr);
|
|
109
|
+
}
|
|
110
|
+
indexQuery++;
|
|
111
|
+
|
|
112
|
+
/* Verifica no array se o último item é o "and", se sim será necessário inserir "(" depois do filter = e ")" antes do "and"
|
|
113
|
+
para que o oData consiga efetuar a query corretamente */
|
|
114
|
+
if (andOr[andOr.length - 1] == "and") {
|
|
115
|
+
|
|
116
|
+
let initIndex = query.indexOf("=");
|
|
117
|
+
let lastIndex = query.indexOf("and");
|
|
118
|
+
|
|
119
|
+
var query1 = [query.slice(0, initIndex + 1), "(", query.slice(initIndex)].join('').replace("=(=", "=(");
|
|
120
|
+
var query2 = [query1.slice(0, lastIndex + 1), ")", query1.slice(lastIndex)].join('');
|
|
121
|
+
query = query2;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
} else {
|
|
125
|
+
if (indexTotalization == 0 && size > 0) totalization += `${rule.formatOdata}`;
|
|
126
|
+
if (indexTotalization > 0 && size > 0) totalization += `,${rule.formatOdata}`;
|
|
127
|
+
indexTotalization++;
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
return { query, totalization };
|
|
131
|
+
},
|
|
132
|
+
tags: (state) => {
|
|
133
|
+
|
|
134
|
+
state.tags = [];
|
|
135
|
+
let description = "";
|
|
136
|
+
|
|
137
|
+
state.queryOData.fields.forEach(function (rule) {
|
|
138
|
+
if (rule.fieldType == "dateTime") {
|
|
139
|
+
description = `${rule.value[0]} - ${rule.value[1]}`;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
if (rule.fieldType == "select") {
|
|
143
|
+
description = rule.value.content;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
if (rule.fieldType == "text" || rule.fieldType == "numeric") {
|
|
147
|
+
description = `${rule.operator} "${rule.value}"`;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
if (rule.fieldType == "checkbox") {
|
|
151
|
+
rule.options.forEach(function (option) {
|
|
152
|
+
rule.value.forEach(function (value) {
|
|
153
|
+
if (option.value == value) {
|
|
154
|
+
description += `${option.title},`;
|
|
155
|
+
}
|
|
156
|
+
});
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
let tag = { id: rule.id, title: rule.title, value: description };
|
|
161
|
+
state.tags.push(tag);
|
|
162
|
+
});
|
|
163
|
+
return state.tags;
|
|
164
|
+
}
|
|
165
|
+
},
|
|
166
|
+
mutations: {
|
|
167
|
+
addFieldsReport: (state, fields) => {
|
|
168
|
+
state.report.fields = fields;
|
|
169
|
+
},
|
|
170
|
+
addRulesReport: (state, rules) => {
|
|
171
|
+
state.report.rules = rules;
|
|
172
|
+
},
|
|
173
|
+
addSelectedRules: (state, selectedRule) => {
|
|
174
|
+
state.query_builder.rules.push(selectedRule);
|
|
175
|
+
},
|
|
176
|
+
removeSelectedRule: (state, id) => {
|
|
177
|
+
var filter = state.query_builder.rules.filter((item) => {
|
|
178
|
+
return id != item.id;
|
|
179
|
+
})
|
|
180
|
+
state.query_builder.rules = filter;
|
|
181
|
+
},
|
|
182
|
+
updateSelectedField: (state, value) => {
|
|
183
|
+
state.selectedField = value;
|
|
184
|
+
},
|
|
185
|
+
updateOptionsInitValue: (state, value) => {
|
|
186
|
+
state.optionsInitValue = value;
|
|
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
|
+
};
|
|
205
|
+
|
|
206
|
+
rules.forEach(function (rule) {
|
|
207
|
+
|
|
208
|
+
/* if (key.query.choices && key.query.type == "totalization") {
|
|
209
|
+
key.query.choices.forEach(function (value) {
|
|
210
|
+
let obj = {
|
|
211
|
+
title: value.como.title,
|
|
212
|
+
value: value.como.value,
|
|
213
|
+
classCss: key.query.classCss,
|
|
214
|
+
type: value.como.type,
|
|
215
|
+
};
|
|
216
|
+
state.totalization.push(obj);
|
|
217
|
+
});
|
|
218
|
+
}*/
|
|
219
|
+
|
|
220
|
+
|
|
221
|
+
if (rule.value != null && rule.value != "" && rule.value != undefined) {
|
|
222
|
+
|
|
223
|
+
let convertToOdata = new convertToOdata();
|
|
224
|
+
let formatOdata = convertToOdata.ConvertToOdata(rule);
|
|
225
|
+
|
|
226
|
+
let ruleOdata = {
|
|
227
|
+
id: rule.id,
|
|
228
|
+
title: rule.title,
|
|
229
|
+
type: rule.type,
|
|
230
|
+
fieldType: rule.fieldType,
|
|
231
|
+
options: rule.options,
|
|
232
|
+
operator: rule.operator,
|
|
233
|
+
show: rule.show,
|
|
234
|
+
isRequired: rule.isRequired,
|
|
235
|
+
formatOdata: formatOdata,
|
|
236
|
+
andOr: rule.andOr,
|
|
237
|
+
value: rule.value,
|
|
238
|
+
};
|
|
239
|
+
|
|
240
|
+
state.queryOData.fields.push(ruleOdata);
|
|
241
|
+
}
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
},
|
|
246
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
namespaced: true,
|
|
3
|
+
state: {
|
|
4
|
+
userLogged: {},
|
|
5
|
+
menu: {
|
|
6
|
+
items: []
|
|
7
|
+
},
|
|
8
|
+
},
|
|
9
|
+
getters: {
|
|
10
|
+
hasRule: (state) => (name) => {
|
|
11
|
+
var hasRule = state.userLogged.user.rules.find(obj => {
|
|
12
|
+
return obj.name === name
|
|
13
|
+
})
|
|
14
|
+
if (hasRule == undefined) return false;
|
|
15
|
+
return true;
|
|
16
|
+
},
|
|
17
|
+
hasModule: (state) => (name) => {
|
|
18
|
+
var hasRule = state.userLogged.user.modules.find(obj => {
|
|
19
|
+
return obj.name === name
|
|
20
|
+
})
|
|
21
|
+
if (hasRule == undefined) return false;
|
|
22
|
+
return true;
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
mutations: {
|
|
26
|
+
addUserLogged: (state, obj) => {
|
|
27
|
+
state.userLogged = obj;
|
|
28
|
+
},
|
|
29
|
+
addItemMenu: (state, items) => {
|
|
30
|
+
items.forEach(function (obj) {
|
|
31
|
+
state.menu.items.push(obj);
|
|
32
|
+
});
|
|
33
|
+
},
|
|
34
|
+
removeItemMenu: (state) => {
|
|
35
|
+
state.menu.items = [];
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
namespaced: true,
|
|
3
|
+
state: {
|
|
4
|
+
formDirty: false,
|
|
5
|
+
validations: [],
|
|
6
|
+
resetForm: {
|
|
7
|
+
name: undefined,
|
|
8
|
+
dateTime: undefined
|
|
9
|
+
}
|
|
10
|
+
},
|
|
11
|
+
getters: {
|
|
12
|
+
isFormValid: (state) => (formName) => {
|
|
13
|
+
var hasNotification = state.validations.find(obj => {
|
|
14
|
+
return obj.formName === formName
|
|
15
|
+
})
|
|
16
|
+
if (hasNotification != undefined) return false;
|
|
17
|
+
return true;
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
mutations: {
|
|
21
|
+
addValidation: (state, obj) => {
|
|
22
|
+
state.validations.push(obj);
|
|
23
|
+
},
|
|
24
|
+
removeValidation: (state, obj) => {
|
|
25
|
+
let filter = state.validations.filter(v => v.key != obj.key);
|
|
26
|
+
state.validations = filter;
|
|
27
|
+
},
|
|
28
|
+
resetValidation: (state, formName) => {
|
|
29
|
+
state.resetForm.dateTime = new Date();
|
|
30
|
+
state.resetForm.name = formName;
|
|
31
|
+
},
|
|
32
|
+
updateFormDirty: (state, formDirty) => {
|
|
33
|
+
state.formDirty = formDirty;
|
|
34
|
+
},
|
|
35
|
+
removeFormDirty: (state) => {
|
|
36
|
+
state.formDirty = false;
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
}
|
package/src/store/store.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import Vue from 'vue';
|
|
2
2
|
import Vuex from 'vuex';
|
|
3
3
|
|
|
4
|
-
import
|
|
5
|
-
import generic from './
|
|
6
|
-
import validation from './
|
|
4
|
+
import user from './modules/user'
|
|
5
|
+
import generic from './modules/generic'
|
|
6
|
+
import validation from './modules/validation'
|
|
7
7
|
|
|
8
8
|
Vue.use(Vuex)
|
|
9
9
|
|
|
10
10
|
export default new Vuex.Store({
|
|
11
11
|
modules: {
|
|
12
|
-
generic, validation,
|
|
12
|
+
generic, validation, user
|
|
13
13
|
}
|
|
14
14
|
})
|
|
@@ -1,199 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div>
|
|
3
|
-
<div>
|
|
4
|
-
<div class="arquivo" v-if="!value">
|
|
5
|
-
<button class="botao pequeno primario">
|
|
6
|
-
<span v-if="!carregandoAdicionar">
|
|
7
|
-
<i class="fas fa-cloud-upload-alt"></i> {{ titulo }}</span
|
|
8
|
-
>
|
|
9
|
-
<vue-loading
|
|
10
|
-
v-if="carregandoAdicionar"
|
|
11
|
-
type="bubbles"
|
|
12
|
-
color="#fff"
|
|
13
|
-
:size="{ width: '20px', height: '20px' }"
|
|
14
|
-
></vue-loading>
|
|
15
|
-
</button>
|
|
16
|
-
<input
|
|
17
|
-
type="file"
|
|
18
|
-
name="myfile"
|
|
19
|
-
ref="arquivo"
|
|
20
|
-
:accept="aceitos"
|
|
21
|
-
v-on:change="carregar()"
|
|
22
|
-
/>
|
|
23
|
-
</div>
|
|
24
|
-
<div v-if="value">
|
|
25
|
-
<button
|
|
26
|
-
class="botao pequeno sucesso"
|
|
27
|
-
@click="baixar()"
|
|
28
|
-
v-if="!carregandoAdicionar"
|
|
29
|
-
>
|
|
30
|
-
<i class="fas fa-cloud-download-alt"></i> Baixar
|
|
31
|
-
</button>
|
|
32
|
-
<button
|
|
33
|
-
class="botao pequeno perigo"
|
|
34
|
-
v-if="!carregandoAdicionar"
|
|
35
|
-
@click="remover()"
|
|
36
|
-
>
|
|
37
|
-
<span v-if="!carregandoRemover">Remover</span>
|
|
38
|
-
<vue-loading
|
|
39
|
-
v-if="carregandoRemover"
|
|
40
|
-
type="bubbles"
|
|
41
|
-
color="#fff"
|
|
42
|
-
:size="{ width: '20px', height: '20px' }"
|
|
43
|
-
></vue-loading>
|
|
44
|
-
</button>
|
|
45
|
-
</div>
|
|
46
|
-
<div class="div-alerta">
|
|
47
|
-
<Alerta tipo="info" v-if="value">
|
|
48
|
-
<span>{{ mensagem }}</span>
|
|
49
|
-
</Alerta>
|
|
50
|
-
</div>
|
|
51
|
-
</div>
|
|
52
|
-
</div>
|
|
53
|
-
</template>
|
|
54
|
-
|
|
55
|
-
<script>
|
|
56
|
-
import Alerta from "../layout/Alerta.vue";
|
|
57
|
-
|
|
58
|
-
import { mapActions } from "vuex";
|
|
59
|
-
|
|
60
|
-
export default {
|
|
61
|
-
name: "ArquivoUpload",
|
|
62
|
-
components: { Alerta },
|
|
63
|
-
props: {
|
|
64
|
-
titulo: String,
|
|
65
|
-
nome: String,
|
|
66
|
-
container: String,
|
|
67
|
-
aceitos: String,
|
|
68
|
-
mensagem: String,
|
|
69
|
-
urlAdicionar: String,
|
|
70
|
-
urlRemover: String,
|
|
71
|
-
nomeBancoDados: String,
|
|
72
|
-
aoCarregar: Function,
|
|
73
|
-
value: String,
|
|
74
|
-
},
|
|
75
|
-
data() {
|
|
76
|
-
return {
|
|
77
|
-
arquivo: "",
|
|
78
|
-
carregandoAdicionar: false,
|
|
79
|
-
carregandoRemover: false,
|
|
80
|
-
urlAzure: "https://espaco.blob.core.windows.net",
|
|
81
|
-
};
|
|
82
|
-
},
|
|
83
|
-
methods: {
|
|
84
|
-
...mapActions("generic", ["postFileApi", "deleteFileApi"]),
|
|
85
|
-
carregar() {
|
|
86
|
-
this.arquivo = this.$refs.arquivo.files[0];
|
|
87
|
-
let params = {
|
|
88
|
-
url: this.urlAdicionar,
|
|
89
|
-
arquivo: this.arquivo,
|
|
90
|
-
container: this.container,
|
|
91
|
-
nome: this.nome,
|
|
92
|
-
aceitos: this.aceitos,
|
|
93
|
-
};
|
|
94
|
-
this.carregandoAdicionar = true;
|
|
95
|
-
this.postFileApi(params).then((response) => {
|
|
96
|
-
if (response.sucesso) {
|
|
97
|
-
if (this.aoCarregar) this.aoCarregar();
|
|
98
|
-
this.$emit("input", response.conteudo);
|
|
99
|
-
} else {
|
|
100
|
-
this.limpar();
|
|
101
|
-
}
|
|
102
|
-
this.carregandoAdicionar = false;
|
|
103
|
-
});
|
|
104
|
-
},
|
|
105
|
-
remover() {
|
|
106
|
-
let props = {
|
|
107
|
-
url: this.urlRemover,
|
|
108
|
-
container: this.container,
|
|
109
|
-
nome: this.nomeBancoDados,
|
|
110
|
-
};
|
|
111
|
-
this.carregandoRemover = true;
|
|
112
|
-
let params = { url: this.urlRemover, obj: props };
|
|
113
|
-
this.deleteFileApi(params).then((response) => {
|
|
114
|
-
if (response.sucesso) {
|
|
115
|
-
if (this.aoCarregar) this.aoCarregar();
|
|
116
|
-
this.limpar();
|
|
117
|
-
this.$emit("input", "");
|
|
118
|
-
}
|
|
119
|
-
this.carregandoRemover = false;
|
|
120
|
-
});
|
|
121
|
-
},
|
|
122
|
-
limpar() {
|
|
123
|
-
this.arquivo = "";
|
|
124
|
-
},
|
|
125
|
-
baixar() {
|
|
126
|
-
const url = `${this.urlAzure}/${this.container}/${this.nomeBancoDados}`;
|
|
127
|
-
window.location.href = url;
|
|
128
|
-
},
|
|
129
|
-
},
|
|
130
|
-
};
|
|
131
|
-
</script>
|
|
132
|
-
|
|
133
|
-
<style scoped>
|
|
134
|
-
.arquivo {
|
|
135
|
-
position: relative;
|
|
136
|
-
overflow: hidden;
|
|
137
|
-
display: inline-block;
|
|
138
|
-
cursor: pointer;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
.botao {
|
|
142
|
-
padding: 8px 12px;
|
|
143
|
-
cursor: pointer;
|
|
144
|
-
border: none;
|
|
145
|
-
border-radius: 40px !important;
|
|
146
|
-
font-size: 14px;
|
|
147
|
-
font-weight: 400;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
.primario {
|
|
151
|
-
background: #577696;
|
|
152
|
-
border-color: #577696;
|
|
153
|
-
color: #fff;
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
.primario:hover {
|
|
157
|
-
background: #355472;
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
.sucesso {
|
|
161
|
-
color: #fff;
|
|
162
|
-
background: #94aa2a;
|
|
163
|
-
border-color: #94aa2a;
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
.sucesso:hover {
|
|
167
|
-
background: #6d7e1c;
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
.perigo {
|
|
171
|
-
color: #fff;
|
|
172
|
-
border-color: #f0134d;
|
|
173
|
-
background: #f0134d;
|
|
174
|
-
margin-left: 5px;
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
.perigo:hover {
|
|
178
|
-
background: #c70f40;
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
.pequeno {
|
|
182
|
-
padding: 5px 10px;
|
|
183
|
-
font-size: 13px;
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
.arquivo input[type="file"] {
|
|
187
|
-
font-size: 100px;
|
|
188
|
-
position: absolute;
|
|
189
|
-
left: 0;
|
|
190
|
-
top: 0;
|
|
191
|
-
opacity: 0;
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
.div-alerta{
|
|
195
|
-
margin-top:15px;
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
</style>
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div>
|
|
3
|
-
<b-form-group :label="titulo">
|
|
4
|
-
<b-form-checkbox-group
|
|
5
|
-
v-model="selecionado"
|
|
6
|
-
:options="opcoes"
|
|
7
|
-
:stacked="empilhado"
|
|
8
|
-
@click.native="executar"
|
|
9
|
-
></b-form-checkbox-group>
|
|
10
|
-
</b-form-group>
|
|
11
|
-
</div>
|
|
12
|
-
</template>
|
|
13
|
-
|
|
14
|
-
<script>
|
|
15
|
-
import { mapState, mapMutations } from "vuex";
|
|
16
|
-
|
|
17
|
-
export default {
|
|
18
|
-
name: "CheckboxMultiplo",
|
|
19
|
-
props: {
|
|
20
|
-
titulo: String,
|
|
21
|
-
opcoes: Array,
|
|
22
|
-
params: Object,
|
|
23
|
-
alterou: Function,
|
|
24
|
-
clicou: Function,
|
|
25
|
-
valorInicial: Array,
|
|
26
|
-
value: Array,
|
|
27
|
-
empilhado: {
|
|
28
|
-
type: Boolean,
|
|
29
|
-
default: false,
|
|
30
|
-
},
|
|
31
|
-
marcarFormSujo: {
|
|
32
|
-
type: Boolean,
|
|
33
|
-
default: true,
|
|
34
|
-
},
|
|
35
|
-
},
|
|
36
|
-
data() {
|
|
37
|
-
return {
|
|
38
|
-
selecionado: [],
|
|
39
|
-
};
|
|
40
|
-
},
|
|
41
|
-
mounted() {
|
|
42
|
-
this.selecionado = this.valorInicial;
|
|
43
|
-
},
|
|
44
|
-
methods: {
|
|
45
|
-
...mapMutations("validation", ["insereFormSujo"]),
|
|
46
|
-
executar(event) {
|
|
47
|
-
if (this.marcarFormSujo) this.insereFormSujo(true);
|
|
48
|
-
this.$emit("input", this.selecionado);
|
|
49
|
-
let self = this;
|
|
50
|
-
setTimeout(function () {
|
|
51
|
-
// adicionado o pointerId para prevenir que não seja executado em duplicidade
|
|
52
|
-
if (self.clicou && event.pointerId === 1) self.clicou(self.params);
|
|
53
|
-
}, 100);
|
|
54
|
-
},
|
|
55
|
-
},
|
|
56
|
-
watch: {
|
|
57
|
-
selecionado() {
|
|
58
|
-
this.$emit("input", this.selecionado);
|
|
59
|
-
if (this.alterou) this.alterou(this.params);
|
|
60
|
-
},
|
|
61
|
-
},
|
|
62
|
-
};
|
|
63
|
-
</script>
|