@nixweb/nixloc-ui 1.17.0 → 1.19.0
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/.github/workflows/publish-npm.yml +32 -32
- package/@nixweb/nixloc-ui/.github/workflows/publish-npm.yml +32 -32
- package/@nixweb/nixloc-ui/README.md +24 -24
- package/@nixweb/nixloc-ui/babel.config.js +5 -5
- package/@nixweb/nixloc-ui/config/dev.env.js +8 -8
- package/@nixweb/nixloc-ui/config/index.js +69 -69
- package/@nixweb/nixloc-ui/config/prod.env.js +5 -5
- package/@nixweb/nixloc-ui/docs/src/component/template/ViewTemplateReportPreview.drawio +209 -209
- package/@nixweb/nixloc-ui/docs/src/store/modulos/relatorio.drawio +36 -36
- package/@nixweb/nixloc-ui/package.json +88 -88
- package/@nixweb/nixloc-ui/public/index.html +19 -19
- package/@nixweb/nixloc-ui/public/styles/app.css +52 -52
- package/@nixweb/nixloc-ui/src/App.vue +13 -13
- package/@nixweb/nixloc-ui/src/component/forms/Button.vue +163 -163
- package/@nixweb/nixloc-ui/src/component/forms/ButtonFilter.vue +74 -74
- package/@nixweb/nixloc-ui/src/component/forms/ButtonGroup.vue +66 -66
- package/@nixweb/nixloc-ui/src/component/forms/ButtonSub.vue +97 -97
- package/@nixweb/nixloc-ui/src/component/forms/ButtonToggle.vue +76 -76
- package/@nixweb/nixloc-ui/src/component/forms/CheckboxGroup.vue +69 -69
- package/@nixweb/nixloc-ui/src/component/forms/CheckboxServer.vue +192 -192
- package/@nixweb/nixloc-ui/src/component/forms/CheckboxSimple.vue +60 -60
- package/@nixweb/nixloc-ui/src/component/forms/Color.vue +38 -38
- package/@nixweb/nixloc-ui/src/component/forms/DateTime.vue +170 -170
- package/@nixweb/nixloc-ui/src/component/forms/DateYearMonth.vue +193 -193
- package/@nixweb/nixloc-ui/src/component/forms/Dropdown.vue +236 -236
- package/@nixweb/nixloc-ui/src/component/forms/EditorHtml.vue +132 -132
- package/@nixweb/nixloc-ui/src/component/forms/FileUpload.vue +170 -170
- package/@nixweb/nixloc-ui/src/component/forms/ImageUpload.vue +214 -214
- package/@nixweb/nixloc-ui/src/component/forms/IncrementDecrement.vue +148 -148
- package/@nixweb/nixloc-ui/src/component/forms/InputAddressGoogle.vue +171 -171
- package/@nixweb/nixloc-ui/src/component/forms/InputCallToAction.vue +135 -135
- package/@nixweb/nixloc-ui/src/component/forms/InputDecimal.vue +153 -153
- package/@nixweb/nixloc-ui/src/component/forms/InputDecimalDiscount.vue +77 -77
- package/@nixweb/nixloc-ui/src/component/forms/InputNumber.vue +160 -160
- package/@nixweb/nixloc-ui/src/component/forms/InputPassword.vue +148 -148
- package/@nixweb/nixloc-ui/src/component/forms/InputTag.vue +124 -124
- package/@nixweb/nixloc-ui/src/component/forms/InputText.vue +174 -174
- package/@nixweb/nixloc-ui/src/component/forms/InputTextEdit.vue +69 -69
- package/@nixweb/nixloc-ui/src/component/forms/InputWhatsApp.vue +47 -47
- package/@nixweb/nixloc-ui/src/component/forms/Modal.vue +57 -57
- package/@nixweb/nixloc-ui/src/component/forms/RadioGroup.vue +91 -91
- package/@nixweb/nixloc-ui/src/component/forms/Select.vue +378 -378
- package/@nixweb/nixloc-ui/src/component/forms/SelectStatic.vue +198 -198
- package/@nixweb/nixloc-ui/src/component/forms/SideBar.vue +99 -99
- package/@nixweb/nixloc-ui/src/component/forms/Slider.vue +18 -18
- package/@nixweb/nixloc-ui/src/component/forms/TextArea.vue +138 -138
- package/@nixweb/nixloc-ui/src/component/forms/Toggle.vue +72 -72
- package/@nixweb/nixloc-ui/src/component/layout/Account.vue +131 -131
- package/@nixweb/nixloc-ui/src/component/layout/Alert.vue +88 -88
- package/@nixweb/nixloc-ui/src/component/layout/Badge.vue +111 -111
- package/@nixweb/nixloc-ui/src/component/layout/BarFloating.vue +67 -67
- package/@nixweb/nixloc-ui/src/component/layout/FixedBar.vue +103 -103
- package/@nixweb/nixloc-ui/src/component/layout/Gantt.vue +128 -128
- package/@nixweb/nixloc-ui/src/component/layout/Header.vue +56 -56
- package/@nixweb/nixloc-ui/src/component/layout/HideShow.vue +61 -61
- package/@nixweb/nixloc-ui/src/component/layout/IconMolded.vue +58 -58
- package/@nixweb/nixloc-ui/src/component/layout/LoadingFullPage.vue +27 -27
- package/@nixweb/nixloc-ui/src/component/layout/Menu.vue +287 -287
- package/@nixweb/nixloc-ui/src/component/layout/Molded.vue +30 -30
- package/@nixweb/nixloc-ui/src/component/layout/NewAccount.vue +136 -136
- package/@nixweb/nixloc-ui/src/component/layout/NewHeader.vue +59 -59
- package/@nixweb/nixloc-ui/src/component/layout/NewIconMolded.vue +70 -70
- package/@nixweb/nixloc-ui/src/component/layout/NewMenu.vue +455 -455
- package/@nixweb/nixloc-ui/src/component/layout/Panel.vue +185 -185
- package/@nixweb/nixloc-ui/src/component/layout/Popover.vue +126 -126
- package/@nixweb/nixloc-ui/src/component/layout/ScrollBar.vue +57 -57
- package/@nixweb/nixloc-ui/src/component/layout/Tab.vue +135 -135
- package/@nixweb/nixloc-ui/src/component/layout/Tag.vue +97 -97
- package/@nixweb/nixloc-ui/src/component/layout/Wizard.vue +211 -211
- package/@nixweb/nixloc-ui/src/component/rental/DisplayCalculatePeriod.vue +48 -48
- package/@nixweb/nixloc-ui/src/component/rental/DisplayPeriodRent.vue +55 -55
- package/@nixweb/nixloc-ui/src/component/rental/DisplayTotalization.vue +86 -86
- package/@nixweb/nixloc-ui/src/component/report/Fields.vue +108 -108
- package/@nixweb/nixloc-ui/src/component/report/Report.vue +313 -313
- package/@nixweb/nixloc-ui/src/component/report/ReportTable.vue +111 -111
- package/@nixweb/nixloc-ui/src/component/report/Totalization.vue +33 -33
- package/@nixweb/nixloc-ui/src/component/shared/CodeEditor.vue +128 -128
- package/@nixweb/nixloc-ui/src/component/shared/Collapse.vue +131 -131
- package/@nixweb/nixloc-ui/src/component/shared/Confirmation.vue +74 -74
- package/@nixweb/nixloc-ui/src/component/shared/DocumentEditor.vue +99 -99
- package/@nixweb/nixloc-ui/src/component/shared/DocumentPreview.vue +81 -81
- package/@nixweb/nixloc-ui/src/component/shared/DocumentPublic.vue +33 -33
- package/@nixweb/nixloc-ui/src/component/shared/ExportExcel.vue +56 -56
- package/@nixweb/nixloc-ui/src/component/shared/ExportPDF.vue +116 -116
- package/@nixweb/nixloc-ui/src/component/shared/FullCalendar.vue +173 -173
- package/@nixweb/nixloc-ui/src/component/shared/HeaderReport.vue +47 -47
- package/@nixweb/nixloc-ui/src/component/shared/HorizontalFilter.vue +64 -64
- package/@nixweb/nixloc-ui/src/component/shared/ListNotifications.vue +70 -70
- package/@nixweb/nixloc-ui/src/component/shared/Loading.vue +107 -107
- package/@nixweb/nixloc-ui/src/component/shared/LoadingCard.vue +64 -64
- package/@nixweb/nixloc-ui/src/component/shared/LoadingMoreButton.vue +23 -23
- package/@nixweb/nixloc-ui/src/component/shared/Messages.vue +109 -109
- package/@nixweb/nixloc-ui/src/component/shared/PDFViewer.vue +24 -24
- package/@nixweb/nixloc-ui/src/component/shared/Pagination.vue +108 -108
- package/@nixweb/nixloc-ui/src/component/shared/ParameterLegend.vue +169 -169
- package/@nixweb/nixloc-ui/src/component/shared/ProgressBar.vue +25 -25
- package/@nixweb/nixloc-ui/src/component/shared/QueryButton.vue +66 -66
- package/@nixweb/nixloc-ui/src/component/shared/Report.vue +200 -200
- package/@nixweb/nixloc-ui/src/component/shared/SaveCancel.vue +99 -99
- package/@nixweb/nixloc-ui/src/component/shared/Search.vue +174 -174
- package/@nixweb/nixloc-ui/src/component/shared/SelectOption.vue +162 -162
- package/@nixweb/nixloc-ui/src/component/shared/Table.vue +174 -174
- package/@nixweb/nixloc-ui/src/component/shared/TableButton.vue +36 -36
- package/@nixweb/nixloc-ui/src/component/shared/TableDraggable.vue +117 -117
- package/@nixweb/nixloc-ui/src/component/shared/TableImport.vue +93 -93
- package/@nixweb/nixloc-ui/src/component/shared/TableItem.vue +214 -214
- package/@nixweb/nixloc-ui/src/component/shared/TableTotalPerPage.vue +77 -77
- package/@nixweb/nixloc-ui/src/component/shared/TableTotalRecords.vue +44 -44
- package/@nixweb/nixloc-ui/src/component/shared/TableTotalization.vue +47 -47
- package/@nixweb/nixloc-ui/src/component/shared/TimeLine.vue +41 -41
- package/@nixweb/nixloc-ui/src/component/shared/Timer.vue +77 -77
- package/@nixweb/nixloc-ui/src/component/shared/Tip.vue +42 -42
- package/@nixweb/nixloc-ui/src/component/shared/Toast.vue +69 -69
- package/@nixweb/nixloc-ui/src/component/shared/ToggleTheme.vue +127 -127
- package/@nixweb/nixloc-ui/src/component/shared/TotalizationReport.vue +86 -86
- package/@nixweb/nixloc-ui/src/component/shared/VerticalFilter.vue +97 -97
- package/@nixweb/nixloc-ui/src/component/shared/automation/ActivitiesList.vue +43 -43
- package/@nixweb/nixloc-ui/src/component/shared/automation/AddRule.vue +60 -60
- package/@nixweb/nixloc-ui/src/component/shared/automation/AutomationBuilder.vue +26 -26
- package/@nixweb/nixloc-ui/src/component/shared/automation/DynamicComponentList.vue +85 -85
- package/@nixweb/nixloc-ui/src/component/shared/automation/SelectRule.vue +97 -97
- package/@nixweb/nixloc-ui/src/component/shared/automation/components/BillingByRent.vue +97 -97
- package/@nixweb/nixloc-ui/src/component/shared/automation/components/SendEmail.vue +93 -93
- package/@nixweb/nixloc-ui/src/component/shared/file-manager/FileManager.vue +390 -390
- package/@nixweb/nixloc-ui/src/component/shared/filter-builder/FilterBuilder.vue +220 -220
- package/@nixweb/nixloc-ui/src/component/shared/filter-builder/FilterQuery.vue +94 -94
- package/@nixweb/nixloc-ui/src/component/shared/query-builder/AddRule.vue +203 -203
- package/@nixweb/nixloc-ui/src/component/shared/query-builder/ConvertToOdata.js +86 -86
- package/@nixweb/nixloc-ui/src/component/shared/query-builder/DynamicComponent.vue +161 -161
- package/@nixweb/nixloc-ui/src/component/shared/query-builder/DynamicComponentList.vue +70 -70
- package/@nixweb/nixloc-ui/src/component/shared/query-builder/Fields.vue +93 -93
- package/@nixweb/nixloc-ui/src/component/shared/query-builder/QueryBuilder.vue +69 -69
- package/@nixweb/nixloc-ui/src/component/shared/query-builder/Rules.vue +68 -68
- package/@nixweb/nixloc-ui/src/component/shared/query-builder/SelectRule.vue +97 -97
- package/@nixweb/nixloc-ui/src/component/shared/query-builder/Tags.vue +59 -59
- package/@nixweb/nixloc-ui/src/component/shared/query-builder/utilities.js +21 -21
- package/@nixweb/nixloc-ui/src/component/signature/Payment.vue +160 -160
- package/@nixweb/nixloc-ui/src/component/signature/Warning.vue +75 -75
- package/@nixweb/nixloc-ui/src/component/template/ListViewWithDataHandler.vue +429 -429
- package/@nixweb/nixloc-ui/src/component/template/ReportCreateUpdate.vue +110 -110
- package/@nixweb/nixloc-ui/src/component/template/ViewTemplateConfiguration.vue +64 -64
- package/@nixweb/nixloc-ui/src/component/template/ViewTemplateDocumentView.vue +213 -213
- package/@nixweb/nixloc-ui/src/component/template/ViewTemplateImportFile.vue +347 -347
- package/@nixweb/nixloc-ui/src/component/template/ViewTemplateReportList.vue +217 -217
- package/@nixweb/nixloc-ui/src/component/template/ViewTemplateReportPreview.vue +432 -432
- package/@nixweb/nixloc-ui/src/component/template/ViewTemplateSelectOption.vue +46 -46
- package/@nixweb/nixloc-ui/src/component/template/ViewTemplateWithSalveCancel.vue +32 -32
- package/@nixweb/nixloc-ui/src/component/template/ViewTemplateWithTable.vue +62 -62
- package/@nixweb/nixloc-ui/src/component/template/model/Report.js +5 -5
- package/@nixweb/nixloc-ui/src/component/training/Course.vue +343 -343
- package/@nixweb/nixloc-ui/src/component/training/CourseView.vue +189 -189
- package/@nixweb/nixloc-ui/src/component/value-objects/Address.js +10 -10
- package/@nixweb/nixloc-ui/src/component/value-objects/Address.vue +157 -157
- package/@nixweb/nixloc-ui/src/component/value-objects/Contact.js +6 -6
- package/@nixweb/nixloc-ui/src/component/value-objects/Contact.vue +106 -106
- package/@nixweb/nixloc-ui/src/component/value-objects/Person.js +10 -10
- package/@nixweb/nixloc-ui/src/component/value-objects/Person.vue +129 -129
- package/@nixweb/nixloc-ui/src/config/axios.js +9 -9
- package/@nixweb/nixloc-ui/src/config/dicas.js +14 -14
- package/@nixweb/nixloc-ui/src/config/router.js +13 -13
- package/@nixweb/nixloc-ui/src/config/token.js +14 -14
- package/@nixweb/nixloc-ui/src/main.js +23 -23
- package/@nixweb/nixloc-ui/src/store/modules/automation.js +30 -30
- package/@nixweb/nixloc-ui/src/store/modules/generic.js +815 -815
- package/@nixweb/nixloc-ui/src/store/modules/report.js +277 -277
- package/@nixweb/nixloc-ui/src/store/modules/user.js +66 -66
- package/@nixweb/nixloc-ui/src/store/modules/util.js +25 -25
- package/@nixweb/nixloc-ui/src/store/modules/validation.js +38 -38
- package/@nixweb/nixloc-ui/src/store/store.js +13 -13
- package/README.md +24 -24
- package/babel.config.js +5 -5
- package/config/dev.env.js +8 -8
- package/config/index.js +69 -69
- package/config/prod.env.js +5 -5
- package/docs/src/component/template/ViewTemplateReportPreview.drawio +209 -209
- package/docs/src/store/modulos/relatorio.drawio +36 -36
- package/package.json +88 -88
- package/public/index.html +19 -19
- package/public/styles/app.css +52 -52
- package/src/component/forms/ButtonFilter.vue +104 -104
- package/src/component/forms/ButtonGroup.vue +66 -66
- package/src/component/forms/ButtonGroupInline.vue +210 -210
- package/src/component/forms/ButtonSub.vue +97 -97
- package/src/component/forms/ButtonToggle.vue +76 -76
- package/src/component/forms/DateYearMonth.vue +192 -192
- package/src/component/forms/ImageUpload.vue +214 -214
- package/src/component/forms/IncrementDecrement.vue +151 -151
- package/src/component/forms/InputAddressGoogle.vue +171 -171
- package/src/component/forms/InputCallToAction.vue +135 -135
- package/src/component/forms/InputDecimalDiscount.vue +146 -146
- package/src/component/forms/InputTag.vue +124 -124
- package/src/component/forms/InputTextEdit.vue +69 -69
- package/src/component/forms/InputWhatsApp.vue +47 -47
- package/src/component/forms/SideBar.vue +99 -99
- package/src/component/forms/Toggle.vue +72 -72
- package/src/component/layout/Account.vue +131 -131
- package/src/component/layout/AnimatedPhrase.vue +68 -68
- package/src/component/layout/BarFloating.vue +67 -67
- package/src/component/layout/BottomActionsBar.vue +205 -205
- package/src/component/layout/ColorPicker.vue +175 -175
- package/src/component/layout/Gantt.vue +128 -128
- package/src/component/layout/HideShow.vue +61 -61
- package/src/component/layout/IconMolded.vue +58 -58
- package/src/component/layout/IconPicker.vue +161 -161
- package/src/component/layout/NewAccount.vue +136 -136
- package/src/component/layout/NewHeader.vue +59 -59
- package/src/component/layout/NewIconMolded.vue +70 -70
- package/src/component/layout/NewMenu.vue +472 -472
- package/src/component/layout/ScrollBar.vue +21 -8
- package/src/component/layout/Tab.vue +259 -259
- package/src/component/layout/Tag.vue +97 -97
- package/src/component/layout/Tooltip.vue +155 -155
- package/src/component/layout/Zoom.vue +111 -111
- package/src/component/rental/DisplayCalculatePeriod.vue +48 -48
- package/src/component/rental/DisplayPeriodRent.vue +55 -55
- package/src/component/rental/DisplayTotalization.vue +86 -86
- package/src/component/report/Fields.vue +108 -108
- package/src/component/report/Report.vue +377 -377
- package/src/component/report/ReportTable.vue +111 -111
- package/src/component/report/Totalization.vue +33 -33
- package/src/component/shared/CodeEditor.vue +128 -128
- package/src/component/shared/Confirmation.vue +74 -74
- package/src/component/shared/DocumentEditor.vue +99 -99
- package/src/component/shared/DocumentPreview.vue +105 -105
- package/src/component/shared/DocumentPublic.vue +33 -33
- package/src/component/shared/ExportExcel.vue +56 -56
- package/src/component/shared/FullCalendar.vue +175 -175
- package/src/component/shared/HeaderReport.vue +47 -47
- package/src/component/shared/ListNotifications.vue +70 -70
- package/src/component/shared/Loading.vue +4 -1
- package/src/component/shared/LoadingCard.vue +64 -64
- package/src/component/shared/ParameterLegend.vue +169 -169
- package/src/component/shared/Report.vue +250 -250
- package/src/component/shared/SaveCancel.vue +117 -99
- package/src/component/shared/SelectOption.vue +162 -162
- package/src/component/shared/TableDraggable.vue +117 -117
- package/src/component/shared/TableImport.vue +93 -93
- package/src/component/shared/TableItem.vue +228 -228
- package/src/component/shared/TableTotalPerPage.vue +114 -114
- package/src/component/shared/TableTotalRecords.vue +44 -44
- package/src/component/shared/TimeLine.vue +41 -41
- package/src/component/shared/Timer.vue +77 -77
- package/src/component/shared/ToggleTheme.vue +127 -127
- package/src/component/shared/TotalizationReport.vue +86 -86
- package/src/component/shared/actions/ActionButtons.vue +53 -53
- package/src/component/shared/actions/ActionErrorContent.vue +103 -103
- package/src/component/shared/actions/ActionFooter.vue +99 -93
- package/src/component/shared/actions/ActionHeader.vue +110 -110
- package/src/component/shared/actions/ActionItemList.vue +143 -143
- package/src/component/shared/actions/ActionsOptions.vue +209 -209
- package/src/component/shared/actions/ActionsSelected.vue +262 -262
- package/src/component/shared/automation/ActivitiesList.vue +43 -43
- package/src/component/shared/automation/AddRule.vue +60 -60
- package/src/component/shared/automation/AutomationBuilder.vue +26 -26
- package/src/component/shared/automation/DynamicComponentList.vue +85 -85
- package/src/component/shared/automation/SelectRule.vue +97 -97
- package/src/component/shared/automation/components/BillingByRent.vue +97 -97
- package/src/component/shared/automation/components/SendEmail.vue +93 -93
- package/src/component/shared/file-manager/FileManager.vue +390 -390
- package/src/component/shared/filter-builder/FilterBuilder.vue +220 -220
- package/src/component/shared/filter-builder/FilterQuery.vue +95 -95
- package/src/component/shared/query-builder/ConvertToOdata.js +86 -86
- package/src/component/shared/query-builder/DynamicComponent.vue +161 -161
- package/src/component/shared/query-builder/Fields.vue +93 -93
- package/src/component/shared/query-builder/Rules.vue +68 -68
- package/src/component/shared/query-builder/SelectRule.vue +97 -97
- package/src/component/shared/query-builder/Tags.vue +59 -59
- package/src/component/signature/Payment.vue +160 -160
- package/src/component/signature/Warning.vue +75 -75
- package/src/component/template/ReportCreateUpdate.vue +110 -110
- package/src/component/template/ViewTemplateDocumentView.vue +213 -213
- package/src/component/template/ViewTemplateImportFile.vue +347 -347
- package/src/component/template/ViewTemplateReportList.vue +240 -240
- package/src/component/template/ViewTemplateReportPreview.vue +521 -521
- package/src/component/template/ViewTemplateSelectOption.vue +46 -46
- package/src/component/template/model/Report.js +5 -5
- package/src/component/training/Course.vue +343 -343
- package/src/component/training/CourseView.vue +198 -198
- package/src/component/value-objects/Address.js +10 -10
- package/src/component/value-objects/Address.vue +173 -173
- package/src/component/value-objects/Contact.js +6 -6
- package/src/component/value-objects/Contact.vue +106 -106
- package/src/component/value-objects/Person.js +10 -10
- package/src/component/value-objects/Person.vue +130 -130
- package/src/store/modules/automation.js +30 -30
- package/src/store/modules/report.js +277 -277
- package/src/store/modules/user.js +69 -69
- package/src/store/modules/util.js +25 -25
|
@@ -1,816 +1,816 @@
|
|
|
1
|
-
import axios from "@/config/axios";
|
|
2
|
-
import Tips from "@/config/tips";
|
|
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: [],
|
|
14
|
-
open: false
|
|
15
|
-
},
|
|
16
|
-
sideBar: {
|
|
17
|
-
name: undefined,
|
|
18
|
-
open: false
|
|
19
|
-
},
|
|
20
|
-
menuCollapsed: true,
|
|
21
|
-
notifications: [],
|
|
22
|
-
pagination: [],
|
|
23
|
-
paginations: { currentPage: 1, totalPerPage: 10 },
|
|
24
|
-
totalPerPage: { "content": "10", "id": 10 },
|
|
25
|
-
selected: [],
|
|
26
|
-
loading: [],
|
|
27
|
-
event: {
|
|
28
|
-
dateTime: undefined,
|
|
29
|
-
name: undefined,
|
|
30
|
-
data: {}
|
|
31
|
-
},
|
|
32
|
-
toast: {
|
|
33
|
-
dateTime: undefined,
|
|
34
|
-
type: undefined,
|
|
35
|
-
},
|
|
36
|
-
ids: undefined,
|
|
37
|
-
search: { content: "", filter: { content: "Contém", id: "contains" } },
|
|
38
|
-
documentHtml: "",
|
|
39
|
-
documentHtmlFinal: "",
|
|
40
|
-
selectStatic: { dateTime: undefined, tag: undefined, fieldTarget: undefined, value: undefined },
|
|
41
|
-
tags: [],
|
|
42
|
-
executedSearch: false,
|
|
43
|
-
clearedSearch: false,
|
|
44
|
-
methodExecutedApi: undefined,
|
|
45
|
-
filterStorage: [],
|
|
46
|
-
filterQuery: [],
|
|
47
|
-
filterFinal: [],
|
|
48
|
-
queryTags: [],
|
|
49
|
-
_filterStorage: [],
|
|
50
|
-
},
|
|
51
|
-
getters: {
|
|
52
|
-
tip: (state) => (tipId) => {
|
|
53
|
-
var tips = new Tips();
|
|
54
|
-
let message = "";
|
|
55
|
-
tips.help.find(value => {
|
|
56
|
-
if (value.tipId == tipId)
|
|
57
|
-
message = value.message;
|
|
58
|
-
})
|
|
59
|
-
return message;
|
|
60
|
-
},
|
|
61
|
-
showModal: (state) => (name) => {
|
|
62
|
-
if (name == state.modal.name) return true;
|
|
63
|
-
return false;
|
|
64
|
-
},
|
|
65
|
-
showVodal: (state) => (name) => {
|
|
66
|
-
return state.vodal.name.includes(name);
|
|
67
|
-
},
|
|
68
|
-
isLoading: (state) => (key) => {
|
|
69
|
-
var loading = state.loading.find(value => {
|
|
70
|
-
return value === key
|
|
71
|
-
})
|
|
72
|
-
if (loading) return true;
|
|
73
|
-
return false;
|
|
74
|
-
},
|
|
75
|
-
getFilterStorage: (state) => (key) => {
|
|
76
|
-
return state.filterStorage.find(x => x.key === key);
|
|
77
|
-
},
|
|
78
|
-
getQueryFilter: (state) => (routeName) => {
|
|
79
|
-
return state.filterQuery.find(x => x.routeName === routeName);
|
|
80
|
-
},
|
|
81
|
-
get_FilterStorage: (state) => (routeName) => {
|
|
82
|
-
return state._filterStorage.find(x => x.routeName === routeName);
|
|
83
|
-
},
|
|
84
|
-
isExistFilterQuery: (state) => (routeName, field) => {
|
|
85
|
-
var arr = state.filterFinal.find(x => x.routeName === routeName && x.field == field);
|
|
86
|
-
if (arr) return true;
|
|
87
|
-
return false;
|
|
88
|
-
},
|
|
89
|
-
paramsFilterStorage: (state) => (route, key, returnIfNull) => {
|
|
90
|
-
var filter = state.filterStorage.find(x => x.key === route);
|
|
91
|
-
|
|
92
|
-
if (filter) {
|
|
93
|
-
var obj = filter.paramsFilter.find(x => x.key === key);
|
|
94
|
-
if (obj) return obj.value;
|
|
95
|
-
return returnIfNull;
|
|
96
|
-
}
|
|
97
|
-
return returnIfNull;
|
|
98
|
-
},
|
|
99
|
-
pagination: (state) => (key) => {
|
|
100
|
-
return state.pagination.find(obj => {
|
|
101
|
-
return obj.key === key
|
|
102
|
-
})
|
|
103
|
-
},
|
|
104
|
-
event: (state) => {
|
|
105
|
-
return state.event;
|
|
106
|
-
},
|
|
107
|
-
documentPreview: (state) => (env) => {
|
|
108
|
-
let documentHtml = state.documentHtml
|
|
109
|
-
let ret = documentHtml;
|
|
110
|
-
|
|
111
|
-
var template = null;
|
|
112
|
-
|
|
113
|
-
if (env == 'dev')
|
|
114
|
-
template = document.getElementById("template-dev");
|
|
115
|
-
|
|
116
|
-
if (env == 'prod')
|
|
117
|
-
template = document.getElementById("template-prod");
|
|
118
|
-
|
|
119
|
-
if (template != null) {
|
|
120
|
-
var tables = template.getElementsByTagName("table");
|
|
121
|
-
let total = tables.length;
|
|
122
|
-
let config = [];
|
|
123
|
-
|
|
124
|
-
let index = 0;
|
|
125
|
-
while (index <= total - 1) {
|
|
126
|
-
|
|
127
|
-
let table = template.getElementsByTagName("table")[index];
|
|
128
|
-
let th = table.getElementsByTagName("th")[0];
|
|
129
|
-
|
|
130
|
-
let obj = {
|
|
131
|
-
vForGrouped: "",
|
|
132
|
-
vForSimple: "",
|
|
133
|
-
nameGroup: "",
|
|
134
|
-
nameGroupReplace: ""
|
|
135
|
-
};
|
|
136
|
-
|
|
137
|
-
if (th) {
|
|
138
|
-
|
|
139
|
-
let isPayment = th.innerText.includes("t.pagamentoLocacao");
|
|
140
|
-
let isPeriod = th.innerText.includes("t.periodoLocacao");
|
|
141
|
-
let isProduct = th.innerText.includes("t.produtoLocacao");
|
|
142
|
-
let isInvoice = th.innerText.includes("t.produtoFatura");
|
|
143
|
-
let isGrouped = th.innerText.includes("t.produtoAgrupado");
|
|
144
|
-
let isMoviment = th.innerText.includes("t.produtoMovimentacao");
|
|
145
|
-
let isCustumerAddress = th.innerText.includes("t.enderecoCliente");
|
|
146
|
-
let isAddressRent = th.innerText.includes("t.saidaRetornoLocacao");
|
|
147
|
-
let isTeamRent = th.innerText.includes("t.equipeLocacao");
|
|
148
|
-
let isOrderService = th.innerText.includes("t.produtoOs");
|
|
149
|
-
let isPaymentOsCustomer = th.innerText.includes("t.pagamentoCliente");
|
|
150
|
-
let isPaymentOsSupplier = th.innerText.includes("t.pagamentoFornecedor");
|
|
151
|
-
let isAttachment = th.innerText.includes("t.anexo");
|
|
152
|
-
|
|
153
|
-
if (isProduct) {
|
|
154
|
-
obj.vForSimple = "v-for='produto in d.itensLocacao'";
|
|
155
|
-
config.push(obj);
|
|
156
|
-
} else if (isInvoice) {
|
|
157
|
-
obj.vForSimple = "v-for='produto in d.itensFatura'";
|
|
158
|
-
config.push(obj);
|
|
159
|
-
} else if (isPeriod) {
|
|
160
|
-
obj.vForSimple = "v-for='periodo in d.periodoLocacao'";
|
|
161
|
-
config.push(obj);
|
|
162
|
-
} else if (isPayment) {
|
|
163
|
-
obj.vForSimple = "v-for='pagamento in d.pagamentoLocacao'";
|
|
164
|
-
config.push(obj);
|
|
165
|
-
} else if (isTeamRent) {
|
|
166
|
-
obj.vForSimple = "v-for='equipe in d.equipeLocacao'";
|
|
167
|
-
config.push(obj);
|
|
168
|
-
} else if (isOrderService) {
|
|
169
|
-
obj.vForSimple = "v-for='produto in d.itensOs'";
|
|
170
|
-
config.push(obj);
|
|
171
|
-
} else if (isPaymentOsCustomer) {
|
|
172
|
-
obj.vForSimple = "v-for='pagamento in d.pagamentoOsCliente'";
|
|
173
|
-
config.push(obj);
|
|
174
|
-
} else if (isPaymentOsSupplier) {
|
|
175
|
-
obj.vForSimple = "v-for='pagamento in d.pagamentoOsFornecedor'";
|
|
176
|
-
config.push(obj);
|
|
177
|
-
} else if (isGrouped) {
|
|
178
|
-
obj.vForGrouped = "v-for='(itensLocacao, grupo) in produtoAgrupado'";
|
|
179
|
-
obj.vForSimple = "v-for='produto in itensLocacao'";
|
|
180
|
-
|
|
181
|
-
// neste cenário basicamente temos que montar o <tbody> no array de agrupamento
|
|
182
|
-
|
|
183
|
-
var initIndex = documentHtml.split("<tbody>", index + 1).join("<tbody>").length;
|
|
184
|
-
var lastIndex = documentHtml.split("</tbody>", index + 1).join("</tbody>").length;
|
|
185
|
-
|
|
186
|
-
let tbody = documentHtml.substring(documentHtml.indexOf("<tbody>", initIndex), documentHtml.lastIndexOf("</tbody>", lastIndex));
|
|
187
|
-
|
|
188
|
-
let tr = tbody.substring(tbody.indexOf("<tr>"), tbody.lastIndexOf("</tr>"));
|
|
189
|
-
|
|
190
|
-
// faz o replace nameGroup para tirar o <tr/>
|
|
191
|
-
obj.nameGroup = tr.substring(0, tr.indexOf('</tr>')) + "</tr>";
|
|
192
|
-
obj.nameGroup = obj.nameGroup.replaceAll("\"", "'");
|
|
193
|
-
obj.nameGroupReplace = obj.nameGroup.replace("<tr>", "").replace("</tr>", "");
|
|
194
|
-
|
|
195
|
-
config.push(obj);
|
|
196
|
-
|
|
197
|
-
} else if (isMoviment) {
|
|
198
|
-
obj.vForSimple = "v-for='produto in d.itensMovimentacao'";
|
|
199
|
-
config.push(obj);
|
|
200
|
-
} else if (isCustumerAddress) {
|
|
201
|
-
obj.vForSimple = "v-for='endereco in d.locacao.cliente.endereco'";
|
|
202
|
-
config.push(obj);
|
|
203
|
-
} else if (isAddressRent) {
|
|
204
|
-
obj.vForSimple = "v-for='endereco in d.saidaRetorno'";
|
|
205
|
-
config.push(obj);
|
|
206
|
-
} else if (isAttachment) {
|
|
207
|
-
obj.vForSimple = "v-for='anexo in d.anexo'";
|
|
208
|
-
config.push(obj);
|
|
209
|
-
} else {
|
|
210
|
-
config.push(obj);
|
|
211
|
-
}
|
|
212
|
-
} else {
|
|
213
|
-
config.push(obj);
|
|
214
|
-
}
|
|
215
|
-
index++;
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
let replace = "";
|
|
219
|
-
config.forEach(x => {
|
|
220
|
-
replace += `.replace("<tbody>${x.nameGroup}<tr>", "<tbody ${x.vForGrouped}>${x.nameGroupReplace}<tr ${x.vForSimple}>")`;
|
|
221
|
-
});
|
|
222
|
-
|
|
223
|
-
var retParse = ret.replaceAll("\"", "'");
|
|
224
|
-
retParse = eval(`retParse${replace}`);
|
|
225
|
-
|
|
226
|
-
var classImportant = retParse
|
|
227
|
-
.replaceAll("t.pagamentoLocacao", "")
|
|
228
|
-
.replaceAll("t.periodoLocacao", "")
|
|
229
|
-
.replaceAll("t.produtoLocacao", "")
|
|
230
|
-
.replaceAll("t.produtoFatura", "")
|
|
231
|
-
.replaceAll("t.produtoAgrupado", "")
|
|
232
|
-
.replaceAll("t.produtoMovimentacao", "")
|
|
233
|
-
.replaceAll("t.enderecoCliente", "")
|
|
234
|
-
.replaceAll("t.saidaRetornoLocacao", "")
|
|
235
|
-
.replaceAll("t.equipeLocacao", "")
|
|
236
|
-
.replaceAll("t.produtoOs", "")
|
|
237
|
-
.replaceAll("t.pagamentoCliente", "")
|
|
238
|
-
.replaceAll("t.pagamentoFornecedor", "")
|
|
239
|
-
.replaceAll("t.anexo", "")
|
|
240
|
-
.replaceAll("<p> !important;</p>", "<p> </p>");
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
return classImportant;
|
|
244
|
-
},
|
|
245
|
-
groupBy: () => (obj) => {
|
|
246
|
-
const result = {};
|
|
247
|
-
obj.array.forEach((item) => {
|
|
248
|
-
if (!result[item[obj.key]]) {
|
|
249
|
-
result[item[obj.key]] = [];
|
|
250
|
-
}
|
|
251
|
-
result[item[obj.key]].push(item);
|
|
252
|
-
});
|
|
253
|
-
return result;
|
|
254
|
-
},
|
|
255
|
-
listIdToString: () => (listId) => {
|
|
256
|
-
var ids = "";
|
|
257
|
-
listId.forEach(function (id) {
|
|
258
|
-
ids += `${id},`;
|
|
259
|
-
});
|
|
260
|
-
return ids;
|
|
261
|
-
},
|
|
262
|
-
},
|
|
263
|
-
mutations: {
|
|
264
|
-
openModal: (state, name) => {
|
|
265
|
-
state.modal.name = name;
|
|
266
|
-
state.modal.open = true;
|
|
267
|
-
},
|
|
268
|
-
toggleMenu: (state, data) => {
|
|
269
|
-
state.menuCollapsed = data;
|
|
270
|
-
},
|
|
271
|
-
hideModal: (state) => {
|
|
272
|
-
state.modal.open = false;
|
|
273
|
-
},
|
|
274
|
-
openSideBar: (state, name) => {
|
|
275
|
-
state.sideBar.name = name;
|
|
276
|
-
state.sideBar.open = true;
|
|
277
|
-
},
|
|
278
|
-
hideSideBar: (state) => {
|
|
279
|
-
state.sideBar.open = false;
|
|
280
|
-
},
|
|
281
|
-
openVodal: (state, name) => {
|
|
282
|
-
state.vodal.name.push(name);
|
|
283
|
-
state.vodal.open = true;
|
|
284
|
-
},
|
|
285
|
-
hideVodal: (state, name) => {
|
|
286
|
-
let filter = state.vodal.name.filter(x => x != name);
|
|
287
|
-
state.vodal.name = filter;
|
|
288
|
-
state.vodal.open = false;
|
|
289
|
-
},
|
|
290
|
-
updateSearch: (state, value) => {
|
|
291
|
-
state.search = value;
|
|
292
|
-
},
|
|
293
|
-
executedSearch: (state) => {
|
|
294
|
-
state.executedSearch = state.executedSearch = !state.executedSearch
|
|
295
|
-
},
|
|
296
|
-
clearedSearch: (state) => {
|
|
297
|
-
state.clearedSearch = state.clearedSearch = !state.clearedSearch
|
|
298
|
-
},
|
|
299
|
-
updateCurrentPage: (state, value) => {
|
|
300
|
-
state.paginations.currentPage = value;
|
|
301
|
-
},
|
|
302
|
-
updateTotalPerPage: (state, value) => {
|
|
303
|
-
state.paginations.totalPerPage = value.id;
|
|
304
|
-
},
|
|
305
|
-
updateDocumentHtmlFinal: (state, html) => {
|
|
306
|
-
state.documentHtmlFinal = html;
|
|
307
|
-
},
|
|
308
|
-
addSelected: (state, selected) => {
|
|
309
|
-
state.selected = selected;
|
|
310
|
-
},
|
|
311
|
-
cleanSelected: (state) => {
|
|
312
|
-
setTimeout(function () {
|
|
313
|
-
state.selected = [];
|
|
314
|
-
}, 100);
|
|
315
|
-
},
|
|
316
|
-
addToast: (state, action) => {
|
|
317
|
-
state.toast.dateTime = new Date();
|
|
318
|
-
state.toast.type = action;
|
|
319
|
-
},
|
|
320
|
-
addMethodExecutedApi: (state, action) => {
|
|
321
|
-
setTimeout(function () {
|
|
322
|
-
state.methodExecutedApi = action;
|
|
323
|
-
}, 100);
|
|
324
|
-
},
|
|
325
|
-
cleanMethodExecutedApi: (state) => {
|
|
326
|
-
setTimeout(function () {
|
|
327
|
-
state.methodExecutedApi = "";
|
|
328
|
-
}, 100);
|
|
329
|
-
},
|
|
330
|
-
addLoading: (state, key) => {
|
|
331
|
-
state.loading.push(key);
|
|
332
|
-
},
|
|
333
|
-
removeLoading: (state, listKey) => {
|
|
334
|
-
listKey.forEach(function (key) {
|
|
335
|
-
let filter = state.loading.filter(function (item) {
|
|
336
|
-
return item != key;
|
|
337
|
-
});
|
|
338
|
-
state.loading = filter;
|
|
339
|
-
});
|
|
340
|
-
},
|
|
341
|
-
updateDocumentHtml: (state, value) => {
|
|
342
|
-
state.documentHtml = value;
|
|
343
|
-
},
|
|
344
|
-
addEvent: (state, obj) => {
|
|
345
|
-
setTimeout(function () {
|
|
346
|
-
state.event.dateTime = new Date();
|
|
347
|
-
state.event.name = obj.name;
|
|
348
|
-
state.event.data = obj.data;
|
|
349
|
-
}, 100);
|
|
350
|
-
},
|
|
351
|
-
removeEvent: (state) => {
|
|
352
|
-
state.event = {};
|
|
353
|
-
},
|
|
354
|
-
addNotifications: (state, notifications) => {
|
|
355
|
-
state.notifications = notifications;
|
|
356
|
-
},
|
|
357
|
-
removeNotificarions: (state) => {
|
|
358
|
-
state.notifications = [];
|
|
359
|
-
},
|
|
360
|
-
addNotificationErrorApi: (state) => {
|
|
361
|
-
var erro = { property: "ERRO API", message: "Falha de Comunicação!" };
|
|
362
|
-
state.notifications = [erro];
|
|
363
|
-
},
|
|
364
|
-
listIdToString: (state, listId) => {
|
|
365
|
-
state.ids = "";
|
|
366
|
-
listId.forEach(function (id) {
|
|
367
|
-
state.ids += `${id},`;
|
|
368
|
-
});
|
|
369
|
-
},
|
|
370
|
-
addFilter: (state, obj) => {
|
|
371
|
-
setTimeout(function () {
|
|
372
|
-
state.selectStatic.dateTime = new Date();
|
|
373
|
-
state.selectStatic.tag = obj.tag;
|
|
374
|
-
state.selectStatic.fieldTarget = obj.fieldTarget;
|
|
375
|
-
state.selectStatic.value = obj.value;
|
|
376
|
-
}, 100);
|
|
377
|
-
},
|
|
378
|
-
addTag: (state, tag) => {
|
|
379
|
-
state.tags.push(tag);
|
|
380
|
-
},
|
|
381
|
-
removeTag: (state, key) => {
|
|
382
|
-
let filter = state.tags.filter(x => x.key != key);
|
|
383
|
-
state.tags = filter;
|
|
384
|
-
},
|
|
385
|
-
cleanTags: (state) => {
|
|
386
|
-
state.tags = []
|
|
387
|
-
},
|
|
388
|
-
openModal: (state, name) => {
|
|
389
|
-
state.modal.name = name;
|
|
390
|
-
state.modal.open = true;
|
|
391
|
-
},
|
|
392
|
-
addFilterStorage: (state, obj) => {
|
|
393
|
-
const index = state.filterStorage.findIndex(x => x.key === obj.key);
|
|
394
|
-
if (index !== -1) {
|
|
395
|
-
state.filterStorage[index] = obj;
|
|
396
|
-
|
|
397
|
-
} else {
|
|
398
|
-
state.filterStorage.push(obj);
|
|
399
|
-
}
|
|
400
|
-
},
|
|
401
|
-
removeFilterStorage: (state, key) => {
|
|
402
|
-
let filter = state.filterStorage.filter(x => x.key != key);
|
|
403
|
-
state.filterStorage = filter;
|
|
404
|
-
},
|
|
405
|
-
addFilterQuery: (state, obj) => {
|
|
406
|
-
// função abaixo é para não deixar duplicidade
|
|
407
|
-
const index = state.filterQuery.findIndex(x => x.routeName === obj.routeName);
|
|
408
|
-
if (index !== -1) {
|
|
409
|
-
state.filterQuery[index] = obj;
|
|
410
|
-
|
|
411
|
-
} else {
|
|
412
|
-
state.filterQuery.push(obj);
|
|
413
|
-
}
|
|
414
|
-
},
|
|
415
|
-
updateFilterFinal: (state, filterFinal) => {
|
|
416
|
-
state.filterFinal = filterFinal;
|
|
417
|
-
},
|
|
418
|
-
updateQueryTags: (state, tags) => {
|
|
419
|
-
state.queryTags = tags;
|
|
420
|
-
},
|
|
421
|
-
_addFilterStorage: (state, obj) => { // está com _addFilterStorage para não ter duplicidade
|
|
422
|
-
// função abaixo é para não deixar duplicidade
|
|
423
|
-
const index = state._filterStorage.findIndex(x => x.routeName === obj.routeName);
|
|
424
|
-
if (index !== -1) {
|
|
425
|
-
state._filterStorage[index] = obj;
|
|
426
|
-
|
|
427
|
-
} else {
|
|
428
|
-
state._filterStorage.push(obj);
|
|
429
|
-
}
|
|
430
|
-
},
|
|
431
|
-
},
|
|
432
|
-
actions: {
|
|
433
|
-
postApi: async function (context, params) {
|
|
434
|
-
context.commit('cleanMethodExecutedApi');
|
|
435
|
-
return axios.post(params.url, params.obj, {
|
|
436
|
-
headers: new Token().tokenHeaders(),
|
|
437
|
-
})
|
|
438
|
-
.then((response) => {
|
|
439
|
-
|
|
440
|
-
if (response.data.success) {
|
|
441
|
-
context.commit('addMethodExecutedApi', 'postApi');
|
|
442
|
-
|
|
443
|
-
if (!params.notNotifyToast)
|
|
444
|
-
context.commit('addToast', 'postApi');
|
|
445
|
-
|
|
446
|
-
context.commit('removeNotificarions');
|
|
447
|
-
|
|
448
|
-
if (!params.notRemoveFormDirty)
|
|
449
|
-
context.commit('validation/removeFormDirty', null, { root: true });
|
|
450
|
-
|
|
451
|
-
return response.data;
|
|
452
|
-
} else {
|
|
453
|
-
|
|
454
|
-
context.commit('addNotifications', response.data.notifications)
|
|
455
|
-
context.commit('addToast', 'messageError');
|
|
456
|
-
|
|
457
|
-
return response.data;
|
|
458
|
-
}
|
|
459
|
-
}, (err) => {
|
|
460
|
-
|
|
461
|
-
if (err.response)
|
|
462
|
-
if (err.response.status === 403) {
|
|
463
|
-
context.commit('addNotifications', [{ message: "Usuário sem permissão para executar esta ação!" }])
|
|
464
|
-
context.commit('addToast', 'noPermission');
|
|
465
|
-
}
|
|
466
|
-
|
|
467
|
-
if (!err.response)
|
|
468
|
-
context.commit('addNotificationErrorApi');
|
|
469
|
-
return false;
|
|
470
|
-
})
|
|
471
|
-
},
|
|
472
|
-
putApi: async function (context, params) {
|
|
473
|
-
context.commit('cleanMethodExecutedApi');
|
|
474
|
-
return axios.put(params.url, params.obj, {
|
|
475
|
-
headers: new Token().tokenHeaders(),
|
|
476
|
-
})
|
|
477
|
-
.then((response) => {
|
|
478
|
-
if (response.data.success) {
|
|
479
|
-
context.commit('addMethodExecutedApi', 'putApi');
|
|
480
|
-
|
|
481
|
-
if (!params.notNotifyToast)
|
|
482
|
-
context.commit('addToast', 'putApi');
|
|
483
|
-
|
|
484
|
-
context.commit('removeNotificarions');
|
|
485
|
-
context.commit('validation/removeFormDirty', null, { root: true });
|
|
486
|
-
return response.data;
|
|
487
|
-
} else {
|
|
488
|
-
context.commit('addNotifications', response.data.notifications)
|
|
489
|
-
context.commit('addToast', 'messageError');
|
|
490
|
-
return response.data;
|
|
491
|
-
}
|
|
492
|
-
}, (err) => {
|
|
493
|
-
if (err.response)
|
|
494
|
-
if (err.response.status === 403) {
|
|
495
|
-
context.commit('addNotifications', [{ message: "Usuário sem permissão para executar esta ação!" }])
|
|
496
|
-
context.commit('addToast', 'noPermission');
|
|
497
|
-
}
|
|
498
|
-
|
|
499
|
-
if (!err.response)
|
|
500
|
-
context.commit('addNotificationErrorApi');
|
|
501
|
-
|
|
502
|
-
return false;
|
|
503
|
-
})
|
|
504
|
-
},
|
|
505
|
-
getApi: async function (context, params) {
|
|
506
|
-
|
|
507
|
-
context.commit('cleanMethodExecutedApi');
|
|
508
|
-
return axios.get(params.url, {
|
|
509
|
-
params: params.obj,
|
|
510
|
-
headers: new Token().tokenHeaders(),
|
|
511
|
-
})
|
|
512
|
-
.then((response) => {
|
|
513
|
-
|
|
514
|
-
if (response.data.success) {
|
|
515
|
-
context.commit('addMethodExecutedApi', params.methodExecutedApi);
|
|
516
|
-
context.commit('removeNotificarions');
|
|
517
|
-
return response.data;
|
|
518
|
-
} else {
|
|
519
|
-
|
|
520
|
-
context.commit('addNotifications', response.data.notifications)
|
|
521
|
-
context.commit('addToast', 'falhaGenerica');
|
|
522
|
-
return response.data;
|
|
523
|
-
}
|
|
524
|
-
}, (err) => {
|
|
525
|
-
context.commit('addNotificationErrorApi');
|
|
526
|
-
return false;
|
|
527
|
-
})
|
|
528
|
-
},
|
|
529
|
-
orderAllApi: async function (context, params) {
|
|
530
|
-
return axios.put(params.url, params.obj, {
|
|
531
|
-
headers: new Token().tokenHeaders(),
|
|
532
|
-
})
|
|
533
|
-
.then((response) => {
|
|
534
|
-
return response.data;
|
|
535
|
-
}, (err) => {
|
|
536
|
-
context.commit('addNotificationErrorApi');
|
|
537
|
-
return false;
|
|
538
|
-
})
|
|
539
|
-
},
|
|
540
|
-
getApiOdata: async function (context, params) {
|
|
541
|
-
return axios.get(params.url, {
|
|
542
|
-
headers: new Token().tokenHeaders(),
|
|
543
|
-
})
|
|
544
|
-
.then((response) => {
|
|
545
|
-
return response.data;
|
|
546
|
-
}, (err) => {
|
|
547
|
-
context.commit('addNotificationErrorApi');
|
|
548
|
-
return false;
|
|
549
|
-
})
|
|
550
|
-
},
|
|
551
|
-
putAllApi: async function (context, params) {
|
|
552
|
-
|
|
553
|
-
context.commit('cleanMethodExecutedApi');
|
|
554
|
-
context.commit('listIdToString', params.selected);
|
|
555
|
-
|
|
556
|
-
let ids = context.state.ids;
|
|
557
|
-
|
|
558
|
-
return axios.put(params.url, { ids: ids }, {
|
|
559
|
-
headers: new Token().tokenHeaders(),
|
|
560
|
-
})
|
|
561
|
-
.then((response) => {
|
|
562
|
-
if (response.data.success) {
|
|
563
|
-
context.commit('addMethodExecutedApi', 'putApi');
|
|
564
|
-
context.commit('addToast', 'putAllApi');
|
|
565
|
-
context.commit('removeNotificarions');
|
|
566
|
-
context.commit('cleanSelected', 'putApi');
|
|
567
|
-
|
|
568
|
-
return response.data;
|
|
569
|
-
} else {
|
|
570
|
-
context.commit('addNotifications', response.data.notifications)
|
|
571
|
-
context.commit('addMethodExecutedApi', 'putApiErro');
|
|
572
|
-
context.commit('addToast', 'messageError');
|
|
573
|
-
return response.data;
|
|
574
|
-
}
|
|
575
|
-
|
|
576
|
-
}, (err) => {
|
|
577
|
-
if (err.response)
|
|
578
|
-
if (err.response.status === 403) {
|
|
579
|
-
context.commit('addNotifications', [{ message: "Usuário sem permissão para executar esta ação!" }])
|
|
580
|
-
context.commit('addToast', 'noPermission');
|
|
581
|
-
}
|
|
582
|
-
|
|
583
|
-
if (!err.response)
|
|
584
|
-
context.commit('addNotificationErrorApi');
|
|
585
|
-
return false;
|
|
586
|
-
})
|
|
587
|
-
},
|
|
588
|
-
deleteAllApi: async function (context, params) {
|
|
589
|
-
|
|
590
|
-
context.commit('cleanMethodExecutedApi');
|
|
591
|
-
context.commit('listIdToString', params.selected);
|
|
592
|
-
|
|
593
|
-
let url = params.url;
|
|
594
|
-
let ids = context.state.ids;
|
|
595
|
-
|
|
596
|
-
return axios.delete(`${url}?ids=${ids}`, {
|
|
597
|
-
headers: new Token().tokenHeaders(),
|
|
598
|
-
})
|
|
599
|
-
.then((response) => {
|
|
600
|
-
if (response.data.success) {
|
|
601
|
-
context.commit('addMethodExecutedApi', 'deleteAllApi');
|
|
602
|
-
context.commit('addToast', 'deleteApiSucesso');
|
|
603
|
-
context.commit('removeNotificarions');
|
|
604
|
-
return response.data;
|
|
605
|
-
} else {
|
|
606
|
-
context.commit('addNotifications', response.data.notifications)
|
|
607
|
-
context.commit('addMethodExecutedApi', 'deleteAllApiErro');
|
|
608
|
-
context.commit('addToast', 'messageError');
|
|
609
|
-
return response.data;
|
|
610
|
-
}
|
|
611
|
-
|
|
612
|
-
}, (err) => {
|
|
613
|
-
if (err.response)
|
|
614
|
-
if (err.response.status === 403) {
|
|
615
|
-
context.commit('addNotifications', [{ message: "Usuário sem permissão para executar esta ação!" }])
|
|
616
|
-
context.commit('addToast', 'noPermission');
|
|
617
|
-
}
|
|
618
|
-
|
|
619
|
-
if (!err.response)
|
|
620
|
-
context.commit('addNotificationErrorApi');
|
|
621
|
-
return false;
|
|
622
|
-
})
|
|
623
|
-
},
|
|
624
|
-
deleteApi: async function (context, params) {
|
|
625
|
-
|
|
626
|
-
context.commit('cleanMethodExecutedApi');
|
|
627
|
-
let url = params.url;
|
|
628
|
-
|
|
629
|
-
return axios.delete(`${url}`, {
|
|
630
|
-
headers: new Token().tokenHeaders(),
|
|
631
|
-
})
|
|
632
|
-
.then((response) => {
|
|
633
|
-
if (response.data.success) {
|
|
634
|
-
context.commit('addMethodExecutedApi', 'deleteApi')
|
|
635
|
-
context.commit('addToast', 'deleteApiSucesso');
|
|
636
|
-
context.commit('removeNotificarions');
|
|
637
|
-
return response.data;
|
|
638
|
-
} else {
|
|
639
|
-
context.commit('addNotifications', response.data.notifications)
|
|
640
|
-
context.commit('addToast', 'messageError');
|
|
641
|
-
return response.data;
|
|
642
|
-
}
|
|
643
|
-
|
|
644
|
-
}, (err) => {
|
|
645
|
-
if (err.response)
|
|
646
|
-
if (err.response.status === 403) {
|
|
647
|
-
context.commit('addNotifications', [{ message: "Usuário sem permissão para executar esta ação!" }])
|
|
648
|
-
context.commit('addToast', 'noPermission');
|
|
649
|
-
}
|
|
650
|
-
|
|
651
|
-
if (!err.response)
|
|
652
|
-
context.commit('addNotificationErrorApi');
|
|
653
|
-
return false;
|
|
654
|
-
})
|
|
655
|
-
},
|
|
656
|
-
getFileApi: async function (context, params) {
|
|
657
|
-
context.commit('cleanMethodExecutedApi');
|
|
658
|
-
return axios.get(params.url, {
|
|
659
|
-
params: params.obj,
|
|
660
|
-
headers: new Token().tokenHeaders(),
|
|
661
|
-
responseType: "arraybuffer",
|
|
662
|
-
})
|
|
663
|
-
.then((response) => {
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
let blob = new Blob([response.data], { type: `application/${params.obj.fileType}` });
|
|
667
|
-
let url = window.URL.createObjectURL(blob);
|
|
668
|
-
|
|
669
|
-
let downloadLink = document.createElement("a");
|
|
670
|
-
downloadLink.href = url;
|
|
671
|
-
downloadLink.download = `${params.obj.fileName}`;
|
|
672
|
-
|
|
673
|
-
document.body.appendChild(downloadLink);
|
|
674
|
-
downloadLink.click();
|
|
675
|
-
|
|
676
|
-
document.body.removeChild(downloadLink);
|
|
677
|
-
|
|
678
|
-
context.commit('addMethodExecutedApi', 'getPdfApi');
|
|
679
|
-
context.commit('removeNotificarions');
|
|
680
|
-
|
|
681
|
-
}, (err) => {
|
|
682
|
-
context.commit('addNotificationErrorApi');
|
|
683
|
-
return false;
|
|
684
|
-
})
|
|
685
|
-
},
|
|
686
|
-
getFileApiWithParameterBody: async function (context, params) {
|
|
687
|
-
context.commit('cleanMethodExecutedApi');
|
|
688
|
-
return axios.post(params.url, params.obj, {
|
|
689
|
-
headers: new Token().tokenHeaders(),
|
|
690
|
-
responseType: "arraybuffer",
|
|
691
|
-
})
|
|
692
|
-
.then((response) => {
|
|
693
|
-
|
|
694
|
-
let blob = new Blob([response.data], { type: "application/pdf" });
|
|
695
|
-
let url = window.URL.createObjectURL(blob);
|
|
696
|
-
|
|
697
|
-
let downloadLink = document.createElement("a");
|
|
698
|
-
downloadLink.href = url;
|
|
699
|
-
downloadLink.download = `${params.obj.fileName}`;
|
|
700
|
-
|
|
701
|
-
document.body.appendChild(downloadLink);
|
|
702
|
-
downloadLink.click();
|
|
703
|
-
|
|
704
|
-
document.body.removeChild(downloadLink);
|
|
705
|
-
|
|
706
|
-
}, (err) => {
|
|
707
|
-
return false;
|
|
708
|
-
})
|
|
709
|
-
},
|
|
710
|
-
postFileApi: async function (context, params) {
|
|
711
|
-
context.commit('cleanMethodExecutedApi');
|
|
712
|
-
|
|
713
|
-
let formData = new FormData();
|
|
714
|
-
formData.append("file", params.file);
|
|
715
|
-
formData.append(params.container, params.container);
|
|
716
|
-
formData.append(params.name, params.name);
|
|
717
|
-
formData.append(params.accepted, params.accepted);
|
|
718
|
-
|
|
719
|
-
return axios.post(params.url, formData, {
|
|
720
|
-
headers: new Token().tokenHeaders(),
|
|
721
|
-
})
|
|
722
|
-
.then((response) => {
|
|
723
|
-
if (response.data.success) {
|
|
724
|
-
context.commit('addMethodExecutedApi', 'postFileApi');
|
|
725
|
-
context.commit('removeNotificarions');
|
|
726
|
-
return response.data;
|
|
727
|
-
} else {
|
|
728
|
-
|
|
729
|
-
context.commit('addNotifications', response.data.notifications)
|
|
730
|
-
context.commit('addToast', 'messageError');
|
|
731
|
-
|
|
732
|
-
return response.data;
|
|
733
|
-
}
|
|
734
|
-
}, (err) => {
|
|
735
|
-
if (err.response)
|
|
736
|
-
if (err.response.status === 403) {
|
|
737
|
-
context.commit('addNotifications', [{ message: "Usuário sem permissão para executar esta ação!" }])
|
|
738
|
-
context.commit('addToast', 'noPermission');
|
|
739
|
-
}
|
|
740
|
-
|
|
741
|
-
if (!err.response)
|
|
742
|
-
context.commit('addNotificationErrorApi');
|
|
743
|
-
return false;
|
|
744
|
-
})
|
|
745
|
-
},
|
|
746
|
-
deleteFileApi: async function (context, params) {
|
|
747
|
-
context.commit('cleanMethodExecutedApi');
|
|
748
|
-
|
|
749
|
-
let url = params.url;
|
|
750
|
-
let name = params.obj.name;
|
|
751
|
-
let container = params.obj.container;
|
|
752
|
-
|
|
753
|
-
return axios.delete(`${url}?name=${name}&container=${container}`, {
|
|
754
|
-
headers: new Token().tokenHeaders(),
|
|
755
|
-
})
|
|
756
|
-
.then((response) => {
|
|
757
|
-
if (response.data.success) {
|
|
758
|
-
context.commit('addMethodExecutedApi', 'deleteFileApi');
|
|
759
|
-
context.commit('removeNotificarions');
|
|
760
|
-
return response.data;
|
|
761
|
-
} else {
|
|
762
|
-
context.commit('addNotifications', response.data.notifications)
|
|
763
|
-
context.commit('addToast', 'addApiError');
|
|
764
|
-
return response.data;
|
|
765
|
-
}
|
|
766
|
-
}, (err) => {
|
|
767
|
-
if (err.response)
|
|
768
|
-
if (err.response.status === 403) {
|
|
769
|
-
context.commit('addNotifications', [{ message: "Usuário sem permissão para executar esta ação!" }])
|
|
770
|
-
context.commit('addToast', 'noPermission');
|
|
771
|
-
}
|
|
772
|
-
|
|
773
|
-
if (!err.response)
|
|
774
|
-
context.commit('addNotificationErrorApi');
|
|
775
|
-
return false;
|
|
776
|
-
})
|
|
777
|
-
},
|
|
778
|
-
getDocumentApi: async function (context, params) {
|
|
779
|
-
context.commit('cleanMethodExecutedApi');
|
|
780
|
-
return axios.get(params.url, {
|
|
781
|
-
params: params.obj,
|
|
782
|
-
headers: {
|
|
783
|
-
"Content-Type": "application/json",
|
|
784
|
-
Authorization: "Bearer " + params.obj.token
|
|
785
|
-
},
|
|
786
|
-
})
|
|
787
|
-
.then((response) => {
|
|
788
|
-
if (response.data.success) {
|
|
789
|
-
return response.data;
|
|
790
|
-
} else {
|
|
791
|
-
return response.data;
|
|
792
|
-
}
|
|
793
|
-
}, (err) => {
|
|
794
|
-
|
|
795
|
-
return false;
|
|
796
|
-
})
|
|
797
|
-
},
|
|
798
|
-
getPdfApi: async function (context, params) {
|
|
799
|
-
context.commit('cleanMethodExecutedApi');
|
|
800
|
-
return axios.get(params.url, {
|
|
801
|
-
params: params.obj,
|
|
802
|
-
responseType: "arraybuffer",
|
|
803
|
-
headers: new Token().tokenHeaders(),
|
|
804
|
-
})
|
|
805
|
-
.then((response) => {
|
|
806
|
-
|
|
807
|
-
let blob = new Blob([response.data], { type: "application/pdf" }),
|
|
808
|
-
url = window.URL.createObjectURL(blob);
|
|
809
|
-
window.open(url);
|
|
810
|
-
}, (err) => {
|
|
811
|
-
return false;
|
|
812
|
-
})
|
|
813
|
-
},
|
|
814
|
-
|
|
815
|
-
}
|
|
1
|
+
import axios from "@/config/axios";
|
|
2
|
+
import Tips from "@/config/tips";
|
|
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: [],
|
|
14
|
+
open: false
|
|
15
|
+
},
|
|
16
|
+
sideBar: {
|
|
17
|
+
name: undefined,
|
|
18
|
+
open: false
|
|
19
|
+
},
|
|
20
|
+
menuCollapsed: true,
|
|
21
|
+
notifications: [],
|
|
22
|
+
pagination: [],
|
|
23
|
+
paginations: { currentPage: 1, totalPerPage: 10 },
|
|
24
|
+
totalPerPage: { "content": "10", "id": 10 },
|
|
25
|
+
selected: [],
|
|
26
|
+
loading: [],
|
|
27
|
+
event: {
|
|
28
|
+
dateTime: undefined,
|
|
29
|
+
name: undefined,
|
|
30
|
+
data: {}
|
|
31
|
+
},
|
|
32
|
+
toast: {
|
|
33
|
+
dateTime: undefined,
|
|
34
|
+
type: undefined,
|
|
35
|
+
},
|
|
36
|
+
ids: undefined,
|
|
37
|
+
search: { content: "", filter: { content: "Contém", id: "contains" } },
|
|
38
|
+
documentHtml: "",
|
|
39
|
+
documentHtmlFinal: "",
|
|
40
|
+
selectStatic: { dateTime: undefined, tag: undefined, fieldTarget: undefined, value: undefined },
|
|
41
|
+
tags: [],
|
|
42
|
+
executedSearch: false,
|
|
43
|
+
clearedSearch: false,
|
|
44
|
+
methodExecutedApi: undefined,
|
|
45
|
+
filterStorage: [],
|
|
46
|
+
filterQuery: [],
|
|
47
|
+
filterFinal: [],
|
|
48
|
+
queryTags: [],
|
|
49
|
+
_filterStorage: [],
|
|
50
|
+
},
|
|
51
|
+
getters: {
|
|
52
|
+
tip: (state) => (tipId) => {
|
|
53
|
+
var tips = new Tips();
|
|
54
|
+
let message = "";
|
|
55
|
+
tips.help.find(value => {
|
|
56
|
+
if (value.tipId == tipId)
|
|
57
|
+
message = value.message;
|
|
58
|
+
})
|
|
59
|
+
return message;
|
|
60
|
+
},
|
|
61
|
+
showModal: (state) => (name) => {
|
|
62
|
+
if (name == state.modal.name) return true;
|
|
63
|
+
return false;
|
|
64
|
+
},
|
|
65
|
+
showVodal: (state) => (name) => {
|
|
66
|
+
return state.vodal.name.includes(name);
|
|
67
|
+
},
|
|
68
|
+
isLoading: (state) => (key) => {
|
|
69
|
+
var loading = state.loading.find(value => {
|
|
70
|
+
return value === key
|
|
71
|
+
})
|
|
72
|
+
if (loading) return true;
|
|
73
|
+
return false;
|
|
74
|
+
},
|
|
75
|
+
getFilterStorage: (state) => (key) => {
|
|
76
|
+
return state.filterStorage.find(x => x.key === key);
|
|
77
|
+
},
|
|
78
|
+
getQueryFilter: (state) => (routeName) => {
|
|
79
|
+
return state.filterQuery.find(x => x.routeName === routeName);
|
|
80
|
+
},
|
|
81
|
+
get_FilterStorage: (state) => (routeName) => {
|
|
82
|
+
return state._filterStorage.find(x => x.routeName === routeName);
|
|
83
|
+
},
|
|
84
|
+
isExistFilterQuery: (state) => (routeName, field) => {
|
|
85
|
+
var arr = state.filterFinal.find(x => x.routeName === routeName && x.field == field);
|
|
86
|
+
if (arr) return true;
|
|
87
|
+
return false;
|
|
88
|
+
},
|
|
89
|
+
paramsFilterStorage: (state) => (route, key, returnIfNull) => {
|
|
90
|
+
var filter = state.filterStorage.find(x => x.key === route);
|
|
91
|
+
|
|
92
|
+
if (filter) {
|
|
93
|
+
var obj = filter.paramsFilter.find(x => x.key === key);
|
|
94
|
+
if (obj) return obj.value;
|
|
95
|
+
return returnIfNull;
|
|
96
|
+
}
|
|
97
|
+
return returnIfNull;
|
|
98
|
+
},
|
|
99
|
+
pagination: (state) => (key) => {
|
|
100
|
+
return state.pagination.find(obj => {
|
|
101
|
+
return obj.key === key
|
|
102
|
+
})
|
|
103
|
+
},
|
|
104
|
+
event: (state) => {
|
|
105
|
+
return state.event;
|
|
106
|
+
},
|
|
107
|
+
documentPreview: (state) => (env) => {
|
|
108
|
+
let documentHtml = state.documentHtml
|
|
109
|
+
let ret = documentHtml;
|
|
110
|
+
|
|
111
|
+
var template = null;
|
|
112
|
+
|
|
113
|
+
if (env == 'dev')
|
|
114
|
+
template = document.getElementById("template-dev");
|
|
115
|
+
|
|
116
|
+
if (env == 'prod')
|
|
117
|
+
template = document.getElementById("template-prod");
|
|
118
|
+
|
|
119
|
+
if (template != null) {
|
|
120
|
+
var tables = template.getElementsByTagName("table");
|
|
121
|
+
let total = tables.length;
|
|
122
|
+
let config = [];
|
|
123
|
+
|
|
124
|
+
let index = 0;
|
|
125
|
+
while (index <= total - 1) {
|
|
126
|
+
|
|
127
|
+
let table = template.getElementsByTagName("table")[index];
|
|
128
|
+
let th = table.getElementsByTagName("th")[0];
|
|
129
|
+
|
|
130
|
+
let obj = {
|
|
131
|
+
vForGrouped: "",
|
|
132
|
+
vForSimple: "",
|
|
133
|
+
nameGroup: "",
|
|
134
|
+
nameGroupReplace: ""
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
if (th) {
|
|
138
|
+
|
|
139
|
+
let isPayment = th.innerText.includes("t.pagamentoLocacao");
|
|
140
|
+
let isPeriod = th.innerText.includes("t.periodoLocacao");
|
|
141
|
+
let isProduct = th.innerText.includes("t.produtoLocacao");
|
|
142
|
+
let isInvoice = th.innerText.includes("t.produtoFatura");
|
|
143
|
+
let isGrouped = th.innerText.includes("t.produtoAgrupado");
|
|
144
|
+
let isMoviment = th.innerText.includes("t.produtoMovimentacao");
|
|
145
|
+
let isCustumerAddress = th.innerText.includes("t.enderecoCliente");
|
|
146
|
+
let isAddressRent = th.innerText.includes("t.saidaRetornoLocacao");
|
|
147
|
+
let isTeamRent = th.innerText.includes("t.equipeLocacao");
|
|
148
|
+
let isOrderService = th.innerText.includes("t.produtoOs");
|
|
149
|
+
let isPaymentOsCustomer = th.innerText.includes("t.pagamentoCliente");
|
|
150
|
+
let isPaymentOsSupplier = th.innerText.includes("t.pagamentoFornecedor");
|
|
151
|
+
let isAttachment = th.innerText.includes("t.anexo");
|
|
152
|
+
|
|
153
|
+
if (isProduct) {
|
|
154
|
+
obj.vForSimple = "v-for='produto in d.itensLocacao'";
|
|
155
|
+
config.push(obj);
|
|
156
|
+
} else if (isInvoice) {
|
|
157
|
+
obj.vForSimple = "v-for='produto in d.itensFatura'";
|
|
158
|
+
config.push(obj);
|
|
159
|
+
} else if (isPeriod) {
|
|
160
|
+
obj.vForSimple = "v-for='periodo in d.periodoLocacao'";
|
|
161
|
+
config.push(obj);
|
|
162
|
+
} else if (isPayment) {
|
|
163
|
+
obj.vForSimple = "v-for='pagamento in d.pagamentoLocacao'";
|
|
164
|
+
config.push(obj);
|
|
165
|
+
} else if (isTeamRent) {
|
|
166
|
+
obj.vForSimple = "v-for='equipe in d.equipeLocacao'";
|
|
167
|
+
config.push(obj);
|
|
168
|
+
} else if (isOrderService) {
|
|
169
|
+
obj.vForSimple = "v-for='produto in d.itensOs'";
|
|
170
|
+
config.push(obj);
|
|
171
|
+
} else if (isPaymentOsCustomer) {
|
|
172
|
+
obj.vForSimple = "v-for='pagamento in d.pagamentoOsCliente'";
|
|
173
|
+
config.push(obj);
|
|
174
|
+
} else if (isPaymentOsSupplier) {
|
|
175
|
+
obj.vForSimple = "v-for='pagamento in d.pagamentoOsFornecedor'";
|
|
176
|
+
config.push(obj);
|
|
177
|
+
} else if (isGrouped) {
|
|
178
|
+
obj.vForGrouped = "v-for='(itensLocacao, grupo) in produtoAgrupado'";
|
|
179
|
+
obj.vForSimple = "v-for='produto in itensLocacao'";
|
|
180
|
+
|
|
181
|
+
// neste cenário basicamente temos que montar o <tbody> no array de agrupamento
|
|
182
|
+
|
|
183
|
+
var initIndex = documentHtml.split("<tbody>", index + 1).join("<tbody>").length;
|
|
184
|
+
var lastIndex = documentHtml.split("</tbody>", index + 1).join("</tbody>").length;
|
|
185
|
+
|
|
186
|
+
let tbody = documentHtml.substring(documentHtml.indexOf("<tbody>", initIndex), documentHtml.lastIndexOf("</tbody>", lastIndex));
|
|
187
|
+
|
|
188
|
+
let tr = tbody.substring(tbody.indexOf("<tr>"), tbody.lastIndexOf("</tr>"));
|
|
189
|
+
|
|
190
|
+
// faz o replace nameGroup para tirar o <tr/>
|
|
191
|
+
obj.nameGroup = tr.substring(0, tr.indexOf('</tr>')) + "</tr>";
|
|
192
|
+
obj.nameGroup = obj.nameGroup.replaceAll("\"", "'");
|
|
193
|
+
obj.nameGroupReplace = obj.nameGroup.replace("<tr>", "").replace("</tr>", "");
|
|
194
|
+
|
|
195
|
+
config.push(obj);
|
|
196
|
+
|
|
197
|
+
} else if (isMoviment) {
|
|
198
|
+
obj.vForSimple = "v-for='produto in d.itensMovimentacao'";
|
|
199
|
+
config.push(obj);
|
|
200
|
+
} else if (isCustumerAddress) {
|
|
201
|
+
obj.vForSimple = "v-for='endereco in d.locacao.cliente.endereco'";
|
|
202
|
+
config.push(obj);
|
|
203
|
+
} else if (isAddressRent) {
|
|
204
|
+
obj.vForSimple = "v-for='endereco in d.saidaRetorno'";
|
|
205
|
+
config.push(obj);
|
|
206
|
+
} else if (isAttachment) {
|
|
207
|
+
obj.vForSimple = "v-for='anexo in d.anexo'";
|
|
208
|
+
config.push(obj);
|
|
209
|
+
} else {
|
|
210
|
+
config.push(obj);
|
|
211
|
+
}
|
|
212
|
+
} else {
|
|
213
|
+
config.push(obj);
|
|
214
|
+
}
|
|
215
|
+
index++;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
let replace = "";
|
|
219
|
+
config.forEach(x => {
|
|
220
|
+
replace += `.replace("<tbody>${x.nameGroup}<tr>", "<tbody ${x.vForGrouped}>${x.nameGroupReplace}<tr ${x.vForSimple}>")`;
|
|
221
|
+
});
|
|
222
|
+
|
|
223
|
+
var retParse = ret.replaceAll("\"", "'");
|
|
224
|
+
retParse = eval(`retParse${replace}`);
|
|
225
|
+
|
|
226
|
+
var classImportant = retParse
|
|
227
|
+
.replaceAll("t.pagamentoLocacao", "")
|
|
228
|
+
.replaceAll("t.periodoLocacao", "")
|
|
229
|
+
.replaceAll("t.produtoLocacao", "")
|
|
230
|
+
.replaceAll("t.produtoFatura", "")
|
|
231
|
+
.replaceAll("t.produtoAgrupado", "")
|
|
232
|
+
.replaceAll("t.produtoMovimentacao", "")
|
|
233
|
+
.replaceAll("t.enderecoCliente", "")
|
|
234
|
+
.replaceAll("t.saidaRetornoLocacao", "")
|
|
235
|
+
.replaceAll("t.equipeLocacao", "")
|
|
236
|
+
.replaceAll("t.produtoOs", "")
|
|
237
|
+
.replaceAll("t.pagamentoCliente", "")
|
|
238
|
+
.replaceAll("t.pagamentoFornecedor", "")
|
|
239
|
+
.replaceAll("t.anexo", "")
|
|
240
|
+
.replaceAll("<p> !important;</p>", "<p> </p>");
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
return classImportant;
|
|
244
|
+
},
|
|
245
|
+
groupBy: () => (obj) => {
|
|
246
|
+
const result = {};
|
|
247
|
+
obj.array.forEach((item) => {
|
|
248
|
+
if (!result[item[obj.key]]) {
|
|
249
|
+
result[item[obj.key]] = [];
|
|
250
|
+
}
|
|
251
|
+
result[item[obj.key]].push(item);
|
|
252
|
+
});
|
|
253
|
+
return result;
|
|
254
|
+
},
|
|
255
|
+
listIdToString: () => (listId) => {
|
|
256
|
+
var ids = "";
|
|
257
|
+
listId.forEach(function (id) {
|
|
258
|
+
ids += `${id},`;
|
|
259
|
+
});
|
|
260
|
+
return ids;
|
|
261
|
+
},
|
|
262
|
+
},
|
|
263
|
+
mutations: {
|
|
264
|
+
openModal: (state, name) => {
|
|
265
|
+
state.modal.name = name;
|
|
266
|
+
state.modal.open = true;
|
|
267
|
+
},
|
|
268
|
+
toggleMenu: (state, data) => {
|
|
269
|
+
state.menuCollapsed = data;
|
|
270
|
+
},
|
|
271
|
+
hideModal: (state) => {
|
|
272
|
+
state.modal.open = false;
|
|
273
|
+
},
|
|
274
|
+
openSideBar: (state, name) => {
|
|
275
|
+
state.sideBar.name = name;
|
|
276
|
+
state.sideBar.open = true;
|
|
277
|
+
},
|
|
278
|
+
hideSideBar: (state) => {
|
|
279
|
+
state.sideBar.open = false;
|
|
280
|
+
},
|
|
281
|
+
openVodal: (state, name) => {
|
|
282
|
+
state.vodal.name.push(name);
|
|
283
|
+
state.vodal.open = true;
|
|
284
|
+
},
|
|
285
|
+
hideVodal: (state, name) => {
|
|
286
|
+
let filter = state.vodal.name.filter(x => x != name);
|
|
287
|
+
state.vodal.name = filter;
|
|
288
|
+
state.vodal.open = false;
|
|
289
|
+
},
|
|
290
|
+
updateSearch: (state, value) => {
|
|
291
|
+
state.search = value;
|
|
292
|
+
},
|
|
293
|
+
executedSearch: (state) => {
|
|
294
|
+
state.executedSearch = state.executedSearch = !state.executedSearch
|
|
295
|
+
},
|
|
296
|
+
clearedSearch: (state) => {
|
|
297
|
+
state.clearedSearch = state.clearedSearch = !state.clearedSearch
|
|
298
|
+
},
|
|
299
|
+
updateCurrentPage: (state, value) => {
|
|
300
|
+
state.paginations.currentPage = value;
|
|
301
|
+
},
|
|
302
|
+
updateTotalPerPage: (state, value) => {
|
|
303
|
+
state.paginations.totalPerPage = value.id;
|
|
304
|
+
},
|
|
305
|
+
updateDocumentHtmlFinal: (state, html) => {
|
|
306
|
+
state.documentHtmlFinal = html;
|
|
307
|
+
},
|
|
308
|
+
addSelected: (state, selected) => {
|
|
309
|
+
state.selected = selected;
|
|
310
|
+
},
|
|
311
|
+
cleanSelected: (state) => {
|
|
312
|
+
setTimeout(function () {
|
|
313
|
+
state.selected = [];
|
|
314
|
+
}, 100);
|
|
315
|
+
},
|
|
316
|
+
addToast: (state, action) => {
|
|
317
|
+
state.toast.dateTime = new Date();
|
|
318
|
+
state.toast.type = action;
|
|
319
|
+
},
|
|
320
|
+
addMethodExecutedApi: (state, action) => {
|
|
321
|
+
setTimeout(function () {
|
|
322
|
+
state.methodExecutedApi = action;
|
|
323
|
+
}, 100);
|
|
324
|
+
},
|
|
325
|
+
cleanMethodExecutedApi: (state) => {
|
|
326
|
+
setTimeout(function () {
|
|
327
|
+
state.methodExecutedApi = "";
|
|
328
|
+
}, 100);
|
|
329
|
+
},
|
|
330
|
+
addLoading: (state, key) => {
|
|
331
|
+
state.loading.push(key);
|
|
332
|
+
},
|
|
333
|
+
removeLoading: (state, listKey) => {
|
|
334
|
+
listKey.forEach(function (key) {
|
|
335
|
+
let filter = state.loading.filter(function (item) {
|
|
336
|
+
return item != key;
|
|
337
|
+
});
|
|
338
|
+
state.loading = filter;
|
|
339
|
+
});
|
|
340
|
+
},
|
|
341
|
+
updateDocumentHtml: (state, value) => {
|
|
342
|
+
state.documentHtml = value;
|
|
343
|
+
},
|
|
344
|
+
addEvent: (state, obj) => {
|
|
345
|
+
setTimeout(function () {
|
|
346
|
+
state.event.dateTime = new Date();
|
|
347
|
+
state.event.name = obj.name;
|
|
348
|
+
state.event.data = obj.data;
|
|
349
|
+
}, 100);
|
|
350
|
+
},
|
|
351
|
+
removeEvent: (state) => {
|
|
352
|
+
state.event = {};
|
|
353
|
+
},
|
|
354
|
+
addNotifications: (state, notifications) => {
|
|
355
|
+
state.notifications = notifications;
|
|
356
|
+
},
|
|
357
|
+
removeNotificarions: (state) => {
|
|
358
|
+
state.notifications = [];
|
|
359
|
+
},
|
|
360
|
+
addNotificationErrorApi: (state) => {
|
|
361
|
+
var erro = { property: "ERRO API", message: "Falha de Comunicação!" };
|
|
362
|
+
state.notifications = [erro];
|
|
363
|
+
},
|
|
364
|
+
listIdToString: (state, listId) => {
|
|
365
|
+
state.ids = "";
|
|
366
|
+
listId.forEach(function (id) {
|
|
367
|
+
state.ids += `${id},`;
|
|
368
|
+
});
|
|
369
|
+
},
|
|
370
|
+
addFilter: (state, obj) => {
|
|
371
|
+
setTimeout(function () {
|
|
372
|
+
state.selectStatic.dateTime = new Date();
|
|
373
|
+
state.selectStatic.tag = obj.tag;
|
|
374
|
+
state.selectStatic.fieldTarget = obj.fieldTarget;
|
|
375
|
+
state.selectStatic.value = obj.value;
|
|
376
|
+
}, 100);
|
|
377
|
+
},
|
|
378
|
+
addTag: (state, tag) => {
|
|
379
|
+
state.tags.push(tag);
|
|
380
|
+
},
|
|
381
|
+
removeTag: (state, key) => {
|
|
382
|
+
let filter = state.tags.filter(x => x.key != key);
|
|
383
|
+
state.tags = filter;
|
|
384
|
+
},
|
|
385
|
+
cleanTags: (state) => {
|
|
386
|
+
state.tags = []
|
|
387
|
+
},
|
|
388
|
+
openModal: (state, name) => {
|
|
389
|
+
state.modal.name = name;
|
|
390
|
+
state.modal.open = true;
|
|
391
|
+
},
|
|
392
|
+
addFilterStorage: (state, obj) => {
|
|
393
|
+
const index = state.filterStorage.findIndex(x => x.key === obj.key);
|
|
394
|
+
if (index !== -1) {
|
|
395
|
+
state.filterStorage[index] = obj;
|
|
396
|
+
|
|
397
|
+
} else {
|
|
398
|
+
state.filterStorage.push(obj);
|
|
399
|
+
}
|
|
400
|
+
},
|
|
401
|
+
removeFilterStorage: (state, key) => {
|
|
402
|
+
let filter = state.filterStorage.filter(x => x.key != key);
|
|
403
|
+
state.filterStorage = filter;
|
|
404
|
+
},
|
|
405
|
+
addFilterQuery: (state, obj) => {
|
|
406
|
+
// função abaixo é para não deixar duplicidade
|
|
407
|
+
const index = state.filterQuery.findIndex(x => x.routeName === obj.routeName);
|
|
408
|
+
if (index !== -1) {
|
|
409
|
+
state.filterQuery[index] = obj;
|
|
410
|
+
|
|
411
|
+
} else {
|
|
412
|
+
state.filterQuery.push(obj);
|
|
413
|
+
}
|
|
414
|
+
},
|
|
415
|
+
updateFilterFinal: (state, filterFinal) => {
|
|
416
|
+
state.filterFinal = filterFinal;
|
|
417
|
+
},
|
|
418
|
+
updateQueryTags: (state, tags) => {
|
|
419
|
+
state.queryTags = tags;
|
|
420
|
+
},
|
|
421
|
+
_addFilterStorage: (state, obj) => { // está com _addFilterStorage para não ter duplicidade
|
|
422
|
+
// função abaixo é para não deixar duplicidade
|
|
423
|
+
const index = state._filterStorage.findIndex(x => x.routeName === obj.routeName);
|
|
424
|
+
if (index !== -1) {
|
|
425
|
+
state._filterStorage[index] = obj;
|
|
426
|
+
|
|
427
|
+
} else {
|
|
428
|
+
state._filterStorage.push(obj);
|
|
429
|
+
}
|
|
430
|
+
},
|
|
431
|
+
},
|
|
432
|
+
actions: {
|
|
433
|
+
postApi: async function (context, params) {
|
|
434
|
+
context.commit('cleanMethodExecutedApi');
|
|
435
|
+
return axios.post(params.url, params.obj, {
|
|
436
|
+
headers: new Token().tokenHeaders(),
|
|
437
|
+
})
|
|
438
|
+
.then((response) => {
|
|
439
|
+
|
|
440
|
+
if (response.data.success) {
|
|
441
|
+
context.commit('addMethodExecutedApi', 'postApi');
|
|
442
|
+
|
|
443
|
+
if (!params.notNotifyToast)
|
|
444
|
+
context.commit('addToast', 'postApi');
|
|
445
|
+
|
|
446
|
+
context.commit('removeNotificarions');
|
|
447
|
+
|
|
448
|
+
if (!params.notRemoveFormDirty)
|
|
449
|
+
context.commit('validation/removeFormDirty', null, { root: true });
|
|
450
|
+
|
|
451
|
+
return response.data;
|
|
452
|
+
} else {
|
|
453
|
+
|
|
454
|
+
context.commit('addNotifications', response.data.notifications)
|
|
455
|
+
context.commit('addToast', 'messageError');
|
|
456
|
+
|
|
457
|
+
return response.data;
|
|
458
|
+
}
|
|
459
|
+
}, (err) => {
|
|
460
|
+
|
|
461
|
+
if (err.response)
|
|
462
|
+
if (err.response.status === 403) {
|
|
463
|
+
context.commit('addNotifications', [{ message: "Usuário sem permissão para executar esta ação!" }])
|
|
464
|
+
context.commit('addToast', 'noPermission');
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
if (!err.response)
|
|
468
|
+
context.commit('addNotificationErrorApi');
|
|
469
|
+
return false;
|
|
470
|
+
})
|
|
471
|
+
},
|
|
472
|
+
putApi: async function (context, params) {
|
|
473
|
+
context.commit('cleanMethodExecutedApi');
|
|
474
|
+
return axios.put(params.url, params.obj, {
|
|
475
|
+
headers: new Token().tokenHeaders(),
|
|
476
|
+
})
|
|
477
|
+
.then((response) => {
|
|
478
|
+
if (response.data.success) {
|
|
479
|
+
context.commit('addMethodExecutedApi', 'putApi');
|
|
480
|
+
|
|
481
|
+
if (!params.notNotifyToast)
|
|
482
|
+
context.commit('addToast', 'putApi');
|
|
483
|
+
|
|
484
|
+
context.commit('removeNotificarions');
|
|
485
|
+
context.commit('validation/removeFormDirty', null, { root: true });
|
|
486
|
+
return response.data;
|
|
487
|
+
} else {
|
|
488
|
+
context.commit('addNotifications', response.data.notifications)
|
|
489
|
+
context.commit('addToast', 'messageError');
|
|
490
|
+
return response.data;
|
|
491
|
+
}
|
|
492
|
+
}, (err) => {
|
|
493
|
+
if (err.response)
|
|
494
|
+
if (err.response.status === 403) {
|
|
495
|
+
context.commit('addNotifications', [{ message: "Usuário sem permissão para executar esta ação!" }])
|
|
496
|
+
context.commit('addToast', 'noPermission');
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
if (!err.response)
|
|
500
|
+
context.commit('addNotificationErrorApi');
|
|
501
|
+
|
|
502
|
+
return false;
|
|
503
|
+
})
|
|
504
|
+
},
|
|
505
|
+
getApi: async function (context, params) {
|
|
506
|
+
|
|
507
|
+
context.commit('cleanMethodExecutedApi');
|
|
508
|
+
return axios.get(params.url, {
|
|
509
|
+
params: params.obj,
|
|
510
|
+
headers: new Token().tokenHeaders(),
|
|
511
|
+
})
|
|
512
|
+
.then((response) => {
|
|
513
|
+
|
|
514
|
+
if (response.data.success) {
|
|
515
|
+
context.commit('addMethodExecutedApi', params.methodExecutedApi);
|
|
516
|
+
context.commit('removeNotificarions');
|
|
517
|
+
return response.data;
|
|
518
|
+
} else {
|
|
519
|
+
|
|
520
|
+
context.commit('addNotifications', response.data.notifications)
|
|
521
|
+
context.commit('addToast', 'falhaGenerica');
|
|
522
|
+
return response.data;
|
|
523
|
+
}
|
|
524
|
+
}, (err) => {
|
|
525
|
+
context.commit('addNotificationErrorApi');
|
|
526
|
+
return false;
|
|
527
|
+
})
|
|
528
|
+
},
|
|
529
|
+
orderAllApi: async function (context, params) {
|
|
530
|
+
return axios.put(params.url, params.obj, {
|
|
531
|
+
headers: new Token().tokenHeaders(),
|
|
532
|
+
})
|
|
533
|
+
.then((response) => {
|
|
534
|
+
return response.data;
|
|
535
|
+
}, (err) => {
|
|
536
|
+
context.commit('addNotificationErrorApi');
|
|
537
|
+
return false;
|
|
538
|
+
})
|
|
539
|
+
},
|
|
540
|
+
getApiOdata: async function (context, params) {
|
|
541
|
+
return axios.get(params.url, {
|
|
542
|
+
headers: new Token().tokenHeaders(),
|
|
543
|
+
})
|
|
544
|
+
.then((response) => {
|
|
545
|
+
return response.data;
|
|
546
|
+
}, (err) => {
|
|
547
|
+
context.commit('addNotificationErrorApi');
|
|
548
|
+
return false;
|
|
549
|
+
})
|
|
550
|
+
},
|
|
551
|
+
putAllApi: async function (context, params) {
|
|
552
|
+
|
|
553
|
+
context.commit('cleanMethodExecutedApi');
|
|
554
|
+
context.commit('listIdToString', params.selected);
|
|
555
|
+
|
|
556
|
+
let ids = context.state.ids;
|
|
557
|
+
|
|
558
|
+
return axios.put(params.url, { ids: ids }, {
|
|
559
|
+
headers: new Token().tokenHeaders(),
|
|
560
|
+
})
|
|
561
|
+
.then((response) => {
|
|
562
|
+
if (response.data.success) {
|
|
563
|
+
context.commit('addMethodExecutedApi', 'putApi');
|
|
564
|
+
context.commit('addToast', 'putAllApi');
|
|
565
|
+
context.commit('removeNotificarions');
|
|
566
|
+
context.commit('cleanSelected', 'putApi');
|
|
567
|
+
|
|
568
|
+
return response.data;
|
|
569
|
+
} else {
|
|
570
|
+
context.commit('addNotifications', response.data.notifications)
|
|
571
|
+
context.commit('addMethodExecutedApi', 'putApiErro');
|
|
572
|
+
context.commit('addToast', 'messageError');
|
|
573
|
+
return response.data;
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
}, (err) => {
|
|
577
|
+
if (err.response)
|
|
578
|
+
if (err.response.status === 403) {
|
|
579
|
+
context.commit('addNotifications', [{ message: "Usuário sem permissão para executar esta ação!" }])
|
|
580
|
+
context.commit('addToast', 'noPermission');
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
if (!err.response)
|
|
584
|
+
context.commit('addNotificationErrorApi');
|
|
585
|
+
return false;
|
|
586
|
+
})
|
|
587
|
+
},
|
|
588
|
+
deleteAllApi: async function (context, params) {
|
|
589
|
+
|
|
590
|
+
context.commit('cleanMethodExecutedApi');
|
|
591
|
+
context.commit('listIdToString', params.selected);
|
|
592
|
+
|
|
593
|
+
let url = params.url;
|
|
594
|
+
let ids = context.state.ids;
|
|
595
|
+
|
|
596
|
+
return axios.delete(`${url}?ids=${ids}`, {
|
|
597
|
+
headers: new Token().tokenHeaders(),
|
|
598
|
+
})
|
|
599
|
+
.then((response) => {
|
|
600
|
+
if (response.data.success) {
|
|
601
|
+
context.commit('addMethodExecutedApi', 'deleteAllApi');
|
|
602
|
+
context.commit('addToast', 'deleteApiSucesso');
|
|
603
|
+
context.commit('removeNotificarions');
|
|
604
|
+
return response.data;
|
|
605
|
+
} else {
|
|
606
|
+
context.commit('addNotifications', response.data.notifications)
|
|
607
|
+
context.commit('addMethodExecutedApi', 'deleteAllApiErro');
|
|
608
|
+
context.commit('addToast', 'messageError');
|
|
609
|
+
return response.data;
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
}, (err) => {
|
|
613
|
+
if (err.response)
|
|
614
|
+
if (err.response.status === 403) {
|
|
615
|
+
context.commit('addNotifications', [{ message: "Usuário sem permissão para executar esta ação!" }])
|
|
616
|
+
context.commit('addToast', 'noPermission');
|
|
617
|
+
}
|
|
618
|
+
|
|
619
|
+
if (!err.response)
|
|
620
|
+
context.commit('addNotificationErrorApi');
|
|
621
|
+
return false;
|
|
622
|
+
})
|
|
623
|
+
},
|
|
624
|
+
deleteApi: async function (context, params) {
|
|
625
|
+
|
|
626
|
+
context.commit('cleanMethodExecutedApi');
|
|
627
|
+
let url = params.url;
|
|
628
|
+
|
|
629
|
+
return axios.delete(`${url}`, {
|
|
630
|
+
headers: new Token().tokenHeaders(),
|
|
631
|
+
})
|
|
632
|
+
.then((response) => {
|
|
633
|
+
if (response.data.success) {
|
|
634
|
+
context.commit('addMethodExecutedApi', 'deleteApi')
|
|
635
|
+
context.commit('addToast', 'deleteApiSucesso');
|
|
636
|
+
context.commit('removeNotificarions');
|
|
637
|
+
return response.data;
|
|
638
|
+
} else {
|
|
639
|
+
context.commit('addNotifications', response.data.notifications)
|
|
640
|
+
context.commit('addToast', 'messageError');
|
|
641
|
+
return response.data;
|
|
642
|
+
}
|
|
643
|
+
|
|
644
|
+
}, (err) => {
|
|
645
|
+
if (err.response)
|
|
646
|
+
if (err.response.status === 403) {
|
|
647
|
+
context.commit('addNotifications', [{ message: "Usuário sem permissão para executar esta ação!" }])
|
|
648
|
+
context.commit('addToast', 'noPermission');
|
|
649
|
+
}
|
|
650
|
+
|
|
651
|
+
if (!err.response)
|
|
652
|
+
context.commit('addNotificationErrorApi');
|
|
653
|
+
return false;
|
|
654
|
+
})
|
|
655
|
+
},
|
|
656
|
+
getFileApi: async function (context, params) {
|
|
657
|
+
context.commit('cleanMethodExecutedApi');
|
|
658
|
+
return axios.get(params.url, {
|
|
659
|
+
params: params.obj,
|
|
660
|
+
headers: new Token().tokenHeaders(),
|
|
661
|
+
responseType: "arraybuffer",
|
|
662
|
+
})
|
|
663
|
+
.then((response) => {
|
|
664
|
+
|
|
665
|
+
|
|
666
|
+
let blob = new Blob([response.data], { type: `application/${params.obj.fileType}` });
|
|
667
|
+
let url = window.URL.createObjectURL(blob);
|
|
668
|
+
|
|
669
|
+
let downloadLink = document.createElement("a");
|
|
670
|
+
downloadLink.href = url;
|
|
671
|
+
downloadLink.download = `${params.obj.fileName}`;
|
|
672
|
+
|
|
673
|
+
document.body.appendChild(downloadLink);
|
|
674
|
+
downloadLink.click();
|
|
675
|
+
|
|
676
|
+
document.body.removeChild(downloadLink);
|
|
677
|
+
|
|
678
|
+
context.commit('addMethodExecutedApi', 'getPdfApi');
|
|
679
|
+
context.commit('removeNotificarions');
|
|
680
|
+
|
|
681
|
+
}, (err) => {
|
|
682
|
+
context.commit('addNotificationErrorApi');
|
|
683
|
+
return false;
|
|
684
|
+
})
|
|
685
|
+
},
|
|
686
|
+
getFileApiWithParameterBody: async function (context, params) {
|
|
687
|
+
context.commit('cleanMethodExecutedApi');
|
|
688
|
+
return axios.post(params.url, params.obj, {
|
|
689
|
+
headers: new Token().tokenHeaders(),
|
|
690
|
+
responseType: "arraybuffer",
|
|
691
|
+
})
|
|
692
|
+
.then((response) => {
|
|
693
|
+
|
|
694
|
+
let blob = new Blob([response.data], { type: "application/pdf" });
|
|
695
|
+
let url = window.URL.createObjectURL(blob);
|
|
696
|
+
|
|
697
|
+
let downloadLink = document.createElement("a");
|
|
698
|
+
downloadLink.href = url;
|
|
699
|
+
downloadLink.download = `${params.obj.fileName}`;
|
|
700
|
+
|
|
701
|
+
document.body.appendChild(downloadLink);
|
|
702
|
+
downloadLink.click();
|
|
703
|
+
|
|
704
|
+
document.body.removeChild(downloadLink);
|
|
705
|
+
|
|
706
|
+
}, (err) => {
|
|
707
|
+
return false;
|
|
708
|
+
})
|
|
709
|
+
},
|
|
710
|
+
postFileApi: async function (context, params) {
|
|
711
|
+
context.commit('cleanMethodExecutedApi');
|
|
712
|
+
|
|
713
|
+
let formData = new FormData();
|
|
714
|
+
formData.append("file", params.file);
|
|
715
|
+
formData.append(params.container, params.container);
|
|
716
|
+
formData.append(params.name, params.name);
|
|
717
|
+
formData.append(params.accepted, params.accepted);
|
|
718
|
+
|
|
719
|
+
return axios.post(params.url, formData, {
|
|
720
|
+
headers: new Token().tokenHeaders(),
|
|
721
|
+
})
|
|
722
|
+
.then((response) => {
|
|
723
|
+
if (response.data.success) {
|
|
724
|
+
context.commit('addMethodExecutedApi', 'postFileApi');
|
|
725
|
+
context.commit('removeNotificarions');
|
|
726
|
+
return response.data;
|
|
727
|
+
} else {
|
|
728
|
+
|
|
729
|
+
context.commit('addNotifications', response.data.notifications)
|
|
730
|
+
context.commit('addToast', 'messageError');
|
|
731
|
+
|
|
732
|
+
return response.data;
|
|
733
|
+
}
|
|
734
|
+
}, (err) => {
|
|
735
|
+
if (err.response)
|
|
736
|
+
if (err.response.status === 403) {
|
|
737
|
+
context.commit('addNotifications', [{ message: "Usuário sem permissão para executar esta ação!" }])
|
|
738
|
+
context.commit('addToast', 'noPermission');
|
|
739
|
+
}
|
|
740
|
+
|
|
741
|
+
if (!err.response)
|
|
742
|
+
context.commit('addNotificationErrorApi');
|
|
743
|
+
return false;
|
|
744
|
+
})
|
|
745
|
+
},
|
|
746
|
+
deleteFileApi: async function (context, params) {
|
|
747
|
+
context.commit('cleanMethodExecutedApi');
|
|
748
|
+
|
|
749
|
+
let url = params.url;
|
|
750
|
+
let name = params.obj.name;
|
|
751
|
+
let container = params.obj.container;
|
|
752
|
+
|
|
753
|
+
return axios.delete(`${url}?name=${name}&container=${container}`, {
|
|
754
|
+
headers: new Token().tokenHeaders(),
|
|
755
|
+
})
|
|
756
|
+
.then((response) => {
|
|
757
|
+
if (response.data.success) {
|
|
758
|
+
context.commit('addMethodExecutedApi', 'deleteFileApi');
|
|
759
|
+
context.commit('removeNotificarions');
|
|
760
|
+
return response.data;
|
|
761
|
+
} else {
|
|
762
|
+
context.commit('addNotifications', response.data.notifications)
|
|
763
|
+
context.commit('addToast', 'addApiError');
|
|
764
|
+
return response.data;
|
|
765
|
+
}
|
|
766
|
+
}, (err) => {
|
|
767
|
+
if (err.response)
|
|
768
|
+
if (err.response.status === 403) {
|
|
769
|
+
context.commit('addNotifications', [{ message: "Usuário sem permissão para executar esta ação!" }])
|
|
770
|
+
context.commit('addToast', 'noPermission');
|
|
771
|
+
}
|
|
772
|
+
|
|
773
|
+
if (!err.response)
|
|
774
|
+
context.commit('addNotificationErrorApi');
|
|
775
|
+
return false;
|
|
776
|
+
})
|
|
777
|
+
},
|
|
778
|
+
getDocumentApi: async function (context, params) {
|
|
779
|
+
context.commit('cleanMethodExecutedApi');
|
|
780
|
+
return axios.get(params.url, {
|
|
781
|
+
params: params.obj,
|
|
782
|
+
headers: {
|
|
783
|
+
"Content-Type": "application/json",
|
|
784
|
+
Authorization: "Bearer " + params.obj.token
|
|
785
|
+
},
|
|
786
|
+
})
|
|
787
|
+
.then((response) => {
|
|
788
|
+
if (response.data.success) {
|
|
789
|
+
return response.data;
|
|
790
|
+
} else {
|
|
791
|
+
return response.data;
|
|
792
|
+
}
|
|
793
|
+
}, (err) => {
|
|
794
|
+
|
|
795
|
+
return false;
|
|
796
|
+
})
|
|
797
|
+
},
|
|
798
|
+
getPdfApi: async function (context, params) {
|
|
799
|
+
context.commit('cleanMethodExecutedApi');
|
|
800
|
+
return axios.get(params.url, {
|
|
801
|
+
params: params.obj,
|
|
802
|
+
responseType: "arraybuffer",
|
|
803
|
+
headers: new Token().tokenHeaders(),
|
|
804
|
+
})
|
|
805
|
+
.then((response) => {
|
|
806
|
+
|
|
807
|
+
let blob = new Blob([response.data], { type: "application/pdf" }),
|
|
808
|
+
url = window.URL.createObjectURL(blob);
|
|
809
|
+
window.open(url);
|
|
810
|
+
}, (err) => {
|
|
811
|
+
return false;
|
|
812
|
+
})
|
|
813
|
+
},
|
|
814
|
+
|
|
815
|
+
}
|
|
816
816
|
}
|