@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.
- package/docs/src/component/template/ModeloRelatorioView.drawio +160 -0
- package/docs/src/store/modulos/relatorio.drawio +37 -0
- package/package.json +77 -75
- package/public/index.html +2 -4
- package/public/styles/app.css +1 -2
- package/src/component/forms/{Botao.vue → Button.vue} +53 -57
- package/src/component/forms/CheckboxGroup.vue +63 -0
- package/src/component/forms/{CheckboxUnico.vue → CheckboxSimple.vue} +6 -6
- package/src/component/forms/{Cor.vue → Color.vue} +9 -9
- package/src/component/forms/DateTime.vue +53 -53
- package/src/component/forms/{BotaoDropdown.vue → Dropdown.vue} +50 -50
- package/src/component/forms/EditorHtml.vue +123 -0
- package/src/component/forms/FileUpload.vue +189 -0
- package/src/component/forms/InputDecimal.vue +137 -0
- package/src/component/forms/InputNumber.vue +149 -0
- package/src/component/forms/InputPassword.vue +135 -0
- package/src/component/forms/InputText.vue +157 -0
- package/src/component/forms/Modal.vue +15 -15
- package/src/component/forms/RadioGroup.vue +50 -0
- package/src/component/forms/Select.vue +337 -0
- package/src/component/forms/SelectStatic.vue +120 -0
- package/src/component/forms/TextArea.vue +126 -0
- package/src/component/forms/Toggle.vue +13 -13
- package/src/component/layout/{Conta.vue → Account.vue} +28 -28
- package/src/component/layout/{Alerta.vue → Alert.vue} +22 -22
- package/src/component/layout/Badge.vue +23 -23
- package/src/component/layout/{BarraFixa.vue → FixedBar.vue} +16 -16
- package/src/component/layout/{CarregandoTelaInteira.vue → LoadingFullPage.vue} +3 -3
- package/src/component/layout/Menu.vue +66 -66
- package/src/component/layout/{Moldura.vue → Molded.vue} +4 -4
- package/src/component/layout/Panel.vue +142 -0
- package/src/component/layout/Popover.vue +1 -1
- package/src/component/layout/{BarraRolagem.vue → Scrollbar.vue} +9 -11
- package/src/component/layout/Tag.vue +9 -9
- package/src/component/layout/Topo.vue +1 -1
- package/src/component/layout/Wizard.vue +3 -3
- package/src/component/shared/BotaoCarregarMais.vue +9 -9
- package/src/component/shared/BotaoConsulta.vue +9 -9
- package/src/component/shared/CabecalhoImpressao.vue +6 -6
- package/src/component/shared/CodigoEditor.vue +16 -16
- package/src/component/shared/Confirmacao.vue +28 -28
- package/src/component/shared/Dica.vue +10 -10
- package/src/component/shared/DocumentoEditor.vue +3 -3
- package/src/component/shared/DocumentoPreview.vue +2 -2
- package/src/component/shared/EsconderMostrar.vue +26 -26
- package/src/component/shared/ExportarExcel.vue +14 -14
- package/src/component/shared/ExportarPDF.vue +10 -10
- package/src/component/shared/FiltroHorizontal.vue +19 -19
- package/src/component/shared/LegendaParametro.vue +17 -17
- package/src/component/shared/{Carregando.vue → Loading.vue} +11 -11
- package/src/component/shared/Messages.vue +83 -0
- package/src/component/shared/Paginacao.vue +10 -10
- package/src/component/shared/Progresso.vue +2 -2
- package/src/component/shared/Registro.vue +2 -2
- package/src/component/shared/ResumoTabela.vue +6 -6
- package/src/component/shared/SalvarCancelar.vue +26 -26
- package/src/component/shared/{Pesquisa.vue → Search.vue} +36 -36
- package/src/component/shared/Tabela.vue +49 -49
- package/src/component/shared/TabelaBotao.vue +13 -13
- package/src/component/shared/Toast.vue +7 -7
- package/src/component/shared/{FiltroVertical.vue → VerticalFilter.vue} +14 -14
- package/src/component/shared/construtor-consulta/AdicionaFiltro.vue +191 -0
- package/src/component/shared/construtor-consulta/Campo.vue +127 -0
- package/src/component/shared/construtor-consulta/ComponenteDinamico.vue +109 -0
- package/src/component/shared/construtor-consulta/ConstrutorConsulta.vue +70 -0
- package/src/component/shared/construtor-consulta/ConverteParaOdata.js +80 -0
- package/src/component/shared/construtor-consulta/EscolherFiltro.vue +96 -0
- package/src/component/shared/{query-builder → construtor-consulta}/Filtro.vue +11 -16
- package/src/component/shared/construtor-consulta/ListaComponenteDinamico.vue +41 -0
- package/src/component/shared/{query-builder → construtor-consulta}/Rodape.vue +9 -9
- package/src/component/shared/{query-builder → construtor-consulta}/Tags.vue +7 -7
- package/src/component/shared/{query-builder → construtor-consulta}/utilities.js +0 -0
- package/src/component/template/ModeloAdicionarModificarView.vue +11 -11
- package/src/component/template/ModeloDocumentoView.vue +79 -79
- package/src/component/template/ModeloLista.vue +66 -66
- package/src/component/template/ModeloRelatorioListaView.vue +71 -68
- package/src/component/template/ModeloRelatorioView.vue +218 -200
- package/src/component/template/ModeloSubView.vue +13 -13
- package/src/component/template/ModeloView.vue +17 -17
- package/src/component/template/Relatorio.js +1 -5
- package/src/component/template/RelatorioAdicionarModificar.vue +44 -44
- package/src/component/value-objects/DadosContato.vue +27 -27
- package/src/component/value-objects/DadosPessoa.js +1 -1
- package/src/component/value-objects/DadosPessoa.vue +52 -52
- package/src/component/value-objects/Endereco.js +1 -1
- package/src/component/value-objects/Endereco.vue +83 -83
- package/src/config/dicas.js +1 -1
- package/src/config/token.js +2 -2
- package/src/store/modules/generic.js +489 -0
- package/src/store/modules/report.js +246 -0
- package/src/store/modules/user.js +38 -0
- package/src/store/modules/validation.js +39 -0
- package/src/store/store.js +4 -4
- package/public/js/menu.js +0 -11
- package/public/styles/menu.css +0 -1399
- package/src/component/forms/ArquivoUpload.vue +0 -199
- package/src/component/forms/CheckboxMultiplo.vue +0 -63
- package/src/component/forms/Decimal.vue +0 -137
- package/src/component/forms/Escolher.vue +0 -324
- package/src/component/forms/EscolherEstatico.vue +0 -139
- package/src/component/forms/Numero.vue +0 -153
- package/src/component/forms/Opcoes.vue +0 -51
- package/src/component/forms/Senha.vue +0 -139
- package/src/component/forms/Texto.vue +0 -161
- package/src/component/forms/TextoArea.vue +0 -126
- package/src/component/forms/TextoEditor.vue +0 -123
- package/src/component/layout/Painel.vue +0 -142
- package/src/component/shared/Mensagem.vue +0 -86
- package/src/component/shared/query-builder/Campo.vue +0 -116
- package/src/component/shared/query-builder/ConverteParaOdata.js +0 -73
- package/src/component/shared/query-builder/QueryBuilder.vue +0 -164
- package/src/component/shared/query-builder/components/CustomSelect.vue +0 -115
- package/src/component/shared/query-builder/components/QueryBuilderChildren.vue +0 -46
- package/src/component/shared/query-builder/components/QueryBuilderGroup.vue +0 -151
- package/src/component/shared/query-builder/components/QueryBuilderRule.vue +0 -81
- package/src/component/shared/query-builder/layouts/Bootstrap/BootstrapGroup.vue +0 -120
- package/src/component/shared/query-builder/layouts/Bootstrap/BootstrapRule.vue +0 -171
- package/src/component/shared/query-builder/main.js +0 -81
- package/src/store/modulos/generic.js +0 -494
- package/src/store/modulos/relatorio.js +0 -201
- package/src/store/modulos/usuario.js +0 -38
- package/src/store/modulos/validation.js +0 -39
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="form-group">
|
|
3
|
+
<label>
|
|
4
|
+
<span class="title" :style="'color: ' + titleColor">{{ title }} </span>
|
|
5
|
+
<span class="required" v-if="required">*</span>
|
|
6
|
+
<Dica :field="field" :formName="formName" />
|
|
7
|
+
</label>
|
|
8
|
+
<div class="inner-addon right-addon">
|
|
9
|
+
<div class="required glyphicon" v-if="notifications.length > 0 && formDirty">
|
|
10
|
+
<i class="fas fa-exclamation-triangle"></i>
|
|
11
|
+
</div>
|
|
12
|
+
<slot v-else></slot>
|
|
13
|
+
<input
|
|
14
|
+
type="text"
|
|
15
|
+
:style="style"
|
|
16
|
+
:placeholder="placeholder"
|
|
17
|
+
:disabled="disabled"
|
|
18
|
+
@keyup.enter.prevent="pressedEnter"
|
|
19
|
+
@keyup="cleanedField"
|
|
20
|
+
@blur="outField"
|
|
21
|
+
v-mask="mask || withoutMask"
|
|
22
|
+
v-bind:value="value"
|
|
23
|
+
v-on:input="$emit('input', $event.target.value)"
|
|
24
|
+
class="form-control"
|
|
25
|
+
:class="{ required: notifications.length > 0 && formDirty }"
|
|
26
|
+
/>
|
|
27
|
+
</div>
|
|
28
|
+
<div v-if="formDirty">
|
|
29
|
+
<div v-for="message in notifications" :key="message">
|
|
30
|
+
<span class="invalid">{{ message }}</span>
|
|
31
|
+
</div>
|
|
32
|
+
</div>
|
|
33
|
+
</div>
|
|
34
|
+
</template>
|
|
35
|
+
|
|
36
|
+
<script>
|
|
37
|
+
import Dica from "../shared/Dica.vue";
|
|
38
|
+
import { mapState, mapMutations } from "vuex";
|
|
39
|
+
|
|
40
|
+
export default {
|
|
41
|
+
components: { Dica },
|
|
42
|
+
name: "InputText",
|
|
43
|
+
props: [
|
|
44
|
+
"title",
|
|
45
|
+
"field",
|
|
46
|
+
"placeholder",
|
|
47
|
+
"disabled",
|
|
48
|
+
"titleColor",
|
|
49
|
+
"mask",
|
|
50
|
+
"style",
|
|
51
|
+
"formName",
|
|
52
|
+
"required",
|
|
53
|
+
"maxLength",
|
|
54
|
+
"value",
|
|
55
|
+
"enter",
|
|
56
|
+
"cleaned",
|
|
57
|
+
"exited",
|
|
58
|
+
"markFormDirty",
|
|
59
|
+
],
|
|
60
|
+
data() {
|
|
61
|
+
return {
|
|
62
|
+
notifications: [],
|
|
63
|
+
formDirty: false,
|
|
64
|
+
withoutMask: {
|
|
65
|
+
mask: "*".repeat(255),
|
|
66
|
+
tokens: {
|
|
67
|
+
"*": { pattern: /./ },
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
};
|
|
71
|
+
},
|
|
72
|
+
created() {
|
|
73
|
+
this.validate();
|
|
74
|
+
},
|
|
75
|
+
methods: {
|
|
76
|
+
...mapMutations("validation", ["addValidation", "removeValidation", "addFormDirty"]),
|
|
77
|
+
validate() {
|
|
78
|
+
this.notifications = [];
|
|
79
|
+
|
|
80
|
+
if (this.required && this.value.length == 0) {
|
|
81
|
+
var message = `${this.title} não pode ser vazio!`;
|
|
82
|
+
this.notifications.push(message);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
if (this.maxLength > 0) {
|
|
86
|
+
if (this.value.length > this.maxLength) {
|
|
87
|
+
var message = `Máximo de ${this.maxLength} caracteres!`;
|
|
88
|
+
this.notifications.push(message);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
pressedEnter() {
|
|
93
|
+
if (this.enter) this.enter();
|
|
94
|
+
},
|
|
95
|
+
outField() {
|
|
96
|
+
if (this.exited) this.exited();
|
|
97
|
+
},
|
|
98
|
+
cleanedField() {
|
|
99
|
+
if (this.value.length == 0) {
|
|
100
|
+
if (this.cleaned) this.cleaned();
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
computed: {
|
|
105
|
+
...mapState("validation", ["resetForm", "validations"]),
|
|
106
|
+
},
|
|
107
|
+
watch: {
|
|
108
|
+
value() {
|
|
109
|
+
this.validate();
|
|
110
|
+
this.formDirty = true;
|
|
111
|
+
// inverti a validação devido não colocar o default como true no props
|
|
112
|
+
var _value = this.markFormDirty == undefined ? true : this.markFormDirty;
|
|
113
|
+
if (_value) this.addFormDirty(true);
|
|
114
|
+
},
|
|
115
|
+
notifications() {
|
|
116
|
+
let self = this;
|
|
117
|
+
this.notifications.forEach(function (notification) {
|
|
118
|
+
let obj = {
|
|
119
|
+
key: self.field + "&" + self.formName,
|
|
120
|
+
formName: self.formName,
|
|
121
|
+
notification: notification,
|
|
122
|
+
};
|
|
123
|
+
self.addValidation(obj);
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
if (this.notifications.length == 0) {
|
|
127
|
+
let obj = {
|
|
128
|
+
key: self.field + "&" + self.formName,
|
|
129
|
+
formName: self.formName,
|
|
130
|
+
};
|
|
131
|
+
self.removeValidation(obj);
|
|
132
|
+
}
|
|
133
|
+
},
|
|
134
|
+
resetForm: {
|
|
135
|
+
handler(form) {
|
|
136
|
+
if (form.nome == this.formName) this.formDirty = false;
|
|
137
|
+
},
|
|
138
|
+
deep: true,
|
|
139
|
+
},
|
|
140
|
+
},
|
|
141
|
+
};
|
|
142
|
+
</script>
|
|
143
|
+
|
|
144
|
+
<style scoped>
|
|
145
|
+
.success {
|
|
146
|
+
color: #94aa2a;
|
|
147
|
+
font-size: 14px;
|
|
148
|
+
}
|
|
149
|
+
.invalid {
|
|
150
|
+
color: #f0134d;
|
|
151
|
+
font-size: 14px;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
.margin-button {
|
|
155
|
+
margin-top: -3px;
|
|
156
|
+
}
|
|
157
|
+
</style>
|
|
@@ -2,17 +2,17 @@
|
|
|
2
2
|
<div>
|
|
3
3
|
<vodal
|
|
4
4
|
:duration="50"
|
|
5
|
-
:show="modal.
|
|
6
|
-
@hide="
|
|
7
|
-
:width="
|
|
8
|
-
:height="
|
|
5
|
+
:show="modal.open"
|
|
6
|
+
@hide="hideModal()"
|
|
7
|
+
:width="width"
|
|
8
|
+
:height="height"
|
|
9
9
|
:closeOnEsc="fecharBotao"
|
|
10
10
|
:closeButton="fecharBotao"
|
|
11
11
|
:closeOnClickMask="false"
|
|
12
12
|
>
|
|
13
13
|
<div class="d-block text-left">
|
|
14
|
-
<
|
|
15
|
-
<div class="
|
|
14
|
+
<Messages v-if="!vodal.open" />
|
|
15
|
+
<div class="title">{{ title }}</div>
|
|
16
16
|
<hr class="hr" />
|
|
17
17
|
<slot></slot>
|
|
18
18
|
</div>
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
</template>
|
|
23
23
|
|
|
24
24
|
<script>
|
|
25
|
-
import
|
|
25
|
+
import Messages from "@nixweb/nixloc-ui/src/component/shared/Messages";
|
|
26
26
|
import Vodal from "vodal";
|
|
27
27
|
|
|
28
28
|
import { mapState, mapMutations } from "vuex";
|
|
@@ -30,30 +30,30 @@ import { mapState, mapMutations } from "vuex";
|
|
|
30
30
|
export default {
|
|
31
31
|
name: "Modal",
|
|
32
32
|
props: {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
33
|
+
title: String,
|
|
34
|
+
width: Number,
|
|
35
|
+
height: Number,
|
|
36
|
+
closeOnEsc: {
|
|
37
37
|
type: Boolean,
|
|
38
38
|
default: true,
|
|
39
39
|
},
|
|
40
|
-
|
|
40
|
+
closeButton: {
|
|
41
41
|
type: Boolean,
|
|
42
42
|
default: true,
|
|
43
43
|
},
|
|
44
44
|
},
|
|
45
|
-
components: {
|
|
45
|
+
components: { Messages, Vodal },
|
|
46
46
|
computed: {
|
|
47
47
|
...mapState("generic", ["modal", "vodal"]),
|
|
48
48
|
},
|
|
49
49
|
methods: {
|
|
50
|
-
...mapMutations("generic", ["
|
|
50
|
+
...mapMutations("generic", ["hideModal"]),
|
|
51
51
|
},
|
|
52
52
|
};
|
|
53
53
|
</script>
|
|
54
54
|
|
|
55
55
|
<style scoped>
|
|
56
|
-
.
|
|
56
|
+
.title {
|
|
57
57
|
font-size: 18px;
|
|
58
58
|
margin-bottom: 5px;
|
|
59
59
|
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<span class="title">{{ title }}</span>
|
|
4
|
+
<Dica :field="field" :formName="formName" />
|
|
5
|
+
<div class="options">
|
|
6
|
+
<b-form-group>
|
|
7
|
+
<b-form-radio-group
|
|
8
|
+
v-model="selected"
|
|
9
|
+
:options="options"
|
|
10
|
+
:disabled="disabled"
|
|
11
|
+
></b-form-radio-group>
|
|
12
|
+
</b-form-group>
|
|
13
|
+
</div>
|
|
14
|
+
</div>
|
|
15
|
+
</template>
|
|
16
|
+
|
|
17
|
+
<script>
|
|
18
|
+
import Dica from "../shared/Dica.vue";
|
|
19
|
+
|
|
20
|
+
import { mapMutations } from "vuex";
|
|
21
|
+
|
|
22
|
+
export default {
|
|
23
|
+
components: { Dica },
|
|
24
|
+
name: "options",
|
|
25
|
+
props: ["title", "options", "value", "changed", "field", "formName", "disabled"],
|
|
26
|
+
data() {
|
|
27
|
+
return {
|
|
28
|
+
selected: this.value,
|
|
29
|
+
};
|
|
30
|
+
},
|
|
31
|
+
methods: {
|
|
32
|
+
...mapMutations("validation", ["addFormDirty"]),
|
|
33
|
+
},
|
|
34
|
+
watch: {
|
|
35
|
+
value() {
|
|
36
|
+
this.selected = this.value;
|
|
37
|
+
},
|
|
38
|
+
selected() {
|
|
39
|
+
this.$emit("input", this.selected);
|
|
40
|
+
this.addFormDirty(true);
|
|
41
|
+
if (this.changed) this.changed();
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
</script>
|
|
46
|
+
<style scoped>
|
|
47
|
+
.options {
|
|
48
|
+
margin-top: 5px;
|
|
49
|
+
}
|
|
50
|
+
</style>
|
|
@@ -0,0 +1,337 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<label>
|
|
4
|
+
<span class="title">{{ title }}</span>
|
|
5
|
+
<span class="required" v-if="required">*</span>
|
|
6
|
+
<Dica :field="field" :formName="formName" />
|
|
7
|
+
</label>
|
|
8
|
+
<div
|
|
9
|
+
class="select"
|
|
10
|
+
:class="{
|
|
11
|
+
'select-invalid': notifications.length > 0 && formDirty,
|
|
12
|
+
border: showBorder,
|
|
13
|
+
}"
|
|
14
|
+
>
|
|
15
|
+
<multiselect
|
|
16
|
+
@open="onOpen"
|
|
17
|
+
@select="onSelected"
|
|
18
|
+
@search-change="onSearch"
|
|
19
|
+
:options="data"
|
|
20
|
+
v-model.trim="currentValue"
|
|
21
|
+
:custom-label="label"
|
|
22
|
+
placeholder
|
|
23
|
+
:disabled="disabled"
|
|
24
|
+
:showLabels="true"
|
|
25
|
+
:noResult="false"
|
|
26
|
+
:maxHeight="250"
|
|
27
|
+
ref="multiselect"
|
|
28
|
+
selectLabel
|
|
29
|
+
deselectLabel
|
|
30
|
+
selectedLabel
|
|
31
|
+
>
|
|
32
|
+
<div slot="beforeList">
|
|
33
|
+
<vue-loading
|
|
34
|
+
v-if="loading"
|
|
35
|
+
type="bubbles"
|
|
36
|
+
color="#577696"
|
|
37
|
+
:size="{ width: '40px', height: '40px' }"
|
|
38
|
+
></vue-loading>
|
|
39
|
+
<div class="before-list" v-if="!loading">
|
|
40
|
+
<Button
|
|
41
|
+
v-if="nameNewRegister"
|
|
42
|
+
key="addNewRegister"
|
|
43
|
+
type="primary"
|
|
44
|
+
title="Novo"
|
|
45
|
+
size="small"
|
|
46
|
+
:clicked="addNewRegister"
|
|
47
|
+
/>
|
|
48
|
+
<Button
|
|
49
|
+
key="cleanSelect"
|
|
50
|
+
type="warning"
|
|
51
|
+
classIcon="fas fa-broom"
|
|
52
|
+
size="small"
|
|
53
|
+
:clicked="cleanSelect"
|
|
54
|
+
/>
|
|
55
|
+
</div>
|
|
56
|
+
</div>
|
|
57
|
+
<div slot="afterList" v-if="totalRecords > 20 && data.length < totalRecords">
|
|
58
|
+
<div class="after-list text-center">
|
|
59
|
+
<Button
|
|
60
|
+
key="loadingMore"
|
|
61
|
+
type="info"
|
|
62
|
+
title="Carregar mais..."
|
|
63
|
+
classIcon="fas fa-redo-alt"
|
|
64
|
+
size="small"
|
|
65
|
+
:clicked="loadingMore"
|
|
66
|
+
/>
|
|
67
|
+
</div>
|
|
68
|
+
</div>
|
|
69
|
+
<div slot="noOptions">Lista está vazia</div>
|
|
70
|
+
<div slot="noResult">Nenhum registro encontrado</div>
|
|
71
|
+
</multiselect>
|
|
72
|
+
<div v-if="formDirty">
|
|
73
|
+
<div v-for="message in notifications" :key="message">
|
|
74
|
+
<span class="invalid">{{ message }}</span>
|
|
75
|
+
</div>
|
|
76
|
+
</div>
|
|
77
|
+
</div>
|
|
78
|
+
|
|
79
|
+
<vodal
|
|
80
|
+
v-if="nameNewRegister"
|
|
81
|
+
:show="showVodal(nameNewRegister)"
|
|
82
|
+
@hide="hideVodal()"
|
|
83
|
+
:width="widthNewRegister"
|
|
84
|
+
:height="heightNewRegister"
|
|
85
|
+
:closeOnEsc="true"
|
|
86
|
+
:closeButton="true"
|
|
87
|
+
>
|
|
88
|
+
<Messages v-if="vodal.open" />
|
|
89
|
+
<div class="title-new-form">{{ titleNewRegister }}</div>
|
|
90
|
+
<hr />
|
|
91
|
+
<slot></slot>
|
|
92
|
+
</vodal>
|
|
93
|
+
</div>
|
|
94
|
+
</template>
|
|
95
|
+
<script>
|
|
96
|
+
import Dica from "../shared/Dica.vue";
|
|
97
|
+
import Messages from "../shared/Messages.vue";
|
|
98
|
+
import Multiselect from "vue-multiselect";
|
|
99
|
+
|
|
100
|
+
import Button from "./Button.vue";
|
|
101
|
+
import Vodal from "vodal";
|
|
102
|
+
|
|
103
|
+
import { mapState, mapActions, mapMutations, mapGetters } from "vuex";
|
|
104
|
+
|
|
105
|
+
export default {
|
|
106
|
+
name: "Select",
|
|
107
|
+
props: {
|
|
108
|
+
title: String,
|
|
109
|
+
field: String,
|
|
110
|
+
formName: String,
|
|
111
|
+
required: Boolean,
|
|
112
|
+
url: String,
|
|
113
|
+
disabled: Boolean,
|
|
114
|
+
fieldTarget: String,
|
|
115
|
+
propsParams: Object,
|
|
116
|
+
value: Object,
|
|
117
|
+
changed: Function,
|
|
118
|
+
nameNewRegister: String,
|
|
119
|
+
titleNewRegister: String,
|
|
120
|
+
widthNewRegister: Number,
|
|
121
|
+
heightNewRegister: Number,
|
|
122
|
+
markFormDirty: {
|
|
123
|
+
type: Boolean,
|
|
124
|
+
default: true,
|
|
125
|
+
},
|
|
126
|
+
showBorder: {
|
|
127
|
+
type: Boolean,
|
|
128
|
+
default: true,
|
|
129
|
+
},
|
|
130
|
+
},
|
|
131
|
+
components: {
|
|
132
|
+
Multiselect,
|
|
133
|
+
Button,
|
|
134
|
+
Vodal,
|
|
135
|
+
Messages,
|
|
136
|
+
Dica,
|
|
137
|
+
},
|
|
138
|
+
data() {
|
|
139
|
+
return {
|
|
140
|
+
currentValue: {},
|
|
141
|
+
data: [],
|
|
142
|
+
totalRecords: 0,
|
|
143
|
+
baseParams: {
|
|
144
|
+
search: "",
|
|
145
|
+
currentPage: 1,
|
|
146
|
+
totalPerPage: 20,
|
|
147
|
+
},
|
|
148
|
+
|
|
149
|
+
registerNew: false,
|
|
150
|
+
loading: true,
|
|
151
|
+
notifications: [],
|
|
152
|
+
formDirty: false,
|
|
153
|
+
};
|
|
154
|
+
},
|
|
155
|
+
created() {
|
|
156
|
+
this.validate();
|
|
157
|
+
if (this.value)
|
|
158
|
+
this.currentValue = { id: this.value.id, content: this.value.content };
|
|
159
|
+
},
|
|
160
|
+
mounted() {
|
|
161
|
+
let el = this.$el.getElementsByClassName("multiselect")[0];
|
|
162
|
+
if (el) {
|
|
163
|
+
el.tabIndex = 0;
|
|
164
|
+
}
|
|
165
|
+
},
|
|
166
|
+
computed: {
|
|
167
|
+
...mapState("validation", ["resetForm", "vodal"]),
|
|
168
|
+
...mapState("generic", ["vodal"]),
|
|
169
|
+
...mapGetters("generic", ["showVodal"]),
|
|
170
|
+
},
|
|
171
|
+
methods: {
|
|
172
|
+
...mapActions("generic", ["getApi"]),
|
|
173
|
+
...mapMutations("generic", [
|
|
174
|
+
"removeLoading",
|
|
175
|
+
"showVodal",
|
|
176
|
+
"hideVodal",
|
|
177
|
+
"removeNotificarions",
|
|
178
|
+
"addFilter",
|
|
179
|
+
]),
|
|
180
|
+
...mapMutations("validation", [
|
|
181
|
+
"addValidation",
|
|
182
|
+
"removeValidation",
|
|
183
|
+
"resetValidation",
|
|
184
|
+
"addFormDirty",
|
|
185
|
+
]),
|
|
186
|
+
onOpen() {
|
|
187
|
+
this.getAll();
|
|
188
|
+
},
|
|
189
|
+
onSelected(value) {
|
|
190
|
+
this.$emit("input", value);
|
|
191
|
+
if (this.changed) this.changed();
|
|
192
|
+
if (this.fieldTarget) {
|
|
193
|
+
let obj = { fieldTarget: this.fieldTarget, value: value.id };
|
|
194
|
+
this.addFilter(obj);
|
|
195
|
+
}
|
|
196
|
+
},
|
|
197
|
+
onSearch(value) {
|
|
198
|
+
this.baseParams.search = value;
|
|
199
|
+
this.getAll();
|
|
200
|
+
},
|
|
201
|
+
label(value) {
|
|
202
|
+
if (value.content) return `${value.content}`;
|
|
203
|
+
},
|
|
204
|
+
getAll() {
|
|
205
|
+
let obj = { ...this.baseParams, ...this.propsParams };
|
|
206
|
+
let params = { url: this.url, obj: obj };
|
|
207
|
+
this.loading = true;
|
|
208
|
+
this.getApi(params).then((response) => {
|
|
209
|
+
this.totalRecords = response.content.totalRecords;
|
|
210
|
+
let self = this;
|
|
211
|
+
if (this.baseParams.currentPage == 1) {
|
|
212
|
+
this.data = [];
|
|
213
|
+
}
|
|
214
|
+
response.content.data.map(function (value, key) {
|
|
215
|
+
self.data.push(value);
|
|
216
|
+
});
|
|
217
|
+
this.loading = false;
|
|
218
|
+
this.removeLoading(["loadingMore"]);
|
|
219
|
+
});
|
|
220
|
+
},
|
|
221
|
+
addNewRegister() {
|
|
222
|
+
this.showVodal(this.nameNewRegister);
|
|
223
|
+
this.resetValidation(this.nameNewRegister);
|
|
224
|
+
this.removeNotificarions();
|
|
225
|
+
this.$refs.multiselect.deactivate();
|
|
226
|
+
this.removeLoading(["addNewRegister"]);
|
|
227
|
+
},
|
|
228
|
+
hideVodal() {
|
|
229
|
+
this.hideVodal();
|
|
230
|
+
},
|
|
231
|
+
cleanSelect() {
|
|
232
|
+
let obj = { id: "", content: "" };
|
|
233
|
+
this.currentValue = obj;
|
|
234
|
+
this.$emit("input", obj);
|
|
235
|
+
this.$refs.multiselect.deactivate();
|
|
236
|
+
this.removeLoading(["cleanSelect"]);
|
|
237
|
+
|
|
238
|
+
if (this.fieldTarget) {
|
|
239
|
+
let obj = { fieldTarget: this.fieldTarget, value: "" };
|
|
240
|
+
this.addFilter(obj);
|
|
241
|
+
}
|
|
242
|
+
},
|
|
243
|
+
loadingMore() {
|
|
244
|
+
this.baseParams.currentPage++;
|
|
245
|
+
this.getAll();
|
|
246
|
+
},
|
|
247
|
+
validate() {
|
|
248
|
+
this.notifications = [];
|
|
249
|
+
if (this.required && !this.value.id) {
|
|
250
|
+
var message = `${this.title} não pode ser vazio!`;
|
|
251
|
+
this.notifications.push(message);
|
|
252
|
+
}
|
|
253
|
+
},
|
|
254
|
+
},
|
|
255
|
+
watch: {
|
|
256
|
+
"value.id": function () {
|
|
257
|
+
this.validate();
|
|
258
|
+
this.formDirty = true;
|
|
259
|
+
if (this.markFormDirty) this.addFormDirty(true);
|
|
260
|
+
this.currentValue = { id: this.value.id, content: this.value.content };
|
|
261
|
+
},
|
|
262
|
+
notifications() {
|
|
263
|
+
let self = this;
|
|
264
|
+
this.notifications.forEach(function (notification) {
|
|
265
|
+
let obj = {
|
|
266
|
+
key: self.field + "&" + self.formName,
|
|
267
|
+
formName: self.formName,
|
|
268
|
+
notification: notification,
|
|
269
|
+
};
|
|
270
|
+
self.addValidation(obj);
|
|
271
|
+
});
|
|
272
|
+
|
|
273
|
+
if (this.notifications.length == 0) {
|
|
274
|
+
let obj = {
|
|
275
|
+
key: self.field + "&" + self.formName,
|
|
276
|
+
formName: self.formName,
|
|
277
|
+
};
|
|
278
|
+
self.removeValidation(obj);
|
|
279
|
+
}
|
|
280
|
+
},
|
|
281
|
+
resetForm: {
|
|
282
|
+
handler(form) {
|
|
283
|
+
if (form.nome == this.formName) {
|
|
284
|
+
let obj = { id: "", content: "" };
|
|
285
|
+
this.currentValue = obj;
|
|
286
|
+
this.$emit("input", obj);
|
|
287
|
+
this.formDirty = false;
|
|
288
|
+
}
|
|
289
|
+
},
|
|
290
|
+
deep: true,
|
|
291
|
+
},
|
|
292
|
+
"vodal.open": function (value) {
|
|
293
|
+
if (!value) this.registerNew = false;
|
|
294
|
+
},
|
|
295
|
+
},
|
|
296
|
+
};
|
|
297
|
+
</script>
|
|
298
|
+
|
|
299
|
+
<style scoped>
|
|
300
|
+
div.before-list {
|
|
301
|
+
padding: 8px;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
div.after-list {
|
|
305
|
+
padding: 8px;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
.invalid {
|
|
309
|
+
color: #f0134d;
|
|
310
|
+
font-size: 14px;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
.select {
|
|
314
|
+
height: 36px;
|
|
315
|
+
border-bottom: 1px solid #d6dadf;
|
|
316
|
+
border-radius: 0px !important;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
.select-invalid {
|
|
320
|
+
border-bottom: 1px solid #ff5454;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
.select-valid {
|
|
324
|
+
border-bottom: 1px solid #94aa2a;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
.title-new-form {
|
|
328
|
+
font-size: 18px;
|
|
329
|
+
margin-bottom: 5px;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
.border {
|
|
333
|
+
border: 1px solid #dbdee0 !important;
|
|
334
|
+
border-radius: 5px !important;
|
|
335
|
+
height: 38px !important;
|
|
336
|
+
}
|
|
337
|
+
</style>
|