@nixweb/nixloc-ui 0.0.93 → 0.0.96

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 (30) hide show
  1. package/package.json +3 -2
  2. package/src/component/forms/DateTime.vue +16 -3
  3. package/src/component/forms/EscolherEstatico.vue +0 -3
  4. package/src/component/layout/BarraRolagem.vue +9 -2
  5. package/src/component/layout/Menu.vue +19 -12
  6. package/src/component/layout/Tag.vue +66 -0
  7. package/src/component/shared/Confirmacao.vue +80 -0
  8. package/src/component/shared/FiltroHorizontal.vue +8 -2
  9. package/src/component/shared/Progresso.vue +14 -1
  10. package/src/component/shared/Tabela.vue +3 -13
  11. package/src/component/shared/query-builder/Campo.vue +116 -0
  12. package/src/component/shared/query-builder/ConverteParaOdata.js +73 -0
  13. package/src/component/shared/query-builder/Filtro.vue +85 -0
  14. package/src/component/shared/query-builder/QueryBuilder.vue +164 -0
  15. package/src/component/shared/query-builder/Rodape.vue +38 -0
  16. package/src/component/shared/query-builder/Tags.vue +84 -0
  17. package/src/component/shared/query-builder/components/CustomSelect.vue +115 -0
  18. package/src/component/shared/query-builder/components/QueryBuilderChildren.vue +46 -0
  19. package/src/component/shared/query-builder/components/QueryBuilderGroup.vue +151 -0
  20. package/src/component/shared/query-builder/components/QueryBuilderRule.vue +81 -0
  21. package/src/component/shared/query-builder/layouts/Bootstrap/BootstrapGroup.vue +120 -0
  22. package/src/component/shared/query-builder/layouts/Bootstrap/BootstrapRule.vue +171 -0
  23. package/src/component/shared/query-builder/main.js +81 -0
  24. package/src/component/shared/query-builder/utilities.js +22 -0
  25. package/src/component/template/ModeloRelatorioListaView.vue +101 -32
  26. package/src/component/template/ModeloRelatorioView.vue +467 -0
  27. package/src/component/template/Relatorio.js +10 -0
  28. package/src/component/template/RelatorioAdicionarModificar.vue +106 -0
  29. package/src/store/modulos/generic.js +11 -0
  30. package/src/store/modulos/relatorio.js +169 -0
@@ -0,0 +1,120 @@
1
+ <template>
2
+ <!-- eslint-disable vue/no-v-html -->
3
+ <div class="vqb-group card" :class="'depth-' + depth.toString()">
4
+ <div class="vqb-group-heading card-header" v-if="false">
5
+ <div class="match-type-container form-inline">
6
+ <label class="mr-2" for="vqb-match-type">
7
+ {{ labels.matchType }}
8
+ </label>
9
+
10
+ <select id="vqb-match-type" v-model="query.logicalOperator" class="form-control">
11
+ <option v-for="label in labels.matchTypes" :key="label.id" :value="label.id">
12
+ {{ label.label }}
13
+ </option>
14
+ </select>
15
+
16
+ <button
17
+ v-if="depth > 1"
18
+ type="button"
19
+ class="close ml-auto"
20
+ @click="remove"
21
+ v-html="labels.removeGroup"
22
+ ></button>
23
+ </div>
24
+ </div>
25
+
26
+ <div class="vqb-group-body card-body">
27
+ <div class="rule-actions form-inline">
28
+ <div class="div-custom">
29
+ <b-row>
30
+ <b-col sm="6">
31
+ <CustomSelect :options="rules" class="select" v-model="selectedRule" />
32
+ </b-col>
33
+ <b-col sm="4">
34
+ <button type="button" class="btn btn-secondary mr-2" @click="addRule">
35
+ {{ labels.addRule }}
36
+ </button>
37
+ </b-col>
38
+ </b-row>
39
+
40
+ <!-- <button
41
+ v-if="depth < maxDepth"
42
+ type="button"
43
+ class="btn btn-secondary"
44
+ @click="addGroup"
45
+ >
46
+ {{ labels.addGroup }}
47
+ </button> -->
48
+ </div>
49
+ </div>
50
+
51
+ <query-builder-children v-bind="$props" />
52
+ </div>
53
+ </div>
54
+ </template>
55
+
56
+ <script>
57
+ import CustomSelect from "../../components/CustomSelect.vue";
58
+ import QueryBuilderGroup from "../../components/QueryBuilderGroup";
59
+ import QueryBuilderRule from "./BootstrapRule.vue";
60
+
61
+ export default {
62
+ name: "QueryBuilderGroup",
63
+
64
+ components: {
65
+ // eslint-disable-next-line vue/no-unused-components
66
+ QueryBuilderRule: QueryBuilderRule,
67
+ CustomSelect,
68
+ },
69
+
70
+ extends: QueryBuilderGroup,
71
+ };
72
+ </script>
73
+
74
+ <style>
75
+ .titulo-option {
76
+ padding: 10px;
77
+ }
78
+
79
+ .div-custom {
80
+ width: 100%;
81
+ }
82
+
83
+ .vue-query-builder .vqb-group .rule-actions {
84
+ margin-bottom: 20px;
85
+ }
86
+
87
+ .vue-query-builder .vqb-rule {
88
+ margin-top: 15px;
89
+ margin-bottom: 15px;
90
+ background-color: #f5f5f5;
91
+ border-color: #ddd;
92
+ padding: 15px;
93
+ }
94
+
95
+ .vue-query-builder .vqb-group.depth-1 .vqb-rule,
96
+ .vue-query-builder .vqb-group.depth-2 {
97
+ border-left: 2px solid #8bc34a;
98
+ }
99
+
100
+ .vue-query-builder .vqb-group.depth-2 .vqb-rule,
101
+ .vue-query-builder .vqb-group.depth-3 {
102
+ border-left: 2px solid #00bcd4;
103
+ }
104
+
105
+ .vue-query-builder .vqb-group.depth-3 .vqb-rule,
106
+ .vue-query-builder .vqb-group.depth-4 {
107
+ border-left: 2px solid #ff5722;
108
+ }
109
+
110
+ .vue-query-builder .close {
111
+ opacity: 1;
112
+ color: rgb(150, 150, 150);
113
+ }
114
+
115
+ @media (min-width: 768px) {
116
+ .vue-query-builder .vqb-rule.form-inline .form-group {
117
+ display: block;
118
+ }
119
+ }
120
+ </style>
@@ -0,0 +1,171 @@
1
+ <template>
2
+ <!-- eslint-disable vue/no-v-html -->
3
+ <div class="vqb-rule card">
4
+ <div class="form-inline">
5
+ <label :class="rule.classeCss" class="mr-5">
6
+ <i :class="rule.icone"></i>
7
+ <span style="margin-left: 10px">{{ rule.label }} </span>
8
+ </label>
9
+
10
+ <!-- List of operands (optional) -->
11
+ <select
12
+ v-if="typeof rule.operands !== 'undefined'"
13
+ v-model="query.operand"
14
+ class="form-control mr-2"
15
+ >
16
+ <option v-for="operand in rule.operands" :key="operand">
17
+ {{ operand }}
18
+ </option>
19
+ </select>
20
+
21
+ <!-- List of operators (e.g. =, !=, >, <) -->
22
+ <select
23
+ v-if="typeof rule.operators !== 'undefined' && rule.operators.length > 1"
24
+ v-model="query.operator"
25
+ class="form-control mr-2"
26
+ >
27
+ <option v-for="operator in rule.operators" :key="operator" :value="operator">
28
+ {{ operator }}
29
+ </option>
30
+ </select>
31
+
32
+ <!-- Basic text input -->
33
+ <input
34
+ v-if="rule.inputType === 'text'"
35
+ v-model="query.value"
36
+ class="form-control"
37
+ type="text"
38
+ :placeholder="labels.textInputPlaceholder"
39
+ />
40
+
41
+ <!-- Basic number input -->
42
+ <input
43
+ v-if="rule.inputType === 'number'"
44
+ v-model="query.value"
45
+ class="form-control"
46
+ type="number"
47
+ />
48
+
49
+ <!-- Datepicker -->
50
+ <input
51
+ v-if="rule.inputType === 'date'"
52
+ v-model="query.value"
53
+ class="form-control"
54
+ type="date"
55
+ />
56
+
57
+ <!-- Custom component input -->
58
+ <div v-if="isCustomComponent" class="vqb-custom-component-wrap">
59
+ <DateTime
60
+ v-if="rule.component == 'datetime'"
61
+ :format="rule.props.format"
62
+ :type="rule.props.type"
63
+ :range="rule.props.range"
64
+ :value="query.value"
65
+ @input="updateQuery"
66
+ />
67
+ </div>
68
+
69
+ <!-- Checkbox input -->
70
+ <template v-if="rule.inputType === 'checkbox'">
71
+ <div
72
+ v-for="choice in rule.choices"
73
+ :key="choice.value"
74
+ class="form-check form-check-inline"
75
+ >
76
+ <input
77
+ :id="'depth' + depth + '-' + rule.id + '-' + index + '-' + choice.value"
78
+ v-model="query.value"
79
+ type="checkbox"
80
+ :value="choice.value"
81
+ class="form-check-input"
82
+ />
83
+ <label
84
+ class="form-check-label"
85
+ :for="'depth' + depth + '-' + rule.id + '-' + index + '-' + choice.value"
86
+ >
87
+ {{ choice.label }}
88
+ </label>
89
+ </div>
90
+ </template>
91
+
92
+ <!-- Radio input -->
93
+ <template v-if="rule.inputType === 'radio'">
94
+ <div
95
+ v-for="choice in rule.choices"
96
+ :key="choice.value"
97
+ class="form-check form-check-inline"
98
+ >
99
+ <input
100
+ :id="'depth' + depth + '-' + rule.id + '-' + index + '-' + choice.value"
101
+ v-model="query.value"
102
+ :name="'depth' + depth + '-' + rule.id + '-' + index"
103
+ type="radio"
104
+ :value="choice.value"
105
+ class="form-check-input"
106
+ />
107
+ <label
108
+ class="form-check-label"
109
+ :for="'depth' + depth + '-' + rule.id + '-' + index + '-' + choice.value"
110
+ >
111
+ {{ choice.label }}
112
+ </label>
113
+ </div>
114
+ </template>
115
+
116
+ <!-- Select without groups -->
117
+ <select
118
+ v-if="rule.inputType === 'select' && !hasOptionGroups"
119
+ v-model="query.value"
120
+ class="form-control"
121
+ :multiple="rule.type === 'multi-select'"
122
+ >
123
+ <option v-for="option in selectOptions" :key="option.value" :value="option.value">
124
+ {{ option.label }}
125
+ </option>
126
+ </select>
127
+
128
+ <!-- Select with groups -->
129
+ <select
130
+ v-if="rule.inputType === 'select' && hasOptionGroups"
131
+ v-model="query.value"
132
+ class="form-control"
133
+ :multiple="rule.type === 'multi-select'"
134
+ >
135
+ <optgroup
136
+ v-for="(option, option_key) in selectOptions"
137
+ :key="option_key"
138
+ :label="option_key"
139
+ >
140
+ <option
141
+ v-for="sub_option in option"
142
+ :key="sub_option.value"
143
+ :value="sub_option.value"
144
+ >
145
+ {{ sub_option.label }}
146
+ </option>
147
+ </optgroup>
148
+ </select>
149
+
150
+ <!-- Remove rule button -->
151
+ <button
152
+ type="button"
153
+ class="close ml-auto"
154
+ @click="remove"
155
+ v-html="labels.removeRule"
156
+ ></button>
157
+ </div>
158
+ </div>
159
+ </template>
160
+
161
+ <script>
162
+ import QueryBuilderRule from "../../components/QueryBuilderRule";
163
+ import DateTime from "@nixweb/nixloc-ui/src/component/forms/DateTime";
164
+
165
+ export default {
166
+ extends: QueryBuilderRule,
167
+ components: {
168
+ DateTime,
169
+ },
170
+ };
171
+ </script>
@@ -0,0 +1,81 @@
1
+ import Vue from 'vue'
2
+ import VueQueryBuilder from '@nixweb/nixloc-ui/src/component/shared/QueryBuilder/VueQueryBuilder.vue'
3
+
4
+ Vue.config.productionTip = false
5
+
6
+ let rules = [
7
+ {
8
+ type: "text",
9
+ id: "first-name",
10
+ label: "First Name",
11
+ },
12
+ {
13
+ type: "text",
14
+ id: "last-name",
15
+ label: "Last Name",
16
+ },
17
+ {
18
+ type: "radio",
19
+ id: "plan-type",
20
+ label: "Plan Type",
21
+ choices: [
22
+ {label: "Standard", value: "standard"},
23
+ {label: "Premium", value: "premium"}
24
+ ]
25
+ },
26
+ {
27
+ type: "checkbox",
28
+ id: "sizes",
29
+ label: "Sizes",
30
+ choices: [
31
+ {label: "Small", value: "small"},
32
+ {label: "Medium", value: "medium"},
33
+ {label: "Large", value: "large"}
34
+ ]
35
+ },
36
+ {
37
+ type: "text",
38
+ id: "date",
39
+ inputType:"date",
40
+ label: "Date",
41
+ operands: ['Start Date', 'End Date']
42
+ },
43
+ {
44
+ type: "select",
45
+ id: 'select',
46
+ label: 'Color',
47
+ operators: ['=', '<>'],
48
+ choices: [
49
+ {label: "red", value: 'Red'},
50
+ {label: "orange", value: 'Orange'},
51
+ {label: "yellow", value: 'Yellow'},
52
+ {label: "green", value: 'Green'},
53
+ {label: "blue", value: 'Blue'},
54
+ {label: "indigo", value: 'Indigo'},
55
+ {label: "violet", value: 'Violet'},
56
+ ]
57
+ },
58
+ ];
59
+
60
+ new Vue({
61
+ el: '#app',
62
+
63
+ components: { VueQueryBuilder },
64
+
65
+ data: {
66
+ rules: rules,
67
+ output: {},
68
+ },
69
+
70
+ computed: {
71
+ outputFormatted: function() {
72
+ return JSON.stringify(this.output, null, 2);
73
+ }
74
+ },
75
+
76
+ methods: {
77
+ updateQuery: function(value){
78
+ this.output = value;
79
+ }
80
+ }
81
+ });
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Returns a depply cloned object without reference.
3
+ * Copied from Vue MultiSelect and Vuex.
4
+ * @type {Object}
5
+ */
6
+ const deepClone = function (obj) {
7
+ if (Array.isArray(obj)) {
8
+ return obj.map(deepClone)
9
+ } else if (obj && typeof obj === 'object') {
10
+ var cloned = {}
11
+ var keys = Object.keys(obj)
12
+ for (var i = 0, l = keys.length; i < l; i++) {
13
+ var key = keys[i]
14
+ cloned[key] = deepClone(obj[key])
15
+ }
16
+ return cloned
17
+ } else {
18
+ return obj
19
+ }
20
+ }
21
+
22
+ export default deepClone;
@@ -9,44 +9,49 @@
9
9
  >
10
10
  <div slot="conteudo-principal">
11
11
  <b-row>
12
- <!-- <b-col xs="12" sm="12" md="12" lg="5" xl="5">
13
- <div><i class="fas fa-star icone-favorito"></i> Favoritos</div>
12
+ <b-col xs="12" sm="12" md="12" lg="6" xl="6" v-if="todos.salvo.length > 0">
13
+ <div><i class="fas fa-file-alt icone-salvo"></i></i> Personalizado</div>
14
14
  <hr />
15
- <div class="div-moldura" v-for="relatorio in favoritos">
15
+ <div class="div-moldura" v-for="relatorio in todos.salvo">
16
16
  <div>
17
17
  <Moldura :bordaArredondada="12">
18
18
  <b-row>
19
- <b-col sm="10" @click="navegarPara(relatorio.nomeRota)">
19
+ <b-col sm="1">
20
+ <i class="fas fa-file-alt icone-report"></i>
21
+ </b-col>
22
+ <b-col sm="10" @click="navegarPara(relatorio)">
20
23
  <div>{{ relatorio.nome }}</div>
21
24
  </b-col>
22
- <b-col sm="2">
23
- <div class="text-right">
24
- <i class="fas fa-times-circle icone-remover"></i>
25
- </div>
25
+ <b-col sm="1">
26
+ <Confirmacao
27
+ titulo="Deseja excluir?"
28
+ tipo="perigo"
29
+ :dados="relatorio"
30
+ :confirmado="excluir"
31
+ >
32
+ <div class="text-right">
33
+ <i class="fas fa-times-circle icone-remover"></i>
34
+ </div>
35
+ </Confirmacao>
26
36
  </b-col>
27
37
  </b-row>
28
38
  </Moldura>
29
39
  </div>
30
40
  </div>
31
- </b-col> -->
32
- <b-col xs="12" sm="12" md="12" lg="5" xl="5">
33
- <div><i class="fas fa-list-ul"></i> Todos</div>
41
+ </b-col>
42
+ <b-col xs="12" sm="12" md="12" lg="6" xl="6">
43
+ <div><i class="fas fa-file-chart-line"></i> Padrão</div>
34
44
  <hr />
35
- <div class="div-moldura" v-for="relatorio in todos">
45
+ <div class="div-moldura" v-for="relatorio in todos.padrao">
36
46
  <div>
37
47
  <Moldura :bordaArredondada="12">
38
48
  <b-row>
39
49
  <b-col sm="1">
40
50
  <i class="fas fa-file-alt icone-report"></i>
41
51
  </b-col>
42
- <b-col sm="10" @click="navegarPara(relatorio.nomeRota)">
52
+ <b-col sm="11" @click="navegarPara(relatorio)">
43
53
  <div class="lado-a-lado">{{ relatorio.nome }}</div>
44
54
  </b-col>
45
- <!-- <b-col sm="2">
46
- <div class="text-right">
47
- <i class="fas fa-plus-circle icone-favorito"></i>
48
- </div>
49
- </b-col>-->
50
55
  </b-row>
51
56
  </Moldura>
52
57
  </div>
@@ -61,52 +66,115 @@
61
66
  <script>
62
67
  import Painel from "@nixweb/nixloc-ui/src/component/layout/Painel.vue";
63
68
  import Moldura from "@nixweb/nixloc-ui/src/component/layout/Moldura";
69
+ import Confirmacao from "@nixweb/nixloc-ui/src/component/shared/Confirmacao";
64
70
 
65
71
  import { mapState, mapGetters, mapActions, mapMutations } from "vuex";
66
72
 
67
73
  export default {
68
74
  name: "ModeloRelatorioListaView",
69
- components: { Painel, Moldura },
75
+ components: { Painel, Moldura, Confirmacao },
70
76
  props: {
71
77
  painel: Object,
72
78
  relatorios: Object,
73
79
  },
74
80
  data() {
75
81
  return {
76
- todos: [],
82
+ todos: {},
83
+ urlObterTodos: "/api/v1/shared/relatorio/obter-todos",
84
+ urlRemover: "/api/v1/shared/relatorio/remover",
77
85
  };
78
86
  },
79
87
  computed: {
80
88
  ...mapState("generic", ["pesquisa", "buscouPesquisa", "limpouPesquisa"]),
81
89
  },
82
90
  mounted() {
83
- this.removeCarregando(["painel"]);
84
- this.todos = this.relatorios;
91
+ this.obterTodos();
92
+ this.todos = JSON.parse(JSON.stringify(this.relatorios)); // remove observable
85
93
  },
86
94
  methods: {
87
95
  ...mapMutations("generic", ["removeCarregando"]),
88
- navegarPara(nomeRota) {
96
+ ...mapMutations("relatorio", [
97
+ "atualizaFiltroSelecionado",
98
+ "atualizaCampoOrdenado",
99
+ "atualizaOpcoesValorInicial",
100
+ ]),
101
+ ...mapActions("generic", ["getApi", "deleteAllApi"]),
102
+ obterTodos() {
103
+ let obj = { modulo: this.painel.modulo };
104
+ let params = { url: this.urlObterTodos, obj: obj };
105
+ this.getApi(params).then((response) => {
106
+ this.todos.salvo = [];
107
+ let self = this;
108
+ response.conteudo.dados.forEach((item) => {
109
+ const consulta = JSON.parse(item.consulta);
110
+ let obj = {
111
+ id: item.id,
112
+ nome: item.nome,
113
+ nomeRota: consulta.nomeRota,
114
+ filtro: consulta.filtro,
115
+ campo: consulta.campo,
116
+ ordenacao: consulta.ordenacao,
117
+ };
118
+ self.todos.salvo.push(obj);
119
+ });
120
+ this.removeCarregando(["painel"]);
121
+ });
122
+ },
123
+ navegarPara(relatorio) {
124
+ if (relatorio.filtro) {
125
+ let filtroSelecionado = { logicalOperator: "all", children: relatorio.filtro };
126
+ this.atualizaOpcoesValorInicial(relatorio.campo);
127
+ this.atualizaCampoOrdenado(relatorio.ordenacao);
128
+ this.atualizaFiltroSelecionado(filtroSelecionado);
129
+ } else {
130
+ this.atualizaOpcoesValorInicial([]);
131
+ }
89
132
  this.$router.push({
90
- name: nomeRota,
133
+ name: relatorio.nomeRota,
134
+ });
135
+ },
136
+ excluir(dados) {
137
+ let selecionados = [];
138
+ selecionados.push(dados.id);
139
+
140
+ let params = {
141
+ url: this.urlRemover,
142
+ selecionados: selecionados,
143
+ };
144
+
145
+ this.deleteAllApi(params).then((reponse) => {
146
+ if (reponse.sucesso) this.obterTodos();
91
147
  });
92
148
  },
93
149
  },
94
150
  watch: {
95
151
  buscouPesquisa: function () {
96
- let filtro = [];
152
+ let padrao = [];
153
+ let salvo = [];
97
154
  let self = this;
98
155
  setTimeout(function () {
99
- self.todos.forEach(function (item) {
156
+ self.todos.padrao.forEach(function (item) {
157
+ if (self.pesquisa.filtro.conteudo == "igual") {
158
+ if (item.nome == self.pesquisa.conteudo) padrao.push(item);
159
+ }
160
+
161
+ if (self.pesquisa.filtro.conteudo == "contem") {
162
+ if (item.nome.includes(self.pesquisa.conteudo)) padrao.push(item);
163
+ }
164
+ });
165
+
166
+ self.todos.salvo.forEach(function (item) {
100
167
  if (self.pesquisa.filtro.conteudo == "igual") {
101
- if (item.nome == self.pesquisa.conteudo) filtro.push(item);
168
+ if (item.nome == self.pesquisa.conteudo) salvo.push(item);
102
169
  }
103
170
 
104
171
  if (self.pesquisa.filtro.conteudo == "contem") {
105
- if (item.nome.includes(self.pesquisa.conteudo)) filtro.push(item);
172
+ if (item.nome.includes(self.pesquisa.conteudo)) salvo.push(item);
106
173
  }
107
174
  });
108
175
 
109
- self.todos = filtro;
176
+ self.todos.salvo = salvo;
177
+ self.todos.padrao = padrao;
110
178
 
111
179
  self.removeCarregando(["pesquisar", "limpar"]);
112
180
  }, 300);
@@ -115,6 +183,7 @@ export default {
115
183
  let self = this;
116
184
  setTimeout(function () {
117
185
  self.todos = self.relatorios;
186
+ self.obterTodos();
118
187
  self.removeCarregando(["pesquisar", "limpar"]);
119
188
  }, 300);
120
189
  },
@@ -123,8 +192,8 @@ export default {
123
192
  </script>
124
193
 
125
194
  <style scoped>
126
- .icone-favorito {
127
- color: orange;
195
+ .icone-salvo {
196
+ color: #94aa2a;
128
197
  }
129
198
 
130
199
  .icone-remover {
@@ -132,7 +201,7 @@ export default {
132
201
  }
133
202
 
134
203
  .icone-report {
135
- font-size: 30px;
204
+ font-size: 25px;
136
205
  opacity: 0.2;
137
206
  color: #577696;
138
207
  }