@nixweb/nixloc-ui 0.0.254 → 0.0.255
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/package.json +1 -1
- package/src/component/forms/DateTime.vue +19 -12
- package/src/component/shared/HorizontalFilter.vue +22 -13
- package/src/component/shared/Pagination.vue +84 -46
- package/src/component/shared/Search.vue +67 -27
- package/src/component/shared/query-builder/AddRule.vue +3 -3
- package/src/component/template/ListViewWithDataHandler.vue +104 -46
- package/src/store/modules/generic.js +35 -13
package/package.json
CHANGED
|
@@ -10,11 +10,11 @@
|
|
|
10
10
|
<date-picker lang="pt-br" :disabled="disabled" :range="range" @confirm="executeConfirm" @change="executeConfirm"
|
|
11
11
|
@clear="close" :confirm="confirm" :confirm-text="confirmText" :format="format" value-type="format"
|
|
12
12
|
:time-picker-options="{
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
start: '07:00',
|
|
14
|
+
step: '00:30',
|
|
15
|
+
end: '23:30',
|
|
16
|
+
format: 'HH:mm',
|
|
17
|
+
}" width="100%" :placeholder="placeholder" :type="type" v-model="valueLocal"
|
|
18
18
|
:class="{ 'is-invalid': notifications.length > 0 && formDirty }"></date-picker>
|
|
19
19
|
</div>
|
|
20
20
|
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
import Tip from "../shared/Tip";
|
|
31
31
|
import DatePicker from "vue2-datepicker";
|
|
32
32
|
|
|
33
|
-
import { mapState, mapMutations } from "vuex";
|
|
33
|
+
import { mapState, mapMutations, mapGetters } from "vuex";
|
|
34
34
|
|
|
35
35
|
export default {
|
|
36
36
|
components: { Tip, DatePicker },
|
|
@@ -72,7 +72,7 @@ export default {
|
|
|
72
72
|
"removeValidation",
|
|
73
73
|
"updateFormDirty",
|
|
74
74
|
]),
|
|
75
|
-
...mapMutations("generic", ["addFilter"]),
|
|
75
|
+
...mapMutations("generic", ["addFilter", "removeTag", "addEvent"]),
|
|
76
76
|
validate() {
|
|
77
77
|
this.notifications = [];
|
|
78
78
|
|
|
@@ -91,15 +91,13 @@ export default {
|
|
|
91
91
|
}
|
|
92
92
|
},
|
|
93
93
|
close() {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
value: { start: "", end: "" },
|
|
97
|
-
};
|
|
98
|
-
this.addFilter(obj);
|
|
94
|
+
this.removeTag("period");
|
|
95
|
+
this.addEvent({ name: "tagRemoved", data: "period" });
|
|
99
96
|
},
|
|
100
97
|
},
|
|
101
98
|
computed: {
|
|
102
99
|
...mapState("validation", ["resetForm", "validations"]),
|
|
100
|
+
...mapGetters("generic", ["event"]),
|
|
103
101
|
},
|
|
104
102
|
watch: {
|
|
105
103
|
valueLocal() {
|
|
@@ -137,6 +135,15 @@ export default {
|
|
|
137
135
|
},
|
|
138
136
|
deep: true,
|
|
139
137
|
},
|
|
138
|
+
event: {
|
|
139
|
+
handler(event) {
|
|
140
|
+
if (event.name == "tagRemoved") {
|
|
141
|
+
this.valueLocal = [];
|
|
142
|
+
|
|
143
|
+
}
|
|
144
|
+
},
|
|
145
|
+
deep: true,
|
|
146
|
+
},
|
|
140
147
|
},
|
|
141
148
|
};
|
|
142
149
|
</script>
|
|
@@ -5,21 +5,21 @@
|
|
|
5
5
|
icon: 'fas fa-arrow-alt-circle-down',
|
|
6
6
|
type: 'info',
|
|
7
7
|
}" :buttonHide="{
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}">
|
|
8
|
+
title: 'Menos filtros',
|
|
9
|
+
icon: 'fas fa-arrow-alt-circle-up',
|
|
10
|
+
type: 'warning',
|
|
11
|
+
}">
|
|
12
12
|
<slot name="content-filter-horizontal"></slot>
|
|
13
13
|
<b-row>
|
|
14
14
|
<b-col :sm="showTotalPerPage ? 10 : 12"></b-col>
|
|
15
15
|
<b-col xs="12" sm="12" md="12" lg="2" xl="2" v-if="showTotalPerPage">
|
|
16
|
-
<SelectStatic title="Mostrar" fieldTarget="totalPerPage" :initialValue="
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
16
|
+
<SelectStatic title="Mostrar" fieldTarget="totalPerPage" :initialValue="initialValue" :data="[
|
|
17
|
+
{ content: '10', id: 10 },
|
|
18
|
+
{ content: '20', id: 20 },
|
|
19
|
+
{ content: '30', id: 30 },
|
|
20
|
+
{ content: '50', id: 50 },
|
|
21
|
+
{ content: '100', id: 100 },
|
|
22
|
+
]" v-model="totalPerPage" />
|
|
23
23
|
</b-col>
|
|
24
24
|
</b-row>
|
|
25
25
|
</Collapse>
|
|
@@ -31,7 +31,7 @@ import Collapse from "./Collapse.vue";
|
|
|
31
31
|
import SelectStatic from "../forms/SelectStatic.vue";
|
|
32
32
|
import Select from "../forms/Select";
|
|
33
33
|
|
|
34
|
-
import { mapMutations } from "vuex";
|
|
34
|
+
import { mapMutations, mapState } from "vuex";
|
|
35
35
|
|
|
36
36
|
export default {
|
|
37
37
|
name: "ListViewWithHandlerData",
|
|
@@ -42,10 +42,19 @@ export default {
|
|
|
42
42
|
default: true,
|
|
43
43
|
},
|
|
44
44
|
},
|
|
45
|
+
data() {
|
|
46
|
+
return {
|
|
47
|
+
initialValue: {}
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
created() {
|
|
51
|
+
this.initialValue = { content: this.paginations.totalPerPage, id: this.paginations.totalPerPage }
|
|
52
|
+
},
|
|
45
53
|
computed: {
|
|
54
|
+
...mapState("generic", ["paginations"]),
|
|
46
55
|
totalPerPage: {
|
|
47
56
|
get() {
|
|
48
|
-
return this.$store.state.generic.totalPerPage;
|
|
57
|
+
return this.$store.state.generic.paginations.totalPerPage;
|
|
49
58
|
},
|
|
50
59
|
set(value) {
|
|
51
60
|
this.updateTotalPerPage(value);
|
|
@@ -1,71 +1,109 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div>
|
|
3
|
-
<
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
3
|
+
<div class="pagination">
|
|
4
|
+
<button class="btn-pagination" @click="previousPage" :disabled="currentPage === 1 || currentPage > totalPages">
|
|
5
|
+
<i class="fa-solid fa-chevron-left"></i>
|
|
6
|
+
</button>
|
|
7
|
+
<div class="div-pagination text-center">
|
|
8
|
+
<span v-if="isLoading('loadingLine')">
|
|
9
|
+
<vue-loading type="bubbles" color="#FCA944" :size="{ width: '26px', height: '26px' }"></vue-loading>
|
|
10
|
+
</span>
|
|
11
|
+
<span v-else>
|
|
12
|
+
<div v-if="currentPage < totalPages">
|
|
13
|
+
{{ currentPage }} de {{ totalPages }}
|
|
14
|
+
</div>
|
|
15
|
+
<div v-else>
|
|
16
|
+
1 de 1
|
|
17
|
+
</div>
|
|
18
|
+
</span>
|
|
19
|
+
</div>
|
|
20
|
+
<button class="btn-pagination" @click="nextPage"
|
|
21
|
+
:disabled="currentPage === totalPages || currentPage > totalPages">
|
|
22
|
+
<i class="fa-solid fa-chevron-right"></i>
|
|
23
|
+
</button>
|
|
24
|
+
</div>
|
|
18
25
|
</div>
|
|
19
26
|
</template>
|
|
20
|
-
|
|
21
27
|
<script>
|
|
28
|
+
|
|
22
29
|
import { mapGetters, mapMutations, mapState } from "vuex";
|
|
23
30
|
|
|
24
31
|
export default {
|
|
25
|
-
name: "Pagination",
|
|
26
32
|
props: {
|
|
27
|
-
_key: String,
|
|
28
33
|
totalRecords: Number,
|
|
29
34
|
},
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
key: this._key,
|
|
35
|
+
data() {
|
|
36
|
+
return {
|
|
33
37
|
currentPage: 1,
|
|
34
|
-
totalPerPage: 10
|
|
35
|
-
}
|
|
38
|
+
totalPerPage: 10 // Substitua pelo número de registros por página desejado
|
|
39
|
+
};
|
|
40
|
+
},
|
|
41
|
+
created() {
|
|
42
|
+
var filter = this.getFilterStorage(this.$route.name);
|
|
43
|
+
if (filter)
|
|
44
|
+
this.currentPage = filter.baseParams.currentPage;
|
|
36
45
|
},
|
|
37
46
|
computed: {
|
|
38
|
-
...
|
|
39
|
-
...
|
|
47
|
+
...mapState("generic", ["paginations"]),
|
|
48
|
+
...mapGetters("generic", ["isLoading", "getFilterStorage"]),
|
|
49
|
+
totalPages() {
|
|
50
|
+
return Math.ceil(this.totalRecords / this.paginations.totalPerPage);
|
|
51
|
+
},
|
|
52
|
+
paginatedData() {
|
|
53
|
+
const startIndex = (this.currentPage - 1) * this.paginations.totalPerPage;
|
|
54
|
+
const endIndex = Math.min(startIndex + this.paginations.totalPerPage, this.totalRecords);
|
|
55
|
+
return Array.from({ length: endIndex - startIndex }, (_, index) => index + startIndex + 1);
|
|
56
|
+
}
|
|
40
57
|
},
|
|
41
58
|
methods: {
|
|
42
|
-
...mapMutations("generic", ["
|
|
43
|
-
|
|
59
|
+
...mapMutations("generic", ["addEvent"]),
|
|
60
|
+
nextPage() {
|
|
61
|
+
if (this.currentPage < this.totalPages) {
|
|
62
|
+
this.currentPage++;
|
|
63
|
+
}
|
|
64
|
+
this.addEvent({ name: "page-click", data: this.currentPage });
|
|
65
|
+
},
|
|
66
|
+
previousPage() {
|
|
67
|
+
if (this.currentPage > 1) {
|
|
68
|
+
this.currentPage--;
|
|
69
|
+
}
|
|
70
|
+
this.addEvent({ name: "page-click", data: this.currentPage });
|
|
71
|
+
}
|
|
72
|
+
}
|
|
44
73
|
};
|
|
45
74
|
</script>
|
|
46
75
|
|
|
47
|
-
<style>
|
|
48
|
-
.
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
76
|
+
<style scoped>
|
|
77
|
+
.div-pagination {
|
|
78
|
+
width: 100px;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.btn-pagination {
|
|
82
|
+
padding: 5px;
|
|
83
|
+
cursor: pointer;
|
|
84
|
+
border: none;
|
|
85
|
+
min-width: 35px;
|
|
86
|
+
border-radius: 30px !important;
|
|
87
|
+
font-size: 13px !important;
|
|
88
|
+
font-weight: 400;
|
|
89
|
+
letter-spacing: 1px !important;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
.pagination {
|
|
94
|
+
display: flex;
|
|
95
|
+
justify-content: end;
|
|
96
|
+
align-items: center;
|
|
97
|
+
margin-right: 10px;
|
|
98
|
+
margin-bottom: 10px;
|
|
53
99
|
}
|
|
54
100
|
|
|
55
|
-
.
|
|
56
|
-
|
|
57
|
-
color: black !important;
|
|
58
|
-
background-color: #ECECEC !important;
|
|
59
|
-
border-radius: 50px !important;
|
|
60
|
-
width: 37px !important;
|
|
61
|
-
height: 37px !important;
|
|
101
|
+
.pagination-button:hover {
|
|
102
|
+
background-color: #ccc;
|
|
62
103
|
}
|
|
63
104
|
|
|
64
|
-
.
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
border-radius: 50px !important;
|
|
68
|
-
width: 37px !important;
|
|
69
|
-
height: 37px !important;
|
|
105
|
+
.pagination-button:disabled {
|
|
106
|
+
opacity: 0.5;
|
|
107
|
+
cursor: not-allowed;
|
|
70
108
|
}
|
|
71
109
|
</style>
|
|
@@ -1,46 +1,68 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
<b-
|
|
4
|
-
<
|
|
5
|
-
<div class="
|
|
6
|
-
<
|
|
7
|
-
<b-
|
|
8
|
-
<
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
2
|
+
<div>
|
|
3
|
+
<b-row>
|
|
4
|
+
<b-col xs="12" sm="12" md="12" lg="7" xl="6">
|
|
5
|
+
<div class="margin">
|
|
6
|
+
<div class="molded">
|
|
7
|
+
<b-row>
|
|
8
|
+
<b-col sm="9">
|
|
9
|
+
|
|
10
|
+
<input class="input-search" type="text" name="search" placeholder="Pesquisar ..."
|
|
11
|
+
@keyup="verifyCleanSearch()" @keyup.enter.prevent="executeSearch()" v-model="search.content" />
|
|
12
|
+
</b-col>
|
|
13
|
+
<b-col sm="3">
|
|
14
|
+
<div class="div-select">
|
|
15
|
+
<SelectStatic classCss="select-search" fieldTarget="filter" :onlyQuery="true"
|
|
16
|
+
:initialValue="{ content: 'Contém', id: 'contains' }" v-model="search.filter" :showBorder="false"
|
|
17
|
+
:data="[
|
|
14
18
|
{ content: 'Contém', id: 'contains' },
|
|
15
19
|
{ content: 'Igual', id: 'equal' },
|
|
16
20
|
]" />
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
21
|
+
</div>
|
|
22
|
+
</b-col>
|
|
23
|
+
</b-row>
|
|
24
|
+
</div>
|
|
25
|
+
</div>
|
|
26
|
+
<div v-if="getFilterStorage($route.name)">
|
|
27
|
+
<div v-if="getFilterStorage($route.name).paramsFilter.length !== 0
|
|
28
|
+
|| getFilterStorage($route.name).baseParams.search !== ''
|
|
29
|
+
|| getFilterStorage($route.name).baseParams.currentPage !== 1">
|
|
30
|
+
<div class="div-filter">
|
|
31
|
+
<i class="fa-solid fa-filter"></i>
|
|
32
|
+
Filtro Ativo
|
|
33
|
+
</div>
|
|
34
|
+
</div>
|
|
20
35
|
</div>
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
36
|
+
|
|
37
|
+
</b-col>
|
|
38
|
+
<b-col xs="4" sm="4" md="4" lg="4" xl="4">
|
|
39
|
+
<div class="div-button">
|
|
40
|
+
<Button _key="btnSearch" type="info" title="Buscar" classIcon="fas fa-search" size="small"
|
|
41
|
+
:clicked="executeSearch" />
|
|
42
|
+
<Button _key="btnClean" type="info" title="Limpar" classIcon="fas fa-broom" size="small"
|
|
43
|
+
:clicked="executeClean" />
|
|
44
|
+
</div>
|
|
45
|
+
</b-col>
|
|
46
|
+
</b-row>
|
|
47
|
+
</div>
|
|
32
48
|
</template>
|
|
33
49
|
|
|
34
50
|
<script>
|
|
35
51
|
import Button from "../forms/Button";
|
|
36
52
|
import SelectStatic from "../forms/SelectStatic.vue";
|
|
37
53
|
|
|
38
|
-
import { mapMutations } from "vuex";
|
|
54
|
+
import { mapMutations, mapGetters, mapState } from "vuex";
|
|
39
55
|
|
|
40
56
|
export default {
|
|
41
57
|
components: { Button, SelectStatic },
|
|
42
58
|
name: "Search",
|
|
59
|
+
data() {
|
|
60
|
+
return {
|
|
61
|
+
showFilterStorage: false,
|
|
62
|
+
}
|
|
63
|
+
},
|
|
43
64
|
computed: {
|
|
65
|
+
...mapGetters("generic", ["getFilterStorage"]),
|
|
44
66
|
search: {
|
|
45
67
|
get() {
|
|
46
68
|
return this.$store.state.generic.search;
|
|
@@ -116,4 +138,22 @@ input[type="text"]:focus {
|
|
|
116
138
|
margin-top: -30px;
|
|
117
139
|
margin-right: 5px;
|
|
118
140
|
}
|
|
141
|
+
|
|
142
|
+
.filter-active {
|
|
143
|
+
margin-right: 13px;
|
|
144
|
+
margin-left: -10px;
|
|
145
|
+
color: #F1BC31;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
.div-filter {
|
|
149
|
+
margin-left: 13px;
|
|
150
|
+
font-size: 11px;
|
|
151
|
+
background-color: #F1BC31;
|
|
152
|
+
color: white;
|
|
153
|
+
margin-top: 5px;
|
|
154
|
+
padding-left: 7px;
|
|
155
|
+
padding-right: 5px;
|
|
156
|
+
border-radius: 10px;
|
|
157
|
+
width: 100px;
|
|
158
|
+
}
|
|
119
159
|
</style>
|
|
@@ -18,9 +18,9 @@
|
|
|
18
18
|
<b-row>
|
|
19
19
|
<b-col sm="3">
|
|
20
20
|
<RadioGroup :options="[
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
{ text: 'e', value: 'and' },
|
|
22
|
+
{ text: 'ou', value: 'or' },
|
|
23
|
+
]" v-model="andOr" />
|
|
24
24
|
</b-col>
|
|
25
25
|
</b-row>
|
|
26
26
|
</div>
|
|
@@ -115,7 +115,7 @@ export default {
|
|
|
115
115
|
totalRecords: 0,
|
|
116
116
|
},
|
|
117
117
|
baseParams: {
|
|
118
|
-
search:
|
|
118
|
+
search: "",
|
|
119
119
|
filter: "contains",
|
|
120
120
|
currentPage: 1,
|
|
121
121
|
totalPerPage: 10,
|
|
@@ -126,13 +126,11 @@ export default {
|
|
|
126
126
|
};
|
|
127
127
|
},
|
|
128
128
|
created() {
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
totalPerPage: this.totalPerPage.id,
|
|
135
|
-
});
|
|
129
|
+
var filter = this.getFilterStorage(this.$route.name);
|
|
130
|
+
if (filter) {
|
|
131
|
+
this.updateCurrentPage(filter.baseParams.currentPage);
|
|
132
|
+
}
|
|
133
|
+
this.getAll();
|
|
136
134
|
},
|
|
137
135
|
beforeDestroy() {
|
|
138
136
|
let search = { content: "", filter: { content: "Contém", id: "contains" } };
|
|
@@ -148,12 +146,11 @@ export default {
|
|
|
148
146
|
"clearedSearch",
|
|
149
147
|
"totalPerPage",
|
|
150
148
|
"selectStatic",
|
|
149
|
+
"paginations",
|
|
150
|
+
"filterStorage",
|
|
151
151
|
"tags"
|
|
152
152
|
]),
|
|
153
|
-
...mapGetters("generic", ["
|
|
154
|
-
paginationKey: function () {
|
|
155
|
-
return this.pagination("templateList");
|
|
156
|
-
},
|
|
153
|
+
...mapGetters("generic", ["isLoading", "getFilterStorage", "event", "showModal"]),
|
|
157
154
|
},
|
|
158
155
|
methods: {
|
|
159
156
|
...mapActions("generic", ["getApi", "orderAllApi", "deleteAllApi"]),
|
|
@@ -162,30 +159,51 @@ export default {
|
|
|
162
159
|
"addLoading",
|
|
163
160
|
"removeLoading",
|
|
164
161
|
"addSelected",
|
|
165
|
-
"updatePagination",
|
|
166
162
|
"updateSearch",
|
|
163
|
+
"updateCurrentPage",
|
|
167
164
|
"addTag",
|
|
168
165
|
"removeTag",
|
|
169
166
|
"cleanTags",
|
|
170
167
|
"openModal",
|
|
171
|
-
"hideModal"
|
|
168
|
+
"hideModal",
|
|
169
|
+
"addFilterStorage",
|
|
170
|
+
"removeFilterStorage"
|
|
172
171
|
]),
|
|
173
172
|
getAll() {
|
|
174
|
-
this.
|
|
173
|
+
this.addLoading("loadingLine");
|
|
174
|
+
var filter = this.getFilterStorage(this.$route.name);
|
|
175
|
+
|
|
176
|
+
let self = this;
|
|
177
|
+
if (filter) {
|
|
178
|
+
this.baseParams = filter.baseParams;
|
|
179
|
+
this.dynamicFilter = filter.dynamicFilter;
|
|
180
|
+
this.propsParam = filter.propsParam;
|
|
181
|
+
this.paramsFilter = filter.paramsFilter;
|
|
175
182
|
|
|
176
|
-
let obj = {
|
|
177
|
-
...this.baseParams,
|
|
178
|
-
...this.dynamicFilter,
|
|
179
|
-
...this.propsParam,
|
|
180
|
-
};
|
|
181
|
-
let params = { url: this.templateList.urlGetApi, obj: obj };
|
|
182
|
-
this.getApi(params).then((response) => {
|
|
183
|
-
this.content = response.content;
|
|
184
|
-
let self = this;
|
|
185
183
|
setTimeout(function () {
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
184
|
+
let search = { content: filter.baseParams.search, filter: { content: "Contém", id: "contains" } };
|
|
185
|
+
self.updateSearch(search);
|
|
186
|
+
self.updateCurrentPage(filter.baseParams.currentPage);
|
|
187
|
+
self.generateDynamicFilter();
|
|
188
|
+
}, 200);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
setTimeout(function () {
|
|
192
|
+
let obj = {
|
|
193
|
+
...self.baseParams,
|
|
194
|
+
...self.dynamicFilter,
|
|
195
|
+
...self.propsParam,
|
|
196
|
+
};
|
|
197
|
+
|
|
198
|
+
let params = { url: self.templateList.urlGetApi, obj: obj };
|
|
199
|
+
console.log(params);
|
|
200
|
+
self.getApi(params).then((response) => {
|
|
201
|
+
self.content = response.content;
|
|
202
|
+
setTimeout(function () {
|
|
203
|
+
self.removeLoading(["panel", "loadingLine", "btnSearch", "btnClean"]);
|
|
204
|
+
}, 350);
|
|
205
|
+
});
|
|
206
|
+
}, 250);
|
|
189
207
|
},
|
|
190
208
|
orderAll(data) {
|
|
191
209
|
if (this.templateList.urlOrderAllApi) {
|
|
@@ -201,26 +219,43 @@ export default {
|
|
|
201
219
|
}
|
|
202
220
|
},
|
|
203
221
|
selectFilter(value) {
|
|
222
|
+
|
|
204
223
|
let fieldTarget = value.fieldTarget;
|
|
205
|
-
let obj = { tag: value.tag, key: fieldTarget, value: value.value };
|
|
206
224
|
|
|
207
|
-
if (
|
|
208
|
-
|
|
225
|
+
if (fieldTarget != "totalPerPage") {
|
|
226
|
+
let obj = { tag: value.tag, key: fieldTarget, value: value.value };
|
|
209
227
|
|
|
228
|
+
if (obj.value !== "") {
|
|
229
|
+
const existingIndex = this.paramsFilter.findIndex(item => item.key === obj.key);
|
|
230
|
+
if (existingIndex !== -1) {
|
|
231
|
+
// Se já existe, atualiza o valor
|
|
232
|
+
this.paramsFilter[existingIndex] = obj;
|
|
233
|
+
} else {
|
|
234
|
+
// Se não existe, adiciona ao paramsFilter
|
|
235
|
+
this.paramsFilter.push(obj);
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
} else { this.baseParams.currentPage = 1; }
|
|
210
239
|
this.convertToObjectAndGetAll();
|
|
211
240
|
},
|
|
212
241
|
convertToObjectAndGetAll() {
|
|
242
|
+
this.generateDynamicFilter();
|
|
243
|
+
this.getAll();
|
|
244
|
+
},
|
|
245
|
+
generateDynamicFilter() {
|
|
213
246
|
var result = {};
|
|
214
247
|
for (var i = 0; i < this.paramsFilter.length; i++) {
|
|
215
248
|
let key = this.paramsFilter[i].key;
|
|
216
249
|
let value = this.paramsFilter[i].value;
|
|
217
250
|
let tag = this.paramsFilter[i].tag;
|
|
218
251
|
|
|
219
|
-
|
|
220
252
|
if (key == "period") {
|
|
221
253
|
result["start"] = value.start;
|
|
222
254
|
result["end"] = value.end;
|
|
223
255
|
|
|
256
|
+
if (value.start)
|
|
257
|
+
tag = `Período: ${value.start}-${value.end}`;
|
|
258
|
+
|
|
224
259
|
} else {
|
|
225
260
|
result[key] = value;
|
|
226
261
|
}
|
|
@@ -233,17 +268,9 @@ export default {
|
|
|
233
268
|
} else {
|
|
234
269
|
this.removeTag(key);
|
|
235
270
|
}
|
|
236
|
-
|
|
237
271
|
}
|
|
238
272
|
|
|
239
273
|
this.dynamicFilter = result;
|
|
240
|
-
|
|
241
|
-
this.updatePagination({
|
|
242
|
-
key: "templateList",
|
|
243
|
-
totalPerPage: this.dynamicFilter.totalPerPage,
|
|
244
|
-
});
|
|
245
|
-
|
|
246
|
-
this.getAll();
|
|
247
274
|
},
|
|
248
275
|
confirmRemoved() {
|
|
249
276
|
this.removeLoading(["remove"]);
|
|
@@ -263,6 +290,17 @@ export default {
|
|
|
263
290
|
cleanParams() {
|
|
264
291
|
this.baseParams.currentPage = 1;
|
|
265
292
|
},
|
|
293
|
+
addStorage() {
|
|
294
|
+
let obj =
|
|
295
|
+
{
|
|
296
|
+
key: this.$route.name,
|
|
297
|
+
baseParams: this.baseParams,
|
|
298
|
+
dynamicFilter: this.dynamicFilter,
|
|
299
|
+
propsParam: this.propsParam,
|
|
300
|
+
paramsFilter: this.paramsFilter
|
|
301
|
+
};
|
|
302
|
+
this.addFilterStorage(obj);
|
|
303
|
+
}
|
|
266
304
|
},
|
|
267
305
|
watch: {
|
|
268
306
|
event: {
|
|
@@ -272,16 +310,23 @@ export default {
|
|
|
272
310
|
if (event.name == "tagRemoved") {
|
|
273
311
|
|
|
274
312
|
this.removeTag(event.data);
|
|
313
|
+
|
|
275
314
|
let filter = this.paramsFilter.filter(x => x.key != event.data);
|
|
276
315
|
this.paramsFilter = filter;
|
|
277
316
|
|
|
278
|
-
this.
|
|
317
|
+
this.addStorage();
|
|
318
|
+
this.getAll();
|
|
279
319
|
}
|
|
280
320
|
if (event.name == "getAllListViewWithDataHandler") {
|
|
281
321
|
this.addSelected([]);
|
|
282
322
|
this.getAll();
|
|
283
323
|
}
|
|
284
324
|
|
|
325
|
+
if (event.name == "page-click") {
|
|
326
|
+
this.baseParams.currentPage = event.data;
|
|
327
|
+
this.addStorage();
|
|
328
|
+
this.getAll();
|
|
329
|
+
}
|
|
285
330
|
},
|
|
286
331
|
deep: true,
|
|
287
332
|
},
|
|
@@ -296,6 +341,8 @@ export default {
|
|
|
296
341
|
}
|
|
297
342
|
},
|
|
298
343
|
executedSearch: function () {
|
|
344
|
+
this.addStorage();
|
|
345
|
+
|
|
299
346
|
this.baseParams.search = this.search.content;
|
|
300
347
|
if (this.search.filter.id) this.baseParams.filter = this.search.filter.id;
|
|
301
348
|
this.cleanParams();
|
|
@@ -307,17 +354,28 @@ export default {
|
|
|
307
354
|
this.cleanParams();
|
|
308
355
|
this.getAll();
|
|
309
356
|
},
|
|
310
|
-
|
|
357
|
+
selectStatic: {
|
|
311
358
|
handler(value) {
|
|
312
|
-
this.
|
|
313
|
-
this.baseParams.currentPage = value.currentPage;
|
|
314
|
-
this.getAll();
|
|
359
|
+
this.selectFilter(value);
|
|
315
360
|
},
|
|
316
361
|
deep: true,
|
|
317
362
|
},
|
|
318
|
-
|
|
363
|
+
dynamicFilter: {
|
|
319
364
|
handler(value) {
|
|
320
|
-
this.
|
|
365
|
+
this.addStorage();
|
|
366
|
+
},
|
|
367
|
+
deep: true,
|
|
368
|
+
},
|
|
369
|
+
propsParam: {
|
|
370
|
+
handler(value) {
|
|
371
|
+
this.addStorage();
|
|
372
|
+
},
|
|
373
|
+
deep: true,
|
|
374
|
+
},
|
|
375
|
+
paginations: {
|
|
376
|
+
handler(value) {
|
|
377
|
+
this.baseParams.totalPerPage = value.totalPerPage;
|
|
378
|
+
this.addStorage();
|
|
321
379
|
},
|
|
322
380
|
deep: true,
|
|
323
381
|
},
|
|
@@ -19,6 +19,7 @@ export default {
|
|
|
19
19
|
},
|
|
20
20
|
notifications: [],
|
|
21
21
|
pagination: [],
|
|
22
|
+
paginations: { currentPage: 1, totalPerPage: 10 },
|
|
22
23
|
totalPerPage: { "content": "10", "id": 10 },
|
|
23
24
|
selected: [],
|
|
24
25
|
loading: [],
|
|
@@ -65,6 +66,19 @@ export default {
|
|
|
65
66
|
if (loading) return true;
|
|
66
67
|
return false;
|
|
67
68
|
},
|
|
69
|
+
getFilterStorage: (state) => (key) => {
|
|
70
|
+
return state.filterStorage.find(x => x.key === key);
|
|
71
|
+
},
|
|
72
|
+
paramsFilterStorage: (state) => (route, key, returnIfNull) => {
|
|
73
|
+
var filter = state.filterStorage.find(x => x.key === route);
|
|
74
|
+
|
|
75
|
+
if (filter) {
|
|
76
|
+
var obj = filter.paramsFilter.find(x => x.key === key);
|
|
77
|
+
if (obj) return obj.value;
|
|
78
|
+
return returnIfNull;
|
|
79
|
+
}
|
|
80
|
+
return returnIfNull;
|
|
81
|
+
},
|
|
68
82
|
pagination: (state) => (key) => {
|
|
69
83
|
return state.pagination.find(obj => {
|
|
70
84
|
return obj.key === key
|
|
@@ -243,8 +257,11 @@ export default {
|
|
|
243
257
|
clearedSearch: (state) => {
|
|
244
258
|
state.clearedSearch = state.clearedSearch = !state.clearedSearch
|
|
245
259
|
},
|
|
260
|
+
updateCurrentPage: (state, value) => {
|
|
261
|
+
state.paginations.currentPage = value;
|
|
262
|
+
},
|
|
246
263
|
updateTotalPerPage: (state, value) => {
|
|
247
|
-
state.totalPerPage = value;
|
|
264
|
+
state.paginations.totalPerPage = value.id;
|
|
248
265
|
},
|
|
249
266
|
addSelected: (state, selected) => {
|
|
250
267
|
state.selected = selected;
|
|
@@ -268,7 +285,6 @@ export default {
|
|
|
268
285
|
state.methodExecutedApi = "";
|
|
269
286
|
}, 100);
|
|
270
287
|
},
|
|
271
|
-
|
|
272
288
|
addLoading: (state, key) => {
|
|
273
289
|
state.loading.push(key);
|
|
274
290
|
},
|
|
@@ -280,15 +296,6 @@ export default {
|
|
|
280
296
|
state.loading = filter;
|
|
281
297
|
});
|
|
282
298
|
},
|
|
283
|
-
addPagination: (state, pagination) => {
|
|
284
|
-
state.pagination.push(pagination);
|
|
285
|
-
},
|
|
286
|
-
updatePagination: (state, pagination) => {
|
|
287
|
-
state.pagination.forEach(function (obj) {
|
|
288
|
-
if (obj.key == pagination.key)
|
|
289
|
-
obj.totalPerPage = pagination.totalPerPage;
|
|
290
|
-
});
|
|
291
|
-
},
|
|
292
299
|
updateDocumentHtml: (state, value) => {
|
|
293
300
|
state.documentHtml = value;
|
|
294
301
|
},
|
|
@@ -336,6 +343,23 @@ export default {
|
|
|
336
343
|
cleanTags: (state) => {
|
|
337
344
|
state.tags = []
|
|
338
345
|
},
|
|
346
|
+
openModal: (state, name) => {
|
|
347
|
+
state.modal.name = name;
|
|
348
|
+
state.modal.open = true;
|
|
349
|
+
},
|
|
350
|
+
addFilterStorage: (state, obj) => {
|
|
351
|
+
const index = state.filterStorage.findIndex(x => x.key === obj.key);
|
|
352
|
+
if (index !== -1) {
|
|
353
|
+
state.filterStorage[index] = obj;
|
|
354
|
+
|
|
355
|
+
} else {
|
|
356
|
+
state.filterStorage.push(obj);
|
|
357
|
+
}
|
|
358
|
+
},
|
|
359
|
+
removeFilterStorage: (state, key) => {
|
|
360
|
+
let filter = state.filterStorage.filter(x => x.key != key);
|
|
361
|
+
state.filterStorage = filter;
|
|
362
|
+
},
|
|
339
363
|
},
|
|
340
364
|
actions: {
|
|
341
365
|
postApi: async function (context, params) {
|
|
@@ -419,8 +443,6 @@ export default {
|
|
|
419
443
|
})
|
|
420
444
|
.then((response) => {
|
|
421
445
|
|
|
422
|
-
console.log(response);
|
|
423
|
-
|
|
424
446
|
if (response.data.success) {
|
|
425
447
|
context.commit('addMethodExecutedApi', params.methodExecutedApi);
|
|
426
448
|
context.commit('removeNotificarions');
|