@nixweb/nixloc-ui 0.0.121 → 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.
Files changed (119) hide show
  1. package/docs/src/component/template/ModeloRelatorioView.drawio +2 -2
  2. package/docs/src/store/modulos/relatorio.drawio +1 -1
  3. package/package.json +77 -77
  4. package/public/styles/app.css +1 -1
  5. package/src/component/forms/{Botao.vue → Button.vue} +53 -57
  6. package/src/component/forms/CheckboxGroup.vue +63 -0
  7. package/src/component/forms/{CheckboxUnico.vue → CheckboxSimple.vue} +6 -6
  8. package/src/component/forms/{Cor.vue → Color.vue} +9 -9
  9. package/src/component/forms/DateTime.vue +53 -53
  10. package/src/component/forms/{BotaoDropdown.vue → Dropdown.vue} +50 -50
  11. package/src/component/forms/EditorHtml.vue +123 -0
  12. package/src/component/forms/FileUpload.vue +189 -0
  13. package/src/component/forms/InputDecimal.vue +137 -0
  14. package/src/component/forms/InputNumber.vue +149 -0
  15. package/src/component/forms/InputPassword.vue +135 -0
  16. package/src/component/forms/InputText.vue +157 -0
  17. package/src/component/forms/Modal.vue +15 -15
  18. package/src/component/forms/RadioGroup.vue +50 -0
  19. package/src/component/forms/Select.vue +337 -0
  20. package/src/component/forms/SelectStatic.vue +120 -0
  21. package/src/component/forms/TextArea.vue +126 -0
  22. package/src/component/forms/Toggle.vue +13 -13
  23. package/src/component/layout/{Conta.vue → Account.vue} +28 -28
  24. package/src/component/layout/{Alerta.vue → Alert.vue} +22 -22
  25. package/src/component/layout/Badge.vue +23 -23
  26. package/src/component/layout/{BarraFixa.vue → FixedBar.vue} +16 -16
  27. package/src/component/layout/{CarregandoTelaInteira.vue → LoadingFullPage.vue} +3 -3
  28. package/src/component/layout/Menu.vue +66 -66
  29. package/src/component/layout/{Moldura.vue → Molded.vue} +4 -4
  30. package/src/component/layout/Panel.vue +142 -0
  31. package/src/component/layout/Popover.vue +1 -1
  32. package/src/component/layout/{BarraRolagem.vue → Scrollbar.vue} +9 -11
  33. package/src/component/layout/Tag.vue +9 -9
  34. package/src/component/layout/Topo.vue +1 -1
  35. package/src/component/layout/Wizard.vue +3 -3
  36. package/src/component/shared/BotaoCarregarMais.vue +9 -9
  37. package/src/component/shared/BotaoConsulta.vue +9 -9
  38. package/src/component/shared/CabecalhoImpressao.vue +6 -6
  39. package/src/component/shared/CodigoEditor.vue +16 -16
  40. package/src/component/shared/Confirmacao.vue +28 -28
  41. package/src/component/shared/Dica.vue +10 -10
  42. package/src/component/shared/DocumentoEditor.vue +3 -3
  43. package/src/component/shared/DocumentoPreview.vue +2 -2
  44. package/src/component/shared/EsconderMostrar.vue +26 -26
  45. package/src/component/shared/ExportarExcel.vue +14 -14
  46. package/src/component/shared/ExportarPDF.vue +10 -10
  47. package/src/component/shared/FiltroHorizontal.vue +19 -19
  48. package/src/component/shared/LegendaParametro.vue +17 -17
  49. package/src/component/shared/{Carregando.vue → Loading.vue} +11 -11
  50. package/src/component/shared/Messages.vue +83 -0
  51. package/src/component/shared/Paginacao.vue +10 -10
  52. package/src/component/shared/Progresso.vue +2 -2
  53. package/src/component/shared/Registro.vue +2 -2
  54. package/src/component/shared/ResumoTabela.vue +6 -6
  55. package/src/component/shared/SalvarCancelar.vue +26 -26
  56. package/src/component/shared/{Pesquisa.vue → Search.vue} +36 -36
  57. package/src/component/shared/Tabela.vue +49 -49
  58. package/src/component/shared/TabelaBotao.vue +13 -13
  59. package/src/component/shared/Toast.vue +7 -7
  60. package/src/component/shared/{FiltroVertical.vue → VerticalFilter.vue} +14 -14
  61. package/src/component/shared/construtor-consulta/AdicionaFiltro.vue +191 -0
  62. package/src/component/shared/construtor-consulta/Campo.vue +127 -0
  63. package/src/component/shared/construtor-consulta/ComponenteDinamico.vue +109 -0
  64. package/src/component/shared/construtor-consulta/ConstrutorConsulta.vue +70 -0
  65. package/src/component/shared/construtor-consulta/ConverteParaOdata.js +80 -0
  66. package/src/component/shared/construtor-consulta/EscolherFiltro.vue +96 -0
  67. package/src/component/shared/{query-builder → construtor-consulta}/Filtro.vue +11 -16
  68. package/src/component/shared/construtor-consulta/ListaComponenteDinamico.vue +41 -0
  69. package/src/component/shared/{query-builder → construtor-consulta}/Rodape.vue +9 -9
  70. package/src/component/shared/{query-builder → construtor-consulta}/Tags.vue +7 -7
  71. package/src/component/shared/{query-builder → construtor-consulta}/utilities.js +0 -0
  72. package/src/component/template/ModeloAdicionarModificarView.vue +11 -11
  73. package/src/component/template/ModeloDocumentoView.vue +79 -79
  74. package/src/component/template/ModeloLista.vue +66 -66
  75. package/src/component/template/ModeloRelatorioListaView.vue +71 -68
  76. package/src/component/template/ModeloRelatorioView.vue +201 -190
  77. package/src/component/template/ModeloSubView.vue +13 -13
  78. package/src/component/template/ModeloView.vue +17 -17
  79. package/src/component/template/Relatorio.js +1 -5
  80. package/src/component/template/RelatorioAdicionarModificar.vue +44 -44
  81. package/src/component/value-objects/DadosContato.vue +27 -27
  82. package/src/component/value-objects/DadosPessoa.js +1 -1
  83. package/src/component/value-objects/DadosPessoa.vue +52 -52
  84. package/src/component/value-objects/Endereco.js +1 -1
  85. package/src/component/value-objects/Endereco.vue +83 -83
  86. package/src/config/dicas.js +1 -1
  87. package/src/config/token.js +2 -2
  88. package/src/store/modules/generic.js +489 -0
  89. package/src/store/modules/report.js +246 -0
  90. package/src/store/modules/user.js +38 -0
  91. package/src/store/modules/validation.js +39 -0
  92. package/src/store/store.js +4 -4
  93. package/src/component/forms/ArquivoUpload.vue +0 -199
  94. package/src/component/forms/CheckboxMultiplo.vue +0 -63
  95. package/src/component/forms/Decimal.vue +0 -137
  96. package/src/component/forms/Escolher.vue +0 -335
  97. package/src/component/forms/EscolherEstatico.vue +0 -139
  98. package/src/component/forms/Numero.vue +0 -153
  99. package/src/component/forms/Opcoes.vue +0 -51
  100. package/src/component/forms/Senha.vue +0 -139
  101. package/src/component/forms/Texto.vue +0 -161
  102. package/src/component/forms/TextoArea.vue +0 -126
  103. package/src/component/forms/TextoEditor.vue +0 -123
  104. package/src/component/layout/Painel.vue +0 -142
  105. package/src/component/shared/Mensagem.vue +0 -86
  106. package/src/component/shared/query-builder/Campo.vue +0 -116
  107. package/src/component/shared/query-builder/ConverteParaOdata.js +0 -77
  108. package/src/component/shared/query-builder/QueryBuilder.vue +0 -164
  109. package/src/component/shared/query-builder/components/CustomSelect.vue +0 -115
  110. package/src/component/shared/query-builder/components/QueryBuilderChildren.vue +0 -46
  111. package/src/component/shared/query-builder/components/QueryBuilderGroup.vue +0 -151
  112. package/src/component/shared/query-builder/components/QueryBuilderRule.vue +0 -81
  113. package/src/component/shared/query-builder/layouts/Bootstrap/BootstrapGroup.vue +0 -120
  114. package/src/component/shared/query-builder/layouts/Bootstrap/BootstrapRule.vue +0 -187
  115. package/src/component/shared/query-builder/main.js +0 -81
  116. package/src/store/modulos/generic.js +0 -494
  117. package/src/store/modulos/relatorio.js +0 -204
  118. package/src/store/modulos/usuario.js +0 -38
  119. package/src/store/modulos/validation.js +0 -39
@@ -1,110 +1,112 @@
1
1
  <template>
2
2
  <div>
3
3
  <Painel
4
- :modulo="painel.modulo"
5
- :titulo="painel.titulo"
6
- :mostrarFiltroVertical="painel.mostrarFiltroVertical"
7
- :mostrarPesquisa="painel.mostrarPesquisa"
8
- :mostrarBotoes="painel.mostrarBotoes"
4
+ :module="panel.module"
5
+ :title="panel.title"
6
+ :showVerticalFilter="panel.showVerticalFilter"
7
+ :showSearch="panel.showSearch"
8
+ :showButtons="panel.showButtons"
9
9
  >
10
- <div slot="conteudo-principal">
10
+ <div slot="content-main">
11
11
  <br />
12
+ {{ urlConsulta }}
12
13
  <div class="div-progresso" v-if="carregando && tamanhoDados > 0">
13
14
  <Progresso
14
- :texto="`Carregando ${tamanhoDados} registro(s) de ${conteudo.totalRegistros}`"
15
+ :texto="`Carregando ${tamanhoDados} registro(s) de ${content.totalRecords}`"
15
16
  :valor="tamanhoDados"
16
- :maximo="conteudo.totalRegistros"
17
- tamanho="medium"
17
+ :maximo="content.totalRecords"
18
+ size="medium"
18
19
  />
19
20
  </div>
20
- <Modal titulo="Salvar" :largura="550" v-show="mostrarModal('salvar')">
21
- <RelatorioAdicionarModificar :modulo="painel.modulo" />
21
+ <Modal title="Salvar" :width="550" v-show="mostrarModal('salvar')">
22
+ <RelatorioAdicionarModificar :module="panel.module" />
22
23
  </Modal>
23
- <Moldura>
24
+ <Molded>
24
25
  <div>
25
- <div slot="conteudo-filtro-horizontal">
26
+ <div slot="content-filter-horizontal">
26
27
  <b-row>
27
28
  <b-col sm="6">
28
- <div class="lado-a-lado">
29
- <Botao
30
- chave="buscarRelatorio"
31
- tipo="primario"
32
- titulo="Buscar"
33
- classeIcone="fas fa-file-search"
34
- tamanho="medio"
35
- :desabilitado="invalido || btnDesativado"
36
- :clique="obterTodos"
29
+ <div class="side-by-side">
30
+ {{ invalid }}
31
+ <Button
32
+ key="buscarRelatorio"
33
+ type="primary"
34
+ title="Buscar"
35
+ classIcon="fas fa-file-search"
36
+ size="medium"
37
+ :disabled="invalid || btnDesativado"
38
+ :clicked="getAll"
37
39
  />
38
40
  </div>
39
- <div class="lado-a-lado">
40
- <Botao
41
- v-if="!invalido"
42
- chave="salvarRelatorio"
43
- tipo="sucesso"
44
- titulo="Salvar Modelo"
45
- classeIcone="fas fa-save"
46
- :desabilitado="carregando || invalido"
47
- tamanho="pequeno"
48
- :clique="salvarRelatorio"
41
+ <div class="side-by-side">
42
+ <Button
43
+ v-if="!invalid"
44
+ key="salvarRelatorio"
45
+ type="success"
46
+ title="Salvar Modelo"
47
+ classIcon="fas fa-save"
48
+ :disabled="carregando || invalid"
49
+ size="small"
50
+ :clicked="salvarRelatorio"
49
51
  />
50
52
  </div>
51
53
  </b-col>
52
54
  <b-col class="text-right" sm="6">
53
- <div class="lado-a-lado">
54
- <Botao
55
- chave="abrirCampo"
56
- tipo="info"
57
- titulo="Campos"
58
- classeIcone="fas fa-database"
59
- tamanho="pequeno"
60
- :desabilitado="carregando"
61
- :clique="abrirCampo"
55
+ <div class="side-by-side">
56
+ <Button
57
+ key="abrirCampo"
58
+ type="info"
59
+ title="fields"
60
+ classIcon="fas fa-database"
61
+ size="small"
62
+ :disabled="carregando"
63
+ :clicked="abrirCampo"
62
64
  />
63
65
  </div>
64
- <div class="lado-a-lado">
65
- <Botao
66
- chave="abrirFiltro"
67
- tipo="info"
68
- titulo="Filtros"
69
- classeIcone="fas fa-filter"
70
- tamanho="pequeno"
71
- :desabilitado="carregando"
72
- :clique="abrirFiltro"
66
+ <div class="side-by-side">
67
+ <Button
68
+ key="abrirFiltro"
69
+ type="info"
70
+ title="Filtros"
71
+ classIcon="fas fa-filter"
72
+ size="small"
73
+ :disabled="carregando"
74
+ :clicked="abrirFiltro"
73
75
  />
74
76
  </div>
75
77
  </b-col>
76
78
  </b-row>
77
- <Modal titulo="Filtros" :largura="900" v-show="mostrarModal('filtro')">
78
- <slot name="filtro"></slot>
79
+ <Modal title="Filtros" :width="900" v-show="mostrarModal('filter')">
80
+ <slot name="filter"></slot>
79
81
  <br />
80
82
  <b-row>
81
83
  <b-col class="text-right" sm="12">
82
- <div class="lado-a-lado">
83
- <Botao
84
- chave="aplicaFiltro"
85
- tipo="primario"
86
- titulo="Aplicar"
87
- classeIcone="fas fa-filter"
88
- tamanho="pequeno"
89
- :clique="aplicarFiltro"
84
+ <div class="side-by-side">
85
+ <Button
86
+ key="aplicaFiltro"
87
+ type="primary"
88
+ title="Aplicar"
89
+ classIcon="fas fa-filter"
90
+ size="small"
91
+ :clicked="aplicarFiltro"
90
92
  />
91
93
  </div>
92
94
  </b-col>
93
95
  </b-row>
94
96
  </Modal>
95
- <Modal titulo="Campos" :largura="600" v-show="mostrarModal('campo')">
96
- <slot name="campo"></slot>
97
+ <Modal title="fields" :width="600" v-show="mostrarModal('field')">
98
+ <slot name="field"></slot>
97
99
  <b-row>
98
100
  <b-col class="text-right" sm="12">
99
- <div class="lado-a-lado">
100
- <Botao
101
- chave="aplicaFiltro"
102
- tipo="primario"
103
- titulo="Aplicar"
104
- classeIcone="fas fa-filter"
105
- tamanho="pequeno"
106
- :desabilitado="campoSelecionado.length == 0"
107
- :clique="aplicarFiltro"
101
+ <div class="side-by-side">
102
+ <Button
103
+ key="aplicaFiltro"
104
+ type="primary"
105
+ title="Aplicar"
106
+ classIcon="fas fa-filter"
107
+ size="small"
108
+ :disabled="selectedField.length == 0"
109
+ :clicked="aplicarFiltro"
108
110
  />
109
111
  </div>
110
112
  </b-col>
@@ -112,66 +114,67 @@
112
114
  </Modal>
113
115
  </div>
114
116
  </div>
115
- </Moldura>
116
- <div class="div-obrigatorio" v-show="invalido">
117
- <Alerta tipo="info" v-for="item in filtroObrigatorio" :key="item.id">
118
- É necessário informar o filtro
119
- <span class="filtro-obrigatorio">{{ item.label }}</span
120
- >, clique no botão "Filtros" para adicionar.
121
- </Alerta>
117
+ </Molded>
118
+ <div class="div-obrigatorio" v-show="invalid">
119
+ <Alert type="info" v-for="item in requiredRules" :key="item.id">
120
+ É necessário informar o filter
121
+ <span class="filter-obrigatorio">{{ item.title }}</span
122
+ >, clicked no botão "Filtros" para adicionar.
123
+ </Alert>
122
124
  </div>
123
125
  <div class="div-tags">
124
126
  <Tags nomeEvento="tagRelatorio" />
125
127
  </div>
126
- <div class="g-div-moldura div-tabela" v-if="!carregando && tamanhoDados > 0">
128
+ <div class="g-div-molded div-tabela" v-if="!carregando && tamanhoDados > 0">
127
129
  <b-row>
128
130
  <b-col sm="6">
129
131
  <div class="div-botao">
130
- <div class="lado-a-lado">
132
+ <div class="side-by-side">
131
133
  <ExportarExcel
132
- :botao="{ tipo: 'editar', titulo: 'Excel', tamanho: 'pequeno' }"
134
+ :botao="{ type: 'edit', title: 'Excel', size: 'small' }"
133
135
  nomeArquivo="Auditoria"
134
- :cabecalho="conteudo.cabecalhoTabela"
135
- :dados="conteudo.dados"
136
+ :cabecalho="content.headerTable"
137
+ :data="content.data"
136
138
  />
137
139
  </div>
138
- <div class="lado-a-lado">
140
+ <div class="side-by-side">
139
141
  <div>
140
- <Botao
142
+ <Button
141
143
  v-print="'#printMe'"
142
- chave="aplicaFiltro"
143
- tipo="editar"
144
- titulo="Imprimir"
145
- classeIcone="fas fa-print"
146
- tamanho="pequeno"
147
- :clique="aplicarFiltro"
144
+ key="aplicaFiltro"
145
+ type="edit"
146
+ title="Imprimir"
147
+ classIcon="fas fa-print"
148
+ size="small"
149
+ :clicked="aplicarFiltro"
148
150
  />
149
151
  </div>
150
152
  </div>
151
153
  </div>
152
154
  </b-col>
153
155
  <b-col sm="6">
154
- <Registro :totalRegistro="conteudo.totalRegistros" />
156
+ <Registro :totalRegistro="content.totalRecords" />
155
157
  </b-col>
156
158
  </b-row>
157
- <BarraRolagem :alturaMinima="400" :alturaMaxima="600">
159
+ <BarraRolagem :minHeight="400" :maxHeight="600">
158
160
  <div id="printMe">
159
161
  <CabecalhoImpressao />
162
+ {{ content.headerTable }}
160
163
  <Tabela
161
- :cabecalhoTabela="conteudo.cabecalhoTabela"
162
- :dados="conteudo.dados"
164
+ :headerTable="content.headerTable"
165
+ :data="content.data"
163
166
  :mostrarChecks="modeloLista.mostrarChecks"
164
167
  />
165
168
  </div>
166
169
  </BarraRolagem>
167
170
  </div>
168
- <div class="div-sem-dados" v-if="nenhumDadoRetornado">
169
- <Alerta tipo="info">
171
+ <div class="div-sem-data" v-if="nenhumDadoRetornado">
172
+ <Alert type="info">
170
173
  <span> Nenhum registro foi encontrato!</span>
171
- </Alerta>
174
+ </Alert>
172
175
  </div>
173
- <div class="div-rodape" v-if="conteudo.resumo.length > 0">
174
- <Rodape :dados="conteudo.resumo" />
176
+ <div class="div-rodape" v-if="content.totalization.length > 0">
177
+ <Rodape :data="content.totalization" />
175
178
  </div>
176
179
  </div>
177
180
  </Painel>
@@ -179,19 +182,19 @@
179
182
  </template>
180
183
 
181
184
  <script>
182
- import Alerta from "@nixweb/nixloc-ui/src/component/layout/Alerta";
185
+ import Alert from "@nixweb/nixloc-ui/src/component/layout/Alert";
183
186
  import Modal from "@nixweb/nixloc-ui/src/component/forms/Modal";
184
- import Botao from "@nixweb/nixloc-ui/src/component/forms/Botao";
187
+ import Button from "@nixweb/nixloc-ui/src/component/forms/Button";
185
188
  import ExportarExcel from "@nixweb/nixloc-ui/src/component/shared/ExportarExcel";
186
189
  import Tabela from "../shared/Tabela.vue";
187
190
  import CabecalhoImpressao from "../shared/CabecalhoImpressao.vue";
188
191
  import Registro from "../shared/Registro.vue";
189
192
  import Painel from "@nixweb/nixloc-ui/src/component/layout/Painel.vue";
190
193
  import BarraRolagem from "@nixweb/nixloc-ui/src/component/layout/BarraRolagem.vue";
191
- import Moldura from "@nixweb/nixloc-ui/src/component/layout/Moldura";
194
+ import Molded from "@nixweb/nixloc-ui/src/component/layout/Molded";
192
195
  import Progresso from "@nixweb/nixloc-ui/src/component/shared/Progresso";
193
- import Rodape from "@nixweb/nixloc-ui/src/component/shared/query-builder/Rodape.vue";
194
- import Tags from "@nixweb/nixloc-ui/src/component/shared/query-builder/Tags.vue";
196
+ import Rodape from "@nixweb/nixloc-ui/src/component/shared/construtor-consulta/Rodape.vue";
197
+ import Tags from "@nixweb/nixloc-ui/src/component/shared/construtor-consulta/Tags.vue";
195
198
  import RelatorioAdicionarModificar from "@nixweb/nixloc-ui/src/component/template/RelatorioAdicionarModificar.vue";
196
199
  import print from "vue-print-nb";
197
200
 
@@ -204,18 +207,18 @@ export default {
204
207
  },
205
208
  props: {
206
209
  modeloLista: Object,
207
- campo: Array,
208
- painel: Object,
210
+ field: Array,
211
+ panel: Object,
209
212
  },
210
213
  components: {
211
- Alerta,
214
+ Alert,
212
215
  Modal,
213
- Botao,
216
+ Button,
214
217
  Registro,
215
218
  Tabela,
216
219
  Painel,
217
220
  BarraRolagem,
218
- Moldura,
221
+ Molded,
219
222
  Rodape,
220
223
  Progresso,
221
224
  Tags,
@@ -225,14 +228,14 @@ export default {
225
228
  },
226
229
  data() {
227
230
  return {
228
- conteudo: {
229
- cabecalhoTabela: [],
230
- dados: [],
231
- resumo: [],
231
+ content: {
232
+ headerTable: [],
233
+ data: [],
234
+ totalization: [],
232
235
  paginacao: 0,
233
- paginaAtual: 1,
234
- totalPorPagina: 100,
235
- totalRegistros: 0,
236
+ currentPage: 1,
237
+ totalPerPage: 100,
238
+ totalRecords: 0,
236
239
  },
237
240
  btnDesativado: true,
238
241
  carregando: false,
@@ -241,67 +244,80 @@ export default {
241
244
  };
242
245
  },
243
246
  mounted() {
244
- this.removeCarregando(["painel"]);
247
+ this.removeLoading(["panel"]);
248
+ },
249
+ beforeDestroy() {
250
+ this.updateOptionsInitValue({});
251
+ this.atualizaCampoOrdenado({});
252
+ this.atualizaFiltroSelecionado({ children: [] });
245
253
  },
246
254
  computed: {
247
255
  ...mapGetters("generic", ["mostrarModal", "evento"]),
248
- ...mapGetters("relatorio", [
249
- "cabecalhoTabela",
250
- "filtroSelecionado",
251
- "filtroObrigatorio",
252
- "temCampoSelecionado",
256
+ ...mapGetters("report", [
257
+ "headerTable",
258
+ "selectedRules",
259
+ "requiredRules",
260
+ "regraObrigatoriaJaAdicionada",
261
+ "hasSelectedField",
253
262
  "oDataSelect",
254
263
  "oDataFilter",
255
264
  "oDataOrderBy",
256
265
  ]),
257
- ...mapState("relatorio", ["relatorio", "campoSelecionado", "resumo"]),
266
+ ...mapState("report", ["report", "selectedField", "totalization"]),
258
267
  urlConsulta() {
259
- let baseUrl = `${this.modeloLista.urlGetApi}?${this.oDataSelect}&${this.oDataOrderBy}&${this.oDataFilter.consulta}&$skip=${this.skip}&$top=${this.conteudo.totalPorPagina}&$count=true`;
268
+ let baseUrl = `${this.modeloLista.urlGetApi}?${this.oDataSelect}&${this.oDataOrderBy}&${this.oDataFilter.consulta}&$skip=${this.skip}&$top=${this.content.totalPerPage}&$count=true`;
260
269
  return baseUrl.replace("&&", "&");
261
270
  },
262
271
  urlResumo() {
263
- let consulta = this.oDataFilter.resumo
272
+ let consulta = this.oDataFilter.totalization
264
273
  ? `$apply=filter(${this.oDataFilter.consulta.replace("$filter=", "")})/`
265
274
  : "$apply=";
266
- let baseUrl = `${this.modeloLista.urlGetApi}?${consulta}aggregate(${this.oDataFilter.resumo})`;
275
+ let baseUrl = `${this.modeloLista.urlGetApi}?${consulta}aggregate(${this.oDataFilter.totalization})`;
267
276
  return baseUrl;
268
277
  },
269
278
  skip() {
270
- return (this.conteudo.paginaAtual - 1) * this.conteudo.totalPorPagina;
279
+ return (this.content.currentPage - 1) * this.content.totalPerPage;
271
280
  },
272
- invalido() {
281
+ invalid() {
273
282
  let retorno = true;
274
- this.filtroObrigatorio.forEach((filtro) => {
275
- var existe = this.filtroSelecionado.children.find((value) => {
276
- if (filtro.label == value.query.label) retorno = false;
277
- });
283
+ this.requiredRules.forEach((rule) => {
284
+ retorno = this.regraObrigatoriaJaAdicionada(rule);
278
285
  });
279
286
 
280
- if (this.filtroObrigatorio.length == 0) retorno = false;
287
+ if (this.requiredRules.length == 0) retorno = false;
281
288
 
282
289
  return retorno;
283
290
  },
284
291
  tamanhoDados() {
285
- return this.conteudo.dados.length;
292
+ return this.content.data.length;
286
293
  },
287
294
  },
288
295
  methods: {
289
296
  ...mapActions("generic", ["getApiOdata"]),
290
- ...mapMutations("generic", ["abrirModal", "fecharModal", "removeCarregando"]),
291
- ...mapMutations("relatorio", ["atualizaCabecalhoTabela", "atualizaConsultaFiltro"]),
292
-
293
- obterTodos() {
294
- this.conteudo.dados = [];
295
- this.conteudo.resumo = [];
297
+ ...mapMutations("generic", [
298
+ "addEvent",
299
+ "abrirModal",
300
+ "hideModal",
301
+ "removeLoading",
302
+ ]),
303
+ ...mapMutations("report", [
304
+ "atualizaFiltroSelecionado",
305
+ "atualizaCampoOrdenado",
306
+ "updateOptionsInitValue",
307
+ "atualizaCabecalhoTabela",
308
+ ]),
309
+ getAll() {
310
+ this.content.data = [];
311
+ this.content.totalization = [];
296
312
  this.btnDesativado = true;
297
313
 
298
- if (!this.invalido) {
314
+ if (!this.invalid) {
299
315
  this.mostraEscondeCampos();
300
316
  this.paginacao();
301
- this.removeCarregando(["buscarRelatorio"]);
317
+ this.removeLoading(["buscarRelatorio"]);
302
318
 
303
- if (this.oDataFilter.resumo) this.resumoOData();
304
- if (!this.oDataFilter.resumo) this.conteudo.resumo = [];
319
+ if (this.oDataFilter.totalization) this.resumoOData();
320
+ if (!this.oDataFilter.totalization) this.content.totalization = [];
305
321
  }
306
322
  },
307
323
  paginacao() {
@@ -309,24 +325,24 @@ export default {
309
325
  this.reiniciaDados();
310
326
 
311
327
  this.getApiOdata(paramsConsulta).then((response) => {
312
- let totalRegistros = response["@odata.count"];
313
- if (totalRegistros == 0) this.nenhumDadoRetornado = true;
314
- this.conteudo.totalRegistros = totalRegistros;
315
- this.conteudo.paginacao = Math.round(
316
- totalRegistros / this.conteudo.totalPorPagina
328
+ let totalRecords = response["@odata.count"];
329
+ if (totalRecords == 0) this.nenhumDadoRetornado = true;
330
+ this.content.totalRecords = totalRecords;
331
+ this.content.paginacao = Math.round(
332
+ totalRecords / this.content.totalPerPage
317
333
  );
318
334
 
319
- if (totalRegistros <= this.conteudo.totalPorPagina) {
335
+ if (totalRecords <= this.content.totalPerPage) {
320
336
  this.consultaOdata();
321
- this.conteudo.cabecalhoTabela = this.cabecalhoTabela;
337
+ this.content.headerTable = this.headerTable;
322
338
  }
323
- if (this.conteudo.paginacao == 0) this.carregando = false;
339
+ if (this.content.paginacao == 0) this.carregando = false;
324
340
  });
325
341
  },
326
342
  reiniciaDados() {
327
343
  this.carregando = true;
328
- this.conteudo.dados = [];
329
- this.conteudo.paginaAtual = 1;
344
+ this.content.data = [];
345
+ this.content.currentPage = 1;
330
346
  this.nenhumDadoRetornado = false;
331
347
  },
332
348
  consultaOdata() {
@@ -334,57 +350,58 @@ export default {
334
350
  this.getApiOdata(paramsConsulta).then((response) => {
335
351
  let self = this;
336
352
  response.value.forEach(function (obj) {
337
- self.conteudo.dados.push(obj);
353
+ self.content.data.push(obj);
338
354
  });
339
- this.conteudo.paginaAtual++;
355
+ this.content.currentPage++;
340
356
  });
341
- this.conteudo.cabecalhoTabela = this.cabecalhoTabela;
357
+ this.content.headerTable = this.headerTable;
342
358
  },
343
359
  resumoOData() {
344
360
  let paramsResumo = { url: this.urlResumo };
345
361
  this.getApiOdata(paramsResumo).then((response) => {
346
- this.conteudo.resumo = [];
362
+ this.content.totalization = [];
347
363
  const result = Object.entries(response[0]);
348
364
  let self = this;
349
365
  result.forEach(function (value) {
350
- self.resumo.forEach(function (legenda) {
366
+ self.totalization.forEach(function (legenda) {
351
367
  let obj = {
352
- titulo: "",
368
+ title: "",
353
369
  valor: value[1],
354
370
  classeCss: legenda.classeCss,
355
- tipo: legenda.tipo,
371
+ type: legenda.type,
356
372
  };
357
373
  if (legenda.valor == value[0]) {
358
- obj.titulo = legenda.titulo;
359
- self.conteudo.resumo.push(obj);
374
+ obj.title = legenda.title;
375
+ self.content.totalization.push(obj);
360
376
  }
361
377
  });
362
378
  });
363
379
  });
364
380
  },
365
381
  abrirCampo() {
366
- this.abrirModal("campo");
367
- this.removeCarregando(["abrirCampo"]);
382
+ this.abrirModal("field");
383
+ this.removeLoading(["abrirCampo"]);
368
384
  },
369
385
  abrirFiltro() {
370
- this.abrirModal("filtro");
371
- this.removeCarregando(["abrirFiltro"]);
386
+ this.abrirModal("filter");
387
+ this.removeLoading(["abrirFiltro"]);
372
388
  },
373
389
  aplicarFiltro() {
374
- this.fecharModal();
375
- this.removeCarregando(["aplicaFiltro", "aplicaCampo"]);
390
+ this.hideModal();
391
+ this.removeLoading(["aplicaFiltro", "aplicaCampo"]);
376
392
  },
377
393
  salvarRelatorio() {
394
+ this.addEvent({ nome: "modificarRelatorio" });
378
395
  this.abrirModal("salvar");
379
- this.removeCarregando(["salvarRelatorio"]);
396
+ this.removeLoading(["salvarRelatorio"]);
380
397
  },
381
398
  mostraEscondeCampos() {
382
399
  let self = this;
383
- this.relatorio.campo.forEach(function (value) {
384
- if (self.temCampoSelecionado(value.campo, self.campoSelecionado)) {
385
- value.mostrar = true;
400
+ this.report.fields.forEach(function (field) {
401
+ if (self.hasSelectedField(field.field, self.selectedField)) {
402
+ value.show = true;
386
403
  } else {
387
- value.mostrar = false;
404
+ value.show = false;
388
405
  }
389
406
  });
390
407
  },
@@ -392,36 +409,30 @@ export default {
392
409
  watch: {
393
410
  evento: {
394
411
  handler(evento) {
395
- if (evento.nome == "tagRelatorio") this.abrirModal("filtro");
412
+ if (evento.nome == "tagRelatorio") this.abrirModal("filter");
396
413
  },
397
414
  deep: true,
398
415
  },
399
- campoSelecionado: {
416
+ selectedField: {
400
417
  handler() {
401
418
  this.mostraEscondeCampos();
402
419
  },
403
420
  deep: true,
404
421
  },
405
- filtroSelecionado: {
406
- handler(filtro) {
407
- this.atualizaConsultaFiltro(filtro);
408
- },
409
- deep: true,
410
- },
411
- "conteudo.paginaAtual": {
412
- handler(paginaAtual) {
413
- if (paginaAtual <= this.conteudo.paginacao - 1) {
422
+ "content.currentPage": {
423
+ handler(currentPage) {
424
+ if (currentPage <= this.content.paginacao - 1) {
414
425
  let self = this;
415
426
  setTimeout(function () {
416
427
  self.consultaOdata();
417
428
  }, 200);
418
429
  }
419
- if (paginaAtual == this.conteudo.paginacao && paginaAtual != 0)
430
+ if (currentPage == this.content.paginacao && currentPage != 0)
420
431
  this.carregando = false;
421
432
  },
422
433
  deep: true,
423
434
  },
424
- "conteudo.paginacao": {
435
+ "content.paginacao": {
425
436
  handler() {
426
437
  this.consultaOdata();
427
438
  },
@@ -458,7 +469,7 @@ export default {
458
469
  margin-bottom: 10px;
459
470
  }
460
471
 
461
- .div-sem-dados {
472
+ .div-sem-data {
462
473
  margin-top: 20px;
463
474
  }
464
475
 
@@ -483,7 +494,7 @@ export default {
483
494
  margin-top: 20px;
484
495
  }
485
496
 
486
- .filtro-obrigatorio {
497
+ .filter-obrigatorio {
487
498
  font-weight: 500;
488
499
  }
489
500
  </style>