@nixweb/nixloc-ui 0.0.93 → 0.0.96
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/package.json +3 -2
- package/src/component/forms/DateTime.vue +16 -3
- package/src/component/forms/EscolherEstatico.vue +0 -3
- package/src/component/layout/BarraRolagem.vue +9 -2
- package/src/component/layout/Menu.vue +19 -12
- package/src/component/layout/Tag.vue +66 -0
- package/src/component/shared/Confirmacao.vue +80 -0
- package/src/component/shared/FiltroHorizontal.vue +8 -2
- package/src/component/shared/Progresso.vue +14 -1
- package/src/component/shared/Tabela.vue +3 -13
- package/src/component/shared/query-builder/Campo.vue +116 -0
- package/src/component/shared/query-builder/ConverteParaOdata.js +73 -0
- package/src/component/shared/query-builder/Filtro.vue +85 -0
- package/src/component/shared/query-builder/QueryBuilder.vue +164 -0
- package/src/component/shared/query-builder/Rodape.vue +38 -0
- package/src/component/shared/query-builder/Tags.vue +84 -0
- package/src/component/shared/query-builder/components/CustomSelect.vue +115 -0
- package/src/component/shared/query-builder/components/QueryBuilderChildren.vue +46 -0
- package/src/component/shared/query-builder/components/QueryBuilderGroup.vue +151 -0
- package/src/component/shared/query-builder/components/QueryBuilderRule.vue +81 -0
- package/src/component/shared/query-builder/layouts/Bootstrap/BootstrapGroup.vue +120 -0
- package/src/component/shared/query-builder/layouts/Bootstrap/BootstrapRule.vue +171 -0
- package/src/component/shared/query-builder/main.js +81 -0
- package/src/component/shared/query-builder/utilities.js +22 -0
- package/src/component/template/ModeloRelatorioListaView.vue +101 -32
- package/src/component/template/ModeloRelatorioView.vue +467 -0
- package/src/component/template/Relatorio.js +10 -0
- package/src/component/template/RelatorioAdicionarModificar.vue +106 -0
- package/src/store/modulos/generic.js +11 -0
- package/src/store/modulos/relatorio.js +169 -0
|
@@ -0,0 +1,169 @@
|
|
|
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
|
+
},
|
|
21
|
+
getters: {
|
|
22
|
+
cabecalhoTabela: (state) => {
|
|
23
|
+
let lista = [];
|
|
24
|
+
state.relatorio.campo.forEach(function (value) {
|
|
25
|
+
if (value.mostrar) lista.push(value);
|
|
26
|
+
});
|
|
27
|
+
return lista;
|
|
28
|
+
},
|
|
29
|
+
opcoes: (state) => {
|
|
30
|
+
// opcoesValorInicial é quando vem do relatório salvo
|
|
31
|
+
|
|
32
|
+
state.opcoes = {
|
|
33
|
+
valorInicial: [],
|
|
34
|
+
opcoes: []
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
var tamanhoValorInicial = state.opcoesValorInicial.length;
|
|
38
|
+
|
|
39
|
+
state.relatorio.campo.forEach(function (value) {
|
|
40
|
+
let opcoes = { text: value.titulo, value: value.campo };
|
|
41
|
+
state.opcoes.opcoes.push(opcoes);
|
|
42
|
+
|
|
43
|
+
if (value.mostrar && tamanhoValorInicial == 0)
|
|
44
|
+
state.opcoes.valorInicial.push(value.campo);
|
|
45
|
+
|
|
46
|
+
if (tamanhoValorInicial > 0)
|
|
47
|
+
state.opcoes.valorInicial = state.opcoesValorInicial;
|
|
48
|
+
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
// se não tiver salvo, reseta o filtro que estava armazenado
|
|
52
|
+
/* if (tamanhoValorInicial == 0)
|
|
53
|
+
state.filtroSelecionado.children = [];*/
|
|
54
|
+
|
|
55
|
+
return state.opcoes;
|
|
56
|
+
},
|
|
57
|
+
filtroObrigatorio: (state) => {
|
|
58
|
+
var filtroObrigatorio = state.relatorio.filtro.filter(x => x.obrigatorio == true);
|
|
59
|
+
return filtroObrigatorio;
|
|
60
|
+
},
|
|
61
|
+
filtroSelecionado: (state) => {
|
|
62
|
+
let filtro = { children: [] };
|
|
63
|
+
|
|
64
|
+
state.filtroSelecionado.children.forEach(function (value) {
|
|
65
|
+
if (value.query.value != null && value.query.value != "" && value.query.value != undefined)
|
|
66
|
+
filtro.children.push(value);
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
return filtro;
|
|
70
|
+
},
|
|
71
|
+
temCampoSelecionado: (state) => (campo, valor) => {
|
|
72
|
+
var existe = valor.find((value) => {
|
|
73
|
+
if (campo == value) return true;
|
|
74
|
+
});
|
|
75
|
+
return existe;
|
|
76
|
+
},
|
|
77
|
+
oDataOrderBy: (state) => {
|
|
78
|
+
let orderBy = `$orderby=${state.campoOrdenado.id} ${state.campoOrdenado.ordenar}`;
|
|
79
|
+
return orderBy;
|
|
80
|
+
},
|
|
81
|
+
oDataSelect: (state) => {
|
|
82
|
+
let consulta = "";
|
|
83
|
+
let seqConsulta = 0;
|
|
84
|
+
|
|
85
|
+
state.relatorio.campo.forEach(function (obj) {
|
|
86
|
+
if (obj.mostrar || obj.obrigatorioOData) {
|
|
87
|
+
if (seqConsulta == 0) consulta += `$select=${obj.campo}`;
|
|
88
|
+
if (seqConsulta > 0) consulta += `,${obj.campo}`;
|
|
89
|
+
seqConsulta++;
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
return consulta;
|
|
94
|
+
},
|
|
95
|
+
oDataFilter: (state) => {
|
|
96
|
+
let consulta = "";
|
|
97
|
+
let resumo = "";
|
|
98
|
+
let seqConsulta = 0;
|
|
99
|
+
let seqResumo = 0;
|
|
100
|
+
var tamanho = state.consulta.length;
|
|
101
|
+
|
|
102
|
+
state.consulta.forEach(function (valor) {
|
|
103
|
+
if (valor.tipo == "campo") {
|
|
104
|
+
if (seqConsulta == 0 && tamanho > 0) consulta += `$filter=${valor.filtro}`;
|
|
105
|
+
if (seqConsulta > 0 && tamanho > 0) consulta += ` and ${valor.filtro}`;
|
|
106
|
+
seqConsulta++;
|
|
107
|
+
} else {
|
|
108
|
+
if (seqResumo == 0 && tamanho > 0) resumo += `${valor.filtro}`;
|
|
109
|
+
if (seqResumo > 0 && tamanho > 0) resumo += `,${valor.filtro}`;
|
|
110
|
+
seqResumo++;
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
return { consulta, resumo };
|
|
115
|
+
},
|
|
116
|
+
},
|
|
117
|
+
mutations: {
|
|
118
|
+
insereRelatorio: (state, obj) => {
|
|
119
|
+
state.relatorio = obj;
|
|
120
|
+
},
|
|
121
|
+
atualizaCampoSelecionado: (state, value) => {
|
|
122
|
+
state.campoSelecionado = value;
|
|
123
|
+
},
|
|
124
|
+
atualizaOpcoesValorInicial: (state, value) => {
|
|
125
|
+
state.opcoesValorInicial = value;
|
|
126
|
+
},
|
|
127
|
+
atualizaFiltroSelecionado: (state, value) => {
|
|
128
|
+
state.filtroSelecionado = value;
|
|
129
|
+
},
|
|
130
|
+
atualizaCampoOrdenado: (state, value) => {
|
|
131
|
+
state.campoOrdenado = value;
|
|
132
|
+
},
|
|
133
|
+
removeFiltroSelecionado: (state, id) => {
|
|
134
|
+
var filtro = state.filtroSelecionado.children.filter((x) => {
|
|
135
|
+
return x.query.id != id;
|
|
136
|
+
});
|
|
137
|
+
state.filtroSelecionado.children = filtro;
|
|
138
|
+
},
|
|
139
|
+
atualizaConsultaFiltro: (state, filtro) => {
|
|
140
|
+
state.resumo = [];
|
|
141
|
+
state.consulta = [];
|
|
142
|
+
|
|
143
|
+
filtro.children.forEach(function (chave) {
|
|
144
|
+
let valor = chave.query.value;
|
|
145
|
+
|
|
146
|
+
if (chave.query.choices && chave.query.tipo == "resumo") {
|
|
147
|
+
chave.query.choices.forEach(function (value) {
|
|
148
|
+
let obj = {
|
|
149
|
+
titulo: value.como.titulo,
|
|
150
|
+
valor: value.como.valor,
|
|
151
|
+
classeCss: chave.query.classeCss,
|
|
152
|
+
tipo: value.como.tipo,
|
|
153
|
+
};
|
|
154
|
+
state.resumo.push(obj);
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
let converteParaOdata = new ConverteParaOdata();
|
|
158
|
+
let filtro = converteParaOdata.converteFiltro(chave.query);
|
|
159
|
+
|
|
160
|
+
if (valor != null && valor != undefined && valor != "") {
|
|
161
|
+
if (filtro != "") {
|
|
162
|
+
let obj = { filtro: filtro, tipo: chave.query.tipo };
|
|
163
|
+
state.consulta.push(obj);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
},
|
|
169
|
+
}
|