@nixweb/nixloc-ui 0.0.119 → 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 (122) hide show
  1. package/docs/src/component/template/ModeloRelatorioView.drawio +160 -0
  2. package/docs/src/store/modulos/relatorio.drawio +37 -0
  3. package/package.json +77 -75
  4. package/public/index.html +2 -4
  5. package/public/styles/app.css +1 -2
  6. package/src/component/forms/{Botao.vue → Button.vue} +53 -57
  7. package/src/component/forms/CheckboxGroup.vue +63 -0
  8. package/src/component/forms/{CheckboxUnico.vue → CheckboxSimple.vue} +6 -6
  9. package/src/component/forms/{Cor.vue → Color.vue} +9 -9
  10. package/src/component/forms/DateTime.vue +53 -53
  11. package/src/component/forms/{BotaoDropdown.vue → Dropdown.vue} +50 -50
  12. package/src/component/forms/EditorHtml.vue +123 -0
  13. package/src/component/forms/FileUpload.vue +189 -0
  14. package/src/component/forms/InputDecimal.vue +137 -0
  15. package/src/component/forms/InputNumber.vue +149 -0
  16. package/src/component/forms/InputPassword.vue +135 -0
  17. package/src/component/forms/InputText.vue +157 -0
  18. package/src/component/forms/Modal.vue +15 -15
  19. package/src/component/forms/RadioGroup.vue +50 -0
  20. package/src/component/forms/Select.vue +337 -0
  21. package/src/component/forms/SelectStatic.vue +120 -0
  22. package/src/component/forms/TextArea.vue +126 -0
  23. package/src/component/forms/Toggle.vue +13 -13
  24. package/src/component/layout/{Conta.vue → Account.vue} +28 -28
  25. package/src/component/layout/{Alerta.vue → Alert.vue} +22 -22
  26. package/src/component/layout/Badge.vue +23 -23
  27. package/src/component/layout/{BarraFixa.vue → FixedBar.vue} +16 -16
  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 +9 -9
  35. package/src/component/layout/Topo.vue +1 -1
  36. package/src/component/layout/Wizard.vue +3 -3
  37. package/src/component/shared/BotaoCarregarMais.vue +9 -9
  38. package/src/component/shared/BotaoConsulta.vue +9 -9
  39. package/src/component/shared/CabecalhoImpressao.vue +6 -6
  40. package/src/component/shared/CodigoEditor.vue +16 -16
  41. package/src/component/shared/Confirmacao.vue +28 -28
  42. package/src/component/shared/Dica.vue +10 -10
  43. package/src/component/shared/DocumentoEditor.vue +3 -3
  44. package/src/component/shared/DocumentoPreview.vue +2 -2
  45. package/src/component/shared/EsconderMostrar.vue +26 -26
  46. package/src/component/shared/ExportarExcel.vue +14 -14
  47. package/src/component/shared/ExportarPDF.vue +10 -10
  48. package/src/component/shared/FiltroHorizontal.vue +19 -19
  49. package/src/component/shared/LegendaParametro.vue +17 -17
  50. package/src/component/shared/{Carregando.vue → Loading.vue} +11 -11
  51. package/src/component/shared/Messages.vue +83 -0
  52. package/src/component/shared/Paginacao.vue +10 -10
  53. package/src/component/shared/Progresso.vue +2 -2
  54. package/src/component/shared/Registro.vue +2 -2
  55. package/src/component/shared/ResumoTabela.vue +6 -6
  56. package/src/component/shared/SalvarCancelar.vue +26 -26
  57. package/src/component/shared/{Pesquisa.vue → Search.vue} +36 -36
  58. package/src/component/shared/Tabela.vue +49 -49
  59. package/src/component/shared/TabelaBotao.vue +13 -13
  60. package/src/component/shared/Toast.vue +7 -7
  61. package/src/component/shared/{FiltroVertical.vue → VerticalFilter.vue} +14 -14
  62. package/src/component/shared/construtor-consulta/AdicionaFiltro.vue +191 -0
  63. package/src/component/shared/construtor-consulta/Campo.vue +127 -0
  64. package/src/component/shared/construtor-consulta/ComponenteDinamico.vue +109 -0
  65. package/src/component/shared/construtor-consulta/ConstrutorConsulta.vue +70 -0
  66. package/src/component/shared/construtor-consulta/ConverteParaOdata.js +80 -0
  67. package/src/component/shared/construtor-consulta/EscolherFiltro.vue +96 -0
  68. package/src/component/shared/{query-builder → construtor-consulta}/Filtro.vue +11 -16
  69. package/src/component/shared/construtor-consulta/ListaComponenteDinamico.vue +41 -0
  70. package/src/component/shared/{query-builder → construtor-consulta}/Rodape.vue +9 -9
  71. package/src/component/shared/{query-builder → construtor-consulta}/Tags.vue +7 -7
  72. package/src/component/shared/{query-builder → construtor-consulta}/utilities.js +0 -0
  73. package/src/component/template/ModeloAdicionarModificarView.vue +11 -11
  74. package/src/component/template/ModeloDocumentoView.vue +79 -79
  75. package/src/component/template/ModeloLista.vue +66 -66
  76. package/src/component/template/ModeloRelatorioListaView.vue +71 -68
  77. package/src/component/template/ModeloRelatorioView.vue +218 -200
  78. package/src/component/template/ModeloSubView.vue +13 -13
  79. package/src/component/template/ModeloView.vue +17 -17
  80. package/src/component/template/Relatorio.js +1 -5
  81. package/src/component/template/RelatorioAdicionarModificar.vue +44 -44
  82. package/src/component/value-objects/DadosContato.vue +27 -27
  83. package/src/component/value-objects/DadosPessoa.js +1 -1
  84. package/src/component/value-objects/DadosPessoa.vue +52 -52
  85. package/src/component/value-objects/Endereco.js +1 -1
  86. package/src/component/value-objects/Endereco.vue +83 -83
  87. package/src/config/dicas.js +1 -1
  88. package/src/config/token.js +2 -2
  89. package/src/store/modules/generic.js +489 -0
  90. package/src/store/modules/report.js +246 -0
  91. package/src/store/modules/user.js +38 -0
  92. package/src/store/modules/validation.js +39 -0
  93. package/src/store/store.js +4 -4
  94. package/public/js/menu.js +0 -11
  95. package/public/styles/menu.css +0 -1399
  96. package/src/component/forms/ArquivoUpload.vue +0 -199
  97. package/src/component/forms/CheckboxMultiplo.vue +0 -63
  98. package/src/component/forms/Decimal.vue +0 -137
  99. package/src/component/forms/Escolher.vue +0 -324
  100. package/src/component/forms/EscolherEstatico.vue +0 -139
  101. package/src/component/forms/Numero.vue +0 -153
  102. package/src/component/forms/Opcoes.vue +0 -51
  103. package/src/component/forms/Senha.vue +0 -139
  104. package/src/component/forms/Texto.vue +0 -161
  105. package/src/component/forms/TextoArea.vue +0 -126
  106. package/src/component/forms/TextoEditor.vue +0 -123
  107. package/src/component/layout/Painel.vue +0 -142
  108. package/src/component/shared/Mensagem.vue +0 -86
  109. package/src/component/shared/query-builder/Campo.vue +0 -116
  110. package/src/component/shared/query-builder/ConverteParaOdata.js +0 -73
  111. package/src/component/shared/query-builder/QueryBuilder.vue +0 -164
  112. package/src/component/shared/query-builder/components/CustomSelect.vue +0 -115
  113. package/src/component/shared/query-builder/components/QueryBuilderChildren.vue +0 -46
  114. package/src/component/shared/query-builder/components/QueryBuilderGroup.vue +0 -151
  115. package/src/component/shared/query-builder/components/QueryBuilderRule.vue +0 -81
  116. package/src/component/shared/query-builder/layouts/Bootstrap/BootstrapGroup.vue +0 -120
  117. package/src/component/shared/query-builder/layouts/Bootstrap/BootstrapRule.vue +0 -171
  118. package/src/component/shared/query-builder/main.js +0 -81
  119. package/src/store/modulos/generic.js +0 -494
  120. package/src/store/modulos/relatorio.js +0 -201
  121. package/src/store/modulos/usuario.js +0 -38
  122. package/src/store/modulos/validation.js +0 -39
@@ -8,102 +8,102 @@
8
8
  <b-form-checkbox v-model="selecionarTodos" @change="selecionar" />
9
9
  </div>
10
10
  </th>
11
- <th v-for="(obj, ind) in cabecalhoTabela" :key="ind">
12
- <div class="titulo-margem" :class="obj.classeCssTitulo">
11
+ <th v-for="(obj, ind) in headerTable" :key="ind">
12
+ <div class="title-margem" :class="obj.classeCssTitulo">
13
13
  <i class="fas fa-search" v-if="obj.iconeBusca"></i>
14
- <span class="titulo-cabecalho"> {{ obj.titulo }}</span>
14
+ <span class="title-cabecalho"> {{ obj.title }}</span>
15
15
  </div>
16
16
  </th>
17
17
  </tr>
18
18
  </thead>
19
19
  <tbody>
20
- <tr v-for="(linha, index) in dados" :key="index" :style="linha.linhaCss">
20
+ <tr v-for="(linha, index) in data" :key="index" :style="linha.linhaCss">
21
21
  <td class="td-checkbox" v-if="mostrarChecks">
22
22
  <b-form-checkbox v-model="selecionados" :value="linha.id" />
23
23
  </td>
24
- <td v-for="(obj, ind) in cabecalhoTabela" :key="ind">
24
+ <td v-for="(obj, ind) in headerTable" :key="ind">
25
25
  <div
26
26
  :class="converteClasse(linha[obj.campoComparacao], obj.classeCssCorpo)"
27
- v-if="obj.tipo === 'texto'"
27
+ v-if="obj.type === 'texto'"
28
28
  >
29
- {{ linha[obj.campo] }}
29
+ {{ linha[obj.field] }}
30
30
  </div>
31
31
  <div
32
32
  :class="converteClasse(linha[obj.campoComparacao], obj.classeCssCorpo)"
33
- v-if="obj.tipo === 'classe'"
33
+ v-if="obj.type === 'classe'"
34
34
  >
35
- {{ linha[obj.campo] }}
35
+ {{ linha[obj.field] }}
36
36
  </div>
37
37
  <div
38
38
  :class="converteClasse(linha[obj.campoComparacao], obj.classeCssCorpo)"
39
- v-if="obj.tipo === 'html'"
39
+ v-if="obj.type === 'html'"
40
40
  >
41
- <div v-if="linha[obj.campo]" v-html="linha[obj.campo]"></div>
41
+ <div v-if="linha[obj.field]" v-html="linha[obj.field]"></div>
42
42
  <div v-else v-html="obj.html"></div>
43
43
  </div>
44
44
  <div
45
45
  :class="converteClasse(linha[obj.campoComparacao], obj.classeCssCorpo)"
46
- v-if="obj.tipo === 'escolher'"
46
+ v-if="obj.type === 'escolher'"
47
47
  >
48
- {{ linha[obj.campo].conteudo }}
48
+ {{ linha[obj.field].content }}
49
49
  </div>
50
50
  <div
51
51
  :class="converteClasse(linha[obj.campoComparacao], obj.classeCssCorpo)"
52
- v-if="obj.tipo === 'data'"
52
+ v-if="obj.type === 'data'"
53
53
  >
54
- {{ linha[obj.campo] | moment("DD/MM/YYYY") }}
54
+ {{ linha[obj.field] | moment("DD/MM/YYYY") }}
55
55
  </div>
56
56
  <div
57
57
  :class="converteClasse(linha[obj.campoComparacao], obj.classeCssCorpo)"
58
- v-if="obj.tipo === 'dataHora'"
58
+ v-if="obj.type === 'dataHora'"
59
59
  >
60
- {{ linha[obj.campo] | moment("DD/MM/YYYY HH:mm") }}
60
+ {{ linha[obj.field] | moment("DD/MM/YYYY HH:mm") }}
61
61
  </div>
62
62
  <div
63
63
  :class="converteClasse(linha[obj.campoComparacao], obj.classeCssCorpo)"
64
- v-if="obj.tipo === 'valor'"
64
+ v-if="obj.type === 'valor'"
65
65
  >
66
- {{ linha[obj.campo] | currency }}
66
+ {{ linha[obj.field] | currency }}
67
67
  </div>
68
68
  <div
69
69
  :class="converteClasse(linha[obj.campoComparacao], obj.classeCssCorpo)"
70
- v-if="obj.tipo === 'pdf'"
70
+ v-if="obj.type === 'pdf'"
71
71
  >
72
72
  <span
73
- @click="solicitarPdf(obj.pdf, linha[obj.campo])"
74
- class="icone"
75
- v-if="linha[obj.campo]"
73
+ @click="solicitarPdf(obj.pdf, linha[obj.field])"
74
+ class="icon"
75
+ v-if="linha[obj.field]"
76
76
  >
77
- <i :class="obj.icone"></i
77
+ <i :class="obj.icon"></i
78
78
  ></span>
79
79
  <span v-else>N/I</span>
80
80
  </div>
81
81
  <div
82
82
  :class="converteClasse(linha[obj.campoComparacao], obj.classeCssCorpo)"
83
- v-if="obj.tipo === 'telerik'"
83
+ v-if="obj.type === 'telerik'"
84
84
  >
85
85
  <span
86
- @click="solicitarTelerik(obj.pdf, linha[obj.campo])"
87
- class="icone"
88
- v-if="linha[obj.campo]"
86
+ @click="solicitarTelerik(obj.pdf, linha[obj.field])"
87
+ class="icon"
88
+ v-if="linha[obj.field]"
89
89
  >
90
- <i :class="obj.icone"></i
90
+ <i :class="obj.icon"></i
91
91
  ></span>
92
92
  <span v-else>N/I</span>
93
93
  </div>
94
94
  <div
95
95
  :class="converteClasse(linha[obj.campoComparacao], obj.classeCssCorpo)"
96
- v-if="obj.tipo === 'botao'"
96
+ v-if="obj.type === 'botao'"
97
97
  >
98
98
  <TabelaBotao :obj="obj" :linha="linha" />
99
99
  </div>
100
- <div class="link" v-if="obj.tipo === 'link'" @click="navegarPara(obj, linha)">
101
- <span> {{ linha[obj.campo] }}</span>
100
+ <div class="link" v-if="obj.type === 'link'" @click="navegateTo(obj, linha)">
101
+ <span> {{ linha[obj.field] }}</span>
102
102
  </div>
103
103
  </td>
104
104
  </tr>
105
105
  </tbody>
106
- <tbody v-show="dados.length == 0">
106
+ <tbody v-show="data.length == 0">
107
107
  <tr>
108
108
  <td colspan="12">
109
109
  <span>Nenhum registro encontrado!</span>
@@ -122,8 +122,8 @@ import { mapState, mapMutations, mapActions } from "vuex";
122
122
  export default {
123
123
  components: { TabelaBotao },
124
124
  props: {
125
- cabecalhoTabela: Array,
126
- dados: Array,
125
+ headerTable: Array,
126
+ data: Array,
127
127
  mostrarChecks: {
128
128
  type: Boolean,
129
129
  default: true,
@@ -141,18 +141,18 @@ export default {
141
141
  return this.$store.state.generic.selecionados;
142
142
  },
143
143
  set(value) {
144
- this.adicionaSelecao(value);
144
+ this.addSelection(value);
145
145
  },
146
146
  },
147
147
  },
148
148
  methods: {
149
- ...mapMutations("generic", ["adicionaSelecao", "insereEvento"]),
149
+ ...mapMutations("generic", ["addSelection", "addEvent"]),
150
150
  ...mapActions("generic", ["pdfApi"]),
151
151
  selecionar() {
152
- this.adicionaSelecao([]);
152
+ this.addSelection([]);
153
153
  if (this.selecionarTodos) {
154
- for (let i in this.dados) {
155
- this.selecionados.push(this.dados[i].id);
154
+ for (let i in this.data) {
155
+ this.selecionados.push(this.data[i].id);
156
156
  }
157
157
  }
158
158
  },
@@ -191,23 +191,23 @@ export default {
191
191
  };
192
192
  this.pdfApi(params).then((response) => {});
193
193
  },
194
- navegarPara(obj, linha) {
195
- if (obj.nomeRota) {
194
+ navegateTo(obj, linha) {
195
+ if (obj.routeName) {
196
196
  this.$router.push({
197
- name: obj.nomeRota,
197
+ name: obj.routeName,
198
198
  params: { id: linha.id },
199
199
  });
200
200
  } else {
201
- this.insereEvento({
201
+ this.addEvent({
202
202
  nome: obj.nomeEvento,
203
- dados: linha,
203
+ data: linha,
204
204
  });
205
205
  }
206
206
  },
207
207
  },
208
208
 
209
209
  beforeDestroy() {
210
- this.adicionaSelecao([]);
210
+ this.addSelection([]);
211
211
  },
212
212
  };
213
213
  </script>
@@ -235,7 +235,7 @@ tr:hover {
235
235
  background-color: #fafafc;
236
236
  }
237
237
 
238
- .titulo-cabecalho {
238
+ .title-cabecalho {
239
239
  font-size: 13px;
240
240
  color: #757d8c;
241
241
  font-weight: 400;
@@ -247,7 +247,7 @@ tr:hover {
247
247
  font-weight: bold;
248
248
  }
249
249
 
250
- .tabela-principal {
250
+ .tabela-main {
251
251
  color: #757d8c;
252
252
  max-width: 200px;
253
253
  }
@@ -269,7 +269,7 @@ tr:hover {
269
269
  transition: 0.1s;
270
270
  }
271
271
 
272
- .icone-link:hover {
272
+ .icon-link:hover {
273
273
  font-size: 12.5px;
274
274
  }
275
275
  </style>
@@ -1,33 +1,33 @@
1
1
  <template>
2
2
  <div>
3
- <Botao
3
+ <Button
4
4
  v-if="obj.qualBotao == 'botao'"
5
- :chave="linha.id"
6
- :titulo="obj.botao.titulo"
7
- :tipo="obj.botao.tipo"
8
- :tamanho="obj.botao.tamanho"
9
- :classeIcone="obj.botao.classeIcone"
5
+ :key="linha.id"
6
+ :title="obj.botao.title"
7
+ :type="obj.botao.type"
8
+ :size="obj.botao.size"
9
+ :classIcon="obj.botao.classIcon"
10
10
  :nomeEvento="obj.botao.nomeEvento"
11
11
  :dadosEvento="linha"
12
12
  />
13
13
  <BotaoDropdown
14
14
  v-if="obj.qualBotao == 'botaodropdown'"
15
- :titulo="obj.botao.titulo"
16
- :tipo="obj.botao.tipo"
17
- :tamanho="obj.botao.tamanho"
18
- :classeIcone="obj.botao.classeIcone"
15
+ :title="obj.botao.title"
16
+ :type="obj.botao.type"
17
+ :size="obj.botao.size"
18
+ :classIcon="obj.botao.classIcon"
19
19
  :dadosEvento="linha"
20
- :itens="obj.botao.itens"
20
+ :items="obj.botao.items"
21
21
  />
22
22
  </div>
23
23
  </template>
24
24
 
25
25
  <script>
26
26
  import BotaoDropdown from "../forms/BotaoDropdown";
27
- import Botao from "../forms/Botao";
27
+ import Button from "../forms/Button";
28
28
  export default {
29
29
  name: "TabelaBotao",
30
- components: { Botao, BotaoDropdown },
30
+ components: { Button, BotaoDropdown },
31
31
  props: {
32
32
  obj: Object,
33
33
  linha: Object,
@@ -18,28 +18,28 @@ export default {
18
18
  },
19
19
  methods: {
20
20
  notifica(value) {
21
- if (value.tipo == "postApi" || value.tipo == "putApi")
22
- this.$toasted.show("Salvo com sucesso", {
21
+ if (value.type == "postApi" || value.type == "putApi")
22
+ this.$toasted.show("Salvo com success", {
23
23
  type: "success",
24
24
  });
25
- if (value.tipo == "postApiErro" || value.tipo == "putApiErro") {
25
+ if (value.type == "postApiError" || value.type == "putApiErro") {
26
26
  this.$toasted.show("Ops! Algo deu errado", {
27
27
  type: "error",
28
28
  });
29
29
  this.voltarParaTopo();
30
30
  }
31
31
 
32
- if (value.tipo == "removerTodosApiSucesso")
33
- this.$toasted.show("Removido com sucesso", {
32
+ if (value.type == "removerTodosApiSucesso")
33
+ this.$toasted.show("Removido com success", {
34
34
  type: "success",
35
35
  });
36
- if (value.tipo == "removerTodosApiErro") {
36
+ if (value.type == "removerTodosApiErro") {
37
37
  this.$toasted.show("Ops! Algo deu errado", {
38
38
  type: "error",
39
39
  });
40
40
  this.voltarParaTopo();
41
41
  }
42
- if (value.tipo == "falhaGenerica") {
42
+ if (value.type == "falhaGenerica") {
43
43
  this.$toasted.show("Ops! Algo deu errado", {
44
44
  type: "error",
45
45
  });
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <div>
3
3
  <div
4
- class="moldura-botao"
4
+ class="molded-botao"
5
5
  :class="{ fechado: !mostrarFiltro, aberto: mostrarFiltro }"
6
6
  v-show="!mostrarFiltro"
7
7
  @click="mouseOver"
@@ -11,7 +11,7 @@
11
11
 
12
12
  <transition name="slide-fade">
13
13
  <div
14
- class="moldura-botao botao-recolher"
14
+ class="molded-botao botao-recolher"
15
15
  v-show="mostrarFiltro"
16
16
  @click="mostrarFiltro = false"
17
17
  >
@@ -20,22 +20,22 @@
20
20
  </transition>
21
21
 
22
22
  <transition name="slide-fade">
23
- <div class="moldura" v-show="mostrarFiltro">
23
+ <div class="molded" v-show="mostrarFiltro">
24
24
  <div class="row">
25
- <div class="col-4 c-titulo-filtro">
25
+ <div class="col-4 c-title-filter">
26
26
  <i class="fas fa-filter"></i>
27
- <span class="espaco-icone">FILTRO</span>
27
+ <span class="espaco-icon">FILTRO</span>
28
28
  </div>
29
29
  </div>
30
30
  <hr />
31
31
  <b-row v-if="mostrarSelecioneTotal">
32
32
  <b-col sm="6">
33
33
  <Escolher
34
- titulo="Mostrar"
35
- campo="Mostrar"
36
- :requerido="false"
34
+ title="show"
35
+ field="show"
36
+ :required="false"
37
37
  url="/api/v1/util/total-por-pagina"
38
- v-model="totalPorPagina"
38
+ v-model="totalPerPage"
39
39
  />
40
40
  </b-col>
41
41
  </b-row>
@@ -64,12 +64,12 @@ export default {
64
64
  };
65
65
  },
66
66
  computed: {
67
- totalPorPagina: {
67
+ totalPerPage: {
68
68
  get() {
69
- return this.$store.state.generic.totalPorPagina;
69
+ return this.$store.state.generic.totalPerPage;
70
70
  },
71
71
  set(value) {
72
- if (!value.conteudo) value.conteudo = 10;
72
+ if (!value.content) value.content = 10;
73
73
  this.atualizaTotalPorPagina(value);
74
74
  },
75
75
  },
@@ -84,7 +84,7 @@ export default {
84
84
  </script>
85
85
 
86
86
  <style scoped>
87
- .moldura {
87
+ .molded {
88
88
  background: white;
89
89
  border-left: solid 1px #dbdee0;
90
90
  font-size: 13px;
@@ -98,7 +98,7 @@ export default {
98
98
  z-index: 999;
99
99
  }
100
100
 
101
- .moldura-botao {
101
+ .molded-botao {
102
102
  font-size: 18px;
103
103
  background: #ffffff;
104
104
  border: solid 1px #dbdfe9;
@@ -0,0 +1,191 @@
1
+ <template>
2
+ <div class="vqb-group card">
3
+ <div class="vqb-group-body card-body">
4
+ <div class="rule-actions form-inline">
5
+ <div class="div-custom">
6
+ <b-row>
7
+ <b-col sm="6">
8
+ <EscolherFiltro
9
+ :options="rules"
10
+ class="select"
11
+ v-model="selectedRule"
12
+ />
13
+ </b-col>
14
+ <b-col sm="3">
15
+ <options
16
+ :options="[
17
+ { text: 'e', value: 'and' },
18
+ { text: 'ou', value: 'or' },
19
+ ]"
20
+ v-model="andOr"
21
+ />
22
+ </b-col>
23
+ <b-col sm="3">
24
+ <button type="button" class="btn btn-secondary" @click="adicionar">
25
+ + Adicionar
26
+ </button>
27
+ </b-col>
28
+ </b-row>
29
+ </div>
30
+ </div>
31
+ <ListaComponenteDinamico />
32
+ </div>
33
+ </div>
34
+ </template>
35
+
36
+ <script>
37
+ import EscolherFiltro from "./EscolherFiltro.vue";
38
+ import ComponenteDinamico from "./ComponenteDinamico.vue";
39
+ import options from "@nixweb/nixloc-ui/src/component/forms/options.vue";
40
+ import ListaComponenteDinamico from "@nixweb/nixloc-ui/src/component/shared/construtor-consulta/ListaComponenteDinamico.vue";
41
+
42
+ import deepClone from "./utilities.js";
43
+
44
+ import { mapGetters, mapMutations } from "vuex";
45
+
46
+ export default {
47
+ name: "AdicionaFiltro",
48
+ components: {
49
+ EscolherFiltro,
50
+ ComponenteDinamico,
51
+ options,
52
+ ListaComponenteDinamico,
53
+ },
54
+ props: {
55
+ consulta: Object,
56
+ rules: Array,
57
+ index: Number,
58
+ maximaProfunidade: Number,
59
+ profundidade: Number,
60
+ titulos: Object,
61
+ },
62
+ data() {
63
+ return {
64
+ selectedRule: this.rules[0],
65
+ andOr: "or",
66
+ duplicidade: [],
67
+ };
68
+ },
69
+ computed: {
70
+ ...mapGetters("generic", ["evento"]),
71
+ },
72
+ methods: {
73
+ ...mapMutations("generic", ["addNotifications"]),
74
+ ...mapMutations("report", ["addSelectedRules"]),
75
+ adicionar() {
76
+ this.selectedRule.andOr = this.andOr;
77
+ this.adicionarRegra();
78
+ },
79
+ adicionarRegra() {
80
+ let consulta_atualizada = deepClone(this.consulta);
81
+ let obj = this.montaFiltro();
82
+
83
+ if (!this.jaExiste(obj.nome)) {
84
+ this.addSelectedRules(obj);
85
+ if (obj.naoPermitirDuplicidade) this.duplicidade.push(obj);
86
+ } else {
87
+ var erro = {
88
+ property: "ERRO QUERY BUILDER",
89
+ message: `Não é possível adicionar o filter ${obj.title} 2 vezes!`,
90
+ };
91
+ this.addNotifications([erro]);
92
+ }
93
+ },
94
+ montaFiltro() {
95
+ let obj = {
96
+ id: this.geraId(),
97
+ nome: this.selectedRule.nome,
98
+ title: this.selectedRule.title,
99
+ fieldType: this.selectedRule.fieldType,
100
+ type: this.selectedRule.type,
101
+ options: this.selectedRule.options,
102
+ props: this.selectedRule.props,
103
+ classeCss: this.selectedRule.classeCss,
104
+ icon: this.selectedRule.icon,
105
+ operatores: this.selectedRule.operatores,
106
+ operator: null,
107
+ andOr: this.selectedRule.andOr,
108
+ isRequired: this.selectedRule.isRequired,
109
+ naoPermitirDuplicidade: this.selectedRule.naoPermitirDuplicidade,
110
+ valor: null,
111
+ };
112
+ return obj;
113
+ },
114
+ geraId() {
115
+ return Math.random()
116
+ .toString(36)
117
+ .replace(/[^a-z]+/g, "")
118
+ .substr(0, 5);
119
+ },
120
+ jaExiste(key) {
121
+ var existe = this.duplicidade.find((item) => {
122
+ return item.nome === key;
123
+ });
124
+ if (existe) return true;
125
+ return false;
126
+ },
127
+ },
128
+ watch: {
129
+ evento: {
130
+ handler(evento) {
131
+ // Se a tag ou a rule que está selecionada foi removida, é necessário remover tambem do array "duplicidade" para liberar e adicionar novamente.
132
+ if (evento.nome == "tagRemovida" || evento.nome == "selectedRuleRemovida") {
133
+ var duplicidade = this.duplicidade.filter((item) => {
134
+ return item.id != evento.data.id;
135
+ });
136
+ this.duplicidade = duplicidade;
137
+ }
138
+ },
139
+ deep: true,
140
+ },
141
+ },
142
+ };
143
+ </script>
144
+
145
+ <style>
146
+ .title-option {
147
+ padding: 10px;
148
+ }
149
+
150
+ .div-custom {
151
+ width: 100%;
152
+ }
153
+
154
+ .vue-query-builder .vqb-group .rule-actions {
155
+ margin-bottom: 20px;
156
+ }
157
+
158
+ .vue-query-builder .vqb-rule {
159
+ margin-top: 15px;
160
+ margin-bottom: 15px;
161
+ background-color: #f5f5f5;
162
+ border-color: #ddd;
163
+ padding: 15px;
164
+ }
165
+
166
+ .vue-query-builder .vqb-group.depth-1 .vqb-rule,
167
+ .vue-query-builder .vqb-group.depth-2 {
168
+ border-left: 2px solid #8bc34a;
169
+ }
170
+
171
+ .vue-query-builder .vqb-group.depth-2 .vqb-rule,
172
+ .vue-query-builder .vqb-group.depth-3 {
173
+ border-left: 2px solid #00bcd4;
174
+ }
175
+
176
+ .vue-query-builder .vqb-group.depth-3 .vqb-rule,
177
+ .vue-query-builder .vqb-group.depth-4 {
178
+ border-left: 2px solid #ff5722;
179
+ }
180
+
181
+ .vue-query-builder .close {
182
+ opacity: 1;
183
+ color: rgb(150, 150, 150);
184
+ }
185
+
186
+ @media (min-width: 768px) {
187
+ .vue-query-builder .vqb-rule.form-inline .form-group {
188
+ display: block;
189
+ }
190
+ }
191
+ </style>