@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,489 @@
|
|
|
1
|
+
import axios from "@/config/axios";
|
|
2
|
+
import tips from "@/config/dicas";
|
|
3
|
+
import Token from "@nixweb/nixloc-ui/src/config/token";
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
namespaced: true,
|
|
7
|
+
state: {
|
|
8
|
+
modal: {
|
|
9
|
+
name: undefined,
|
|
10
|
+
open: false
|
|
11
|
+
},
|
|
12
|
+
vodal: {
|
|
13
|
+
name: undefined,
|
|
14
|
+
open: false
|
|
15
|
+
},
|
|
16
|
+
notifications: [],
|
|
17
|
+
pagination: [],
|
|
18
|
+
selected: [],
|
|
19
|
+
loading: [],
|
|
20
|
+
event: {
|
|
21
|
+
dateTime: undefined,
|
|
22
|
+
name: undefined,
|
|
23
|
+
data: {}
|
|
24
|
+
},
|
|
25
|
+
toast: {
|
|
26
|
+
dateTime: undefined,
|
|
27
|
+
type: undefined,
|
|
28
|
+
},
|
|
29
|
+
ids: undefined,
|
|
30
|
+
search: { content: "", filter: { text: "Contém", value: "contem" } },
|
|
31
|
+
documentHtml: "",
|
|
32
|
+
selectStatic: { dateTime: undefined, targetField: undefined, value: undefined },
|
|
33
|
+
executedSearch: false,
|
|
34
|
+
clearedSearch: false,
|
|
35
|
+
methodExecutedApi: undefined,
|
|
36
|
+
},
|
|
37
|
+
getters: {
|
|
38
|
+
showModal: (state) => (name) => {
|
|
39
|
+
if (name == state.modal.name) return true;
|
|
40
|
+
return false;
|
|
41
|
+
},
|
|
42
|
+
showVodal: (state) => (name) => {
|
|
43
|
+
if (name == state.vodal.name) return true;
|
|
44
|
+
return false;
|
|
45
|
+
},
|
|
46
|
+
isLoading: (state) => (key) => {
|
|
47
|
+
var loading = state.loading.find(value => {
|
|
48
|
+
return value === key
|
|
49
|
+
})
|
|
50
|
+
if (loading) return true;
|
|
51
|
+
return false;
|
|
52
|
+
},
|
|
53
|
+
pagination: (state) => (key) => {
|
|
54
|
+
return state.pagination.find(obj => {
|
|
55
|
+
return obj.key === key
|
|
56
|
+
})
|
|
57
|
+
},
|
|
58
|
+
tip: (state) => (obj) => {
|
|
59
|
+
return tips.find(value => {
|
|
60
|
+
if (value.formName == obj.formName && value.field == obj.field)
|
|
61
|
+
return value
|
|
62
|
+
})
|
|
63
|
+
},
|
|
64
|
+
event: (state) => {
|
|
65
|
+
return state.event;
|
|
66
|
+
},
|
|
67
|
+
documentPreview: (state) => {
|
|
68
|
+
let documentHtml = state.documentHtml
|
|
69
|
+
let ret = documentHtml;
|
|
70
|
+
|
|
71
|
+
var tables = document.getElementsByTagName("table");
|
|
72
|
+
let total = tables.length;
|
|
73
|
+
|
|
74
|
+
let config = [];
|
|
75
|
+
|
|
76
|
+
let index = 0;
|
|
77
|
+
while (index <= total - 1) {
|
|
78
|
+
|
|
79
|
+
let table = document.getElementsByTagName("table")[index];
|
|
80
|
+
let th = table.getElementsByTagName("th")[0];
|
|
81
|
+
|
|
82
|
+
let obj = {
|
|
83
|
+
vForGrouped: "",
|
|
84
|
+
vForSimple: "",
|
|
85
|
+
nameGroup: "",
|
|
86
|
+
nameGroupReplace: ""
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
if (th) {
|
|
90
|
+
let isGrouped = th.innerText.includes("n.grupo");
|
|
91
|
+
let isProduct = th.innerText.includes("n.produto");
|
|
92
|
+
let isPeriod = th.innerText.includes("n.periodo");
|
|
93
|
+
let isPayment = th.innerText.includes("n.pagamento");
|
|
94
|
+
|
|
95
|
+
if (isProduct) {
|
|
96
|
+
obj.vForSimple = "v-for='p in d.produto'";
|
|
97
|
+
config.push(obj);
|
|
98
|
+
} else if (isPeriod) {
|
|
99
|
+
obj.vForSimple = "v-for='pe in d.periodo'";
|
|
100
|
+
config.push(obj);
|
|
101
|
+
} else if (isPayment) {
|
|
102
|
+
obj.vForSimple = "v-for='pg in d.pagamento'";
|
|
103
|
+
config.push(obj);
|
|
104
|
+
} else if (isGrouped) {
|
|
105
|
+
obj.vForGrouped = "v-for='(produto, grN) in produtoAgrupado'";
|
|
106
|
+
obj.vForSimple = "v-for='p in d.produto'";
|
|
107
|
+
|
|
108
|
+
var initIndex = documentHtml.split("<tbody>", index + 1).join("<tbody>").length;
|
|
109
|
+
var lastIndex = documentHtml.split("</tbody>", index + 1).join("</tbody>").length;
|
|
110
|
+
|
|
111
|
+
let tbody = documentHtml.substring(documentHtml.indexOf("<tbody>", initIndex), documentHtml.lastIndexOf("</tbody>", lastIndex));
|
|
112
|
+
|
|
113
|
+
let tr = tbody.substring(tbody.indexOf("<tr>"), tbody.lastIndexOf("</tr>"));
|
|
114
|
+
|
|
115
|
+
obj.nameGroup = tr.substring(0, tr.indexOf('</tr>')) + "</tr>";
|
|
116
|
+
obj.nameGroup = obj.nameGroup.replaceAll("\"", "'");
|
|
117
|
+
obj.nameGroupReplace = obj.nameGroup.replace("<tr>", "").replace("</tr>", "");
|
|
118
|
+
config.push(obj);
|
|
119
|
+
|
|
120
|
+
} else {
|
|
121
|
+
config.push(obj);
|
|
122
|
+
}
|
|
123
|
+
} else {
|
|
124
|
+
config.push(obj);
|
|
125
|
+
}
|
|
126
|
+
index++;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
let replace = "";
|
|
130
|
+
config.forEach(x => {
|
|
131
|
+
replace += `.replace("<tbody>${x.nameGroup}<tr>", "<tbody ${x.vForGrouped}>${x.nameGroupReplace}<tr ${x.vForSimple}>")`;
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
var retParse = ret.replaceAll("\"", "'");
|
|
135
|
+
retParse = eval(`ret${replace}`);
|
|
136
|
+
|
|
137
|
+
var classImportant = retParse
|
|
138
|
+
.replaceAll("n.grupo", "")
|
|
139
|
+
.replaceAll("n.produto", "")
|
|
140
|
+
.replaceAll("n.periodo", "")
|
|
141
|
+
.replaceAll("n.pagamento", "")
|
|
142
|
+
.replaceAll("<p> !important;</p>", "<p> </p>");
|
|
143
|
+
|
|
144
|
+
return classImportant;
|
|
145
|
+
},
|
|
146
|
+
groupBy: () => (obj) => {
|
|
147
|
+
const result = {};
|
|
148
|
+
obj.array.forEach((item) => {
|
|
149
|
+
if (!result[item[obj.key]]) {
|
|
150
|
+
result[item[obj.key]] = [];
|
|
151
|
+
}
|
|
152
|
+
result[item[obj.key]].push(item);
|
|
153
|
+
});
|
|
154
|
+
return result;
|
|
155
|
+
},
|
|
156
|
+
},
|
|
157
|
+
mutations: {
|
|
158
|
+
openModal: (state, name) => {
|
|
159
|
+
state.modal.name = name;
|
|
160
|
+
state.modal.open = true;
|
|
161
|
+
},
|
|
162
|
+
hideModal: (state) => {
|
|
163
|
+
state.modal.open = false;
|
|
164
|
+
},
|
|
165
|
+
openVodal: (state, name) => {
|
|
166
|
+
state.vodal.name = name;
|
|
167
|
+
state.vodal.open = true;
|
|
168
|
+
},
|
|
169
|
+
hideVodal: (state) => {
|
|
170
|
+
state.vodal.name = "";
|
|
171
|
+
state.vodal.open = false;
|
|
172
|
+
},
|
|
173
|
+
updateSearch: (state, value) => {
|
|
174
|
+
state.search = value;
|
|
175
|
+
},
|
|
176
|
+
executedSearch: (state) => {
|
|
177
|
+
state.executedSearch = state.executedSearch = !state.executedSearch
|
|
178
|
+
},
|
|
179
|
+
clearedSearch: (state) => {
|
|
180
|
+
state.clearedSearch = state.clearedSearch = !state.clearedSearch
|
|
181
|
+
},
|
|
182
|
+
addSelection: (state, selected) => {
|
|
183
|
+
state.selected = selected;
|
|
184
|
+
},
|
|
185
|
+
addToast: (state, action) => {
|
|
186
|
+
state.toast.dateTime = new Date();
|
|
187
|
+
state.toast.type = action;
|
|
188
|
+
},
|
|
189
|
+
addMethodExecutedApi: (state, action) => {
|
|
190
|
+
state.methodExecutedApi = action;
|
|
191
|
+
},
|
|
192
|
+
cleanMethodExecutedApi: (state) => {
|
|
193
|
+
state.methodExecutedApi = "";
|
|
194
|
+
},
|
|
195
|
+
addLoading: (state, key) => {
|
|
196
|
+
state.loading.push(key);
|
|
197
|
+
},
|
|
198
|
+
removeLoading: (state, listKey) => {
|
|
199
|
+
listKey.forEach(function (key) {
|
|
200
|
+
let filter = state.loading.filter(function (item) {
|
|
201
|
+
return item != key;
|
|
202
|
+
});
|
|
203
|
+
state.loading = filter;
|
|
204
|
+
});
|
|
205
|
+
},
|
|
206
|
+
addPagination: (state, pagination) => {
|
|
207
|
+
state.pagination.push(pagination);
|
|
208
|
+
},
|
|
209
|
+
updatePagination: (state, pagination) => {
|
|
210
|
+
state.pagination.forEach(function (obj) {
|
|
211
|
+
if (obj.key == pagination.key)
|
|
212
|
+
obj.totalPerPage = pagination.totalPerPage;
|
|
213
|
+
});
|
|
214
|
+
},
|
|
215
|
+
updateDocumentHtml: (state, value) => {
|
|
216
|
+
state.documentHtml = value;
|
|
217
|
+
},
|
|
218
|
+
addEvent: (state, obj) => {
|
|
219
|
+
state.event.dateTime = new Date();
|
|
220
|
+
state.event.name = obj.name;
|
|
221
|
+
state.event.data = obj.data;
|
|
222
|
+
},
|
|
223
|
+
removeEvent: (state) => {
|
|
224
|
+
state.event = {};
|
|
225
|
+
},
|
|
226
|
+
addNotifications: (state, notifications) => {
|
|
227
|
+
state.notifications = notifications;
|
|
228
|
+
},
|
|
229
|
+
removeNotificarions: (state) => {
|
|
230
|
+
state.notifications = [];
|
|
231
|
+
},
|
|
232
|
+
addNotificationErrorApi: (state) => {
|
|
233
|
+
var erro = { property: "ERRO API", message: "Falha de Comunicação!" };
|
|
234
|
+
state.notifications = [erro];
|
|
235
|
+
},
|
|
236
|
+
listIdToString: (state, listId) => {
|
|
237
|
+
state.ids = "";
|
|
238
|
+
listId.forEach(function (id) {
|
|
239
|
+
state.ids += `${id},`;
|
|
240
|
+
});
|
|
241
|
+
},
|
|
242
|
+
addFilter: (state, obj) => {
|
|
243
|
+
state.selectStatic.dateTime = new Date();
|
|
244
|
+
state.selectStatic.targetField = obj.targetField;
|
|
245
|
+
state.selectStatic.value = obj.value;
|
|
246
|
+
},
|
|
247
|
+
|
|
248
|
+
},
|
|
249
|
+
actions: {
|
|
250
|
+
postApi: async function (context, params) {
|
|
251
|
+
context.commit('cleanMethodExecutedApi');
|
|
252
|
+
return axios.post(params.url, params.obj, {
|
|
253
|
+
headers: new Token().tokenHeaders(),
|
|
254
|
+
})
|
|
255
|
+
.then((response) => {
|
|
256
|
+
if (response.data.success) {
|
|
257
|
+
context.commit('addMethodExecutedApi', 'postApi');
|
|
258
|
+
|
|
259
|
+
if (!params.notNotifyToast)
|
|
260
|
+
context.commit('addToast', 'postApi');
|
|
261
|
+
|
|
262
|
+
context.commit('removeNotificarions');
|
|
263
|
+
context.commit('validation/removeFormDirty', null, { root: true });
|
|
264
|
+
return response.data;
|
|
265
|
+
} else {
|
|
266
|
+
|
|
267
|
+
context.commit('addNotifications', response.data.notifications)
|
|
268
|
+
context.commit('addToast', 'postApiError');
|
|
269
|
+
return response.data;
|
|
270
|
+
}
|
|
271
|
+
}, (err) => {
|
|
272
|
+
if (err.response)
|
|
273
|
+
if (err.response.status === 403)
|
|
274
|
+
context.commit('addNotifications', [{ message: "Usuário sem permissão para adicionar!" }])
|
|
275
|
+
|
|
276
|
+
if (!err.response)
|
|
277
|
+
context.commit('addNotificationErrorApi');
|
|
278
|
+
return false;
|
|
279
|
+
})
|
|
280
|
+
},
|
|
281
|
+
putApi: async function (context, params) {
|
|
282
|
+
context.commit('cleanMethodExecutedApi');
|
|
283
|
+
return axios.put(params.url, params.obj, {
|
|
284
|
+
headers: new Token().tokenHeaders(),
|
|
285
|
+
})
|
|
286
|
+
.then((response) => {
|
|
287
|
+
if (response.data.success) {
|
|
288
|
+
context.commit('addMethodExecutedApi', 'putApi');
|
|
289
|
+
|
|
290
|
+
if (!params.notNotifyToast)
|
|
291
|
+
context.commit('addToast', 'putApi');
|
|
292
|
+
|
|
293
|
+
context.commit('removeNotificarions');
|
|
294
|
+
context.commit('validation/removeFormDirty', null, { root: true });
|
|
295
|
+
return response.data;
|
|
296
|
+
} else {
|
|
297
|
+
context.commit('addToast', 'putApiErro');
|
|
298
|
+
context.commit('addNotifications', response.data.notifications)
|
|
299
|
+
return response.data;
|
|
300
|
+
}
|
|
301
|
+
}, (err) => {
|
|
302
|
+
if (err.response)
|
|
303
|
+
if (err.response.status === 403)
|
|
304
|
+
context.commit('addNotifications', [{ message: "Usuário sem permissão para modificar!" }])
|
|
305
|
+
|
|
306
|
+
if (!err.response)
|
|
307
|
+
context.commit('addNotificationErrorApi');
|
|
308
|
+
|
|
309
|
+
return false;
|
|
310
|
+
})
|
|
311
|
+
},
|
|
312
|
+
getApi: async function (context, params) {
|
|
313
|
+
context.commit('cleanMethodExecutedApi');
|
|
314
|
+
return axios.get(params.url, {
|
|
315
|
+
params: params.obj,
|
|
316
|
+
headers: new Token().tokenHeaders(),
|
|
317
|
+
})
|
|
318
|
+
.then((response) => {
|
|
319
|
+
if (response.data.success) {
|
|
320
|
+
context.commit('addMethodExecutedApi', params.methodExecutedApi);
|
|
321
|
+
context.commit('removeNotificarions');
|
|
322
|
+
return response.data;
|
|
323
|
+
} else {
|
|
324
|
+
context.commit('addNotifications', response.data.notifications)
|
|
325
|
+
context.commit('addToast', 'falhaGenerica');
|
|
326
|
+
return response.data;
|
|
327
|
+
}
|
|
328
|
+
}, (err) => {
|
|
329
|
+
context.commit('addNotificationErrorApi');
|
|
330
|
+
return false;
|
|
331
|
+
})
|
|
332
|
+
},
|
|
333
|
+
getApiOdata: async function (context, params) {
|
|
334
|
+
return axios.get(params.url, {
|
|
335
|
+
headers: new Token().tokenHeaders(),
|
|
336
|
+
})
|
|
337
|
+
.then((response) => {
|
|
338
|
+
return response.data;
|
|
339
|
+
}, (err) => {
|
|
340
|
+
context.commit('addNotificationErrorApi');
|
|
341
|
+
return false;
|
|
342
|
+
})
|
|
343
|
+
},
|
|
344
|
+
deleteAllApi: async function (context, params) {
|
|
345
|
+
|
|
346
|
+
context.commit('cleanMethodExecutedApi');
|
|
347
|
+
context.commit('listIdToString', params.selected);
|
|
348
|
+
|
|
349
|
+
let url = params.url;
|
|
350
|
+
let ids = context.state.ids;
|
|
351
|
+
|
|
352
|
+
return axios.delete(`${url}?ids=${ids}`, {
|
|
353
|
+
headers: new Token().tokenHeaders(),
|
|
354
|
+
})
|
|
355
|
+
.then((response) => {
|
|
356
|
+
if (response.data.success) {
|
|
357
|
+
context.commit('addMethodExecutedApi', 'deleteAllApi');
|
|
358
|
+
context.commit('addToast', 'deleteApiSucesso');
|
|
359
|
+
context.commit('removeNotificarions');
|
|
360
|
+
return response.data;
|
|
361
|
+
} else {
|
|
362
|
+
context.commit('addNotifications', response.data.notifications)
|
|
363
|
+
context.commit('addMethodExecutedApi', 'deleteAllApiErro');
|
|
364
|
+
context.commit('addToast', 'deleteApiErro');
|
|
365
|
+
return response.data;
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
}, (err) => {
|
|
369
|
+
if (err.response)
|
|
370
|
+
if (err.response.status === 403)
|
|
371
|
+
context.commit('addNotifications', [{ message: "Usuário sem permissão para remover!" }])
|
|
372
|
+
|
|
373
|
+
if (!err.response)
|
|
374
|
+
context.commit('addNotificationErrorApi');
|
|
375
|
+
return false;
|
|
376
|
+
})
|
|
377
|
+
},
|
|
378
|
+
deleteApi: async function (context, params) {
|
|
379
|
+
|
|
380
|
+
context.commit('cleanMethodExecutedApi');
|
|
381
|
+
let url = params.url;
|
|
382
|
+
|
|
383
|
+
return axios.delete(`${url}`, {
|
|
384
|
+
headers: new Token().tokenHeaders(),
|
|
385
|
+
})
|
|
386
|
+
.then((response) => {
|
|
387
|
+
if (response.data.success) {
|
|
388
|
+
context.commit('addMethodExecutedApi', 'deleteApi')
|
|
389
|
+
context.commit('addToast', 'deleteApiSucesso');
|
|
390
|
+
context.commit('removeNotificarions');
|
|
391
|
+
return response.data;
|
|
392
|
+
} else {
|
|
393
|
+
context.commit('addNotifications', response.data.notifications)
|
|
394
|
+
context.commit('addToast', 'deleteApiErro');
|
|
395
|
+
return response.data;
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
}, (err) => {
|
|
399
|
+
if (err.response)
|
|
400
|
+
if (err.response.status === 403)
|
|
401
|
+
context.commit('addNotifications', [{ message: "Usuário sem permissão para remover!" }])
|
|
402
|
+
|
|
403
|
+
if (!err.response)
|
|
404
|
+
context.commit('addNotificationErrorApi');
|
|
405
|
+
return false;
|
|
406
|
+
})
|
|
407
|
+
},
|
|
408
|
+
getFileApi: async function (context, params) {
|
|
409
|
+
context.commit('cleanMethodExecutedApi');
|
|
410
|
+
return axios.post(params.url, params.obj, {
|
|
411
|
+
headers: new Token().tokenHeaders(), responseType: "arraybuffer",
|
|
412
|
+
})
|
|
413
|
+
.then((response) => {
|
|
414
|
+
let blob = new Blob([response.data], { type: "application/pdf" }),
|
|
415
|
+
url = window.URL.createObjectURL(blob);
|
|
416
|
+
window.open(url);
|
|
417
|
+
context.commit('addMethodExecutedApi', 'getPdfApi');
|
|
418
|
+
context.commit('removeNotificarions');
|
|
419
|
+
|
|
420
|
+
}, (err) => {
|
|
421
|
+
context.commit('addNotificationErrorApi');
|
|
422
|
+
return false;
|
|
423
|
+
})
|
|
424
|
+
},
|
|
425
|
+
postFileApi: async function (context, params) {
|
|
426
|
+
context.commit('cleanMethodExecutedApi');
|
|
427
|
+
|
|
428
|
+
let formData = new FormData();
|
|
429
|
+
formData.append("file", params.file);
|
|
430
|
+
formData.append(params.container, params.container);
|
|
431
|
+
formData.append(params.name, params.name);
|
|
432
|
+
formData.append(params.accepted, params.accepted);
|
|
433
|
+
|
|
434
|
+
return axios.post(params.url, formData, {
|
|
435
|
+
headers: new Token().tokenHeaders(),
|
|
436
|
+
})
|
|
437
|
+
.then((response) => {
|
|
438
|
+
if (response.data.success) {
|
|
439
|
+
context.commit('addMethodExecutedApi', 'postFileApi');
|
|
440
|
+
context.commit('removeNotificarions');
|
|
441
|
+
return response.data;
|
|
442
|
+
} else {
|
|
443
|
+
context.commit('addToast', 'addApiError');
|
|
444
|
+
context.commit('addNotifications', response.data.notifications)
|
|
445
|
+
|
|
446
|
+
return response.data;
|
|
447
|
+
}
|
|
448
|
+
}, (err) => {
|
|
449
|
+
if (err.response)
|
|
450
|
+
if (err.response.status === 403)
|
|
451
|
+
context.commit('addNotifications', [{ message: "Usuário sem permissão para adicionar!" }])
|
|
452
|
+
|
|
453
|
+
if (!err.response)
|
|
454
|
+
context.commit('addNotificationErrorApi');
|
|
455
|
+
return false;
|
|
456
|
+
})
|
|
457
|
+
},
|
|
458
|
+
deleteFileApi: async function (context, params) {
|
|
459
|
+
context.commit('cleanMethodExecutedApi');
|
|
460
|
+
|
|
461
|
+
let url = params.url;
|
|
462
|
+
let name = params.obj.name;
|
|
463
|
+
let container = params.obj.container;
|
|
464
|
+
|
|
465
|
+
return axios.delete(`${url}?name=${name}&container=${container}`, {
|
|
466
|
+
headers: new Token().tokenHeaders(),
|
|
467
|
+
})
|
|
468
|
+
.then((response) => {
|
|
469
|
+
if (response.data.success) {
|
|
470
|
+
context.commit('addMethodExecutedApi', 'deleteFileApi');
|
|
471
|
+
context.commit('removeNotificarions');
|
|
472
|
+
return response.data;
|
|
473
|
+
} else {
|
|
474
|
+
context.commit('addNotifications', response.data.notifications)
|
|
475
|
+
context.commit('addToast', 'addApiError');
|
|
476
|
+
return response.data;
|
|
477
|
+
}
|
|
478
|
+
}, (err) => {
|
|
479
|
+
if (err.response)
|
|
480
|
+
if (err.response.status === 403)
|
|
481
|
+
context.commit('addNotifications', [{ message: "Usuário sem permissão para remover!" }])
|
|
482
|
+
|
|
483
|
+
if (!err.response)
|
|
484
|
+
context.commit('addNotificationErrorApi');
|
|
485
|
+
return false;
|
|
486
|
+
})
|
|
487
|
+
},
|
|
488
|
+
}
|
|
489
|
+
}
|