@nixweb/nixloc-ui 0.0.125 → 0.0.128

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 (111) hide show
  1. package/docs/src/component/template/ViewTemplateReportPreview.drawio +210 -0
  2. package/package.json +79 -77
  3. package/src/App.vue +13 -13
  4. package/src/component/forms/Button.vue +170 -169
  5. package/src/component/forms/CheckboxGroup.vue +72 -63
  6. package/src/component/forms/CheckboxSimple.vue +46 -27
  7. package/src/component/forms/Color.vue +38 -38
  8. package/src/component/forms/DateTime.vue +167 -177
  9. package/src/component/forms/Dropdown.vue +218 -224
  10. package/src/component/forms/EditorHtml.vue +126 -123
  11. package/src/component/forms/FileUpload.vue +185 -189
  12. package/src/component/forms/ImageUpload.vue +230 -0
  13. package/src/component/forms/IncrementDecrement.vue +101 -0
  14. package/src/component/forms/InputDecimal.vue +142 -137
  15. package/src/component/forms/InputNumber.vue +154 -149
  16. package/src/component/forms/InputPassword.vue +135 -135
  17. package/src/component/forms/InputText.vue +162 -157
  18. package/src/component/forms/Modal.vue +65 -60
  19. package/src/component/forms/RadioGroup.vue +50 -50
  20. package/src/component/forms/Select.vue +349 -337
  21. package/src/component/forms/SelectStatic.vue +127 -120
  22. package/src/component/forms/Slider.vue +18 -18
  23. package/src/component/forms/TextArea.vue +126 -126
  24. package/src/component/layout/Alert.vue +92 -92
  25. package/src/component/layout/Badge.vue +103 -103
  26. package/src/component/layout/FixedBar.vue +100 -68
  27. package/src/component/layout/Header.vue +38 -35
  28. package/src/component/layout/LoadingFullPage.vue +27 -27
  29. package/src/component/layout/Menu.vue +210 -214
  30. package/src/component/layout/Molded.vue +28 -27
  31. package/src/component/layout/Panel.vue +140 -142
  32. package/src/component/layout/Popover.vue +126 -126
  33. package/src/component/layout/ScrollBar.vue +42 -43
  34. package/src/component/layout/Tab.vue +135 -0
  35. package/src/component/layout/Tag.vue +3 -3
  36. package/src/component/layout/Wizard.vue +211 -213
  37. package/src/component/rental/DisplayPeriodRent.vue +81 -0
  38. package/src/component/rental/DisplayTotalization.vue +47 -0
  39. package/src/component/shared/Collapse.vue +131 -131
  40. package/src/component/shared/Confirmation.vue +2 -2
  41. package/src/component/shared/DocumentEditor.vue +1 -1
  42. package/src/component/shared/DocumentPreview.vue +1 -1
  43. package/src/component/shared/DocumentPublic.vue +34 -0
  44. package/src/component/shared/ExportExcel.vue +1 -8
  45. package/src/component/shared/ExportPDF.vue +116 -116
  46. package/src/component/shared/{HeaderPrint.vue → HeaderReport.vue} +4 -4
  47. package/src/component/shared/HorizontalFilter.vue +59 -59
  48. package/src/component/shared/Loading.vue +107 -107
  49. package/src/component/shared/LoadingMoreButton.vue +23 -23
  50. package/src/component/shared/Messages.vue +81 -83
  51. package/src/component/shared/PDFViewer.vue +22 -22
  52. package/src/component/shared/Pagination.vue +52 -53
  53. package/src/component/shared/{LegendaParametro.vue → ParameterLegend.vue} +22 -26
  54. package/src/component/shared/ProgressBar.vue +22 -21
  55. package/src/component/shared/QueryButton.vue +66 -66
  56. package/src/component/shared/Report.vue +187 -0
  57. package/src/component/shared/SaveCancel.vue +26 -5
  58. package/src/component/shared/Search.vue +154 -154
  59. package/src/component/shared/SelectOption.vue +146 -0
  60. package/src/component/shared/Table.vue +163 -243
  61. package/src/component/shared/TableButton.vue +36 -36
  62. package/src/component/shared/TableDraggable.vue +127 -0
  63. package/src/component/shared/TableItem.vue +177 -0
  64. package/src/component/shared/TableTotalRecords.vue +9 -10
  65. package/src/component/shared/TableTotalization.vue +47 -47
  66. package/src/component/shared/Tip.vue +42 -42
  67. package/src/component/shared/Toast.vue +54 -54
  68. package/src/component/shared/TotalizationReport.vue +59 -0
  69. package/src/component/shared/VerticalFilter.vue +97 -145
  70. package/src/component/shared/query-builder/AddRule.vue +181 -187
  71. package/src/component/shared/query-builder/ConvertToOdata.js +34 -43
  72. package/src/component/shared/query-builder/DynamicComponent.vue +21 -16
  73. package/src/component/shared/query-builder/DynamicComponentList.vue +73 -0
  74. package/src/component/shared/query-builder/Fields.vue +29 -63
  75. package/src/component/shared/query-builder/QueryBuilder.vue +69 -69
  76. package/src/component/shared/query-builder/Rules.vue +2 -14
  77. package/src/component/shared/query-builder/SelectRule.vue +15 -15
  78. package/src/component/shared/query-builder/Tags.vue +24 -8
  79. package/src/component/shared/query-builder/utilities.js +21 -21
  80. package/src/component/template/{ListViewWithHandlerData.vue → ListViewWithDataHandler.vue} +260 -231
  81. package/src/component/template/{AddEditReport.vue → ReportCreateUpdate.vue} +40 -22
  82. package/src/component/template/ViewTemplateConfiguration.vue +64 -69
  83. package/src/component/template/ViewTemplateDocumentView.vue +22 -25
  84. package/src/component/template/ViewTemplateReportList.vue +39 -57
  85. package/src/component/template/ViewTemplateReportPreview.vue +270 -341
  86. package/src/component/template/ViewTemplateReportPreviewCOPIASEGURANCA.vue +497 -0
  87. package/src/component/template/ViewTemplateSelectOption.vue +60 -0
  88. package/src/component/template/ViewTemplateWithSalveCancel.vue +32 -32
  89. package/src/component/template/ViewTemplateWithTable.vue +56 -49
  90. package/src/component/template/model/Report.js +2 -2
  91. package/src/component/value-objects/Address.js +11 -0
  92. package/src/component/value-objects/{Endereco.vue → Address.vue} +39 -40
  93. package/src/component/value-objects/{DadosContato.js → Contact.js} +2 -2
  94. package/src/component/value-objects/{DadosContato.vue → Contact.vue} +24 -17
  95. package/src/component/value-objects/Person.js +10 -0
  96. package/src/component/value-objects/{DadosPessoa.vue → Person.vue} +50 -35
  97. package/src/config/axios.js +9 -9
  98. package/src/config/dicas.js +14 -14
  99. package/src/config/router.js +13 -13
  100. package/src/config/token.js +14 -14
  101. package/src/main.js +23 -23
  102. package/src/store/modules/generic.js +512 -488
  103. package/src/store/modules/report.js +156 -127
  104. package/src/store/modules/user.js +6 -0
  105. package/src/store/modules/validation.js +38 -38
  106. package/src/store/store.js +13 -13
  107. package/docs/src/component/template/ModeloRelatorioView.drawio +0 -160
  108. package/src/component/shared/query-builder/ListDynamicComponent.vue +0 -42
  109. package/src/component/shared/query-builder/Totalization.vue +0 -38
  110. package/src/component/value-objects/DadosPessoa.js +0 -10
  111. package/src/component/value-objects/Endereco.js +0 -11
@@ -1,231 +1,260 @@
1
- <template>
2
- <div>
3
- <div :class="{ 'g-div-molded': showMolded }">
4
- <b-row>
5
- <b-col sm="12"
6
- ><div>
7
- <HorizontalFilter v-if="showHorizontalFilter">
8
- <div slot="content-filter-horizontal">
9
- <slot name="content-filter-horizontal"></slot>
10
- </div>
11
- </HorizontalFilter></div
12
- ></b-col>
13
- </b-row>
14
- <b-row>
15
- <b-col sm="6">
16
- <TableTotalization :totalization="content.totalization" />
17
- </b-col>
18
- <b-col sm="6">
19
- <TableTotalRecords :totalRecords="content.totalRecords" />
20
- </b-col>
21
- </b-row>
22
- <FixedBar posicao="topo" v-show="selected.length > 0">
23
- <div>
24
- <Button
25
- v-if="buttonRemove"
26
- key="remove"
27
- :title="`Remover ${selected.length}`"
28
- type="danger"
29
- size="small"
30
- :clicked="removeSelected"
31
- />
32
- <slot name="content-buttons-table-header"></slot>
33
- </div>
34
- </FixedBar>
35
- <Table
36
- :header="templateList.headerTable"
37
- :data="content.data"
38
- :showChecks="templateList.showChecks"
39
- >
40
- <div slot="content-buttons-table">
41
- <slot name="content-buttons-table"></slot>
42
- </div>
43
- </Table>
44
- </div>
45
- <br />
46
- <Pagination key="templateList" :totalRecords="content.totalRecords" />
47
- </div>
48
- </template>
49
-
50
- <script>
51
- import Pagination from "../shared/Pagination.vue";
52
- import Table from "../shared/Table.vue";
53
- import Button from "../forms/Button.vue";
54
- import FixedBar from "../layout/FixedBar.vue";
55
- import TableTotalRecords from "../shared/TableTotalRecords.vue";
56
- import TableTotalization from "../shared/TableTotalization.vue";
57
- import HorizontalFilter from "../shared/HorizontalFilter.vue";
58
-
59
- import { mapState, mapGetters, mapActions, mapMutations } from "vuex";
60
-
61
- export default {
62
- name: "ListViewWithHandlerData",
63
- props: {
64
- templateList: Object,
65
- propsParam: Object,
66
- showMolded: {
67
- type: Boolean,
68
- default: true,
69
- },
70
- showHorizontalFilter: {
71
- type: Boolean,
72
- default: true,
73
- },
74
- buttonRemove: {
75
- type: Boolean,
76
- default: true,
77
- },
78
- },
79
- components: {
80
- HorizontalFilter,
81
- TableTotalization,
82
- TableTotalRecords,
83
- FixedBar,
84
- Button,
85
- Table,
86
- Pagination,
87
- },
88
- data() {
89
- return {
90
- content: {
91
- data: [],
92
- totalRecords: 0,
93
- },
94
- baseParams: {
95
- search: undefined,
96
- filter: "contem",
97
- currentPage: 1,
98
- totalPerPage: 10,
99
- },
100
- paramsFilter: [],
101
- dynamicFilter: {},
102
- };
103
- },
104
- created() {
105
- // o carregamento inicial getAll() é feito pela mudança no paginationKey
106
- },
107
- mounted() {
108
- this.updatePagination({
109
- key: "templateList",
110
- totalPerPage: this.baseParams.totalPerPage,
111
- });
112
- },
113
- beforeDestroy() {
114
- let search = { content: "", filter: { content: "contem", id: "contem" } };
115
- this.updateSearch(search);
116
- },
117
- computed: {
118
- ...mapState("generic", [
119
- "selected",
120
- "methodExecutedApi",
121
- "search",
122
- "executedSearch",
123
- "clearedSearch",
124
- "totalPerPage",
125
- "selectStatic",
126
- ]),
127
- ...mapGetters("generic", ["pagination"]),
128
- paginationKey: function () {
129
- return this.pagination("templateList");
130
- },
131
- },
132
- methods: {
133
- ...mapActions("generic", ["getApi", "deleteAllApi"]),
134
- ...mapMutations("generic", [
135
- "removeLoading",
136
- "addSelected",
137
- "updatePagination",
138
- "updateSearch",
139
- ]),
140
- getAll() {
141
- let obj = { ...this.baseParams, ...this.dynamicFilter, ...this.propsParam };
142
- let params = { url: this.templateList.urlGetApi, obj: obj };
143
- this.getApi(params).then((response) => {
144
- this.content = response.content;
145
- this.removeLoading(["panel", "modeloSubView", "search", "clean"]);
146
- });
147
- },
148
- removeSelected() {
149
- let params = {
150
- url: this.templateList.urlRemoverTodosApi,
151
- selected: this.selected,
152
- };
153
- this.deleteAllApi(params).then(() => {
154
- this.removeLoading(["remove"]);
155
- this.addSelected([]);
156
- });
157
- },
158
- limpaParams() {
159
- this.baseParams.currentPage = 1;
160
- },
161
- },
162
- watch: {
163
- methodExecutedApi: function (value) {
164
- if (
165
- value === "postApi" ||
166
- value === "putApi" ||
167
- value === "deleteAllApi" ||
168
- value === "deleteAllApiErro"
169
- ) {
170
- this.getAll();
171
- }
172
- },
173
- executedSearch: function () {
174
- this.baseParams.search = this.search.content;
175
- this.baseParams.filter = this.search.filter.id;
176
- this.limpaParams();
177
- this.getAll();
178
- },
179
- clearedSearch: function () {
180
- this.baseParams.search = "";
181
- this.baseParams.filter = "";
182
- this.limpaParams();
183
- this.getAll();
184
- },
185
- paginationKey: {
186
- handler(value) {
187
- this.limpaParams();
188
- this.baseParams.currentPage = value.currentPage;
189
- this.getAll();
190
- },
191
- deep: true,
192
- },
193
- selectStatic: {
194
- handler(value) {
195
- let fieldTarget = value.fieldTarget;
196
- let obj = { key: fieldTarget, valor: value.valor };
197
- this.paramsFilter.push(obj);
198
-
199
- var result = {};
200
- for (var i = 0; i < this.paramsFilter.length; i++) {
201
- let key = this.paramsFilter[i].key;
202
- let valor = this.paramsFilter[i].valor;
203
-
204
- if (key == "periodo") {
205
- result["inicio"] = valor.inicio;
206
- result["fim"] = valor.fim;
207
- } else {
208
- result[key] = valor;
209
- }
210
- }
211
-
212
- this.dynamicFilter = result;
213
-
214
- this.updatePagination({
215
- key: "templateList",
216
- totalPerPage: this.dynamicFilter.totalPerPage,
217
- });
218
-
219
- this.getAll();
220
- },
221
- deep: true,
222
- },
223
- },
224
- };
225
- </script>
226
-
227
- <style scoped>
228
- .div-button-excluir {
229
- padding-bottom: 10px;
230
- }
231
- </style>
1
+ <template>
2
+ <div>
3
+ <div :class="{ 'g-div-molded': showMolded }">
4
+ <b-row>
5
+ <b-col sm="12">
6
+ <div>
7
+ <HorizontalFilter v-if="showHorizontalFilter">
8
+ <div slot="content-filter-horizontal">
9
+ <slot name="content-filter-horizontal"></slot>
10
+ </div>
11
+ </HorizontalFilter>
12
+ </div>
13
+ </b-col>
14
+ </b-row>
15
+ <b-row>
16
+ <b-col sm="6">
17
+ <div v-if="templateList.dragAndDrop">
18
+ <i class="fa-regular fa-maximize"></i> Clique e arraste para ordenar
19
+ </div>
20
+ <TableTotalization :totalization="content.totalization" />
21
+ </b-col>
22
+ <b-col sm="6">
23
+ <TableTotalRecords :totalRecords="content.totalRecords" />
24
+ </b-col>
25
+ </b-row>
26
+ <Loading type="line" :center="false" v-show="isLoading('loadingLine')" />
27
+ <FixedBar posicao="topo" v-show="selected.length > 0">
28
+ <div>
29
+ <Button
30
+ v-if="buttonRemove"
31
+ key="remove"
32
+ :title="`Remover ${selected.length}`"
33
+ type="danger"
34
+ size="small"
35
+ :clicked="removeSelected"
36
+ />
37
+ <slot name="content-buttons-table-header"></slot>
38
+ </div>
39
+ </FixedBar>
40
+ <Table
41
+ :header="templateList.headerTable"
42
+ :data="content.data"
43
+ :showChecks="templateList.showChecks"
44
+ :dragAndDrop="templateList.dragAndDrop"
45
+ >
46
+ <div slot="content-buttons-table">
47
+ <slot name="content-buttons-table"></slot>
48
+ </div>
49
+ </Table>
50
+ </div>
51
+ <br />
52
+ <Pagination _key="templateList" :totalRecords="content.totalRecords" />
53
+ </div>
54
+ </template>
55
+
56
+ <script>
57
+ import Pagination from "@nixweb/nixloc-ui/src/component/shared/Pagination.vue";
58
+ import Table from "../shared/Table.vue";
59
+ import Button from "../forms/Button.vue";
60
+ import FixedBar from "../layout/FixedBar.vue";
61
+ import TableTotalRecords from "../shared/TableTotalRecords.vue";
62
+ import TableTotalization from "../shared/TableTotalization.vue";
63
+ import HorizontalFilter from "../shared/HorizontalFilter.vue";
64
+ import Loading from "../shared/Loading.vue";
65
+
66
+ import { mapState, mapGetters, mapActions, mapMutations } from "vuex";
67
+
68
+ export default {
69
+ name: "ListViewWithDataHandler",
70
+ props: {
71
+ templateList: Object,
72
+ propsParam: Object,
73
+ showMolded: {
74
+ type: Boolean,
75
+ default: true,
76
+ },
77
+ showHorizontalFilter: {
78
+ type: Boolean,
79
+ default: true,
80
+ },
81
+ buttonRemove: {
82
+ type: Boolean,
83
+ default: true,
84
+ },
85
+ },
86
+ components: {
87
+ HorizontalFilter,
88
+ TableTotalization,
89
+ TableTotalRecords,
90
+ Loading,
91
+ FixedBar,
92
+ Button,
93
+ Table,
94
+ Pagination,
95
+ },
96
+ data() {
97
+ return {
98
+ content: {
99
+ data: [],
100
+ totalRecords: 0,
101
+ },
102
+ baseParams: {
103
+ search: undefined,
104
+ filter: "contains",
105
+ currentPage: 1,
106
+ totalPerPage: 10,
107
+ },
108
+ paramsFilter: [],
109
+ dynamicFilter: {},
110
+ };
111
+ },
112
+ created() {
113
+ // o carregamento inicial getAll() é feito pela mudança no paginationKey
114
+ },
115
+ mounted() {
116
+ this.updatePagination({
117
+ key: "templateList",
118
+ totalPerPage: this.baseParams.totalPerPage,
119
+ });
120
+ },
121
+ beforeDestroy() {
122
+ let search = { content: "", filter: { content: "Contém", id: "contains" } };
123
+ this.updateSearch(search);
124
+ },
125
+ computed: {
126
+ ...mapState("generic", [
127
+ "selected",
128
+ "methodExecutedApi",
129
+ "search",
130
+ "executedSearch",
131
+ "clearedSearch",
132
+ "totalPerPage",
133
+ "selectStatic",
134
+ ]),
135
+ ...mapGetters("generic", ["pagination", "isLoading", "event"]),
136
+ paginationKey: function () {
137
+ return this.pagination("templateList");
138
+ },
139
+ },
140
+ methods: {
141
+ ...mapActions("generic", ["getApi", "orderAllApi", "deleteAllApi"]),
142
+ ...mapMutations("generic", [
143
+ "addLoading",
144
+ "removeLoading",
145
+ "addSelected",
146
+ "updatePagination",
147
+ "updateSearch",
148
+ ]),
149
+ getAll() {
150
+ let obj = { ...this.baseParams, ...this.dynamicFilter, ...this.propsParam };
151
+ let params = { url: this.templateList.urlGetApi, obj: obj };
152
+ this.getApi(params).then((response) => {
153
+ this.content = response.content;
154
+ let self = this;
155
+ setTimeout(function () {
156
+ self.removeLoading(["panel", "loadingLine", "btnSearch", "btnClean"]);
157
+ }, 350);
158
+ });
159
+ },
160
+ orderAll(data) {
161
+ let obj = { listIds: data.listIds };
162
+
163
+ let params = {
164
+ url: this.templateList.urlOrderAllApi,
165
+ obj: obj,
166
+ notNotifyToast: true,
167
+ };
168
+
169
+ this.orderAllApi(params).then((response) => {});
170
+ },
171
+ removeSelected() {
172
+ let params = {
173
+ url: this.templateList.urlDeleteAllApi,
174
+ selected: this.selected,
175
+ };
176
+ this.deleteAllApi(params).then(() => {
177
+ this.removeLoading(["remove"]);
178
+ this.addSelected([]);
179
+ });
180
+ },
181
+ cleanParams() {
182
+ this.baseParams.currentPage = 1;
183
+ },
184
+ },
185
+ watch: {
186
+ event: {
187
+ handler(event) {
188
+ if (event.name == "tableDragAndDrop") this.orderAll(event.data);
189
+ },
190
+ deep: true,
191
+ },
192
+ methodExecutedApi: function (value) {
193
+ if (
194
+ value === "postApi" ||
195
+ value === "putApi" ||
196
+ value === "deleteAllApi" ||
197
+ value === "deleteAllApiErro"
198
+ ) {
199
+ this.getAll();
200
+ }
201
+ },
202
+ executedSearch: function () {
203
+ this.baseParams.search = this.search.content;
204
+ if (this.search.filter.id) this.baseParams.filter = this.search.filter.id;
205
+ this.cleanParams();
206
+ this.getAll();
207
+ },
208
+ clearedSearch: function () {
209
+ this.baseParams.search = "";
210
+ this.baseParams.filter = "";
211
+ this.cleanParams();
212
+ this.getAll();
213
+ },
214
+ paginationKey: {
215
+ handler(value) {
216
+ this.cleanParams();
217
+ this.baseParams.currentPage = value.currentPage;
218
+ this.getAll();
219
+ },
220
+ deep: true,
221
+ },
222
+ selectStatic: {
223
+ handler(value) {
224
+ let fieldTarget = value.fieldTarget;
225
+ let obj = { key: fieldTarget, value: value.value };
226
+ this.paramsFilter.push(obj);
227
+
228
+ var result = {};
229
+ for (var i = 0; i < this.paramsFilter.length; i++) {
230
+ let key = this.paramsFilter[i].key;
231
+ let value = this.paramsFilter[i].value;
232
+
233
+ if (key == "period") {
234
+ result["start"] = value.inicio;
235
+ result["end"] = value.fim;
236
+ } else {
237
+ result[key] = value;
238
+ }
239
+ }
240
+
241
+ this.dynamicFilter = result;
242
+
243
+ this.updatePagination({
244
+ key: "templateList",
245
+ totalPerPage: this.dynamicFilter.totalPerPage,
246
+ });
247
+
248
+ this.getAll();
249
+ },
250
+ deep: true,
251
+ },
252
+ },
253
+ };
254
+ </script>
255
+
256
+ <style scoped>
257
+ .div-button-excluir {
258
+ padding-bottom: 10px;
259
+ }
260
+ </style>
@@ -1,8 +1,8 @@
1
1
  <template>
2
2
  <div>
3
3
  <b-row>
4
- <b-col sm="12"
5
- ><InputText
4
+ <b-col sm="12">
5
+ <InputText
6
6
  title="Nome"
7
7
  field="name"
8
8
  :formName="formName"
@@ -17,7 +17,7 @@
17
17
  <b-col sm="12">
18
18
  <div class="text-right">
19
19
  <Button
20
- key="save"
20
+ _key="btnSaveReport"
21
21
  type="success"
22
22
  title="Salvar"
23
23
  :disabled="!isFormValid(formName)"
@@ -34,41 +34,44 @@
34
34
  <script>
35
35
  import InputText from "@nixweb/nixloc-ui/src/component/forms/InputText";
36
36
  import Button from "@nixweb/nixloc-ui/src/component/forms/Button";
37
+
37
38
  import Report from "@nixweb/nixloc-ui/src/component/template/model/Report.js";
38
39
 
39
40
  import { mapGetters, mapState, mapActions, mapMutations } from "vuex";
40
41
 
41
42
  export default {
42
- name: "AddEditReport",
43
+ name: "ReportCreateUpdate",
43
44
  components: { Button, InputText },
44
45
  props: {
45
46
  module: String,
46
47
  },
47
48
  data() {
48
49
  return {
49
- formName: "reportAddEditView",
50
+ formName: "reportCreateUpdate",
50
51
  report: new Report(),
51
- urlAdicionar: "/api/v1/shared/report/adicionar",
52
- urlModificar: "/api/v1/shared/report/modificar",
52
+ urlCreate: "/api/v1/shared/report/create",
53
+ urlUpdate: "/api/v1/shared/report/update",
53
54
  };
54
55
  },
55
56
  computed: {
56
57
  ...mapGetters("validation", ["isFormValid"]),
57
58
  ...mapGetters("generic", ["event"]),
58
- ...mapGetters("report", ["headerTable", "filtroSelecionado"]),
59
- ...mapState("report", ["selectedField", "campoOrdenado"]),
59
+ ...mapState("report", ["selectedFields", "selectedRules"]),
60
60
  },
61
61
  methods: {
62
62
  ...mapActions("generic", ["postApi", "putApi"]),
63
- ...mapMutations("generic", ["removeLoading", "removeEvent", "hideModal"]),
63
+ ...mapMutations("generic", ["removeLoading", "addEvent", "hideModal"]),
64
64
  ...mapMutations("validation", ["resetValidation"]),
65
65
  saveReport() {
66
- var personalizado = this.report.id ? "" : "Personalizado";
66
+ var custom = this.report.id ? "" : "Custom";
67
67
  const query = {
68
- routeName: `${this.$route.name}${personalizado}`,
69
- field: this.selectedField,
70
- ordenacao: this.campoOrdenado,
71
- filter: this.filtroSelecionado.children,
68
+ routeName: `${this.$route.name}${custom}`,
69
+ selectedFields: {
70
+ orderBy: this.selectedFields.orderBy,
71
+ selected: this.selectedFields.selected,
72
+ sort: this.selectedFields.sort,
73
+ },
74
+ selectedRules: this.selectedRules,
72
75
  };
73
76
  let obj = {
74
77
  id: this.report.id,
@@ -77,26 +80,41 @@ export default {
77
80
  query: JSON.stringify(query),
78
81
  };
79
82
  if (this.report.id) {
80
- let params = { url: this.urlModificar, obj: obj };
83
+ let params = { url: this.urlUpdate, obj: obj };
81
84
  this.putApi(params).then((response) => {
82
- if (response.success) this.hideModal();
83
- this.removeLoading(["save"]);
85
+ if (response.success) {
86
+ this.sendEvent();
87
+ this.hideModal();
88
+ }
89
+ this.removeLoading(["btnSaveReport"]);
84
90
  });
85
91
  } else {
86
- let params = { url: this.urlAdicionar, obj: obj };
92
+ let params = { url: this.urlCreate, obj: obj };
87
93
  this.postApi(params).then((response) => {
88
- if (response.success) this.hideModal();
89
- this.removeLoading(["save"]);
94
+ if (response.success) {
95
+ const query = JSON.parse(response.content.query);
96
+ this.$router.replace({
97
+ name: query.routeName,
98
+ params: { id: response.content.id, name: response.content.name },
99
+ });
100
+ this.sendEvent();
101
+ this.hideModal();
102
+ }
103
+ this.removeLoading(["btnSaveReport"]);
90
104
  });
91
105
  }
92
106
  },
107
+ sendEvent() {
108
+ this.addEvent({ name: "savedReport" });
109
+ },
93
110
  },
94
111
  watch: {
95
112
  event: {
96
113
  handler(event) {
97
- if (event.name == "changeReport") {
114
+ if (event.name == "saveReport") {
98
115
  this.report.id = this.$route.params.id;
99
116
  if (this.report.id) this.report.name = this.$route.params.name;
117
+ this.saveReport();
100
118
  }
101
119
  },
102
120
  deep: true,