@nixweb/nixloc-ui 0.0.253 → 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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nixweb/nixloc-ui",
3
- "version": "0.0.253",
3
+ "version": "0.0.255",
4
4
  "description": "Componentes UI",
5
5
  "author": "Fábio Ávila <fabio@nixweb.com.br>",
6
6
  "private": false,
@@ -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
- 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"
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
- let obj = {
95
- fieldTarget: this.fieldTarget,
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>
@@ -14,7 +14,7 @@
14
14
  </div>
15
15
  </div>
16
16
  </template>
17
-
17
+
18
18
  <script>
19
19
  export default {
20
20
  name: "InputTag",
@@ -65,7 +65,7 @@ export default {
65
65
 
66
66
  };
67
67
  </script>
68
-
68
+
69
69
  <style>
70
70
  .email-input-container {
71
71
  display: flex;
@@ -113,6 +113,8 @@ export default {
113
113
  font-size: 14px;
114
114
  padding: 4px;
115
115
  font-weight: 400 !important;
116
+ margin: 2px 5px 2px 5px;
117
+ background-color: transparent;
116
118
  }
117
119
 
118
120
  .email-input::placeholder {
@@ -120,5 +122,4 @@ export default {
120
122
  opacity: 0.5;
121
123
  color: #969595;
122
124
  }
123
- </style>
124
-
125
+ </style>
@@ -0,0 +1,71 @@
1
+ <template>
2
+ <div>
3
+ <transition name="fade">
4
+ <div v-if="showFloating" class="div-fixed footer-bar">
5
+ <slot></slot>
6
+ </div>
7
+ </transition>
8
+
9
+ </div>
10
+ </template>
11
+ <script>
12
+ export default {
13
+ name: "BarFloating",
14
+ props: {
15
+ distance: {
16
+ type: Number,
17
+ default: 0,
18
+ }
19
+ },
20
+ data() {
21
+ return {
22
+ showFloating: true,
23
+ }
24
+ },
25
+ mounted() {
26
+ window.addEventListener('scroll', this.checkPosition);
27
+ },
28
+ destroyed() {
29
+ window.removeEventListener('scroll', this.checkPosition);
30
+ },
31
+ methods: {
32
+ checkPosition() {
33
+
34
+ if (this.distance == 0) {
35
+ return true;
36
+ }
37
+ else {
38
+ const currentPosition = window.scrollY;
39
+
40
+ if (currentPosition > this.distance) {
41
+ this.showFloating = true;
42
+ } else {
43
+ this.showFloating = false;
44
+ }
45
+ }
46
+ }
47
+ }
48
+ }
49
+ </script>
50
+ <style scoped>
51
+ .div-fixed {
52
+ position: fixed;
53
+ top: 50%;
54
+ left: 57%;
55
+ transform: translate(-50%, -50%);
56
+ width: 75%;
57
+ opacity: 1;
58
+ transition: opacity 1s ease;
59
+ z-index: 1000;
60
+ }
61
+
62
+ .fade-enter-active,
63
+ .fade-leave-active {
64
+ transition: opacity 0.5s;
65
+ }
66
+
67
+ .fade-enter,
68
+ .fade-leave-to {
69
+ opacity: 0;
70
+ }
71
+ </style>
@@ -13,9 +13,9 @@
13
13
  <div class="box-main" v-for="(item, index) in menuFilter(true)" :key="index">
14
14
  <a href="#" @click.prevent="openSubMenu(item.module)" :class="highlightSession(item.module)">
15
15
  <div :class="{
16
- 'icon-active': menuActive == item.module,
17
- 'icon-normal': menuActive != item.module,
18
- }">
16
+ 'icon-active': menuActive == item.module,
17
+ 'icon-normal': menuActive != item.module,
18
+ }">
19
19
  <b-row>
20
20
  <b-col sm="12">
21
21
  <div class="box-icon text-center">
@@ -51,7 +51,8 @@
51
51
  <li v-for="(item, index) in subMenuFilter(false)" :key="index">
52
52
  <h5 v-if="item.type === 'group'" class="context-menu__title">
53
53
  <span class="sub-title"> {{ item.groupName }}</span>
54
- <span v-if="index === 0" @click.prevent="hideSubMenu" class="context-menu__btn-close icon-close" href="#">
54
+ <span v-if="index === 0" @click.prevent="hideSubMenu" class="context-menu__btn-close icon-close"
55
+ href="#">
55
56
  <i class="fas fa-times-circle"></i>
56
57
  </span>
57
58
  </h5>
@@ -5,21 +5,21 @@
5
5
  icon: 'fas fa-arrow-alt-circle-down',
6
6
  type: 'info',
7
7
  }" :buttonHide="{
8
- title: 'Menos filtros',
9
- icon: 'fas fa-arrow-alt-circle-up',
10
- type: 'warning',
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="{ content: '10', id: 10 }" :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" />
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
- <b-pagination v-model="pagination(_key).currentPage" align="right" :hide-goto-end-buttons="true"
4
- :per-page="totalPerPage.id" :total-rows="totalRecords">
5
- <template #first-text>
6
- <i class="fa-regular fa-chevron-left"></i>
7
- </template>
8
- <template #prev-text>
9
- <i class="fa-regular fa-chevron-left"></i>
10
- </template>
11
- <template #next-text>
12
- <i class="fa-regular fa-chevron-right"></i>
13
- </template>
14
- <template #last-text>
15
- <i class="fa-regular fa-chevron-right"></i>
16
- </template>
17
- </b-pagination>
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
- created() {
31
- this.addPagination({
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
- ...mapGetters("generic", ["pagination"]),
39
- ...mapState("generic", ["totalPerPage"]),
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", ["addPagination"]),
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
- .page-item {
49
- font-size: 15px !important;
50
- border: 0px solid !important;
51
- width: 50px !important;
52
- font-weight: 700 !important;
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
- .page-item.active .page-link {
56
- z-index: 3 !important;
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
- .page-link {
65
- color: #6c757d !important;
66
- border: 0px solid #dee2e6 !important;
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
- <b-row>
3
- <b-col xs="12" sm="12" md="12" lg="7" xl="6">
4
- <div class="margin">
5
- <div class="molded">
6
- <b-row>
7
- <b-col sm="9">
8
- <input class="input-search" type="text" name="search" placeholder="Pesquisar ..."
9
- @keyup="verifyCleanSearch()" @keyup.enter.prevent="executeSearch()" v-model="search.content" /></b-col>
10
- <b-col sm="3">
11
- <div class="div-select">
12
- <SelectStatic classCss="select-search" fieldTarget="filter" :onlyQuery="true"
13
- :initialValue="{ content: 'Contém', id: 'contains' }" v-model="search.filter" :showBorder="false" :data="[
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
- </div>
18
- </b-col>
19
- </b-row>
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
- </div>
22
- </b-col>
23
- <b-col xs="4" sm="4" md="4" lg="4" xl="4">
24
- <div class="div-button">
25
- <Button _key="btnSearch" type="info" title="Buscar" classIcon="fas fa-search" size="small"
26
- :clicked="executeSearch" />
27
- <Button _key="btnClean" type="info" title="Limpar" classIcon="fas fa-broom" size="small"
28
- :clicked="executeClean" />
29
- </div>
30
- </b-col>
31
- </b-row>
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
- { text: 'e', value: 'and' },
22
- { text: 'ou', value: 'or' },
23
- ]" v-model="andOr" />
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>
@@ -25,15 +25,17 @@
25
25
  </b-col>
26
26
  </b-row>
27
27
  <Loading type="line" :center="false" v-show="isLoading('loadingLine')" />
28
- <div class="fixed-bar-options" v-show="selected.length > 0">
29
- <div class="side-by-side">
30
- <Button v-if="buttonRemove" key="remove" :title="`Remover ${selected.length}`" type="danger" size="small"
31
- :clicked="confirmRemoved" />
32
- </div>
33
- <div class="side-by-side">
34
- <slot name="content-buttons-table-header"></slot>
28
+ <BarFloating>
29
+ <div class="fixed-bar-options" v-show="selected.length > 0">
30
+ <div class="side-by-side">
31
+ <Button v-if="buttonRemove" key="remove" :title="`Remover ${selected.length}`" type="danger" size="small"
32
+ :clicked="confirmRemoved" />
33
+ </div>
34
+ <div class="side-by-side">
35
+ <slot name="content-buttons-table-header"></slot>
36
+ </div>
35
37
  </div>
36
- </div>
38
+ </BarFloating>
37
39
  <Table :header="templateList.headerTable" :data="content.data" :showChecks="templateList.showChecks"
38
40
  :dragAndDrop="templateList.dragAndDrop">
39
41
  <div slot="content-buttons-table">
@@ -61,6 +63,7 @@ import Pagination from "@nixweb/nixloc-ui/src/component/shared/Pagination.vue";
61
63
  import Table from "../shared/Table.vue";
62
64
  import Button from "../forms/Button.vue";
63
65
  import FixedBar from "../layout/FixedBar.vue";
66
+ import BarFloating from "@nixweb/nixloc-ui/src/component/layout/BarFloating.vue";
64
67
  import TableTotalRecords from "../shared/TableTotalRecords.vue";
65
68
  import TableTotalization from "../shared/TableTotalization.vue";
66
69
  import HorizontalFilter from "../shared/HorizontalFilter.vue";
@@ -95,6 +98,7 @@ export default {
95
98
  TableTotalization,
96
99
  TableTotalRecords,
97
100
  Confirmation,
101
+ BarFloating,
98
102
  Alert,
99
103
  Modal,
100
104
  Loading,
@@ -111,7 +115,7 @@ export default {
111
115
  totalRecords: 0,
112
116
  },
113
117
  baseParams: {
114
- search: undefined,
118
+ search: "",
115
119
  filter: "contains",
116
120
  currentPage: 1,
117
121
  totalPerPage: 10,
@@ -122,13 +126,11 @@ export default {
122
126
  };
123
127
  },
124
128
  created() {
125
- // o carregamento inicial getAll() é feito pela mudança no paginationKey
126
- },
127
- mounted() {
128
- this.updatePagination({
129
- key: "templateList",
130
- totalPerPage: this.totalPerPage.id,
131
- });
129
+ var filter = this.getFilterStorage(this.$route.name);
130
+ if (filter) {
131
+ this.updateCurrentPage(filter.baseParams.currentPage);
132
+ }
133
+ this.getAll();
132
134
  },
133
135
  beforeDestroy() {
134
136
  let search = { content: "", filter: { content: "Contém", id: "contains" } };
@@ -144,12 +146,11 @@ export default {
144
146
  "clearedSearch",
145
147
  "totalPerPage",
146
148
  "selectStatic",
149
+ "paginations",
150
+ "filterStorage",
147
151
  "tags"
148
152
  ]),
149
- ...mapGetters("generic", ["pagination", "isLoading", "event", "showModal"]),
150
- paginationKey: function () {
151
- return this.pagination("templateList");
152
- },
153
+ ...mapGetters("generic", ["isLoading", "getFilterStorage", "event", "showModal"]),
153
154
  },
154
155
  methods: {
155
156
  ...mapActions("generic", ["getApi", "orderAllApi", "deleteAllApi"]),
@@ -158,30 +159,51 @@ export default {
158
159
  "addLoading",
159
160
  "removeLoading",
160
161
  "addSelected",
161
- "updatePagination",
162
162
  "updateSearch",
163
+ "updateCurrentPage",
163
164
  "addTag",
164
165
  "removeTag",
165
166
  "cleanTags",
166
167
  "openModal",
167
- "hideModal"
168
+ "hideModal",
169
+ "addFilterStorage",
170
+ "removeFilterStorage"
168
171
  ]),
169
172
  getAll() {
170
- this.baseParams.totalPerPage = this.totalPerPage.id
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;
171
182
 
172
- let obj = {
173
- ...this.baseParams,
174
- ...this.dynamicFilter,
175
- ...this.propsParam,
176
- };
177
- let params = { url: this.templateList.urlGetApi, obj: obj };
178
- this.getApi(params).then((response) => {
179
- this.content = response.content;
180
- let self = this;
181
183
  setTimeout(function () {
182
- self.removeLoading(["panel", "loadingLine", "btnSearch", "btnClean"]);
183
- }, 350);
184
- });
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);
185
207
  },
186
208
  orderAll(data) {
187
209
  if (this.templateList.urlOrderAllApi) {
@@ -197,26 +219,43 @@ export default {
197
219
  }
198
220
  },
199
221
  selectFilter(value) {
222
+
200
223
  let fieldTarget = value.fieldTarget;
201
- let obj = { tag: value.tag, key: fieldTarget, value: value.value };
202
224
 
203
- if (obj.value != "")
204
- this.paramsFilter.push(obj);
225
+ if (fieldTarget != "totalPerPage") {
226
+ let obj = { tag: value.tag, key: fieldTarget, value: value.value };
205
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; }
206
239
  this.convertToObjectAndGetAll();
207
240
  },
208
241
  convertToObjectAndGetAll() {
242
+ this.generateDynamicFilter();
243
+ this.getAll();
244
+ },
245
+ generateDynamicFilter() {
209
246
  var result = {};
210
247
  for (var i = 0; i < this.paramsFilter.length; i++) {
211
248
  let key = this.paramsFilter[i].key;
212
249
  let value = this.paramsFilter[i].value;
213
250
  let tag = this.paramsFilter[i].tag;
214
251
 
215
-
216
252
  if (key == "period") {
217
253
  result["start"] = value.start;
218
254
  result["end"] = value.end;
219
255
 
256
+ if (value.start)
257
+ tag = `Período: ${value.start}-${value.end}`;
258
+
220
259
  } else {
221
260
  result[key] = value;
222
261
  }
@@ -229,17 +268,9 @@ export default {
229
268
  } else {
230
269
  this.removeTag(key);
231
270
  }
232
-
233
271
  }
234
272
 
235
273
  this.dynamicFilter = result;
236
-
237
- this.updatePagination({
238
- key: "templateList",
239
- totalPerPage: this.dynamicFilter.totalPerPage,
240
- });
241
-
242
- this.getAll();
243
274
  },
244
275
  confirmRemoved() {
245
276
  this.removeLoading(["remove"]);
@@ -259,6 +290,17 @@ export default {
259
290
  cleanParams() {
260
291
  this.baseParams.currentPage = 1;
261
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
+ }
262
304
  },
263
305
  watch: {
264
306
  event: {
@@ -268,16 +310,23 @@ export default {
268
310
  if (event.name == "tagRemoved") {
269
311
 
270
312
  this.removeTag(event.data);
313
+
271
314
  let filter = this.paramsFilter.filter(x => x.key != event.data);
272
315
  this.paramsFilter = filter;
273
316
 
274
- this.convertToObjectAndGetAll();
317
+ this.addStorage();
318
+ this.getAll();
275
319
  }
276
320
  if (event.name == "getAllListViewWithDataHandler") {
277
321
  this.addSelected([]);
278
322
  this.getAll();
279
323
  }
280
324
 
325
+ if (event.name == "page-click") {
326
+ this.baseParams.currentPage = event.data;
327
+ this.addStorage();
328
+ this.getAll();
329
+ }
281
330
  },
282
331
  deep: true,
283
332
  },
@@ -292,6 +341,8 @@ export default {
292
341
  }
293
342
  },
294
343
  executedSearch: function () {
344
+ this.addStorage();
345
+
295
346
  this.baseParams.search = this.search.content;
296
347
  if (this.search.filter.id) this.baseParams.filter = this.search.filter.id;
297
348
  this.cleanParams();
@@ -303,17 +354,28 @@ export default {
303
354
  this.cleanParams();
304
355
  this.getAll();
305
356
  },
306
- paginationKey: {
357
+ selectStatic: {
307
358
  handler(value) {
308
- this.cleanParams();
309
- this.baseParams.currentPage = value.currentPage;
310
- this.getAll();
359
+ this.selectFilter(value);
311
360
  },
312
361
  deep: true,
313
362
  },
314
- selectStatic: {
363
+ dynamicFilter: {
315
364
  handler(value) {
316
- this.selectFilter(value);
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();
317
379
  },
318
380
  deep: true,
319
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) {
@@ -418,6 +442,7 @@ export default {
418
442
  headers: new Token().tokenHeaders(),
419
443
  })
420
444
  .then((response) => {
445
+
421
446
  if (response.data.success) {
422
447
  context.commit('addMethodExecutedApi', params.methodExecutedApi);
423
448
  context.commit('removeNotificarions');