@nixweb/nixloc-ui 0.0.121 → 0.0.124

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 (135) hide show
  1. package/docs/src/component/template/ModeloRelatorioView.drawio +2 -2
  2. package/docs/src/store/modulos/relatorio.drawio +2 -2
  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} +8 -8
  8. package/src/component/forms/{Cor.vue → Color.vue} +9 -9
  9. package/src/component/forms/DateTime.vue +55 -55
  10. package/src/component/forms/{BotaoDropdown.vue → Dropdown.vue} +58 -58
  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/{Topo.vue → Header.vue} +5 -5
  28. package/src/component/layout/{CarregandoTelaInteira.vue → LoadingFullPage.vue} +3 -3
  29. package/src/component/layout/Menu.vue +66 -66
  30. package/src/component/layout/{Moldura.vue → Molded.vue} +4 -4
  31. package/src/component/layout/Panel.vue +142 -0
  32. package/src/component/layout/Popover.vue +1 -1
  33. package/src/component/layout/{BarraRolagem.vue → Scrollbar.vue} +9 -11
  34. package/src/component/layout/Tag.vue +15 -15
  35. package/src/component/layout/Wizard.vue +3 -3
  36. package/src/component/shared/{CodigoEditor.vue → CodeEditor.vue} +25 -25
  37. package/src/component/shared/Collapse.vue +131 -0
  38. package/src/component/shared/Confirmation.vue +80 -0
  39. package/src/component/shared/{DocumentoEditor.vue → DocumentEditor.vue} +10 -16
  40. package/src/component/shared/{DocumentoPreview.vue → DocumentPreview.vue} +2 -2
  41. package/src/component/shared/ExportExcel.vue +67 -0
  42. package/src/component/shared/{ExportarPDF.vue → ExportPDF.vue} +18 -18
  43. package/src/component/shared/HeaderPrint.vue +36 -0
  44. package/src/component/shared/HorizontalFilter.vue +59 -0
  45. package/src/component/shared/LegendaParametro.vue +22 -22
  46. package/src/component/shared/{Carregando.vue → Loading.vue} +16 -16
  47. package/src/component/shared/LoadingMoreButton.vue +23 -0
  48. package/src/component/shared/Messages.vue +83 -0
  49. package/src/component/shared/{Paginacao.vue → Pagination.vue} +12 -12
  50. package/src/component/shared/ProgressBar.vue +21 -0
  51. package/src/component/shared/{BotaoConsulta.vue → QueryButton.vue} +16 -16
  52. package/src/component/shared/SaveCancel.vue +56 -0
  53. package/src/component/shared/{Pesquisa.vue → Search.vue} +46 -46
  54. package/src/component/shared/Table.vue +243 -0
  55. package/src/component/shared/TableButton.vue +36 -0
  56. package/src/component/shared/{Registro.vue → TableTotalRecords.vue} +7 -7
  57. package/src/component/shared/{ResumoTabela.vue → TableTotalization.vue} +12 -8
  58. package/src/component/shared/Tip.vue +42 -0
  59. package/src/component/shared/Toast.vue +7 -7
  60. package/src/component/shared/{FiltroVertical.vue → VerticalFilter.vue} +24 -24
  61. package/src/component/shared/query-builder/AddRule.vue +187 -0
  62. package/src/component/shared/query-builder/ConvertToOdata.js +80 -0
  63. package/src/component/shared/query-builder/DynamicComponent.vue +107 -0
  64. package/src/component/shared/query-builder/Fields.vue +127 -0
  65. package/src/component/shared/query-builder/ListDynamicComponent.vue +42 -0
  66. package/src/component/shared/query-builder/QueryBuilder.vue +25 -120
  67. package/src/component/shared/query-builder/{Filtro.vue → Rules.vue} +13 -18
  68. package/src/component/shared/query-builder/SelectRule.vue +96 -0
  69. package/src/component/shared/query-builder/Tags.vue +14 -14
  70. package/src/component/shared/query-builder/{Rodape.vue → Totalization.vue} +10 -10
  71. package/src/component/template/AddEditReport.vue +106 -0
  72. package/src/component/template/ListViewWithHandlerData.vue +231 -0
  73. package/src/component/template/ViewTemplateConfiguration.vue +69 -0
  74. package/src/component/template/ViewTemplateDocumentView.vue +227 -0
  75. package/src/component/template/ViewTemplateReportList.vue +230 -0
  76. package/src/component/template/ViewTemplateReportPreview.vue +500 -0
  77. package/src/component/template/ViewTemplateWithSalveCancel.vue +32 -0
  78. package/src/component/template/ViewTemplateWithTable.vue +49 -0
  79. package/src/component/template/model/Report.js +6 -0
  80. package/src/component/value-objects/DadosContato.vue +34 -35
  81. package/src/component/value-objects/DadosPessoa.vue +58 -58
  82. package/src/component/value-objects/Endereco.vue +96 -97
  83. package/src/config/dicas.js +1 -1
  84. package/src/config/token.js +2 -2
  85. package/src/store/modules/generic.js +489 -0
  86. package/src/store/modules/report.js +246 -0
  87. package/src/store/modules/user.js +38 -0
  88. package/src/store/modules/validation.js +39 -0
  89. package/src/store/store.js +4 -4
  90. package/src/component/forms/ArquivoUpload.vue +0 -199
  91. package/src/component/forms/CheckboxMultiplo.vue +0 -63
  92. package/src/component/forms/Decimal.vue +0 -137
  93. package/src/component/forms/Escolher.vue +0 -335
  94. package/src/component/forms/EscolherEstatico.vue +0 -139
  95. package/src/component/forms/Numero.vue +0 -153
  96. package/src/component/forms/Opcoes.vue +0 -51
  97. package/src/component/forms/Senha.vue +0 -139
  98. package/src/component/forms/Texto.vue +0 -161
  99. package/src/component/forms/TextoArea.vue +0 -126
  100. package/src/component/forms/TextoEditor.vue +0 -123
  101. package/src/component/layout/Painel.vue +0 -142
  102. package/src/component/shared/BotaoCarregarMais.vue +0 -23
  103. package/src/component/shared/CabecalhoImpressao.vue +0 -36
  104. package/src/component/shared/Confirmacao.vue +0 -80
  105. package/src/component/shared/Dica.vue +0 -42
  106. package/src/component/shared/EsconderMostrar.vue +0 -131
  107. package/src/component/shared/ExportarExcel.vue +0 -67
  108. package/src/component/shared/FiltroHorizontal.vue +0 -59
  109. package/src/component/shared/Mensagem.vue +0 -86
  110. package/src/component/shared/Progresso.vue +0 -21
  111. package/src/component/shared/SalvarCancelar.vue +0 -56
  112. package/src/component/shared/Tabela.vue +0 -275
  113. package/src/component/shared/TabelaBotao.vue +0 -36
  114. package/src/component/shared/query-builder/Campo.vue +0 -116
  115. package/src/component/shared/query-builder/ConverteParaOdata.js +0 -77
  116. package/src/component/shared/query-builder/components/CustomSelect.vue +0 -115
  117. package/src/component/shared/query-builder/components/QueryBuilderChildren.vue +0 -46
  118. package/src/component/shared/query-builder/components/QueryBuilderGroup.vue +0 -151
  119. package/src/component/shared/query-builder/components/QueryBuilderRule.vue +0 -81
  120. package/src/component/shared/query-builder/layouts/Bootstrap/BootstrapGroup.vue +0 -120
  121. package/src/component/shared/query-builder/layouts/Bootstrap/BootstrapRule.vue +0 -187
  122. package/src/component/shared/query-builder/main.js +0 -81
  123. package/src/component/template/ModeloAdicionarModificarView.vue +0 -32
  124. package/src/component/template/ModeloDocumentoView.vue +0 -227
  125. package/src/component/template/ModeloLista.vue +0 -231
  126. package/src/component/template/ModeloRelatorioListaView.vue +0 -227
  127. package/src/component/template/ModeloRelatorioView.vue +0 -489
  128. package/src/component/template/ModeloSubView.vue +0 -69
  129. package/src/component/template/ModeloView.vue +0 -49
  130. package/src/component/template/Relatorio.js +0 -10
  131. package/src/component/template/RelatorioAdicionarModificar.vue +0 -106
  132. package/src/store/modulos/generic.js +0 -494
  133. package/src/store/modulos/relatorio.js +0 -204
  134. package/src/store/modulos/usuario.js +0 -38
  135. package/src/store/modulos/validation.js +0 -39
@@ -1,164 +1,69 @@
1
1
  <template>
2
2
  <div class="vue-query-builder">
3
3
  <slot v-bind="vqbProps">
4
- <query-builder-group v-bind="vqbProps" :query.sync="query" />
4
+ <AddRule v-bind="vqbProps" />
5
5
  </slot>
6
6
  </div>
7
7
  </template>
8
8
 
9
9
  <script>
10
- /* eslint-disable vue/require-default-prop */
11
- import QueryBuilderGroup from "./layouts/Bootstrap/BootstrapGroup.vue";
12
- import deepClone from "./utilities.js";
13
-
14
- var defaultLabels = {
15
- matchType: "Construtor de Consulta",
16
- matchTypes: [
17
- { id: "all", label: "All" },
18
- { id: "any", label: "Any" },
19
- ],
20
- addRule: "+ Adicionar",
21
- removeRule: "&times;",
22
- addGroup: "+ Adicionar",
23
- removeGroup: "&times;",
24
- textInputPlaceholder: "Valor",
25
- };
10
+ import AddRule from "./AddRule.vue";
26
11
 
27
12
  export default {
28
- name: "VueQueryBuilder",
29
-
13
+ name: "QueryBuilder",
30
14
  components: {
31
- QueryBuilderGroup,
15
+ AddRule,
32
16
  },
33
-
34
17
  props: {
35
18
  rules: Array,
36
- labels: {
37
- type: Object,
38
- default() {
39
- return defaultLabels;
40
- },
41
- },
42
- maxDepth: {
43
- type: Number,
44
- default: 3,
45
- validator: function (value) {
46
- return value >= 1;
47
- },
48
- },
49
- value: Object,
50
19
  },
51
-
52
20
  data() {
53
21
  return {
54
- query: {
55
- logicalOperator: this.labels.matchTypes[0].id,
56
- children: [],
57
- },
58
- ruleTypes: {
22
+ query: {},
23
+ typeRule: {
59
24
  text: {
60
- operators: ["igual", "diferente", "contem"],
61
- inputType: "text",
62
25
  id: "text-field",
26
+ operators: ["igual", "diferente", "contem"],
27
+ fieldType: "text",
63
28
  },
64
29
  numeric: {
65
- operators: ["=", "!=", "<", "<=", ">", ">="],
66
- inputType: "number",
67
30
  id: "number-field",
68
- },
69
- custom: {
70
- operators: [],
71
- inputType: "text",
72
- id: "custom-field",
31
+ operators: ["=", "!=", "<", "<=", ">", ">="],
32
+ fieldType: "number",
73
33
  },
74
34
  radio: {
75
- operators: [],
76
- choices: [],
77
- inputType: "radio",
78
35
  id: "radio-field",
36
+ operators: [],
37
+ options: [],
38
+ fieldType: "radio",
79
39
  },
80
40
  checkbox: {
81
- operators: ["checkbox"],
82
- choices: [],
83
- inputType: "checkbox",
84
41
  id: "checkbox-field",
85
- },
86
- select: {
87
- operators: [],
88
- choices: [],
89
- inputType: "select",
90
- id: "select-field",
91
- },
92
- "multi-select": {
93
- operators: ["="],
94
- choices: [],
95
- inputType: "select",
96
- id: "multi-select-field",
42
+ operators: ["checkbox"],
43
+ options: [],
44
+ fieldType: "checkbox",
97
45
  },
98
46
  },
99
47
  };
100
48
  },
101
-
102
49
  computed: {
103
- mergedLabels() {
104
- return Object.assign({}, defaultLabels, this.labels);
105
- },
106
-
107
- mergedRules() {
108
- var mergedRules = [];
109
- var vm = this;
110
-
111
- vm.rules.forEach(function (rule) {
112
- if (typeof vm.ruleTypes[rule.type] !== "undefined") {
113
- mergedRules.push(Object.assign({}, vm.ruleTypes[rule.type], rule));
50
+ mergeRules() {
51
+ var mergeRules = [];
52
+ var self = this;
53
+ self.rules.forEach(function (rule) {
54
+ if (typeof self.typeRule[rule.fieldType] !== "undefined") {
55
+ mergeRules.push(Object.assign({}, self.typeRule[rule.fieldType], rule));
114
56
  } else {
115
- mergedRules.push(rule);
57
+ mergeRules.push(rule);
116
58
  }
117
59
  });
118
-
119
- return mergedRules;
60
+ return mergeRules;
120
61
  },
121
-
122
62
  vqbProps() {
123
63
  return {
124
- index: 0,
125
- depth: 1,
126
- maxDepth: this.maxDepth,
127
- ruleTypes: this.ruleTypes,
128
- rules: this.mergedRules,
129
- labels: this.mergedLabels,
64
+ rules: this.mergeRules,
130
65
  };
131
66
  },
132
67
  },
133
-
134
- mounted() {
135
- this.$watch(
136
- "query",
137
- (newQuery) => {
138
- if (JSON.stringify(newQuery) !== JSON.stringify(this.value)) {
139
- this.$emit("input", deepClone(newQuery));
140
- }
141
- },
142
- {
143
- deep: true,
144
- }
145
- );
146
-
147
- this.$watch(
148
- "value",
149
- (newValue) => {
150
- if (JSON.stringify(newValue) !== JSON.stringify(this.query)) {
151
- this.query = deepClone(newValue);
152
- }
153
- },
154
- {
155
- deep: true,
156
- }
157
- );
158
-
159
- if (typeof this.$options.propsData.value !== "undefined") {
160
- this.query = Object.assign(this.query, this.$options.propsData.value);
161
- }
162
- },
163
68
  };
164
69
  </script>
@@ -1,33 +1,28 @@
1
1
  <template>
2
2
  <div>
3
- <BarraRolagem :alturaMinima="450" :alturaMaxima="600">
4
- <QueryBuilder :rules="relatorio.filtro" v-model="filtroSelecionado" />
5
- </BarraRolagem>
3
+ <ScrollBar :minHeight="450" :maxHeight="600">
4
+ <QueryBuilder :rules="rules" />
5
+ </ScrollBar>
6
6
  </div>
7
7
  </template>
8
8
 
9
9
  <script>
10
10
  import QueryBuilder from "./QueryBuilder.vue";
11
- import BarraRolagem from "@nixweb/nixloc-ui/src/component/layout/BarraRolagem.vue";
11
+ import ScrollBar from "@nixweb/nixloc-ui/src/component/layout/ScrollBar.vue";
12
12
 
13
- import { mapMutations, mapState } from "vuex";
13
+ import { mapMutations } from "vuex";
14
14
 
15
15
  export default {
16
- name: "Filtro",
17
- components: { BarraRolagem, QueryBuilder },
18
- computed: {
19
- ...mapState("relatorio", ["relatorio"]),
20
- filtroSelecionado: {
21
- get() {
22
- return this.$store.state.relatorio.filtroSelecionado;
23
- },
24
- set(value) {
25
- this.atualizaFiltroSelecionado(value);
26
- },
27
- },
16
+ name: "Rules",
17
+ components: { ScrollBar, QueryBuilder },
18
+ props: {
19
+ rules: Array,
20
+ },
21
+ mounted() {
22
+ this.addRulesReport(this.rules);
28
23
  },
29
24
  methods: {
30
- ...mapMutations("relatorio", ["atualizaFiltroSelecionado"]),
25
+ ...mapMutations("report", ["addRulesReport"]),
31
26
  },
32
27
  };
33
28
  </script>
@@ -0,0 +1,96 @@
1
+ <template>
2
+ <div class="escolher-filter" :tabindex="tabindex" @blur="abrir = false">
3
+ <div class="selecionado" :class="{ abrir: abrir }" @click="abrir = !abrir">
4
+ {{ selecionado }}
5
+ </div>
6
+ <div class="items" :class="{ hide: !abrir }">
7
+ <div v-for="(options, i) of options" :key="i">
8
+ <div @click="select(options)">
9
+ <span :class="options.classCss">
10
+ <i :class="options.icon"></i>
11
+ <span> {{ options.title }}</span>
12
+ </span>
13
+ </div>
14
+ </div>
15
+ </div>
16
+ </div>
17
+ </template>
18
+
19
+ <script>
20
+ export default {
21
+ props: ["options", "tabindex", "value"],
22
+ data() {
23
+ return {
24
+ selecionado: "Selecione os filtros",
25
+ abrir: false,
26
+ };
27
+ },
28
+ mounted() {
29
+ this.$emit("input", this.selecionado);
30
+ },
31
+ methods: {
32
+ select(options) {
33
+ this.$emit("input", options);
34
+ this.selecionado = options.title;
35
+ this.abrir = false;
36
+ },
37
+ },
38
+ };
39
+ </script>
40
+
41
+ <style scoped>
42
+ .escolher-filter {
43
+ position: relative;
44
+ width: 100%;
45
+ text-align: left;
46
+ outline: none;
47
+ height: 40px;
48
+ line-height: 40px;
49
+ z-index: 1000;
50
+ }
51
+
52
+ .escolher-filter .selecionado {
53
+ background-color: white;
54
+ border-bottom: 1px solid #dbdee0;
55
+ color: black;
56
+ padding-left: 1em;
57
+ cursor: pointer;
58
+ user-select: none;
59
+ }
60
+
61
+ .escolher-filter .selecionado:after {
62
+ position: absolute;
63
+ content: "";
64
+ top: 22px;
65
+ right: 1em;
66
+ width: 0;
67
+ height: 0;
68
+ border: 5px solid transparent;
69
+ border-color: black transparent transparent transparent;
70
+ }
71
+
72
+ .escolher-filter .items {
73
+ color: black;
74
+ border-radius: 0px 0px 6px 6px;
75
+ overflow: hidden;
76
+ position: absolute;
77
+ background-color: #fafafc;
78
+ left: 0;
79
+ right: 0;
80
+ z-index: 1;
81
+ height: 200px;
82
+ overflow-y: visible;
83
+ overflow-x: hidden;
84
+ }
85
+
86
+ .escolher-filter .items div {
87
+ color: black;
88
+ padding-left: 1em;
89
+ cursor: pointer;
90
+ user-select: none;
91
+ }
92
+
93
+ .hide {
94
+ display: none;
95
+ }
96
+ </style>
@@ -1,10 +1,10 @@
1
1
  <template>
2
2
  <div>
3
- <div class="lado-a-lado div-tag" v-for="tag in tags" :key="tag.id">
3
+ <div class="side-by-side div-tag" v-for="tag in tags" :key="tag.id">
4
4
  <Tag
5
- :nomeEvento="nomeEvento"
6
- :dadosEvento="tag"
7
- :titulo="tag.titulo"
5
+ :eventName="eventName"
6
+ :eventData="tag"
7
+ :title="tag.title"
8
8
  :valor="tag.valor"
9
9
  />
10
10
  </div>
@@ -20,25 +20,25 @@ export default {
20
20
  name: "Tags",
21
21
  components: { Tag },
22
22
  props: {
23
- nomeEvento: String,
23
+ eventName: String,
24
24
  },
25
25
 
26
26
  computed: {
27
- ...mapGetters("relatorio", ["tags"]),
28
- ...mapGetters("generic", ["mostrarModal", "evento"]),
27
+ ...mapGetters("report", ["tags"]),
28
+ ...mapGetters("generic", ["showModal", "event"]),
29
29
  },
30
30
  methods: {
31
- ...mapMutations("relatorio", ["removeFiltroSelecionado"]),
31
+ ...mapMutations("report", ["removeFiltroSelecionado"]),
32
32
  },
33
33
  watch: {
34
- evento: {
35
- handler(evento) {
36
- if (evento.nome == "tagRemovida") {
37
- var tags = this.tags.filter((x) => {
38
- return x.id != evento.dados.id;
34
+ event: {
35
+ handler(event) {
36
+ if (event.nome == "tagRemovida") {
37
+ var tags = this.tags.filter((item) => {
38
+ return item.id != event.data.id;
39
39
  });
40
40
  this.tags = tags;
41
- this.removeFiltroSelecionado(evento.dados.id);
41
+ this.removeFiltroSelecionado(event.data.id);
42
42
  }
43
43
  },
44
44
  deep: true,
@@ -1,37 +1,37 @@
1
1
  <template>
2
2
  <div>
3
- <Moldura>
4
- <div v-for="item in dados" :key="item.titulo">
5
- <div :class="item.classeCss">
3
+ <Molded>
4
+ <div v-for="item in data" :key="item.title">
5
+ <div :class="item.classCss">
6
6
  <b-row>
7
7
  <b-col class="text-right" sm="10">
8
- <span class="titulo">{{ item.titulo }}</span>
8
+ <span class="title">{{ item.title }}</span>
9
9
  </b-col>
10
10
  <b-col class="text-right" sm="2">
11
- <span class="titulo">{{ item.valor }}</span>
11
+ <span class="title">{{ item.valor }}</span>
12
12
  </b-col>
13
13
  </b-row>
14
14
  </div>
15
15
  </div>
16
- </Moldura>
16
+ </Molded>
17
17
  </div>
18
18
  </template>
19
19
  <script>
20
- import Moldura from "@nixweb/nixloc-ui/src/component/layout/Moldura";
20
+ import Molded from "@nixweb/nixloc-ui/src/component/layout/Molded";
21
21
 
22
22
  export default {
23
23
  name: "RodapeRelatorio",
24
24
  components: {
25
- Moldura,
25
+ Molded,
26
26
  },
27
27
  props: {
28
- dados: Array,
28
+ data: Array,
29
29
  },
30
30
  };
31
31
  </script>
32
32
 
33
33
  <style scoped>
34
- .titulo {
34
+ .title {
35
35
  font-size: 15px;
36
36
  font-weight: 400;
37
37
  }
@@ -0,0 +1,106 @@
1
+ <template>
2
+ <div>
3
+ <b-row>
4
+ <b-col sm="12"
5
+ ><InputText
6
+ title="Nome"
7
+ field="name"
8
+ :formName="formName"
9
+ :required="true"
10
+ :maxLength="40"
11
+ v-model="report.name"
12
+ :markFormDirty="false"
13
+ />
14
+ </b-col>
15
+ </b-row>
16
+ <b-row>
17
+ <b-col sm="12">
18
+ <div class="text-right">
19
+ <Button
20
+ key="save"
21
+ type="success"
22
+ title="Salvar"
23
+ :disabled="!isFormValid(formName)"
24
+ classIcon="fas fa-save"
25
+ size="medium"
26
+ :clicked="saveReport"
27
+ />
28
+ </div>
29
+ </b-col>
30
+ </b-row>
31
+ </div>
32
+ </template>
33
+
34
+ <script>
35
+ import InputText from "@nixweb/nixloc-ui/src/component/forms/InputText";
36
+ import Button from "@nixweb/nixloc-ui/src/component/forms/Button";
37
+ import Report from "@nixweb/nixloc-ui/src/component/template/model/Report.js";
38
+
39
+ import { mapGetters, mapState, mapActions, mapMutations } from "vuex";
40
+
41
+ export default {
42
+ name: "AddEditReport",
43
+ components: { Button, InputText },
44
+ props: {
45
+ module: String,
46
+ },
47
+ data() {
48
+ return {
49
+ formName: "reportAddEditView",
50
+ report: new Report(),
51
+ urlAdicionar: "/api/v1/shared/report/adicionar",
52
+ urlModificar: "/api/v1/shared/report/modificar",
53
+ };
54
+ },
55
+ computed: {
56
+ ...mapGetters("validation", ["isFormValid"]),
57
+ ...mapGetters("generic", ["event"]),
58
+ ...mapGetters("report", ["headerTable", "filtroSelecionado"]),
59
+ ...mapState("report", ["selectedField", "campoOrdenado"]),
60
+ },
61
+ methods: {
62
+ ...mapActions("generic", ["postApi", "putApi"]),
63
+ ...mapMutations("generic", ["removeLoading", "removeEvent", "hideModal"]),
64
+ ...mapMutations("validation", ["resetValidation"]),
65
+ saveReport() {
66
+ var personalizado = this.report.id ? "" : "Personalizado";
67
+ const query = {
68
+ routeName: `${this.$route.name}${personalizado}`,
69
+ field: this.selectedField,
70
+ ordenacao: this.campoOrdenado,
71
+ filter: this.filtroSelecionado.children,
72
+ };
73
+ let obj = {
74
+ id: this.report.id,
75
+ name: this.report.name,
76
+ module: this.module,
77
+ query: JSON.stringify(query),
78
+ };
79
+ if (this.report.id) {
80
+ let params = { url: this.urlModificar, obj: obj };
81
+ this.putApi(params).then((response) => {
82
+ if (response.success) this.hideModal();
83
+ this.removeLoading(["save"]);
84
+ });
85
+ } else {
86
+ let params = { url: this.urlAdicionar, obj: obj };
87
+ this.postApi(params).then((response) => {
88
+ if (response.success) this.hideModal();
89
+ this.removeLoading(["save"]);
90
+ });
91
+ }
92
+ },
93
+ },
94
+ watch: {
95
+ event: {
96
+ handler(event) {
97
+ if (event.name == "changeReport") {
98
+ this.report.id = this.$route.params.id;
99
+ if (this.report.id) this.report.name = this.$route.params.name;
100
+ }
101
+ },
102
+ deep: true,
103
+ },
104
+ },
105
+ };
106
+ </script>