@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.
- package/docs/src/component/template/ModeloRelatorioView.drawio +2 -2
- package/docs/src/store/modulos/relatorio.drawio +2 -2
- package/package.json +77 -77
- package/public/styles/app.css +1 -1
- 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} +8 -8
- package/src/component/forms/{Cor.vue → Color.vue} +9 -9
- package/src/component/forms/DateTime.vue +55 -55
- package/src/component/forms/{BotaoDropdown.vue → Dropdown.vue} +58 -58
- 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/{Topo.vue → Header.vue} +5 -5
- 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 +15 -15
- package/src/component/layout/Wizard.vue +3 -3
- package/src/component/shared/{CodigoEditor.vue → CodeEditor.vue} +25 -25
- package/src/component/shared/Collapse.vue +131 -0
- package/src/component/shared/Confirmation.vue +80 -0
- package/src/component/shared/{DocumentoEditor.vue → DocumentEditor.vue} +10 -16
- package/src/component/shared/{DocumentoPreview.vue → DocumentPreview.vue} +2 -2
- package/src/component/shared/ExportExcel.vue +67 -0
- package/src/component/shared/{ExportarPDF.vue → ExportPDF.vue} +18 -18
- package/src/component/shared/HeaderPrint.vue +36 -0
- package/src/component/shared/HorizontalFilter.vue +59 -0
- package/src/component/shared/LegendaParametro.vue +22 -22
- package/src/component/shared/{Carregando.vue → Loading.vue} +16 -16
- package/src/component/shared/LoadingMoreButton.vue +23 -0
- package/src/component/shared/Messages.vue +83 -0
- package/src/component/shared/{Paginacao.vue → Pagination.vue} +12 -12
- package/src/component/shared/ProgressBar.vue +21 -0
- package/src/component/shared/{BotaoConsulta.vue → QueryButton.vue} +16 -16
- package/src/component/shared/SaveCancel.vue +56 -0
- package/src/component/shared/{Pesquisa.vue → Search.vue} +46 -46
- package/src/component/shared/Table.vue +243 -0
- package/src/component/shared/TableButton.vue +36 -0
- package/src/component/shared/{Registro.vue → TableTotalRecords.vue} +7 -7
- package/src/component/shared/{ResumoTabela.vue → TableTotalization.vue} +12 -8
- package/src/component/shared/Tip.vue +42 -0
- package/src/component/shared/Toast.vue +7 -7
- package/src/component/shared/{FiltroVertical.vue → VerticalFilter.vue} +24 -24
- package/src/component/shared/query-builder/AddRule.vue +187 -0
- package/src/component/shared/query-builder/ConvertToOdata.js +80 -0
- package/src/component/shared/query-builder/DynamicComponent.vue +107 -0
- package/src/component/shared/query-builder/Fields.vue +127 -0
- package/src/component/shared/query-builder/ListDynamicComponent.vue +42 -0
- package/src/component/shared/query-builder/QueryBuilder.vue +25 -120
- package/src/component/shared/query-builder/{Filtro.vue → Rules.vue} +13 -18
- package/src/component/shared/query-builder/SelectRule.vue +96 -0
- package/src/component/shared/query-builder/Tags.vue +14 -14
- package/src/component/shared/query-builder/{Rodape.vue → Totalization.vue} +10 -10
- package/src/component/template/AddEditReport.vue +106 -0
- package/src/component/template/ListViewWithHandlerData.vue +231 -0
- package/src/component/template/ViewTemplateConfiguration.vue +69 -0
- package/src/component/template/ViewTemplateDocumentView.vue +227 -0
- package/src/component/template/ViewTemplateReportList.vue +230 -0
- package/src/component/template/ViewTemplateReportPreview.vue +500 -0
- package/src/component/template/ViewTemplateWithSalveCancel.vue +32 -0
- package/src/component/template/ViewTemplateWithTable.vue +49 -0
- package/src/component/template/model/Report.js +6 -0
- package/src/component/value-objects/DadosContato.vue +34 -35
- package/src/component/value-objects/DadosPessoa.vue +58 -58
- package/src/component/value-objects/Endereco.vue +96 -97
- 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/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 -335
- 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/BotaoCarregarMais.vue +0 -23
- package/src/component/shared/CabecalhoImpressao.vue +0 -36
- package/src/component/shared/Confirmacao.vue +0 -80
- package/src/component/shared/Dica.vue +0 -42
- package/src/component/shared/EsconderMostrar.vue +0 -131
- package/src/component/shared/ExportarExcel.vue +0 -67
- package/src/component/shared/FiltroHorizontal.vue +0 -59
- package/src/component/shared/Mensagem.vue +0 -86
- package/src/component/shared/Progresso.vue +0 -21
- package/src/component/shared/SalvarCancelar.vue +0 -56
- package/src/component/shared/Tabela.vue +0 -275
- package/src/component/shared/TabelaBotao.vue +0 -36
- package/src/component/shared/query-builder/Campo.vue +0 -116
- package/src/component/shared/query-builder/ConverteParaOdata.js +0 -77
- 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 -187
- package/src/component/shared/query-builder/main.js +0 -81
- package/src/component/template/ModeloAdicionarModificarView.vue +0 -32
- package/src/component/template/ModeloDocumentoView.vue +0 -227
- package/src/component/template/ModeloLista.vue +0 -231
- package/src/component/template/ModeloRelatorioListaView.vue +0 -227
- package/src/component/template/ModeloRelatorioView.vue +0 -489
- package/src/component/template/ModeloSubView.vue +0 -69
- package/src/component/template/ModeloView.vue +0 -49
- package/src/component/template/Relatorio.js +0 -10
- package/src/component/template/RelatorioAdicionarModificar.vue +0 -106
- package/src/store/modulos/generic.js +0 -494
- package/src/store/modulos/relatorio.js +0 -204
- package/src/store/modulos/usuario.js +0 -38
- package/src/store/modulos/validation.js +0 -39
|
@@ -1,30 +1,26 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div class="c-div-
|
|
2
|
+
<div class="c-div-button">
|
|
3
3
|
<button
|
|
4
|
-
class="
|
|
4
|
+
class="button"
|
|
5
5
|
:class="{
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
info:
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
6
|
+
small: size === 'small',
|
|
7
|
+
medium: size === 'medium',
|
|
8
|
+
large: size === 'large',
|
|
9
|
+
primary: type === 'primary',
|
|
10
|
+
success: type === 'success',
|
|
11
|
+
warning: type === 'warning',
|
|
12
|
+
info: type === 'info',
|
|
13
|
+
edit: type === 'edit',
|
|
14
|
+
danger: type === 'danger',
|
|
15
|
+
disabled: disabled,
|
|
16
16
|
}"
|
|
17
|
-
:disabled="
|
|
18
|
-
@click="
|
|
17
|
+
:disabled="disabled"
|
|
18
|
+
@click="execute()"
|
|
19
19
|
>
|
|
20
|
-
<i
|
|
21
|
-
|
|
22
|
-
:class="classeIcone"
|
|
23
|
-
v-if="!carregando(this.chave) && classeIcone"
|
|
24
|
-
></i>
|
|
25
|
-
<span v-if="!carregando(this.chave)">{{ titulo }}</span>
|
|
20
|
+
<i class="title" :class="classIcon" v-if="!isLoading(this.key) && classIcon"></i>
|
|
21
|
+
<span v-if="!isLoading(this.key)">{{ title }}</span>
|
|
26
22
|
<vue-loading
|
|
27
|
-
v-if="
|
|
23
|
+
v-if="isLoading(this.key)"
|
|
28
24
|
type="bubbles"
|
|
29
25
|
color="#fff"
|
|
30
26
|
:size="{ width: '26px', height: '26px' }"
|
|
@@ -37,46 +33,46 @@
|
|
|
37
33
|
import { mapGetters, mapMutations } from "vuex";
|
|
38
34
|
|
|
39
35
|
export default {
|
|
40
|
-
name: "
|
|
36
|
+
name: "Button",
|
|
41
37
|
props: {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
38
|
+
key: String,
|
|
39
|
+
title: String,
|
|
40
|
+
type: String,
|
|
41
|
+
size: String,
|
|
42
|
+
eventName: String,
|
|
43
|
+
eventData: Object,
|
|
44
|
+
classIcon: String,
|
|
45
|
+
disabled: Boolean,
|
|
46
|
+
clicked: Function,
|
|
51
47
|
},
|
|
52
48
|
computed: {
|
|
53
|
-
...mapGetters("generic", ["
|
|
49
|
+
...mapGetters("generic", ["isLoading"]),
|
|
54
50
|
},
|
|
55
51
|
methods: {
|
|
56
|
-
...mapMutations("generic", ["
|
|
57
|
-
|
|
58
|
-
if (this.
|
|
59
|
-
this.
|
|
60
|
-
|
|
61
|
-
|
|
52
|
+
...mapMutations("generic", ["addLoading", "addEvent"]),
|
|
53
|
+
execute() {
|
|
54
|
+
if (this.eventName)
|
|
55
|
+
this.addEvent({
|
|
56
|
+
name: this.eventName,
|
|
57
|
+
data: this.eventData,
|
|
62
58
|
});
|
|
63
|
-
this.
|
|
64
|
-
if (this.
|
|
59
|
+
this.addLoading(this.key);
|
|
60
|
+
if (this.clicked) this.clicked();
|
|
65
61
|
},
|
|
66
62
|
},
|
|
67
63
|
};
|
|
68
64
|
</script>
|
|
69
65
|
<style scoped>
|
|
70
|
-
.c-div-
|
|
66
|
+
.c-div-button {
|
|
71
67
|
display: inline-block;
|
|
72
68
|
margin-left: 5px;
|
|
73
69
|
}
|
|
74
70
|
|
|
75
|
-
.
|
|
71
|
+
.title {
|
|
76
72
|
margin: 2px;
|
|
77
73
|
}
|
|
78
74
|
|
|
79
|
-
.
|
|
75
|
+
.button {
|
|
80
76
|
padding: 8px 12px;
|
|
81
77
|
cursor: pointer;
|
|
82
78
|
border: none;
|
|
@@ -90,44 +86,44 @@ export default {
|
|
|
90
86
|
box-shadow: 0px 10px 20px -6px rgb(0 0 0 / 12%);
|
|
91
87
|
}
|
|
92
88
|
|
|
93
|
-
.
|
|
89
|
+
.small {
|
|
94
90
|
padding: 4px 8px;
|
|
95
91
|
font-size: 13px;
|
|
96
92
|
}
|
|
97
93
|
|
|
98
|
-
.
|
|
94
|
+
.medium {
|
|
99
95
|
padding: 7px 12px;
|
|
100
96
|
font-size: 13px;
|
|
101
97
|
}
|
|
102
98
|
|
|
103
|
-
.
|
|
99
|
+
.large {
|
|
104
100
|
padding: 10px 15px;
|
|
105
101
|
font-size: 14px;
|
|
106
102
|
}
|
|
107
103
|
|
|
108
|
-
.
|
|
104
|
+
.disabled {
|
|
109
105
|
background: #bbbbbb !important;
|
|
110
106
|
border-color: #bbbbbb !important;
|
|
111
107
|
color: #fff;
|
|
112
108
|
}
|
|
113
109
|
|
|
114
|
-
.
|
|
110
|
+
.primary {
|
|
115
111
|
background: #577696;
|
|
116
112
|
border-color: #577696;
|
|
117
113
|
color: #fff;
|
|
118
114
|
}
|
|
119
115
|
|
|
120
|
-
.
|
|
116
|
+
.primary:hover {
|
|
121
117
|
background: #355472;
|
|
122
118
|
}
|
|
123
119
|
|
|
124
|
-
.
|
|
120
|
+
.success {
|
|
125
121
|
color: #fff;
|
|
126
122
|
background: #94aa2a;
|
|
127
123
|
border-color: #94aa2a;
|
|
128
124
|
}
|
|
129
125
|
|
|
130
|
-
.
|
|
126
|
+
.success:hover {
|
|
131
127
|
background: #6d7e1c;
|
|
132
128
|
}
|
|
133
129
|
|
|
@@ -141,33 +137,33 @@ export default {
|
|
|
141
137
|
background: #3e90b3;
|
|
142
138
|
}
|
|
143
139
|
|
|
144
|
-
.
|
|
140
|
+
.edit {
|
|
145
141
|
color: #fff;
|
|
146
142
|
border-color: #7b7f83;
|
|
147
143
|
background: #7b7f83;
|
|
148
144
|
}
|
|
149
145
|
|
|
150
|
-
.
|
|
146
|
+
.edit:hover {
|
|
151
147
|
background: #595c5f;
|
|
152
148
|
}
|
|
153
149
|
|
|
154
|
-
.
|
|
150
|
+
.warning {
|
|
155
151
|
color: #fff;
|
|
156
152
|
border-color: #f1bc31;
|
|
157
153
|
background: #f1bc31;
|
|
158
154
|
}
|
|
159
155
|
|
|
160
|
-
.
|
|
156
|
+
.warning:hover {
|
|
161
157
|
background: #a37d1b;
|
|
162
158
|
}
|
|
163
159
|
|
|
164
|
-
.
|
|
160
|
+
.danger {
|
|
165
161
|
color: #fff;
|
|
166
162
|
border-color: #f0134d;
|
|
167
163
|
background: #f0134d;
|
|
168
164
|
}
|
|
169
165
|
|
|
170
|
-
.
|
|
166
|
+
.danger:hover {
|
|
171
167
|
background: #c70f40;
|
|
172
168
|
}
|
|
173
169
|
</style>
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<b-form-group :label="title">
|
|
4
|
+
<b-form-checkbox-group
|
|
5
|
+
v-model="selected"
|
|
6
|
+
:options="options"
|
|
7
|
+
:stacked="stacked"
|
|
8
|
+
@click.native="execute"
|
|
9
|
+
></b-form-checkbox-group>
|
|
10
|
+
</b-form-group>
|
|
11
|
+
</div>
|
|
12
|
+
</template>
|
|
13
|
+
|
|
14
|
+
<script>
|
|
15
|
+
import { mapMutations } from "vuex";
|
|
16
|
+
|
|
17
|
+
export default {
|
|
18
|
+
name: "CheckboxGroup",
|
|
19
|
+
props: {
|
|
20
|
+
title: String,
|
|
21
|
+
options: Array,
|
|
22
|
+
params: Object,
|
|
23
|
+
changed: Function,
|
|
24
|
+
clicked: Function,
|
|
25
|
+
initialValue: Array,
|
|
26
|
+
value: Array,
|
|
27
|
+
stacked: {
|
|
28
|
+
type: Boolean,
|
|
29
|
+
default: false,
|
|
30
|
+
},
|
|
31
|
+
markFormDirty: {
|
|
32
|
+
type: Boolean,
|
|
33
|
+
default: true,
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
data() {
|
|
37
|
+
return {
|
|
38
|
+
selected: [],
|
|
39
|
+
};
|
|
40
|
+
},
|
|
41
|
+
mounted() {
|
|
42
|
+
this.selected = this.initialValue;
|
|
43
|
+
},
|
|
44
|
+
methods: {
|
|
45
|
+
...mapMutations("validation", ["updateFormDirty"]),
|
|
46
|
+
execute(event) {
|
|
47
|
+
if (this.markFormDirty) this.updateFormDirty(true);
|
|
48
|
+
this.$emit("input", this.selected);
|
|
49
|
+
let self = this;
|
|
50
|
+
setTimeout(function () {
|
|
51
|
+
// adicionado o pointerId para prevenir que não seja executado em duplicidade
|
|
52
|
+
if (self.clicked && event.pointerId === 1) self.clicked(self.params);
|
|
53
|
+
}, 100);
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
watch: {
|
|
57
|
+
selected() {
|
|
58
|
+
this.$emit("input", this.selected);
|
|
59
|
+
if (this.changed) this.changed(this.params);
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
};
|
|
63
|
+
</script>
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div>
|
|
3
3
|
<b-form-checkbox v-model="value" :value="true" :unchecked-value="false">
|
|
4
|
-
{{
|
|
5
|
-
<
|
|
4
|
+
{{ title }}
|
|
5
|
+
<Tip :field="field" :formName="formName" />
|
|
6
6
|
</b-form-checkbox>
|
|
7
7
|
</div>
|
|
8
8
|
</template>
|
|
9
9
|
|
|
10
10
|
<script>
|
|
11
|
-
import
|
|
11
|
+
import Tip from "../shared/Tip.vue";
|
|
12
12
|
export default {
|
|
13
|
-
components: {
|
|
14
|
-
name: "
|
|
13
|
+
components: { Tip },
|
|
14
|
+
name: "CheckboxSimple",
|
|
15
15
|
props: {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
title: String,
|
|
17
|
+
formName: String,
|
|
18
|
+
field: String,
|
|
19
19
|
value: Boolean,
|
|
20
20
|
},
|
|
21
21
|
watch: {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="form-group">
|
|
3
3
|
<div>
|
|
4
|
-
<span class="
|
|
5
|
-
<compact-picker v-model.trim="
|
|
4
|
+
<span class="title">{{ title }} </span>
|
|
5
|
+
<compact-picker v-model.trim="color.hex" />
|
|
6
6
|
</div>
|
|
7
7
|
</div>
|
|
8
8
|
</template>
|
|
@@ -11,26 +11,26 @@
|
|
|
11
11
|
import { Chrome } from "vue-color";
|
|
12
12
|
|
|
13
13
|
export default {
|
|
14
|
-
name: "
|
|
14
|
+
name: "Color",
|
|
15
15
|
components: {
|
|
16
16
|
"compact-picker": Chrome,
|
|
17
17
|
},
|
|
18
18
|
props: {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
title: String,
|
|
20
|
+
field: String,
|
|
21
|
+
formName: String,
|
|
22
22
|
value: String,
|
|
23
23
|
},
|
|
24
24
|
data() {
|
|
25
25
|
return {
|
|
26
|
-
|
|
26
|
+
color: { hex: "#40BF84" },
|
|
27
27
|
};
|
|
28
28
|
},
|
|
29
29
|
watch: {
|
|
30
30
|
value() {
|
|
31
|
-
this.
|
|
31
|
+
this.color.hex = this.value;
|
|
32
32
|
},
|
|
33
|
-
"
|
|
33
|
+
"color.hex": function (value) {
|
|
34
34
|
if (value.hex) this.$emit("input", value.hex);
|
|
35
35
|
},
|
|
36
36
|
},
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="form-group">
|
|
3
3
|
<label>
|
|
4
|
-
<span class="
|
|
5
|
-
<span class="
|
|
6
|
-
<
|
|
4
|
+
<span class="title">{{ title }} </span>
|
|
5
|
+
<span class="required" v-if="required">*</span>
|
|
6
|
+
<Tip :field="field" :formName="formName" />
|
|
7
7
|
</label>
|
|
8
8
|
<div class="inner-addon right-addon">
|
|
9
9
|
<i
|
|
10
|
-
v-if="
|
|
11
|
-
class="
|
|
10
|
+
v-if="notifications.length > 0 && formDirty"
|
|
11
|
+
class="required glyphicon fas fa-exclamation-triangle"
|
|
12
12
|
></i>
|
|
13
13
|
<date-picker
|
|
14
14
|
lang="pt-br"
|
|
@@ -30,35 +30,35 @@
|
|
|
30
30
|
:placeholder="placeholder"
|
|
31
31
|
:type="type"
|
|
32
32
|
v-model="valor"
|
|
33
|
-
:class="{ 'is-invalid':
|
|
33
|
+
:class="{ 'is-invalid': notifications.length > 0 && formDirty }"
|
|
34
34
|
></date-picker>
|
|
35
35
|
</div>
|
|
36
36
|
|
|
37
|
-
<div v-if="
|
|
38
|
-
<div v-for="
|
|
39
|
-
<span class="
|
|
37
|
+
<div v-if="formDirty">
|
|
38
|
+
<div v-for="message in notifications" :key="message">
|
|
39
|
+
<span class="invalid">{{ message }}</span>
|
|
40
40
|
</div>
|
|
41
41
|
</div>
|
|
42
42
|
</div>
|
|
43
43
|
</template>
|
|
44
44
|
|
|
45
45
|
<script>
|
|
46
|
-
import
|
|
46
|
+
import Tip from "../shared/Tip";
|
|
47
47
|
import DatePicker from "vue2-datepicker";
|
|
48
48
|
|
|
49
49
|
import { mapState, mapMutations } from "vuex";
|
|
50
50
|
|
|
51
51
|
export default {
|
|
52
|
-
components: {
|
|
52
|
+
components: { Tip, DatePicker },
|
|
53
53
|
name: "Data",
|
|
54
54
|
mixins: [],
|
|
55
55
|
props: [
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
"
|
|
56
|
+
"title",
|
|
57
|
+
"field",
|
|
58
|
+
"fieldTarget",
|
|
59
59
|
"placeholder",
|
|
60
|
-
"
|
|
61
|
-
"
|
|
60
|
+
"formName",
|
|
61
|
+
"required",
|
|
62
62
|
"format",
|
|
63
63
|
"type",
|
|
64
64
|
"value",
|
|
@@ -67,12 +67,12 @@ export default {
|
|
|
67
67
|
"confirmText",
|
|
68
68
|
],
|
|
69
69
|
/* props: {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
70
|
+
title: String,
|
|
71
|
+
field: String,
|
|
72
|
+
fieldTarget: String,
|
|
73
73
|
placeholder: String,
|
|
74
|
-
|
|
75
|
-
|
|
74
|
+
formName: String,
|
|
75
|
+
required: Boolean,
|
|
76
76
|
format: String,
|
|
77
77
|
type: String,
|
|
78
78
|
value: String,
|
|
@@ -82,82 +82,82 @@ export default {
|
|
|
82
82
|
},*/
|
|
83
83
|
data() {
|
|
84
84
|
return {
|
|
85
|
-
|
|
86
|
-
|
|
85
|
+
notifications: [],
|
|
86
|
+
formDirty: false,
|
|
87
87
|
valor: "",
|
|
88
88
|
};
|
|
89
89
|
},
|
|
90
90
|
created() {
|
|
91
|
-
this.
|
|
91
|
+
this.validate();
|
|
92
92
|
this.valor = this.value;
|
|
93
93
|
},
|
|
94
94
|
methods: {
|
|
95
95
|
...mapMutations("validation", [
|
|
96
|
-
"
|
|
97
|
-
"
|
|
98
|
-
"
|
|
96
|
+
"addValidation",
|
|
97
|
+
"removeValidation",
|
|
98
|
+
"updateFormDirty",
|
|
99
99
|
]),
|
|
100
|
-
...mapMutations("generic", ["
|
|
101
|
-
|
|
102
|
-
this.
|
|
100
|
+
...mapMutations("generic", ["addFilter"]),
|
|
101
|
+
validate() {
|
|
102
|
+
this.notifications = [];
|
|
103
103
|
|
|
104
|
-
if (this.
|
|
105
|
-
var
|
|
106
|
-
this.
|
|
104
|
+
if (this.required && this.valor.length == 0) {
|
|
105
|
+
var message = `${this.title} não pode ser vazio!`;
|
|
106
|
+
this.notifications.push(message);
|
|
107
107
|
}
|
|
108
108
|
},
|
|
109
109
|
confirma() {
|
|
110
110
|
if (this.range) {
|
|
111
111
|
let obj = {
|
|
112
|
-
|
|
112
|
+
fieldTarget: this.fieldTarget,
|
|
113
113
|
valor: { inicio: this.valor[0], fim: this.valor[1] },
|
|
114
114
|
};
|
|
115
|
-
this.
|
|
115
|
+
this.addFilter(obj);
|
|
116
116
|
}
|
|
117
117
|
},
|
|
118
118
|
fechar() {
|
|
119
119
|
let obj = {
|
|
120
|
-
|
|
120
|
+
fieldTarget: this.fieldTarget,
|
|
121
121
|
valor: { inicio: "", fim: "" },
|
|
122
122
|
};
|
|
123
|
-
this.
|
|
123
|
+
this.addFilter(obj);
|
|
124
124
|
},
|
|
125
125
|
},
|
|
126
126
|
computed: {
|
|
127
|
-
...mapState("validation", ["
|
|
127
|
+
...mapState("validation", ["resetForm", "validations"]),
|
|
128
128
|
},
|
|
129
129
|
watch: {
|
|
130
130
|
valor() {
|
|
131
|
-
this.
|
|
132
|
-
this.
|
|
133
|
-
this.
|
|
131
|
+
this.validate();
|
|
132
|
+
this.formDirty = true;
|
|
133
|
+
this.updateFormDirty(true);
|
|
134
134
|
this.$emit("input", this.valor);
|
|
135
135
|
},
|
|
136
136
|
value() {
|
|
137
137
|
this.valor = this.value;
|
|
138
138
|
},
|
|
139
|
-
|
|
139
|
+
notifications() {
|
|
140
140
|
let self = this;
|
|
141
|
-
this.
|
|
141
|
+
this.notifications.forEach(function (notification) {
|
|
142
142
|
let obj = {
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
143
|
+
key: self.field + "&" + self.formName,
|
|
144
|
+
formName: self.formName,
|
|
145
|
+
notification: notification,
|
|
146
146
|
};
|
|
147
|
-
self.
|
|
147
|
+
self.addValidation(obj);
|
|
148
148
|
});
|
|
149
149
|
|
|
150
|
-
if (this.
|
|
150
|
+
if (this.notifications.length == 0) {
|
|
151
151
|
let obj = {
|
|
152
|
-
|
|
153
|
-
|
|
152
|
+
key: self.field + "&" + self.formName,
|
|
153
|
+
formName: self.formName,
|
|
154
154
|
};
|
|
155
|
-
self.
|
|
155
|
+
self.removeValidation(obj);
|
|
156
156
|
}
|
|
157
157
|
},
|
|
158
|
-
|
|
158
|
+
resetForm: {
|
|
159
159
|
handler(form) {
|
|
160
|
-
if (form.nome == this.
|
|
160
|
+
if (form.nome == this.formName) this.formDirty = false;
|
|
161
161
|
},
|
|
162
162
|
deep: true,
|
|
163
163
|
},
|
|
@@ -166,11 +166,11 @@ export default {
|
|
|
166
166
|
</script>
|
|
167
167
|
|
|
168
168
|
<style scoped>
|
|
169
|
-
.
|
|
169
|
+
.success {
|
|
170
170
|
color: #94aa2a;
|
|
171
171
|
font-size: 14px;
|
|
172
172
|
}
|
|
173
|
-
.
|
|
173
|
+
.invalid {
|
|
174
174
|
color: #f0134d;
|
|
175
175
|
font-size: 14px;
|
|
176
176
|
}
|