@nixweb/nixloc-ui 0.0.124 → 0.0.127

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. package/docs/src/component/template/ViewTemplateReportPreview.drawio +210 -0
  2. package/package.json +3 -1
  3. package/src/component/forms/Button.vue +7 -6
  4. package/src/component/forms/CheckboxGroup.vue +7 -4
  5. package/src/component/forms/CheckboxSimple.vue +17 -2
  6. package/src/component/forms/DateTime.vue +15 -29
  7. package/src/component/forms/EditorHtml.vue +8 -5
  8. package/src/component/forms/FileUpload.vue +7 -11
  9. package/src/component/forms/ImageUpload.vue +222 -0
  10. package/src/component/forms/InputDecimal.vue +10 -9
  11. package/src/component/forms/InputNumber.vue +20 -15
  12. package/src/component/forms/InputPassword.vue +1 -1
  13. package/src/component/forms/InputText.vue +3 -3
  14. package/src/component/forms/Modal.vue +9 -4
  15. package/src/component/forms/Select.vue +12 -9
  16. package/src/component/forms/SelectStatic.vue +8 -1
  17. package/src/component/layout/Menu.vue +4 -3
  18. package/src/component/layout/Panel.vue +0 -2
  19. package/src/component/layout/{Scrollbar.vue → ScrollBar.vue} +4 -5
  20. package/src/component/layout/Tag.vue +3 -3
  21. package/src/component/layout/Wizard.vue +11 -13
  22. package/src/component/shared/BodyReport.vue +186 -0
  23. package/src/component/shared/Confirmation.vue +2 -2
  24. package/src/component/shared/DocumentEditor.vue +1 -1
  25. package/src/component/shared/ExportExcel.vue +1 -8
  26. package/src/component/shared/{HeaderPrint.vue → HeaderReport.vue} +3 -3
  27. package/src/component/shared/HorizontalFilter.vue +1 -1
  28. package/src/component/shared/Loading.vue +1 -1
  29. package/src/component/shared/Messages.vue +2 -4
  30. package/src/component/shared/Pagination.vue +4 -5
  31. package/src/component/shared/{LegendaParametro.vue → ParameterLegend.vue} +25 -29
  32. package/src/component/shared/ProgressBar.vue +2 -1
  33. package/src/component/shared/SaveCancel.vue +20 -4
  34. package/src/component/shared/Search.vue +16 -16
  35. package/src/component/shared/SelectOption.vue +137 -0
  36. package/src/component/shared/Table.vue +33 -22
  37. package/src/component/shared/TableButton.vue +3 -3
  38. package/src/component/shared/TableTotalRecords.vue +9 -10
  39. package/src/component/shared/Toast.vue +2 -2
  40. package/src/component/shared/VerticalFilter.vue +2 -50
  41. package/src/component/shared/query-builder/AddRule.vue +49 -55
  42. package/src/component/shared/query-builder/ConvertToOdata.js +39 -42
  43. package/src/component/shared/query-builder/DynamicComponent.vue +16 -15
  44. package/src/component/shared/query-builder/DynamicComponentList.vue +62 -0
  45. package/src/component/shared/query-builder/Fields.vue +32 -66
  46. package/src/component/shared/query-builder/QueryBuilder.vue +12 -12
  47. package/src/component/shared/query-builder/Rules.vue +2 -14
  48. package/src/component/shared/query-builder/SelectRule.vue +15 -15
  49. package/src/component/shared/query-builder/Tags.vue +24 -8
  50. package/src/component/template/{ListViewWithHandlerData.vue → ListViewWithDataHandler.vue} +30 -23
  51. package/src/component/template/{AddEditReport.vue → ReportCreateUpdate.vue} +31 -20
  52. package/src/component/template/ViewTemplateConfiguration.vue +6 -12
  53. package/src/component/template/ViewTemplateDocumentView.vue +21 -25
  54. package/src/component/template/ViewTemplateReportList.vue +39 -57
  55. package/src/component/template/ViewTemplateReportPreview.vue +238 -354
  56. package/src/component/template/ViewTemplateReportPreviewCOPIASEGURANCA.vue +497 -0
  57. package/src/component/template/ViewTemplateSelectOption.vue +60 -0
  58. package/src/component/template/ViewTemplateWithTable.vue +21 -14
  59. package/src/component/template/model/Report.js +2 -2
  60. package/src/component/value-objects/Address.js +11 -0
  61. package/src/component/value-objects/{Endereco.vue → Address.vue} +39 -40
  62. package/src/component/value-objects/{DadosContato.js → Contact.js} +2 -2
  63. package/src/component/value-objects/{DadosContato.vue → Contact.vue} +17 -17
  64. package/src/component/value-objects/Person.js +10 -0
  65. package/src/component/value-objects/{DadosPessoa.vue → Person.vue} +35 -35
  66. package/src/store/modules/generic.js +17 -11
  67. package/src/store/modules/report.js +124 -113
  68. package/src/store/modules/user.js +3 -0
  69. package/docs/src/component/template/ModeloRelatorioView.drawio +0 -160
  70. package/src/component/shared/query-builder/ListDynamicComponent.vue +0 -42
  71. package/src/component/value-objects/DadosPessoa.js +0 -10
  72. package/src/component/value-objects/Endereco.js +0 -11
@@ -9,450 +9,326 @@
9
9
  >
10
10
  <div slot="content-main">
11
11
  <br />
12
- {{ urlConsulta }}
13
- <div class="div-progresso" v-if="carregando && tamanhoDados > 0">
12
+ <div class="div-progress" v-if="liveTotalRecords != baseParams.totalRecords">
14
13
  <ProgressBar
15
- :texto="`Loading ${tamanhoDados} registro(s) de ${content.totalRecords}`"
16
- :valor="tamanhoDados"
17
- :maximo="content.totalRecords"
14
+ :text="`Carregando ${liveTotalRecords} registro(s) de ${baseParams.totalRecords}`"
15
+ :value="liveTotalRecords"
16
+ :max="baseParams.totalRecords"
18
17
  size="medium"
19
18
  />
20
19
  </div>
21
- <Modal title="Salvar" :width="550" v-show="showModal('salvar')">
22
- <AddEditReport :module="panel.module" />
23
- </Modal>
24
20
  <Molded>
25
- <div>
26
- <div slot="content-filter-horizontal">
27
- <b-row>
28
- <b-col sm="6">
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"
39
- />
40
- </div>
41
- <div class="side-by-side">
42
- <Button
43
- v-if="!invalid"
44
- key="saveReport"
45
- type="success"
46
- title="Salvar Modelo"
47
- classIcon="fas fa-save"
48
- :disabled="carregando || invalid"
49
- size="small"
50
- :clicked="saveReport"
51
- />
52
- </div>
53
- </b-col>
54
- <b-col class="text-right" sm="6">
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"
64
- />
65
- </div>
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"
75
- />
76
- </div>
77
- </b-col>
78
- </b-row>
79
- <Modal title="Filtros" :width="900" v-show="showModal('filter')">
80
- <slot name="filter"></slot>
81
- <br />
82
- <b-row>
83
- <b-col class="text-right" sm="12">
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"
92
- />
93
- </div>
94
- </b-col>
95
- </b-row>
96
- </Modal>
97
- <Modal title="fields" :width="600" v-show="showModal('field')">
98
- <slot name="field"></slot>
99
- <b-row>
100
- <b-col class="text-right" sm="12">
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"
110
- />
111
- </div>
112
- </b-col>
113
- </b-row>
114
- </Modal>
115
- </div>
116
- </div>
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>
124
- </div>
125
- <div class="div-tags">
126
- <Tags eventName="tagRelatorio" />
127
- </div>
128
- <div class="g-div-molded div-tabela" v-if="!carregando && tamanhoDados > 0">
129
21
  <b-row>
130
22
  <b-col sm="6">
131
- <div class="div-button">
132
- <div class="side-by-side">
133
- <ExportExcel
134
- :button="{ type: 'edit', title: 'Excel', size: 'small' }"
135
- fileName="Auditoria"
136
- :cabecalho="content.headerTable"
137
- :data="content.data"
138
- />
139
- </div>
140
- <div class="side-by-side">
141
- <div>
142
- <Button
143
- v-print="'#printMe'"
144
- key="aplicaFiltro"
145
- type="edit"
146
- title="Imprimir"
147
- classIcon="fas fa-print"
148
- size="small"
149
- :clicked="aplicarFiltro"
150
- />
151
- </div>
152
- </div>
23
+ <div class="side-by-side">
24
+ <Button
25
+ _key="btnSearchReport"
26
+ type="primary"
27
+ title="Buscar"
28
+ classIcon="fas fa-file-search"
29
+ :disabled="btnSaveDisabled || !rulesIsValid"
30
+ size="medium"
31
+ :clicked="getAll"
32
+ />
33
+ </div>
34
+ <div class="side-by-side">
35
+ <Button
36
+ _key="btnSaveReport"
37
+ type="success"
38
+ title="Salvar"
39
+ classIcon="fas fa-save"
40
+ size="small"
41
+ :disabled="isLoading || !rulesIsValid"
42
+ :params="{ name: 'save', title: 'Salvar', width: 550 }"
43
+ :clicked="executeOpenModal"
44
+ />
153
45
  </div>
154
46
  </b-col>
155
- <b-col sm="6">
156
- <TableTotalRecords :totalRecords="content.totalRecords" />
47
+ <b-col class="text-right" sm="6">
48
+ <div class="side-by-side">
49
+ <Button
50
+ _key="btnExecuteOpenModal"
51
+ type="info"
52
+ title="Campos"
53
+ classIcon="fas fa-database"
54
+ size="small"
55
+ :disabled="isLoading"
56
+ :params="{ name: 'fields', title: 'Campos', width: 550 }"
57
+ :clicked="executeOpenModal"
58
+ />
59
+ </div>
60
+ <div class="side-by-side">
61
+ <Button
62
+ _key="btnExecuteOpenModal"
63
+ type="info"
64
+ title="Filtros"
65
+ classIcon="fas fa-filter"
66
+ size="small"
67
+ :disabled="isLoading"
68
+ :params="{ name: 'rules', title: 'Filtros', width: 900 }"
69
+ :clicked="executeOpenModal"
70
+ />
71
+ </div>
157
72
  </b-col>
158
73
  </b-row>
159
- <ScrollBar :minHeight="400" :maxHeight="600">
160
- <div id="printMe">
161
- <HeaderPrint />
162
- {{ content.headerTable }}
163
- <Table
164
- :headerTable="content.headerTable"
165
- :data="content.data"
166
- :showChecks="templateList.showChecks"
167
- />
168
- </div>
169
- </ScrollBar>
74
+ </Molded>
75
+ <div class="div-tags">
76
+ <Tags eventName="tagReport" />
170
77
  </div>
171
- <div class="div-sem-data" v-if="nenhumDadoRetornado">
172
- <Alert type="info">
173
- <span> Nenhum registro foi encontrato!</span>
78
+ <div class="div-required" v-show="!rulesIsValid">
79
+ <Alert type="warning" v-for="rule in rulesRequired" :key="rule.id">
80
+ É necessário informar o filtro
81
+ <span class="filter-required">{{ rule.title }}</span
82
+ >, clique no botão "Filtros" para adicionar.
174
83
  </Alert>
175
84
  </div>
176
- <div class="div-rodape" v-if="content.totalization.length > 0">
177
- <Rodape :data="content.totalization" />
85
+ <div class="body-report" v-show="showBodyReport && rulesIsValid">
86
+ <BodyReport :header="content.headerTable" :data="content.data" />
178
87
  </div>
179
88
  </div>
180
89
  </Panel>
90
+ <Modal
91
+ :title="modalOptions.title"
92
+ :width="modalOptions.width"
93
+ v-show="showModal('templateReport')"
94
+ >
95
+ <ReportCreateUpdate :module="panel.module" v-show="modalOptions.name == 'save'" />
96
+ <Fields v-if="modalOptions.name == 'fields'" />
97
+ <Rules v-show="modalOptions.name == 'rules'" />
98
+ <div
99
+ class="text-right btn-apply"
100
+ v-show="modalOptions.name == 'fields' || modalOptions.name == 'rules'"
101
+ >
102
+ <Button
103
+ _key="btnApplyFieldsAndRules"
104
+ type="primary"
105
+ title="Aplicar"
106
+ classIcon="fas fa-filter"
107
+ size="small"
108
+ :clicked="applyFieldsAndRules"
109
+ />
110
+ </div>
111
+ </Modal>
181
112
  </div>
182
113
  </template>
183
114
 
184
115
  <script>
185
- import Alert from "@nixweb/nixloc-ui/src/component/layout/Alert";
186
- import Modal from "@nixweb/nixloc-ui/src/component/forms/Modal";
187
- import Button from "@nixweb/nixloc-ui/src/component/forms/Button";
188
- import ExportExcel from "@nixweb/nixloc-ui/src/component/shared/ExportExcel";
189
- import Table from "../shared/Table.vue";
190
- import HeaderPrint from "../shared/HeaderPrint.vue";
191
- import TableTotalRecords from "../shared/TableTotalRecords.vue";
192
116
  import Panel from "@nixweb/nixloc-ui/src/component/layout/Panel.vue";
193
- import ScrollBar from "@nixweb/nixloc-ui/src/component/layout/ScrollBar.vue";
194
117
  import Molded from "@nixweb/nixloc-ui/src/component/layout/Molded";
195
118
  import ProgressBar from "@nixweb/nixloc-ui/src/component/shared/ProgressBar";
196
- import Rodape from "@nixweb/nixloc-ui/src/component/shared/construtor-query/Rodape.vue";
197
- import Tags from "@nixweb/nixloc-ui/src/component/shared/construtor-query/Tags.vue";
198
- import AddEditReport from "@nixweb/nixloc-ui/src/component/template/AddEditReport.vue";
199
- import print from "vue-print-nb";
119
+ import Button from "@nixweb/nixloc-ui/src/component/forms/Button";
120
+ import Modal from "@nixweb/nixloc-ui/src/component/forms/Modal";
121
+ import Alert from "@nixweb/nixloc-ui/src/component/layout/Alert";
122
+ import Tags from "@nixweb/nixloc-ui/src/component/shared/query-builder/Tags.vue";
123
+ import BodyReport from "../shared/BodyReport.vue";
124
+
125
+ import ReportCreateUpdate from "@nixweb/nixloc-ui/src/component/template/ReportCreateUpdate.vue";
126
+ import Fields from "@nixweb/nixloc-ui/src/component/shared/query-builder/Fields.vue";
127
+ import Rules from "@nixweb/nixloc-ui/src/component/shared/query-builder/Rules.vue";
200
128
 
201
129
  import { mapState, mapGetters, mapActions, mapMutations } from "vuex";
202
130
 
203
131
  export default {
204
132
  name: "TemplateReportView",
205
- directives: {
206
- print,
207
- },
208
133
  props: {
209
- templateList: Object,
210
- field: Array,
211
134
  panel: Object,
135
+ templateList: Object,
136
+ templateReport: Object,
212
137
  },
213
138
  components: {
214
- Alert,
215
- Modal,
216
- Button,
217
- TableTotalRecords,
218
- Table,
219
139
  Panel,
220
- ScrollBar,
221
140
  Molded,
222
- Rodape,
223
141
  ProgressBar,
142
+ Button,
143
+ Modal,
144
+ Alert,
224
145
  Tags,
225
- AddEditReport,
226
- ExportExcel,
227
- HeaderPrint,
146
+ BodyReport,
147
+ ReportCreateUpdate,
148
+ Fields,
149
+ Rules,
228
150
  },
229
151
  data() {
230
152
  return {
153
+ id: this.$route.params.id,
154
+ urlGetById: "api/v1/shared/report/get-by-id",
231
155
  content: {
232
156
  headerTable: [],
233
157
  data: [],
158
+ totalPages: [],
234
159
  totalization: [],
235
- pagination: 0,
236
- currentPage: 1,
160
+ noDataReturned: false,
161
+ },
162
+ baseParams: {
163
+ currentPage: 0,
237
164
  totalPerPage: 100,
165
+ totalPage: 0,
238
166
  totalRecords: 0,
239
167
  },
240
- btnDesativado: true,
241
- carregando: false,
242
- nenhumDadoRetornado: false,
243
- teste: this.router,
168
+ modalOptions: {
169
+ name: "",
170
+ title: "",
171
+ width: 0,
172
+ },
173
+ btnSaveDisabled: false,
174
+ isLoading: false,
175
+ showBodyReport: false,
244
176
  };
245
177
  },
246
178
  mounted() {
247
- this.removeLoading(["panel"]);
179
+ this.addReport({
180
+ id: this.id,
181
+ fields: this.templateReport.fields,
182
+ rules: this.templateReport.rules,
183
+ });
184
+
185
+ if (this.id) this.getById();
186
+
187
+ if (!this.id) this.removeLoading(["panel"]);
248
188
  },
249
189
  beforeDestroy() {
250
- this.updateOptionsInitValue({});
251
- this.atualizaCampoOrdenado({});
252
- this.atualizaFiltroSelecionado({ children: [] });
190
+ this.removeInitialReportCustom();
253
191
  },
254
- computed: {
255
- ...mapGetters("generic", ["showModal", "event"]),
256
- ...mapGetters("report", [
257
- "headerTable",
258
- "selectedRules",
259
- "requiredRules",
260
- "regraObrigatoriaJaAdicionada",
261
- "hasSelectedField",
262
- "oDataSelect",
263
- "oDataFilter",
264
- "oDataOrderBy",
192
+ methods: {
193
+ ...mapActions("generic", ["getApi", "getApiOdata"]),
194
+ ...mapActions("report", [
195
+ "addReport",
196
+ "addInitialReportCustom",
197
+ "removeInitialReportCustom",
265
198
  ]),
266
- ...mapState("report", ["report", "selectedField", "totalization"]),
267
- urlConsulta() {
268
- let baseUrl = `${this.templateList.urlGetApi}?${this.oDataSelect}&${this.oDataOrderBy}&${this.oDataFilter.query}&$skip=${this.skip}&$top=${this.content.totalPerPage}&$count=true`;
269
- return baseUrl.replace("&&", "&");
270
- },
271
- urlResumo() {
272
- let query = this.oDataFilter.totalization
273
- ? `$apply=filter(${this.oDataFilter.query.replace("$filter=", "")})/`
274
- : "$apply=";
275
- let baseUrl = `${this.templateList.urlGetApi}?${query}aggregate(${this.oDataFilter.totalization})`;
276
- return baseUrl;
277
- },
278
- skip() {
279
- return (this.content.currentPage - 1) * this.content.totalPerPage;
280
- },
281
- invalid() {
282
- let retorno = true;
283
- this.requiredRules.forEach((rule) => {
284
- retorno = this.regraObrigatoriaJaAdicionada(rule);
199
+ ...mapMutations("generic", ["addEvent", "openModal", "hideModal", "removeLoading"]),
200
+ getById() {
201
+ let params = { url: this.urlGetById, obj: { id: this.id } };
202
+ this.getApi(params).then((response) => {
203
+ const query = JSON.parse(response.content.query);
204
+ let report = {
205
+ selectedFields: query.selectedFields,
206
+ selectedRules: query.selectedRules,
207
+ };
208
+ this.addInitialReportCustom(report);
209
+ this.removeLoading(["panel"]);
285
210
  });
286
-
287
- if (this.requiredRules.length == 0) retorno = false;
288
-
289
- return retorno;
290
211
  },
291
- tamanhoDados() {
292
- return this.content.data.length;
293
- },
294
- },
295
- methods: {
296
- ...mapActions("generic", ["getApiOdata"]),
297
- ...mapMutations("generic", [
298
- "addEvent",
299
- "showModal",
300
- "hideModal",
301
- "removeLoading",
302
- ]),
303
- ...mapMutations("report", [
304
- "atualizaFiltroSelecionado",
305
- "atualizaCampoOrdenado",
306
- "updateOptionsInitValue",
307
- "atualizaCabecalhoTabela",
308
- ]),
309
212
  getAll() {
310
- this.content.data = [];
311
- this.content.totalization = [];
312
- this.btnDesativado = true;
313
-
314
- if (!this.invalid) {
315
- this.mostraEscondeCampos();
316
- this.pagination();
317
- this.removeLoading(["buscarRelatorio"]);
213
+ this.btnSaveDisabled = true;
318
214
 
319
- if (this.oDataFilter.totalization) this.resumoOData();
320
- if (!this.oDataFilter.totalization) this.content.totalization = [];
215
+ if (this.rulesIsValid) {
216
+ this.getTotalRecords();
217
+ this.removeLoading(["btnSearchReport"]);
321
218
  }
322
219
  },
323
- pagination() {
324
- let paramsConsulta = { url: this.urlConsulta };
325
- this.reiniciaDados();
220
+ getTotalRecords() {
221
+ let paramsQuery = { url: this.urlQuery };
222
+ this.resetData();
326
223
 
327
- this.getApiOdata(paramsConsulta).then((response) => {
224
+ this.getApiOdata(paramsQuery).then((response) => {
328
225
  let totalRecords = response["@odata.count"];
329
- if (totalRecords == 0) this.nenhumDadoRetornado = true;
330
- this.content.totalRecords = totalRecords;
331
- this.content.pagination = Math.round(
332
- totalRecords / this.content.totalPerPage
226
+ if (totalRecords == 0) this.noDataReturned = true;
227
+
228
+ this.baseParams.totalRecords = totalRecords;
229
+ this.baseParams.totalPage = Math.ceil(
230
+ totalRecords / this.baseParams.totalPerPage
333
231
  );
334
232
 
335
- if (totalRecords <= this.content.totalPerPage) {
336
- this.consultaOdata();
337
- this.content.headerTable = this.headerTable;
338
- }
339
- if (this.content.pagination == 0) this.carregando = false;
233
+ if (this.baseParams.totalPage <= 1) this.loadingOnlyIfOnePage(response.value);
234
+ if (this.baseParams.totalPage > 1) this.loadingOnlyIfManyPages();
235
+
236
+ this.content.headerTable = this.headerTable;
237
+ this.showBodyReport = true;
340
238
  });
341
239
  },
342
- reiniciaDados() {
343
- this.carregando = true;
344
- this.content.data = [];
345
- this.content.currentPage = 1;
346
- this.nenhumDadoRetornado = false;
240
+ loadingOnlyIfOnePage(data) {
241
+ this.content.data = data;
242
+ this.btnSaveDisabled = true;
243
+ this.isLoading = false;
347
244
  },
348
- consultaOdata() {
349
- let paramsConsulta = { url: this.urlConsulta };
350
- this.getApiOdata(paramsConsulta).then((response) => {
245
+ loadingOnlyIfManyPages() {
246
+ let seq = 0;
247
+ while (seq <= this.baseParams.totalPage - 1) {
248
+ this.content.totalPages.push(seq);
249
+ seq++;
250
+ }
251
+ },
252
+ getAllManyPages() {
253
+ let paramsQuery = { url: this.urlQuery };
254
+ this.getApiOdata(paramsQuery).then((response) => {
351
255
  let self = this;
352
256
  response.value.forEach(function (obj) {
353
257
  self.content.data.push(obj);
354
258
  });
355
- this.content.currentPage++;
356
- });
357
- this.content.headerTable = this.headerTable;
358
- },
359
- resumoOData() {
360
- let paramsResumo = { url: this.urlResumo };
361
- this.getApiOdata(paramsResumo).then((response) => {
362
- this.content.totalization = [];
363
- const result = Object.entries(response[0]);
364
- let self = this;
365
- result.forEach(function (value) {
366
- self.totalization.forEach(function (legenda) {
367
- let obj = {
368
- title: "",
369
- valor: value[1],
370
- classCss: legenda.classCss,
371
- type: legenda.type,
372
- };
373
- if (legenda.valor == value[0]) {
374
- obj.title = legenda.title;
375
- self.content.totalization.push(obj);
376
- }
377
- });
378
- });
379
259
  });
260
+ this.content.totalPages.pop();
261
+ this.baseParams.currentPage++;
380
262
  },
381
- abrirCampo() {
382
- this.showModal("field");
383
- this.removeLoading(["abrirCampo"]);
263
+ resetData() {
264
+ this.isLoading = true;
265
+ this.content.data = [];
266
+ this.content.totalPages = [];
267
+ this.baseParams.currentPage = 0;
268
+ this.noDataReturned = false;
384
269
  },
385
- abrirFiltro() {
386
- this.showModal("filter");
387
- this.removeLoading(["abrirFiltro"]);
270
+ executeOpenModal(params) {
271
+ if (this.id && params.name == "save") {
272
+ this.addEvent({ name: "saveReport" });
273
+ } else {
274
+ this.modalOptions = params;
275
+ this.openModal("templateReport");
276
+ this.removeLoading(["btnExecuteOpenModal", "btnSaveReport"]);
277
+ }
388
278
  },
389
- aplicarFiltro() {
390
- this.hideModal();
391
- this.removeLoading(["aplicaFiltro", "aplicaCampo"]);
279
+ applyFieldsAndRules() {
280
+ this.hideModal("templateReport");
281
+ this.removeLoading(["btnApplyFieldsAndRules"]);
392
282
  },
393
- saveReport() {
394
- this.addEvent({ nome: "changeReport" });
395
- this.showModal("salvar");
396
- this.removeLoading(["saveReport"]);
283
+ },
284
+ computed: {
285
+ ...mapGetters("generic", ["showModal", "event"]),
286
+ ...mapGetters("report", [
287
+ "headerTable",
288
+ "oDataFilter",
289
+ "oDataSelect",
290
+ "oDataOrderBy",
291
+ "rulesIsValid",
292
+ "rulesRequired",
293
+ ]),
294
+ ...mapState("report", ["report"]),
295
+ urlQuery() {
296
+ let skip = this.baseParams.currentPage * this.baseParams.totalPerPage;
297
+ let baseUrl = `${this.templateList.urlGetApi}?${this.oDataSelect}&${this.oDataOrderBy}&${this.oDataFilter.query}&$skip=${skip}&$top=${this.baseParams.totalPerPage}&$count=true`;
298
+ return baseUrl.replace("&&", "&");
397
299
  },
398
- mostraEscondeCampos() {
399
- let self = this;
400
- this.report.fields.forEach(function (field) {
401
- if (self.hasSelectedField(field.field, self.selectedField)) {
402
- value.show = true;
403
- } else {
404
- value.show = false;
405
- }
406
- });
300
+ liveTotalRecords() {
301
+ return this.content.data.length;
407
302
  },
408
303
  },
409
304
  watch: {
410
- event: {
411
- handler(event) {
412
- if (event.nome == "tagRelatorio") this.showModal("filter");
413
- },
414
- deep: true,
415
- },
416
- selectedField: {
417
- handler() {
418
- this.mostraEscondeCampos();
419
- },
420
- deep: true,
421
- },
422
- "content.currentPage": {
423
- handler(currentPage) {
424
- if (currentPage <= this.content.pagination - 1) {
305
+ "content.totalPages": {
306
+ handler(totalPages) {
307
+ if (totalPages.length > 0) {
425
308
  let self = this;
426
309
  setTimeout(function () {
427
- self.consultaOdata();
310
+ self.getAllManyPages();
428
311
  }, 200);
429
312
  }
430
- if (currentPage == this.content.pagination && currentPage != 0)
431
- this.carregando = false;
313
+ if (totalPages.length == 1) this.isLoading = false;
432
314
  },
433
315
  deep: true,
434
316
  },
435
- "content.pagination": {
436
- handler() {
437
- this.consultaOdata();
438
- },
439
- deep: true,
440
- },
441
- "oDataFilter.query": {
442
- handler() {
443
- this.btnDesativado = false;
317
+ oDataFilter: {
318
+ handler(totalPages) {
319
+ this.btnSaveDisabled = false;
444
320
  },
445
321
  deep: true,
446
322
  },
447
323
  oDataSelect: {
448
- handler() {
449
- this.btnDesativado = false;
324
+ handler(totalPages) {
325
+ this.btnSaveDisabled = false;
450
326
  },
451
327
  deep: true,
452
328
  },
453
329
  oDataOrderBy: {
454
- handler() {
455
- this.btnDesativado = false;
330
+ handler(totalPages) {
331
+ this.btnSaveDisabled = false;
456
332
  },
457
333
  deep: true,
458
334
  },
@@ -465,7 +341,7 @@ export default {
465
341
  padding-bottom: 15px;
466
342
  }
467
343
 
468
- .div-progresso {
344
+ .div-progress {
469
345
  margin-bottom: 10px;
470
346
  }
471
347
 
@@ -473,7 +349,7 @@ export default {
473
349
  margin-top: 20px;
474
350
  }
475
351
 
476
- .div-tabela {
352
+ .div-table {
477
353
  margin-top: 20px;
478
354
  }
479
355
 
@@ -482,7 +358,7 @@ export default {
482
358
  margin-right: 5px;
483
359
  }
484
360
 
485
- .div-rodape {
361
+ .div-Totalization {
486
362
  margin-top: 20px;
487
363
  }
488
364
 
@@ -490,11 +366,19 @@ export default {
490
366
  margin-top: 15px;
491
367
  }
492
368
 
493
- .div-obrigatorio {
369
+ .div-required {
494
370
  margin-top: 20px;
495
371
  }
496
372
 
497
- .filter-obrigatorio {
373
+ .filter-required {
498
374
  font-weight: 500;
499
375
  }
376
+
377
+ .btn-apply {
378
+ margin-top: 10px;
379
+ }
380
+
381
+ .body-report {
382
+ margin-top: 30px;
383
+ }
500
384
  </style>