@nixweb/nixloc-ui 0.0.119 → 0.0.122
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 +160 -0
- package/docs/src/store/modulos/relatorio.drawio +37 -0
- package/package.json +77 -75
- package/public/index.html +2 -4
- package/public/styles/app.css +1 -2
- 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} +6 -6
- package/src/component/forms/{Cor.vue → Color.vue} +9 -9
- package/src/component/forms/DateTime.vue +53 -53
- package/src/component/forms/{BotaoDropdown.vue → Dropdown.vue} +50 -50
- 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/{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 +9 -9
- package/src/component/layout/Topo.vue +1 -1
- package/src/component/layout/Wizard.vue +3 -3
- package/src/component/shared/BotaoCarregarMais.vue +9 -9
- package/src/component/shared/BotaoConsulta.vue +9 -9
- package/src/component/shared/CabecalhoImpressao.vue +6 -6
- package/src/component/shared/CodigoEditor.vue +16 -16
- package/src/component/shared/Confirmacao.vue +28 -28
- package/src/component/shared/Dica.vue +10 -10
- package/src/component/shared/DocumentoEditor.vue +3 -3
- package/src/component/shared/DocumentoPreview.vue +2 -2
- package/src/component/shared/EsconderMostrar.vue +26 -26
- package/src/component/shared/ExportarExcel.vue +14 -14
- package/src/component/shared/ExportarPDF.vue +10 -10
- package/src/component/shared/FiltroHorizontal.vue +19 -19
- package/src/component/shared/LegendaParametro.vue +17 -17
- package/src/component/shared/{Carregando.vue → Loading.vue} +11 -11
- package/src/component/shared/Messages.vue +83 -0
- package/src/component/shared/Paginacao.vue +10 -10
- package/src/component/shared/Progresso.vue +2 -2
- package/src/component/shared/Registro.vue +2 -2
- package/src/component/shared/ResumoTabela.vue +6 -6
- package/src/component/shared/SalvarCancelar.vue +26 -26
- package/src/component/shared/{Pesquisa.vue → Search.vue} +36 -36
- package/src/component/shared/Tabela.vue +49 -49
- package/src/component/shared/TabelaBotao.vue +13 -13
- package/src/component/shared/Toast.vue +7 -7
- package/src/component/shared/{FiltroVertical.vue → VerticalFilter.vue} +14 -14
- package/src/component/shared/construtor-consulta/AdicionaFiltro.vue +191 -0
- package/src/component/shared/construtor-consulta/Campo.vue +127 -0
- package/src/component/shared/construtor-consulta/ComponenteDinamico.vue +109 -0
- package/src/component/shared/construtor-consulta/ConstrutorConsulta.vue +70 -0
- package/src/component/shared/construtor-consulta/ConverteParaOdata.js +80 -0
- package/src/component/shared/construtor-consulta/EscolherFiltro.vue +96 -0
- package/src/component/shared/{query-builder → construtor-consulta}/Filtro.vue +11 -16
- package/src/component/shared/construtor-consulta/ListaComponenteDinamico.vue +41 -0
- package/src/component/shared/{query-builder → construtor-consulta}/Rodape.vue +9 -9
- package/src/component/shared/{query-builder → construtor-consulta}/Tags.vue +7 -7
- package/src/component/shared/{query-builder → construtor-consulta}/utilities.js +0 -0
- package/src/component/template/ModeloAdicionarModificarView.vue +11 -11
- package/src/component/template/ModeloDocumentoView.vue +79 -79
- package/src/component/template/ModeloLista.vue +66 -66
- package/src/component/template/ModeloRelatorioListaView.vue +71 -68
- package/src/component/template/ModeloRelatorioView.vue +218 -200
- package/src/component/template/ModeloSubView.vue +13 -13
- package/src/component/template/ModeloView.vue +17 -17
- package/src/component/template/Relatorio.js +1 -5
- package/src/component/template/RelatorioAdicionarModificar.vue +44 -44
- package/src/component/value-objects/DadosContato.vue +27 -27
- package/src/component/value-objects/DadosPessoa.js +1 -1
- package/src/component/value-objects/DadosPessoa.vue +52 -52
- package/src/component/value-objects/Endereco.js +1 -1
- package/src/component/value-objects/Endereco.vue +83 -83
- 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/public/js/menu.js +0 -11
- package/public/styles/menu.css +0 -1399
- 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 -324
- 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/Mensagem.vue +0 -86
- package/src/component/shared/query-builder/Campo.vue +0 -116
- package/src/component/shared/query-builder/ConverteParaOdata.js +0 -73
- package/src/component/shared/query-builder/QueryBuilder.vue +0 -164
- 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 -171
- package/src/component/shared/query-builder/main.js +0 -81
- package/src/store/modulos/generic.js +0 -494
- package/src/store/modulos/relatorio.js +0 -201
- package/src/store/modulos/usuario.js +0 -38
- package/src/store/modulos/validation.js +0 -39
|
@@ -1,494 +0,0 @@
|
|
|
1
|
-
import axios from "@/config/axios";
|
|
2
|
-
import dicas from "@/config/dicas";
|
|
3
|
-
import Token from "@nixweb/nixloc-ui/src/config/token";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
export default {
|
|
7
|
-
namespaced: true,
|
|
8
|
-
state: {
|
|
9
|
-
modal: {
|
|
10
|
-
nome: undefined,
|
|
11
|
-
abrir: false
|
|
12
|
-
},
|
|
13
|
-
vodal: {
|
|
14
|
-
nome: undefined,
|
|
15
|
-
abrir: false
|
|
16
|
-
},
|
|
17
|
-
notificacoes: [],
|
|
18
|
-
paginacao: [],
|
|
19
|
-
selecionados: [],
|
|
20
|
-
carregando: [],
|
|
21
|
-
evento: {
|
|
22
|
-
dataHora: undefined,
|
|
23
|
-
nome: undefined,
|
|
24
|
-
dados: {}
|
|
25
|
-
},
|
|
26
|
-
toast: {
|
|
27
|
-
dataHora: undefined,
|
|
28
|
-
tipo: undefined,
|
|
29
|
-
},
|
|
30
|
-
ids: undefined,
|
|
31
|
-
pesquisa: { conteudo: "", filtro: { text: "Contém", value: "contem" } },
|
|
32
|
-
documentoHtml: "",
|
|
33
|
-
EscolherEstatico: { dataHora: undefined, campoAlvo: undefined, valor: undefined },
|
|
34
|
-
buscouPesquisa: false,
|
|
35
|
-
limpouPesquisa: false,
|
|
36
|
-
metodoExecutadoApi: undefined,
|
|
37
|
-
},
|
|
38
|
-
getters: {
|
|
39
|
-
mostrarModal: (state) => (nome) => {
|
|
40
|
-
if (nome == state.modal.nome) return true;
|
|
41
|
-
return false;
|
|
42
|
-
},
|
|
43
|
-
mostrarVodal: (state) => (nome) => {
|
|
44
|
-
if (nome == state.vodal.nome) return true;
|
|
45
|
-
return false;
|
|
46
|
-
},
|
|
47
|
-
carregando: (state) => (chave) => {
|
|
48
|
-
var carregando = state.carregando.find(value => {
|
|
49
|
-
return value === chave
|
|
50
|
-
})
|
|
51
|
-
if (carregando) return true;
|
|
52
|
-
return false;
|
|
53
|
-
},
|
|
54
|
-
paginacao: (state) => (chave) => {
|
|
55
|
-
return state.paginacao.find(obj => {
|
|
56
|
-
return obj.chave === chave
|
|
57
|
-
})
|
|
58
|
-
},
|
|
59
|
-
dica: (state) => (obj) => {
|
|
60
|
-
return dicas.find(value => {
|
|
61
|
-
if (value.formNome == obj.formNome && value.campo == obj.campo)
|
|
62
|
-
return value
|
|
63
|
-
})
|
|
64
|
-
},
|
|
65
|
-
evento: (state) => {
|
|
66
|
-
return state.evento;
|
|
67
|
-
},
|
|
68
|
-
documentoPreview: (state) => {
|
|
69
|
-
let documentoHtml = state.documentoHtml
|
|
70
|
-
let retorno = documentoHtml;
|
|
71
|
-
|
|
72
|
-
var tabelas = document.getElementsByTagName("table");
|
|
73
|
-
let total = tabelas.length;
|
|
74
|
-
|
|
75
|
-
let config = [];
|
|
76
|
-
|
|
77
|
-
let sequencial = 0;
|
|
78
|
-
while (sequencial <= total - 1) {
|
|
79
|
-
|
|
80
|
-
let tabela = document.getElementsByTagName("table")[sequencial];
|
|
81
|
-
let th = tabela.getElementsByTagName("th")[0];
|
|
82
|
-
|
|
83
|
-
let obj = {
|
|
84
|
-
vForAgrupado: "",
|
|
85
|
-
vForSimples: "",
|
|
86
|
-
nomeGrupo: "",
|
|
87
|
-
nomeGrupoReplace: ""
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
if (th) {
|
|
91
|
-
let ehPorGrupo = th.innerText.includes("n.grupo");
|
|
92
|
-
let ehProduto = th.innerText.includes("n.produto");
|
|
93
|
-
let ehPeriodo = th.innerText.includes("n.periodo");
|
|
94
|
-
let ehPagamento = th.innerText.includes("n.pagamento");
|
|
95
|
-
|
|
96
|
-
if (ehProduto) {
|
|
97
|
-
obj.vForSimples = "v-for='p in d.produto'";
|
|
98
|
-
config.push(obj);
|
|
99
|
-
} else if (ehPeriodo) {
|
|
100
|
-
obj.vForSimples = "v-for='pe in d.periodo'";
|
|
101
|
-
config.push(obj);
|
|
102
|
-
} else if (ehPagamento) {
|
|
103
|
-
obj.vForSimples = "v-for='pg in d.pagamento'";
|
|
104
|
-
config.push(obj);
|
|
105
|
-
} else if (ehPorGrupo) {
|
|
106
|
-
obj.vForAgrupado = "v-for='(produto, grN) in produtoAgrupado'";
|
|
107
|
-
obj.vForSimples = "v-for='p in d.produto'";
|
|
108
|
-
|
|
109
|
-
var posicaoInicio = documentoHtml.split("<tbody>", sequencial + 1).join("<tbody>").length;
|
|
110
|
-
var posicaoFim = documentoHtml.split("</tbody>", sequencial + 1).join("</tbody>").length;
|
|
111
|
-
|
|
112
|
-
let tbody = documentoHtml.substring(documentoHtml.indexOf("<tbody>", posicaoInicio), documentoHtml.lastIndexOf("</tbody>", posicaoFim));
|
|
113
|
-
|
|
114
|
-
let tr = tbody.substring(tbody.indexOf("<tr>"), tbody.lastIndexOf("</tr>"));
|
|
115
|
-
|
|
116
|
-
obj.nomeGrupo = tr.substring(0, tr.indexOf('</tr>')) + "</tr>";
|
|
117
|
-
obj.nomeGrupo = obj.nomeGrupo.replaceAll("\"", "'");
|
|
118
|
-
obj.nomeGrupoReplace = obj.nomeGrupo.replace("<tr>", "").replace("</tr>", "");
|
|
119
|
-
config.push(obj);
|
|
120
|
-
|
|
121
|
-
} else {
|
|
122
|
-
config.push(obj);
|
|
123
|
-
}
|
|
124
|
-
} else {
|
|
125
|
-
config.push(obj);
|
|
126
|
-
}
|
|
127
|
-
sequencial++;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
let replace = "";
|
|
131
|
-
config.forEach(x => {
|
|
132
|
-
replace += `.replace("<tbody>${x.nomeGrupo}<tr>", "<tbody ${x.vForAgrupado}>${x.nomeGrupoReplace}<tr ${x.vForSimples}>")`;
|
|
133
|
-
});
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
console.log(config);
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
var ret = retorno.replaceAll("\"", "'");
|
|
140
|
-
ret = eval(`ret${replace}`);
|
|
141
|
-
|
|
142
|
-
var classeImportant = ret
|
|
143
|
-
.replaceAll("n.grupo", "")
|
|
144
|
-
.replaceAll("n.produto", "")
|
|
145
|
-
.replaceAll("n.periodo", "")
|
|
146
|
-
.replaceAll("n.pagamento", "")
|
|
147
|
-
.replaceAll("<p> !important;</p>", "<p> </p>");
|
|
148
|
-
|
|
149
|
-
return classeImportant;
|
|
150
|
-
},
|
|
151
|
-
agruparPor: () => (obj) => {
|
|
152
|
-
const result = {};
|
|
153
|
-
obj.array.forEach((item) => {
|
|
154
|
-
if (!result[item[obj.key]]) {
|
|
155
|
-
result[item[obj.key]] = [];
|
|
156
|
-
}
|
|
157
|
-
result[item[obj.key]].push(item);
|
|
158
|
-
});
|
|
159
|
-
return result;
|
|
160
|
-
},
|
|
161
|
-
},
|
|
162
|
-
mutations: {
|
|
163
|
-
abrirModal: (state, nome) => {
|
|
164
|
-
state.modal.nome = nome;
|
|
165
|
-
state.modal.abrir = true;
|
|
166
|
-
},
|
|
167
|
-
fecharModal: (state) => {
|
|
168
|
-
state.modal.abrir = false;
|
|
169
|
-
},
|
|
170
|
-
abrirVodal: (state, nome) => {
|
|
171
|
-
state.vodal.nome = nome;
|
|
172
|
-
state.vodal.abrir = true;
|
|
173
|
-
},
|
|
174
|
-
fecharVodal: (state) => {
|
|
175
|
-
state.vodal.nome = "";
|
|
176
|
-
state.vodal.abrir = false;
|
|
177
|
-
},
|
|
178
|
-
atualizaCampoPesquisa: (state, value) => {
|
|
179
|
-
state.pesquisa = value;
|
|
180
|
-
},
|
|
181
|
-
buscouPesquisa: (state) => {
|
|
182
|
-
state.buscouPesquisa = state.buscouPesquisa = !state.buscouPesquisa
|
|
183
|
-
},
|
|
184
|
-
limpouPesquisa: (state) => {
|
|
185
|
-
state.limpouPesquisa = state.limpouPesquisa = !state.limpouPesquisa
|
|
186
|
-
},
|
|
187
|
-
adicionaSelecao: (state, selecionados) => {
|
|
188
|
-
state.selecionados = selecionados;
|
|
189
|
-
},
|
|
190
|
-
insereToast: (state, acao) => {
|
|
191
|
-
state.toast.dataHora = new Date();
|
|
192
|
-
state.toast.tipo = acao;
|
|
193
|
-
},
|
|
194
|
-
insereMetodoExecutadoApi: (state, acao) => {
|
|
195
|
-
state.metodoExecutadoApi = acao;
|
|
196
|
-
},
|
|
197
|
-
limpaMetodoExecutadoApi: (state) => {
|
|
198
|
-
state.metodoExecutadoApi = "";
|
|
199
|
-
},
|
|
200
|
-
insereCarregando: (state, chave) => {
|
|
201
|
-
state.carregando.push(chave);
|
|
202
|
-
},
|
|
203
|
-
removeCarregando: (state, listaChave) => {
|
|
204
|
-
listaChave.forEach(function (chave) {
|
|
205
|
-
let filtro = state.carregando.filter(function (o) {
|
|
206
|
-
return o != chave;
|
|
207
|
-
});
|
|
208
|
-
state.carregando = filtro;
|
|
209
|
-
});
|
|
210
|
-
},
|
|
211
|
-
inserePaginacao: (state, paginacao) => {
|
|
212
|
-
state.paginacao.push(paginacao);
|
|
213
|
-
},
|
|
214
|
-
atualizaPaginacao: (state, paginacao) => {
|
|
215
|
-
state.paginacao.forEach(function (obj) {
|
|
216
|
-
if (obj.chave == paginacao.chave)
|
|
217
|
-
obj.totalPorPagina = paginacao.totalPorPagina;
|
|
218
|
-
});
|
|
219
|
-
},
|
|
220
|
-
atualizaDocumentoHtml: (state, value) => {
|
|
221
|
-
state.documentoHtml = value;
|
|
222
|
-
},
|
|
223
|
-
insereEvento: (state, obj) => {
|
|
224
|
-
state.evento.dataHora = new Date();
|
|
225
|
-
state.evento.nome = obj.nome;
|
|
226
|
-
state.evento.dados = obj.dados;
|
|
227
|
-
},
|
|
228
|
-
removeEvento: (state) => {
|
|
229
|
-
state.evento = {};
|
|
230
|
-
},
|
|
231
|
-
insereNotificacao: (state, notificacoes) => {
|
|
232
|
-
state.notificacoes = notificacoes;
|
|
233
|
-
},
|
|
234
|
-
insereNotificacaoErroApi: (state) => {
|
|
235
|
-
var erro = { property: "ERRO API", mensagem: "Falha de Comunicação!" };
|
|
236
|
-
state.notificacoes = [erro];
|
|
237
|
-
},
|
|
238
|
-
removeNotificacao: (state) => {
|
|
239
|
-
state.notificacoes = [];
|
|
240
|
-
},
|
|
241
|
-
listaIdParaStringVirgula: (state, listaId) => {
|
|
242
|
-
state.ids = "";
|
|
243
|
-
listaId.forEach(function (id) {
|
|
244
|
-
state.ids += `${id},`;
|
|
245
|
-
});
|
|
246
|
-
},
|
|
247
|
-
insereFiltro: (state, obj) => {
|
|
248
|
-
state.EscolherEstatico.dataHora = new Date();
|
|
249
|
-
state.EscolherEstatico.campoAlvo = obj.campoAlvo;
|
|
250
|
-
state.EscolherEstatico.valor = obj.valor;
|
|
251
|
-
},
|
|
252
|
-
|
|
253
|
-
},
|
|
254
|
-
actions: {
|
|
255
|
-
postApi: async function (context, params) {
|
|
256
|
-
context.commit('limpaMetodoExecutadoApi');
|
|
257
|
-
return axios.post(params.url, params.obj, {
|
|
258
|
-
headers: new Token().tokenHeaders(),
|
|
259
|
-
})
|
|
260
|
-
.then((response) => {
|
|
261
|
-
if (response.data.sucesso) {
|
|
262
|
-
context.commit('insereMetodoExecutadoApi', 'postApi');
|
|
263
|
-
|
|
264
|
-
if (!params.naoNotificarToast)
|
|
265
|
-
context.commit('insereToast', 'postApi');
|
|
266
|
-
|
|
267
|
-
context.commit('removeNotificacao');
|
|
268
|
-
context.commit('validation/removeFormSujo', null, { root: true });
|
|
269
|
-
return response.data;
|
|
270
|
-
} else {
|
|
271
|
-
|
|
272
|
-
context.commit('insereNotificacao', response.data.notificacoes)
|
|
273
|
-
context.commit('insereToast', 'postApiErro');
|
|
274
|
-
return response.data;
|
|
275
|
-
}
|
|
276
|
-
}, (err) => {
|
|
277
|
-
if (err.response)
|
|
278
|
-
if (err.response.status === 403)
|
|
279
|
-
context.commit('insereNotificacao', [{ mensagem: "Usuário sem permissão para adicionar!" }])
|
|
280
|
-
|
|
281
|
-
if (!err.response)
|
|
282
|
-
context.commit('insereNotificacaoErroApi');
|
|
283
|
-
return false;
|
|
284
|
-
})
|
|
285
|
-
},
|
|
286
|
-
putApi: async function (context, params) {
|
|
287
|
-
context.commit('limpaMetodoExecutadoApi');
|
|
288
|
-
return axios.put(params.url, params.obj, {
|
|
289
|
-
headers: new Token().tokenHeaders(),
|
|
290
|
-
})
|
|
291
|
-
.then((response) => {
|
|
292
|
-
if (response.data.sucesso) {
|
|
293
|
-
context.commit('insereMetodoExecutadoApi', 'putApi');
|
|
294
|
-
|
|
295
|
-
if (!params.naoNotificarToast)
|
|
296
|
-
context.commit('insereToast', 'putApi');
|
|
297
|
-
|
|
298
|
-
context.commit('removeNotificacao');
|
|
299
|
-
context.commit('validation/removeFormSujo', null, { root: true });
|
|
300
|
-
return response.data;
|
|
301
|
-
} else {
|
|
302
|
-
context.commit('insereToast', 'putApiErro');
|
|
303
|
-
context.commit('insereNotificacao', response.data.notificacoes)
|
|
304
|
-
return response.data;
|
|
305
|
-
}
|
|
306
|
-
}, (err) => {
|
|
307
|
-
if (err.response)
|
|
308
|
-
if (err.response.status === 403)
|
|
309
|
-
context.commit('insereNotificacao', [{ mensagem: "Usuário sem permissão para modificar!" }])
|
|
310
|
-
|
|
311
|
-
if (!err.response)
|
|
312
|
-
context.commit('insereNotificacaoErroApi');
|
|
313
|
-
|
|
314
|
-
return false;
|
|
315
|
-
})
|
|
316
|
-
},
|
|
317
|
-
getApi: async function (context, params) {
|
|
318
|
-
context.commit('limpaMetodoExecutadoApi');
|
|
319
|
-
return axios.get(params.url, {
|
|
320
|
-
params: params.obj,
|
|
321
|
-
headers: new Token().tokenHeaders(),
|
|
322
|
-
})
|
|
323
|
-
.then((response) => {
|
|
324
|
-
if (response.data.sucesso) {
|
|
325
|
-
context.commit('insereMetodoExecutadoApi', params.MetodoExecutadoApi);
|
|
326
|
-
context.commit('removeNotificacao');
|
|
327
|
-
return response.data;
|
|
328
|
-
} else {
|
|
329
|
-
context.commit('insereNotificacao', response.data.notificacoes)
|
|
330
|
-
context.commit('insereToast', 'falhaGenerica');
|
|
331
|
-
return response.data;
|
|
332
|
-
}
|
|
333
|
-
}, (err) => {
|
|
334
|
-
context.commit('insereNotificacaoErroApi');
|
|
335
|
-
return false;
|
|
336
|
-
})
|
|
337
|
-
},
|
|
338
|
-
getApiOdata: async function (context, params) {
|
|
339
|
-
return axios.get(params.url, {
|
|
340
|
-
headers: new Token().tokenHeaders(),
|
|
341
|
-
})
|
|
342
|
-
.then((response) => {
|
|
343
|
-
return response.data;
|
|
344
|
-
}, (err) => {
|
|
345
|
-
context.commit('insereNotificacaoErroApi');
|
|
346
|
-
return false;
|
|
347
|
-
})
|
|
348
|
-
},
|
|
349
|
-
deleteAllApi: async function (context, params) {
|
|
350
|
-
|
|
351
|
-
context.commit('limpaMetodoExecutadoApi');
|
|
352
|
-
context.commit('listaIdParaStringVirgula', params.selecionados);
|
|
353
|
-
|
|
354
|
-
let url = params.url;
|
|
355
|
-
let ids = context.state.ids;
|
|
356
|
-
|
|
357
|
-
return axios.delete(`${url}?ids=${ids}`, {
|
|
358
|
-
headers: new Token().tokenHeaders(),
|
|
359
|
-
})
|
|
360
|
-
.then((response) => {
|
|
361
|
-
if (response.data.sucesso) {
|
|
362
|
-
context.commit('insereMetodoExecutadoApi', 'deleteAllApi');
|
|
363
|
-
context.commit('insereToast', 'deleteApiSucesso');
|
|
364
|
-
context.commit('removeNotificacao');
|
|
365
|
-
return response.data;
|
|
366
|
-
} else {
|
|
367
|
-
context.commit('insereNotificacao', response.data.notificacoes)
|
|
368
|
-
context.commit('insereMetodoExecutadoApi', 'deleteAllApiErro');
|
|
369
|
-
context.commit('insereToast', 'deleteApiErro');
|
|
370
|
-
return response.data;
|
|
371
|
-
}
|
|
372
|
-
|
|
373
|
-
}, (err) => {
|
|
374
|
-
if (err.response)
|
|
375
|
-
if (err.response.status === 403)
|
|
376
|
-
context.commit('insereNotificacao', [{ mensagem: "Usuário sem permissão para remover!" }])
|
|
377
|
-
|
|
378
|
-
if (!err.response)
|
|
379
|
-
context.commit('insereNotificacaoErroApi');
|
|
380
|
-
return false;
|
|
381
|
-
})
|
|
382
|
-
},
|
|
383
|
-
deleteApi: async function (context, params) {
|
|
384
|
-
|
|
385
|
-
context.commit('limpaMetodoExecutadoApi');
|
|
386
|
-
let url = params.url;
|
|
387
|
-
|
|
388
|
-
return axios.delete(`${url}`, {
|
|
389
|
-
headers: new Token().tokenHeaders(),
|
|
390
|
-
})
|
|
391
|
-
.then((response) => {
|
|
392
|
-
if (response.data.sucesso) {
|
|
393
|
-
context.commit('insereMetodoExecutadoApi', 'deleteApi')
|
|
394
|
-
context.commit('insereToast', 'deleteApiSucesso');
|
|
395
|
-
context.commit('removeNotificacao');
|
|
396
|
-
return response.data;
|
|
397
|
-
} else {
|
|
398
|
-
context.commit('insereNotificacao', response.data.notificacoes)
|
|
399
|
-
context.commit('insereToast', 'deleteApiErro');
|
|
400
|
-
return response.data;
|
|
401
|
-
}
|
|
402
|
-
|
|
403
|
-
}, (err) => {
|
|
404
|
-
if (err.response)
|
|
405
|
-
if (err.response.status === 403)
|
|
406
|
-
context.commit('insereNotificacao', [{ mensagem: "Usuário sem permissão para remover!" }])
|
|
407
|
-
|
|
408
|
-
if (!err.response)
|
|
409
|
-
context.commit('insereNotificacaoErroApi');
|
|
410
|
-
return false;
|
|
411
|
-
})
|
|
412
|
-
},
|
|
413
|
-
getFileApi: async function (context, params) {
|
|
414
|
-
context.commit('limpaMetodoExecutadoApi');
|
|
415
|
-
return axios.post(params.url, params.obj, {
|
|
416
|
-
headers: new Token().tokenHeaders(), responseType: "arraybuffer",
|
|
417
|
-
})
|
|
418
|
-
.then((response) => {
|
|
419
|
-
let blob = new Blob([response.data], { type: "application/pdf" }),
|
|
420
|
-
url = window.URL.createObjectURL(blob);
|
|
421
|
-
window.open(url);
|
|
422
|
-
context.commit('insereMetodoExecutadoApi', 'getPdfApi');
|
|
423
|
-
context.commit('removeNotificacao');
|
|
424
|
-
|
|
425
|
-
}, (err) => {
|
|
426
|
-
context.commit('insereNotificacaoErroApi');
|
|
427
|
-
return false;
|
|
428
|
-
})
|
|
429
|
-
},
|
|
430
|
-
postFileApi: async function (context, params) {
|
|
431
|
-
context.commit('limpaMetodoExecutadoApi');
|
|
432
|
-
|
|
433
|
-
let formData = new FormData();
|
|
434
|
-
formData.append("file", params.arquivo);
|
|
435
|
-
formData.append(params.container, params.container);
|
|
436
|
-
formData.append(params.nome, params.nome);
|
|
437
|
-
formData.append(params.aceitos, params.aceitos);
|
|
438
|
-
|
|
439
|
-
return axios.post(params.url, formData, {
|
|
440
|
-
headers: new Token().tokenHeaders(),
|
|
441
|
-
})
|
|
442
|
-
.then((response) => {
|
|
443
|
-
if (response.data.sucesso) {
|
|
444
|
-
context.commit('insereMetodoExecutadoApi', 'postFileApi');
|
|
445
|
-
context.commit('removeNotificacao');
|
|
446
|
-
return response.data;
|
|
447
|
-
} else {
|
|
448
|
-
context.commit('insereToast', 'adicionarApiErro');
|
|
449
|
-
context.commit('insereNotificacao', response.data.notificacoes)
|
|
450
|
-
|
|
451
|
-
return response.data;
|
|
452
|
-
}
|
|
453
|
-
}, (err) => {
|
|
454
|
-
if (err.response)
|
|
455
|
-
if (err.response.status === 403)
|
|
456
|
-
context.commit('insereNotificacao', [{ mensagem: "Usuário sem permissão para adicionar!" }])
|
|
457
|
-
|
|
458
|
-
if (!err.response)
|
|
459
|
-
context.commit('insereNotificacaoErroApi');
|
|
460
|
-
return false;
|
|
461
|
-
})
|
|
462
|
-
},
|
|
463
|
-
deleteFileApi: async function (context, params) {
|
|
464
|
-
context.commit('limpaMetodoExecutadoApi');
|
|
465
|
-
|
|
466
|
-
let url = params.url;
|
|
467
|
-
let nome = params.obj.nome;
|
|
468
|
-
let container = params.obj.container;
|
|
469
|
-
|
|
470
|
-
return axios.delete(`${url}?nome=${nome}&container=${container}`, {
|
|
471
|
-
headers: new Token().tokenHeaders(),
|
|
472
|
-
})
|
|
473
|
-
.then((response) => {
|
|
474
|
-
if (response.data.sucesso) {
|
|
475
|
-
context.commit('insereMetodoExecutadoApi', 'deleteFileApi');
|
|
476
|
-
context.commit('removeNotificacao');
|
|
477
|
-
return response.data;
|
|
478
|
-
} else {
|
|
479
|
-
context.commit('insereNotificacao', response.data.notificacoes)
|
|
480
|
-
context.commit('insereToast', 'adicionarApiErro');
|
|
481
|
-
return response.data;
|
|
482
|
-
}
|
|
483
|
-
}, (err) => {
|
|
484
|
-
if (err.response)
|
|
485
|
-
if (err.response.status === 403)
|
|
486
|
-
context.commit('insereNotificacao', [{ mensagem: "Usuário sem permissão para remover!" }])
|
|
487
|
-
|
|
488
|
-
if (!err.response)
|
|
489
|
-
context.commit('insereNotificacaoErroApi');
|
|
490
|
-
return false;
|
|
491
|
-
})
|
|
492
|
-
},
|
|
493
|
-
}
|
|
494
|
-
}
|
|
@@ -1,201 +0,0 @@
|
|
|
1
|
-
import ConverteParaOdata from "@nixweb/nixloc-ui/src/component/shared/query-builder/ConverteParaOdata.js";
|
|
2
|
-
|
|
3
|
-
export default {
|
|
4
|
-
namespaced: true,
|
|
5
|
-
state: {
|
|
6
|
-
relatorio: {
|
|
7
|
-
campo: [],
|
|
8
|
-
filtro: [],
|
|
9
|
-
},
|
|
10
|
-
campoSelecionado: [],
|
|
11
|
-
campoOrdenado: {},
|
|
12
|
-
filtroSelecionado: { children: [] },
|
|
13
|
-
opcoes: {
|
|
14
|
-
valorInicial: [],
|
|
15
|
-
opcoes: []
|
|
16
|
-
},
|
|
17
|
-
opcoesValorInicial: [],
|
|
18
|
-
consulta: [],
|
|
19
|
-
resumo: [],
|
|
20
|
-
tags: []
|
|
21
|
-
},
|
|
22
|
-
getters: {
|
|
23
|
-
cabecalhoTabela: (state) => {
|
|
24
|
-
let lista = [];
|
|
25
|
-
state.relatorio.campo.forEach(function (value) {
|
|
26
|
-
if (value.mostrar) lista.push(value);
|
|
27
|
-
});
|
|
28
|
-
return lista;
|
|
29
|
-
},
|
|
30
|
-
opcoes: (state) => {
|
|
31
|
-
// opcoesValorInicial é quando vem do relatório salvo
|
|
32
|
-
|
|
33
|
-
state.opcoes = {
|
|
34
|
-
valorInicial: [],
|
|
35
|
-
opcoes: []
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
var tamanhoValorInicial = state.opcoesValorInicial.length;
|
|
39
|
-
|
|
40
|
-
state.relatorio.campo.forEach(function (value) {
|
|
41
|
-
let opcoes = { text: value.titulo, value: value.campo };
|
|
42
|
-
state.opcoes.opcoes.push(opcoes);
|
|
43
|
-
|
|
44
|
-
if (value.mostrar && tamanhoValorInicial == 0)
|
|
45
|
-
state.opcoes.valorInicial.push(value.campo);
|
|
46
|
-
|
|
47
|
-
if (tamanhoValorInicial > 0)
|
|
48
|
-
state.opcoes.valorInicial = state.opcoesValorInicial;
|
|
49
|
-
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
// se não tiver salvo, reseta o filtro que estava armazenado
|
|
53
|
-
/* if (tamanhoValorInicial == 0)
|
|
54
|
-
state.filtroSelecionado.children = [];*/
|
|
55
|
-
|
|
56
|
-
return state.opcoes;
|
|
57
|
-
},
|
|
58
|
-
filtroObrigatorio: (state) => {
|
|
59
|
-
var filtroObrigatorio = state.relatorio.filtro.filter(x => x.obrigatorio == true);
|
|
60
|
-
return filtroObrigatorio;
|
|
61
|
-
},
|
|
62
|
-
filtroSelecionado: (state) => {
|
|
63
|
-
let filtro = { children: [] };
|
|
64
|
-
|
|
65
|
-
state.filtroSelecionado.children.forEach(function (value) {
|
|
66
|
-
if (value.query.value != null && value.query.value != "" && value.query.value != undefined)
|
|
67
|
-
filtro.children.push(value);
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
return filtro;
|
|
71
|
-
},
|
|
72
|
-
temCampoSelecionado: (state) => (campo, valor) => {
|
|
73
|
-
var existe = valor.find((value) => {
|
|
74
|
-
if (campo == value) return true;
|
|
75
|
-
});
|
|
76
|
-
return existe;
|
|
77
|
-
},
|
|
78
|
-
oDataOrderBy: (state) => {
|
|
79
|
-
let orderBy = `$orderby=${state.campoOrdenado.id} ${state.campoOrdenado.ordenar}`;
|
|
80
|
-
return orderBy;
|
|
81
|
-
},
|
|
82
|
-
oDataSelect: (state) => {
|
|
83
|
-
let consulta = "";
|
|
84
|
-
let seqConsulta = 0;
|
|
85
|
-
|
|
86
|
-
state.relatorio.campo.forEach(function (obj) {
|
|
87
|
-
if (obj.mostrar || obj.obrigatorioOData) {
|
|
88
|
-
if (seqConsulta == 0) consulta += `$select=${obj.campo}`;
|
|
89
|
-
if (seqConsulta > 0) consulta += `,${obj.campo}`;
|
|
90
|
-
seqConsulta++;
|
|
91
|
-
}
|
|
92
|
-
});
|
|
93
|
-
|
|
94
|
-
return consulta;
|
|
95
|
-
},
|
|
96
|
-
oDataFilter: (state) => {
|
|
97
|
-
let consulta = "";
|
|
98
|
-
let resumo = "";
|
|
99
|
-
let seqConsulta = 0;
|
|
100
|
-
let seqResumo = 0;
|
|
101
|
-
var tamanho = state.consulta.length;
|
|
102
|
-
|
|
103
|
-
state.consulta.forEach(function (valor) {
|
|
104
|
-
if (valor.tipo == "campo") {
|
|
105
|
-
if (seqConsulta == 0 && tamanho > 0) consulta += `$filter=${valor.filtro}`;
|
|
106
|
-
if (seqConsulta > 0 && tamanho > 0) consulta += ` and ${valor.filtro}`;
|
|
107
|
-
seqConsulta++;
|
|
108
|
-
} else {
|
|
109
|
-
if (seqResumo == 0 && tamanho > 0) resumo += `${valor.filtro}`;
|
|
110
|
-
if (seqResumo > 0 && tamanho > 0) resumo += `,${valor.filtro}`;
|
|
111
|
-
seqResumo++;
|
|
112
|
-
}
|
|
113
|
-
});
|
|
114
|
-
|
|
115
|
-
return { consulta, resumo };
|
|
116
|
-
},
|
|
117
|
-
tags: (state) => {
|
|
118
|
-
state.tags = [];
|
|
119
|
-
state.filtroSelecionado.children.forEach(function (value) {
|
|
120
|
-
let valor = "";
|
|
121
|
-
let type = value.query.type;
|
|
122
|
-
|
|
123
|
-
if (value.query.value) {
|
|
124
|
-
if (type == "custom-component" && value.query.label == "Período") {
|
|
125
|
-
valor = `${value.query.value[0]} - ${value.query.value[1]}`;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
if (type == "text" || type == "numeric") {
|
|
129
|
-
valor = `${value.query.operator} "${value.query.value}"`;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
if (type == "checkbox") {
|
|
133
|
-
value.query.choices.forEach(function (opcoes) {
|
|
134
|
-
value.query.value.forEach(function (value) {
|
|
135
|
-
if (opcoes.value == value) {
|
|
136
|
-
valor += `${opcoes.label},`;
|
|
137
|
-
}
|
|
138
|
-
});
|
|
139
|
-
});
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
let tag = { id: value.query.id, titulo: value.query.label, valor: valor };
|
|
143
|
-
if (value.query.value != null) state.tags.push(tag);
|
|
144
|
-
}
|
|
145
|
-
});
|
|
146
|
-
return state.tags;
|
|
147
|
-
}
|
|
148
|
-
},
|
|
149
|
-
mutations: {
|
|
150
|
-
insereRelatorio: (state, obj) => {
|
|
151
|
-
state.relatorio = obj;
|
|
152
|
-
},
|
|
153
|
-
atualizaCampoSelecionado: (state, value) => {
|
|
154
|
-
state.campoSelecionado = value;
|
|
155
|
-
},
|
|
156
|
-
atualizaOpcoesValorInicial: (state, value) => {
|
|
157
|
-
state.opcoesValorInicial = value;
|
|
158
|
-
},
|
|
159
|
-
atualizaFiltroSelecionado: (state, value) => {
|
|
160
|
-
state.filtroSelecionado = value;
|
|
161
|
-
},
|
|
162
|
-
atualizaCampoOrdenado: (state, value) => {
|
|
163
|
-
state.campoOrdenado = value;
|
|
164
|
-
},
|
|
165
|
-
removeFiltroSelecionado: (state, id) => {
|
|
166
|
-
var filtro = state.filtroSelecionado.children.filter((x) => {
|
|
167
|
-
return x.query.id != id;
|
|
168
|
-
});
|
|
169
|
-
state.filtroSelecionado.children = filtro;
|
|
170
|
-
},
|
|
171
|
-
atualizaConsultaFiltro: (state, filtro) => {
|
|
172
|
-
state.resumo = [];
|
|
173
|
-
state.consulta = [];
|
|
174
|
-
|
|
175
|
-
filtro.children.forEach(function (chave) {
|
|
176
|
-
let valor = chave.query.value;
|
|
177
|
-
|
|
178
|
-
if (chave.query.choices && chave.query.tipo == "resumo") {
|
|
179
|
-
chave.query.choices.forEach(function (value) {
|
|
180
|
-
let obj = {
|
|
181
|
-
titulo: value.como.titulo,
|
|
182
|
-
valor: value.como.valor,
|
|
183
|
-
classeCss: chave.query.classeCss,
|
|
184
|
-
tipo: value.como.tipo,
|
|
185
|
-
};
|
|
186
|
-
state.resumo.push(obj);
|
|
187
|
-
});
|
|
188
|
-
}
|
|
189
|
-
let converteParaOdata = new ConverteParaOdata();
|
|
190
|
-
let filtro = converteParaOdata.converteFiltro(chave.query);
|
|
191
|
-
|
|
192
|
-
if (valor != null && valor != undefined && valor != "") {
|
|
193
|
-
if (filtro != "") {
|
|
194
|
-
let obj = { filtro: filtro, tipo: chave.query.tipo };
|
|
195
|
-
state.consulta.push(obj);
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
});
|
|
199
|
-
}
|
|
200
|
-
},
|
|
201
|
-
}
|