@nixweb/nixloc-ui 0.0.300 → 0.0.301
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/App.vue +13 -0
- package/src/component/forms/Button.vue +163 -0
- package/src/component/forms/ButtonFilter.vue +75 -0
- package/src/component/forms/ButtonGroup.vue +67 -0
- package/src/component/forms/ButtonSub.vue +98 -0
- package/src/component/forms/ButtonToggle.vue +77 -0
- package/src/component/forms/CheckboxGroup.vue +69 -0
- package/src/component/forms/CheckboxServer.vue +192 -0
- package/src/component/forms/CheckboxSimple.vue +60 -0
- package/src/component/forms/Color.vue +38 -0
- package/src/component/forms/DateTime.vue +170 -0
- package/src/component/forms/DateYearMonth.vue +193 -0
- package/src/component/forms/Dropdown.vue +236 -0
- package/src/component/forms/EditorHtml.vue +132 -0
- package/src/component/forms/FileUpload.vue +170 -0
- package/src/component/forms/ImageUpload.vue +214 -0
- package/src/component/forms/IncrementDecrement.vue +148 -0
- package/src/component/forms/InputAddressGoogle.vue +171 -0
- package/src/component/forms/InputCallToAction.vue +135 -0
- package/src/component/forms/InputDecimal.vue +153 -0
- package/src/component/forms/InputDecimalDiscount.vue +78 -0
- package/src/component/forms/InputNumber.vue +160 -0
- package/src/component/forms/InputPassword.vue +148 -0
- package/src/component/forms/InputTag.vue +125 -0
- package/src/component/forms/InputText.vue +174 -0
- package/src/component/forms/InputTextEdit.vue +69 -0
- package/src/component/forms/InputWhatsApp.vue +48 -0
- package/src/component/forms/Modal.vue +57 -0
- package/src/component/forms/RadioGroup.vue +91 -0
- package/src/component/forms/Select.vue +378 -0
- package/src/component/forms/SelectStatic.vue +198 -0
- package/src/component/forms/SideBar.vue +100 -0
- package/src/component/forms/Slider.vue +18 -0
- package/src/component/forms/TextArea.vue +138 -0
- package/src/component/forms/Toggle.vue +72 -0
- package/src/component/layout/Account.vue +131 -0
- package/src/component/layout/Alert.vue +88 -0
- package/src/component/layout/Badge.vue +111 -0
- package/src/component/layout/BarFloating.vue +68 -0
- package/src/component/layout/FixedBar.vue +103 -0
- package/src/component/layout/Gantt.vue +128 -0
- package/src/component/layout/Header.vue +56 -0
- package/src/component/layout/HideShow.vue +62 -0
- package/src/component/layout/IconMolded.vue +59 -0
- package/src/component/layout/LoadingFullPage.vue +27 -0
- package/src/component/layout/Menu.vue +287 -0
- package/src/component/layout/Molded.vue +30 -0
- package/src/component/layout/NewAccount.vue +136 -0
- package/src/component/layout/NewHeader.vue +60 -0
- package/src/component/layout/NewIconMolded.vue +71 -0
- package/src/component/layout/NewMenu.vue +456 -0
- package/src/component/layout/Panel.vue +185 -0
- package/src/component/layout/Popover.vue +126 -0
- package/src/component/layout/ScrollBar.vue +57 -0
- package/src/component/layout/Tab.vue +135 -0
- package/src/component/layout/Tag.vue +97 -0
- package/src/component/layout/Wizard.vue +211 -0
- package/src/component/rental/DisplayCalculatePeriod.vue +49 -0
- package/src/component/rental/DisplayPeriodRent.vue +55 -0
- package/src/component/rental/DisplayTotalization.vue +86 -0
- package/src/component/report/Fields.vue +109 -0
- package/src/component/report/Report.vue +314 -0
- package/src/component/report/ReportTable.vue +112 -0
- package/src/component/report/Totalization.vue +34 -0
- package/src/component/shared/CodeEditor.vue +128 -0
- package/src/component/shared/Collapse.vue +131 -0
- package/src/component/shared/Confirmation.vue +74 -0
- package/src/component/shared/DocumentEditor.vue +99 -0
- package/src/component/shared/DocumentPreview.vue +81 -0
- package/src/component/shared/DocumentPublic.vue +33 -0
- package/src/component/shared/ExportExcel.vue +56 -0
- package/src/component/shared/ExportPDF.vue +116 -0
- package/src/component/shared/FullCalendar.vue +174 -0
- package/src/component/shared/HeaderReport.vue +47 -0
- package/src/component/shared/HorizontalFilter.vue +64 -0
- package/src/component/shared/ListNotifications.vue +70 -0
- package/src/component/shared/Loading.vue +107 -0
- package/src/component/shared/LoadingCard.vue +65 -0
- package/src/component/shared/LoadingMoreButton.vue +23 -0
- package/src/component/shared/Messages.vue +109 -0
- package/src/component/shared/PDFViewer.vue +24 -0
- package/src/component/shared/Pagination.vue +108 -0
- package/src/component/shared/ParameterLegend.vue +169 -0
- package/src/component/shared/ProgressBar.vue +25 -0
- package/src/component/shared/QueryButton.vue +66 -0
- package/src/component/shared/Report.vue +200 -0
- package/src/component/shared/SaveCancel.vue +99 -0
- package/src/component/shared/Search.vue +174 -0
- package/src/component/shared/SelectOption.vue +162 -0
- package/src/component/shared/Table.vue +174 -0
- package/src/component/shared/TableButton.vue +36 -0
- package/src/component/shared/TableDraggable.vue +117 -0
- package/src/component/shared/TableImport.vue +93 -0
- package/src/component/shared/TableItem.vue +214 -0
- package/src/component/shared/TableTotalPerPage.vue +78 -0
- package/src/component/shared/TableTotalRecords.vue +44 -0
- package/src/component/shared/TableTotalization.vue +47 -0
- package/src/component/shared/TimeLine.vue +42 -0
- package/src/component/shared/Timer.vue +78 -0
- package/src/component/shared/Tip.vue +42 -0
- package/src/component/shared/Toast.vue +69 -0
- package/src/component/shared/ToggleTheme.vue +128 -0
- package/src/component/shared/TotalizationReport.vue +86 -0
- package/src/component/shared/VerticalFilter.vue +97 -0
- package/src/component/shared/automation/ActivitiesList.vue +44 -0
- package/src/component/shared/automation/AddRule.vue +61 -0
- package/src/component/shared/automation/AutomationBuilder.vue +27 -0
- package/src/component/shared/automation/DynamicComponentList.vue +86 -0
- package/src/component/shared/automation/SelectRule.vue +98 -0
- package/src/component/shared/automation/components/BillingByRent.vue +98 -0
- package/src/component/shared/automation/components/SendEmail.vue +94 -0
- package/src/component/shared/file-manager/FileManager.vue +391 -0
- package/src/component/shared/filter-builder/FilterBuilder.vue +221 -0
- package/src/component/shared/filter-builder/FilterQuery.vue +94 -0
- package/src/component/shared/query-builder/AddRule.vue +203 -0
- package/src/component/shared/query-builder/ConvertToOdata.js +86 -0
- package/src/component/shared/query-builder/DynamicComponent.vue +161 -0
- package/src/component/shared/query-builder/DynamicComponentList.vue +70 -0
- package/src/component/shared/query-builder/Fields.vue +93 -0
- package/src/component/shared/query-builder/QueryBuilder.vue +69 -0
- package/src/component/shared/query-builder/Rules.vue +68 -0
- package/src/component/shared/query-builder/SelectRule.vue +97 -0
- package/src/component/shared/query-builder/Tags.vue +59 -0
- package/src/component/shared/query-builder/utilities.js +22 -0
- package/src/component/signature/Payment.vue +161 -0
- package/src/component/signature/Warning.vue +76 -0
- package/src/component/template/ListViewWithDataHandler.vue +429 -0
- package/src/component/template/ReportCreateUpdate.vue +110 -0
- package/src/component/template/ViewTemplateConfiguration.vue +64 -0
- package/src/component/template/ViewTemplateDocumentView.vue +213 -0
- package/src/component/template/ViewTemplateImportFile.vue +347 -0
- package/src/component/template/ViewTemplateReportList.vue +217 -0
- package/src/component/template/ViewTemplateReportPreview.vue +432 -0
- package/src/component/template/ViewTemplateSelectOption.vue +46 -0
- package/src/component/template/ViewTemplateWithSalveCancel.vue +32 -0
- package/src/component/template/ViewTemplateWithTable.vue +62 -0
- package/src/component/template/model/Report.js +6 -0
- package/src/component/training/Course.vue +344 -0
- package/src/component/training/CourseView.vue +190 -0
- package/src/component/value-objects/Address.js +11 -0
- package/src/component/value-objects/Address.vue +157 -0
- package/src/component/value-objects/Contact.js +7 -0
- package/src/component/value-objects/Contact.vue +106 -0
- package/src/component/value-objects/Person.js +10 -0
- package/src/component/value-objects/Person.vue +129 -0
- package/src/config/axios.js +9 -0
- package/src/config/dicas.js +15 -0
- package/src/config/router.js +14 -0
- package/src/config/token.js +15 -0
- package/src/main.js +23 -0
- package/src/store/modules/automation.js +31 -0
- package/src/store/modules/generic.js +816 -0
- package/src/store/modules/report.js +278 -0
- package/src/store/modules/user.js +67 -0
- package/src/store/modules/util.js +26 -0
- package/src/store/modules/validation.js +39 -0
- package/src/store/store.js +14 -0
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<b-row>
|
|
4
|
+
<b-col sm="9">
|
|
5
|
+
<SelectStatic title="Tipo" :onlyQuery="true" :data="options" :markFormDirty="true"
|
|
6
|
+
v-model="filterSelected" />
|
|
7
|
+
</b-col>
|
|
8
|
+
</b-row>
|
|
9
|
+
<div>
|
|
10
|
+
<div v-for="item in filtersAdded">
|
|
11
|
+
<div class="molded">
|
|
12
|
+
<b-row>
|
|
13
|
+
<b-col sm="11">
|
|
14
|
+
<CheckboxGroup v-if="item.type == 'options'" :title="item.title" :options="item.options"
|
|
15
|
+
:initialValue="item.value" v-model="item.value" />
|
|
16
|
+
<div class="div-date">
|
|
17
|
+
<DateTime v-if="item.type == 'date' || item.type == 'dateRange'" :title="item.title"
|
|
18
|
+
format="DD/MM/YYYY" type="date" :range="true" :confirm="true" confirmText="Ok"
|
|
19
|
+
placeholder v-model="item.value" />
|
|
20
|
+
</div>
|
|
21
|
+
<div v-if="item.type == 'decimal'">
|
|
22
|
+
<b-row>
|
|
23
|
+
<b-col sm="6">
|
|
24
|
+
<InputDecimal title="Valor Inicial" v-model="item.valueStart" />
|
|
25
|
+
</b-col>
|
|
26
|
+
<b-col sm="6">
|
|
27
|
+
<InputDecimal title="Valor Final" v-model="item.valueEnd" />
|
|
28
|
+
</b-col>
|
|
29
|
+
</b-row>
|
|
30
|
+
</div>
|
|
31
|
+
<div v-if="item.type == 'multiOptions' || item.type == 'listOptions'">
|
|
32
|
+
<div class="div-multi-options">
|
|
33
|
+
<CheckboxServer v-if="!item.options" :title="item.title"
|
|
34
|
+
:propsParams="item.propsParams" :url="item.url" v-model="item.value" />
|
|
35
|
+
|
|
36
|
+
<CheckboxGroup v-else :title="item.title" :options="item.options"
|
|
37
|
+
:initialValue="item.value" v-model="item.value" />
|
|
38
|
+
</div>
|
|
39
|
+
</div>
|
|
40
|
+
|
|
41
|
+
<RadioGroup v-if="item.type == 'radio'" :title="item.title" :options="item.options"
|
|
42
|
+
v-model="item.value" />
|
|
43
|
+
|
|
44
|
+
<InputText v-if="item.type == 'text' || item.type == 'patrimony'" :title="item.title"
|
|
45
|
+
v-model="item.value" />
|
|
46
|
+
|
|
47
|
+
<InputNumber v-if="item.type == 'number'" :title="item.title" v-model="item.value" />
|
|
48
|
+
</b-col>
|
|
49
|
+
<b-col sm="1">
|
|
50
|
+
<div class="icon-remove" @click="removeItem(item.field)">
|
|
51
|
+
<i class="fas fa-times"></i>
|
|
52
|
+
</div>
|
|
53
|
+
</b-col>
|
|
54
|
+
</b-row>
|
|
55
|
+
</div>
|
|
56
|
+
</div>
|
|
57
|
+
</div>
|
|
58
|
+
<div class="text-center">
|
|
59
|
+
<Button _key="btnApply" title="Aplicar" backGroundColor="#017AFF" color="white" size="small"
|
|
60
|
+
:clicked="apply" />
|
|
61
|
+
</div>
|
|
62
|
+
</div>
|
|
63
|
+
</template>
|
|
64
|
+
|
|
65
|
+
<script>
|
|
66
|
+
|
|
67
|
+
import Button from "@nixweb/nixloc-ui/src/component/forms/Button";
|
|
68
|
+
import InputText from "@nixweb/nixloc-ui/src/component/forms/InputText";
|
|
69
|
+
import InputDecimal from "@nixweb/nixloc-ui/src/component/forms/InputDecimal";
|
|
70
|
+
import InputNumber from "@nixweb/nixloc-ui/src/component/forms/InputNumber";
|
|
71
|
+
import SelectStatic from "@nixweb/nixloc-ui/src/component/forms/SelectStatic";
|
|
72
|
+
import CheckboxGroup from "@nixweb/nixloc-ui/src/component/forms/CheckboxGroup";
|
|
73
|
+
import CheckboxServer from "@nixweb/nixloc-ui/src/component/forms/CheckboxServer";
|
|
74
|
+
import ScrollBar from "@nixweb/nixloc-ui/src/component/layout/ScrollBar.vue";
|
|
75
|
+
import DateTime from "@nixweb/nixloc-ui/src/component/forms/DateTime";
|
|
76
|
+
import RadioGroup from "@nixweb/nixloc-ui/src/component/forms/RadioGroup";
|
|
77
|
+
|
|
78
|
+
import { mapMutations, mapState, mapGetters } from "vuex";
|
|
79
|
+
|
|
80
|
+
export default {
|
|
81
|
+
name: "FilterBuilder",
|
|
82
|
+
props: ["filters", "value"],
|
|
83
|
+
components: { SelectStatic, Button, CheckboxGroup, CheckboxServer, InputText, InputNumber, ScrollBar, DateTime, InputDecimal, RadioGroup },
|
|
84
|
+
data() {
|
|
85
|
+
return {
|
|
86
|
+
filterSelected: {},
|
|
87
|
+
filtersAdded: [],
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
mounted() {
|
|
91
|
+
var filterStorage = this.getQueryFilter(this.$route.name);
|
|
92
|
+
if (filterStorage) {
|
|
93
|
+
this.filtersAdded = filterStorage.filtersAdded;
|
|
94
|
+
this.addEvent({ name: "stringFilter", data: this.filterFinal });
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
},
|
|
98
|
+
computed: {
|
|
99
|
+
...mapGetters("generic", ["event", "getQueryFilter"]),
|
|
100
|
+
...mapState("generic", ["filterQuery"]),
|
|
101
|
+
options() {
|
|
102
|
+
let options = [];
|
|
103
|
+
this.filters.forEach(filter => {
|
|
104
|
+
options.push(
|
|
105
|
+
{
|
|
106
|
+
id: filter.type,
|
|
107
|
+
content: filter.title,
|
|
108
|
+
listName: filter.listName,
|
|
109
|
+
field: filter.field,
|
|
110
|
+
options: filter.options,
|
|
111
|
+
title: filter.title,
|
|
112
|
+
type: filter.type,
|
|
113
|
+
url: filter.url,
|
|
114
|
+
value: filter.value,
|
|
115
|
+
required: filter.required,
|
|
116
|
+
propsParams: filter.propsParams
|
|
117
|
+
});
|
|
118
|
+
});
|
|
119
|
+
return options;
|
|
120
|
+
},
|
|
121
|
+
filterFinal() {
|
|
122
|
+
return this.filtersAdded.map(item => ({
|
|
123
|
+
routeName: this.$route.name,
|
|
124
|
+
title: item.title,
|
|
125
|
+
listName: item.listName,
|
|
126
|
+
field: item.field,
|
|
127
|
+
type: item.type,
|
|
128
|
+
originalValue: item.value,
|
|
129
|
+
required: item.required,
|
|
130
|
+
value: item.type == "decimal" ? [item.valueStart, item.valueEnd].join('<>') : Array.isArray(item.value) ? item.value.join('<>') : item.value.toString()
|
|
131
|
+
}));
|
|
132
|
+
},
|
|
133
|
+
},
|
|
134
|
+
methods: {
|
|
135
|
+
...mapMutations("generic", ["addEvent", "hideModal", "removeLoading", "addFilterQuery"]),
|
|
136
|
+
add() {
|
|
137
|
+
if (this.filterSelected.id && !this.contentExists(this.filterSelected.field)) {
|
|
138
|
+
this.filtersAdded.push(this.filterSelected);
|
|
139
|
+
this.filterSelected = { content: "", id: "" };
|
|
140
|
+
}
|
|
141
|
+
this.removeLoading(["btnAddFilter"]);
|
|
142
|
+
},
|
|
143
|
+
contentExists(field) {
|
|
144
|
+
return this.filtersAdded.some(item => item.field === field);
|
|
145
|
+
},
|
|
146
|
+
removeItem(field) {
|
|
147
|
+
this.filtersAdded = this.filtersAdded.filter(item => item.field !== field);
|
|
148
|
+
},
|
|
149
|
+
apply() {
|
|
150
|
+
this.addEvent({ name: "stringFilter", data: this.filterFinal });
|
|
151
|
+
this.hideModal();
|
|
152
|
+
this.removeLoading(["btnApply"]);
|
|
153
|
+
}
|
|
154
|
+
},
|
|
155
|
+
watch: {
|
|
156
|
+
event: {
|
|
157
|
+
handler(event) {
|
|
158
|
+
|
|
159
|
+
if (event.name == "tagFilterRemove") {
|
|
160
|
+
this.removeItem(event.data.field);
|
|
161
|
+
this.addEvent({ name: "stringFilter" });
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
if (event.name == "filterStorageRemoved") {
|
|
165
|
+
this.filtersAdded = [];
|
|
166
|
+
this.addEvent({ name: "stringFilter", data: this.filterFinal });
|
|
167
|
+
}
|
|
168
|
+
},
|
|
169
|
+
deep: true,
|
|
170
|
+
},
|
|
171
|
+
filterFinal: {
|
|
172
|
+
handler(filterFinal) {
|
|
173
|
+
this.$emit("input", filterFinal);
|
|
174
|
+
this.addFilterQuery({ routeName: this.$route.name, filtersAdded: this.filtersAdded });
|
|
175
|
+
},
|
|
176
|
+
deep: true,
|
|
177
|
+
},
|
|
178
|
+
filterSelected: {
|
|
179
|
+
handler(filterSelected) {
|
|
180
|
+
this.add();
|
|
181
|
+
},
|
|
182
|
+
deep: true,
|
|
183
|
+
},
|
|
184
|
+
},
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
</script>
|
|
189
|
+
|
|
190
|
+
<style scoped>
|
|
191
|
+
.div-btn {
|
|
192
|
+
margin-top: 38px;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
.div-date {
|
|
196
|
+
width: 300px;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
.molded {
|
|
200
|
+
border: 1px solid #e8eaed;
|
|
201
|
+
background-color: white;
|
|
202
|
+
border-radius: 8px !important;
|
|
203
|
+
padding-left: 10px;
|
|
204
|
+
padding-right: 10px;
|
|
205
|
+
padding-top: 10px;
|
|
206
|
+
margin-bottom: 10px;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
.icon-remove {
|
|
211
|
+
display: flex;
|
|
212
|
+
align-items: center;
|
|
213
|
+
justify-content: center;
|
|
214
|
+
height: 60px;
|
|
215
|
+
width: 30px;
|
|
216
|
+
cursor: pointer;
|
|
217
|
+
color: #F0134D;
|
|
218
|
+
cursor: pointer;
|
|
219
|
+
font-size: 17px;
|
|
220
|
+
}
|
|
221
|
+
</style>
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="div-main-filter">
|
|
3
|
+
<div>
|
|
4
|
+
<Button _key="btnFilter" tooltip="Aplicar Filtros" color="black" backGroundColor="#F0F0F0" title="Filtros"
|
|
5
|
+
classIcon="fa-sharp fa-solid fa-filters" size="small" :clicked="openFilter" />
|
|
6
|
+
|
|
7
|
+
<div class="side-by-side" v-for="item in tags">
|
|
8
|
+
<div class="div-tag">
|
|
9
|
+
<Tag v-if="item.value" eventName="eventName" :params="item" eventData="tag"
|
|
10
|
+
:clickedBody="openFilter" :clickedRemove="removeTag" :title="item.title" :value="item.value"
|
|
11
|
+
:tagRemoved="false" />
|
|
12
|
+
</div>
|
|
13
|
+
</div>
|
|
14
|
+
</div>
|
|
15
|
+
|
|
16
|
+
<Modal title="Filtros" :width="700" :height="750" v-show="showModal('filter')">
|
|
17
|
+
<FilterBuilder :filters="filters" v-model="filterFinal" />
|
|
18
|
+
</Modal>
|
|
19
|
+
</div>
|
|
20
|
+
</template>
|
|
21
|
+
|
|
22
|
+
<script>
|
|
23
|
+
|
|
24
|
+
import Button from "@nixweb/nixloc-ui/src/component/forms/Button";
|
|
25
|
+
import Modal from "@nixweb/nixloc-ui/src/component/forms/Modal";
|
|
26
|
+
import FilterBuilder from "./FilterBuilder.vue";
|
|
27
|
+
import Tag from "@nixweb/nixloc-ui/src/component/layout/Tag";
|
|
28
|
+
|
|
29
|
+
import { mapGetters, mapMutations } from "vuex";
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
export default {
|
|
33
|
+
name: "FilterQuery",
|
|
34
|
+
props: ["filters", "showDateYearMonth", "value"],
|
|
35
|
+
components: {
|
|
36
|
+
Button, Modal, FilterBuilder, Tag
|
|
37
|
+
},
|
|
38
|
+
data() {
|
|
39
|
+
return {
|
|
40
|
+
filterFinal: [],
|
|
41
|
+
tags: [],
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
computed: {
|
|
45
|
+
...mapGetters("generic", ["showModal", "event"]),
|
|
46
|
+
},
|
|
47
|
+
methods: {
|
|
48
|
+
...mapMutations("generic", ["openModal", "addEvent", "removeLoading", "updateQueryTags", "updateFilterFinal"]),
|
|
49
|
+
openFilter() {
|
|
50
|
+
this.openModal("filter");
|
|
51
|
+
this.removeLoading(["btnFilter"]);
|
|
52
|
+
},
|
|
53
|
+
removeTag(params) {
|
|
54
|
+
this.tags = this.tags.filter(item => item.field !== params.field);
|
|
55
|
+
this.addEvent({ name: "tagFilterRemove", data: params });
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
watch: {
|
|
59
|
+
event: {
|
|
60
|
+
handler(event) {
|
|
61
|
+
if (event.name == "stringFilter") {
|
|
62
|
+
var data = JSON.stringify(event.data);
|
|
63
|
+
this.tags = JSON.parse(data);
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
deep: true,
|
|
67
|
+
},
|
|
68
|
+
filterFinal: {
|
|
69
|
+
handler(filterFinal) {
|
|
70
|
+
this.$emit("input", filterFinal);
|
|
71
|
+
this.updateFilterFinal(filterFinal);
|
|
72
|
+
},
|
|
73
|
+
deep: true,
|
|
74
|
+
},
|
|
75
|
+
tags: {
|
|
76
|
+
handler(tags) {
|
|
77
|
+
this.updateQueryTags(tags);
|
|
78
|
+
},
|
|
79
|
+
deep: true,
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
</script>.
|
|
86
|
+
<style>
|
|
87
|
+
.div-main-filter {
|
|
88
|
+
margin-bottom: 20px;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.div-tag {
|
|
92
|
+
margin-left: 2px;
|
|
93
|
+
}
|
|
94
|
+
</style>
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<div class="vqb-group card">
|
|
4
|
+
<div class="vqb-group-body card-body">
|
|
5
|
+
<div class="rule-actions form-inline">
|
|
6
|
+
<div class="div-custom">
|
|
7
|
+
<b-row>
|
|
8
|
+
<b-col sm="6">
|
|
9
|
+
<SelectRule :options="rules" class="select" v-model="selectedRule" />
|
|
10
|
+
</b-col>
|
|
11
|
+
<b-col sm="3">
|
|
12
|
+
<div class="div-btn">
|
|
13
|
+
<i class="fa-solid fa-circle-plus" @click="add"></i>
|
|
14
|
+
</div>
|
|
15
|
+
</b-col>
|
|
16
|
+
</b-row>
|
|
17
|
+
<div class="div-and-or">
|
|
18
|
+
<b-row>
|
|
19
|
+
<b-col sm="3">
|
|
20
|
+
<RadioGroup :options="[
|
|
21
|
+
{ text: 'e', value: 'and' },
|
|
22
|
+
{ text: 'ou', value: 'or' },
|
|
23
|
+
]" v-model="andOr" />
|
|
24
|
+
</b-col>
|
|
25
|
+
</b-row>
|
|
26
|
+
</div>
|
|
27
|
+
</div>
|
|
28
|
+
</div>
|
|
29
|
+
</div>
|
|
30
|
+
</div>
|
|
31
|
+
<DynamicComponentList />
|
|
32
|
+
</div>
|
|
33
|
+
</template>
|
|
34
|
+
|
|
35
|
+
<script>
|
|
36
|
+
import SelectRule from "./SelectRule.vue";
|
|
37
|
+
import DynamicComponent from "./DynamicComponent.vue";
|
|
38
|
+
import RadioGroup from "@nixweb/nixloc-ui/src/component/forms/RadioGroup.vue";
|
|
39
|
+
import DynamicComponentList from "@nixweb/nixloc-ui/src/component/shared/query-builder/DynamicComponentList.vue";
|
|
40
|
+
|
|
41
|
+
import { mapGetters, mapMutations } from "vuex";
|
|
42
|
+
|
|
43
|
+
export default {
|
|
44
|
+
name: "AddRule",
|
|
45
|
+
components: {
|
|
46
|
+
SelectRule,
|
|
47
|
+
DynamicComponent,
|
|
48
|
+
RadioGroup,
|
|
49
|
+
DynamicComponentList,
|
|
50
|
+
},
|
|
51
|
+
props: {
|
|
52
|
+
rules: Array,
|
|
53
|
+
},
|
|
54
|
+
data() {
|
|
55
|
+
return {
|
|
56
|
+
selectedRule: this.rules[0],
|
|
57
|
+
andOr: "and",
|
|
58
|
+
duplicate: [],
|
|
59
|
+
};
|
|
60
|
+
},
|
|
61
|
+
computed: {
|
|
62
|
+
...mapGetters("generic", ["event"]),
|
|
63
|
+
},
|
|
64
|
+
methods: {
|
|
65
|
+
...mapMutations("generic", ["addNotifications"]),
|
|
66
|
+
...mapMutations("report", ["addSelectedRules"]),
|
|
67
|
+
add() {
|
|
68
|
+
this.selectedRule.andOr = this.andOr;
|
|
69
|
+
this.addRule();
|
|
70
|
+
},
|
|
71
|
+
addRule() {
|
|
72
|
+
let obj = this.mountObject();
|
|
73
|
+
|
|
74
|
+
if (!this.verifyIfExist(obj.name)) {
|
|
75
|
+
this.addSelectedRules(obj);
|
|
76
|
+
if (obj.notDuplicate) this.duplicate.push(obj);
|
|
77
|
+
} else {
|
|
78
|
+
var error = {
|
|
79
|
+
property: "ERRO QUERY BUILDER",
|
|
80
|
+
message: `Não é possível adicionar o filter ${obj.title} 2 vezes!`,
|
|
81
|
+
};
|
|
82
|
+
this.addNotifications([error]);
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
mountObject() {
|
|
86
|
+
let obj = {
|
|
87
|
+
id: this.generateId(),
|
|
88
|
+
name: this.selectedRule.name,
|
|
89
|
+
title: this.selectedRule.title,
|
|
90
|
+
typeField: this.selectedRule.typeField,
|
|
91
|
+
type: this.selectedRule.type,
|
|
92
|
+
options: this.selectedRule.options,
|
|
93
|
+
props: this.selectedRule.props,
|
|
94
|
+
classCss: this.selectedRule.classCss,
|
|
95
|
+
icon: this.selectedRule.icon,
|
|
96
|
+
operators: this.selectedRule.operators,
|
|
97
|
+
operator: null,
|
|
98
|
+
andOr: this.selectedRule.andOr,
|
|
99
|
+
isRequired: this.selectedRule.isRequired,
|
|
100
|
+
notDuplicate: this.selectedRule.notDuplicate,
|
|
101
|
+
value: null,
|
|
102
|
+
};
|
|
103
|
+
return obj;
|
|
104
|
+
},
|
|
105
|
+
generateId() {
|
|
106
|
+
return Math.random()
|
|
107
|
+
.toString(36)
|
|
108
|
+
.replace(/[^a-z]+/g, "")
|
|
109
|
+
.substr(0, 5);
|
|
110
|
+
},
|
|
111
|
+
verifyIfExist(name) {
|
|
112
|
+
var hasRule = this.duplicate.find((rule) => {
|
|
113
|
+
return rule.name === name;
|
|
114
|
+
});
|
|
115
|
+
if (hasRule) return true;
|
|
116
|
+
return false;
|
|
117
|
+
},
|
|
118
|
+
},
|
|
119
|
+
watch: {
|
|
120
|
+
event: {
|
|
121
|
+
handler(event) {
|
|
122
|
+
// se a tag ou a rule que está selecionada foi removida, é necessário remove tambem do array "duplicate" para liberar e adicionar novamente.
|
|
123
|
+
if (event.name == "tagRemoved" || event.name == "selectedRuleRemoved") {
|
|
124
|
+
var duplicate = this.duplicate.filter((item) => {
|
|
125
|
+
return item.id != event.data.id;
|
|
126
|
+
});
|
|
127
|
+
this.duplicate = duplicate;
|
|
128
|
+
}
|
|
129
|
+
},
|
|
130
|
+
deep: true,
|
|
131
|
+
},
|
|
132
|
+
},
|
|
133
|
+
};
|
|
134
|
+
</script>
|
|
135
|
+
|
|
136
|
+
<style>
|
|
137
|
+
.card {
|
|
138
|
+
border: 1px solid #e8eaed !important;
|
|
139
|
+
background-color: white !important;
|
|
140
|
+
border-radius: 8px !important;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.card-body {
|
|
144
|
+
padding: 10px;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
.title-option {
|
|
148
|
+
padding: 10px;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
.div-custom {
|
|
152
|
+
width: 100%;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
.vue-query-builder .vqb-group .rule-actions {
|
|
156
|
+
margin-bottom: 20px;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
.vue-query-builder .vqb-rule {
|
|
160
|
+
margin-top: 15px;
|
|
161
|
+
margin-bottom: 15px;
|
|
162
|
+
background-color: #f5f5f5;
|
|
163
|
+
border-color: #ddd;
|
|
164
|
+
padding: 15px;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
.vue-query-builder .vqb-group.depth-1 .vqb-rule,
|
|
168
|
+
.vue-query-builder .vqb-group.depth-2 {
|
|
169
|
+
border-left: 2px solid #8bc34a;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
.vue-query-builder .vqb-group.depth-2 .vqb-rule,
|
|
173
|
+
.vue-query-builder .vqb-group.depth-3 {
|
|
174
|
+
border-left: 2px solid #00bcd4;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
.vue-query-builder .vqb-group.depth-3 .vqb-rule,
|
|
178
|
+
.vue-query-builder .vqb-group.depth-4 {
|
|
179
|
+
border-left: 2px solid #ff5722;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
.vue-query-builder .close {
|
|
183
|
+
opacity: 1;
|
|
184
|
+
color: rgb(150, 150, 150);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
.div-btn {
|
|
188
|
+
margin-top: -3px;
|
|
189
|
+
font-size: 25px;
|
|
190
|
+
color: #577696;
|
|
191
|
+
cursor: pointer;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
.div-and-or {
|
|
195
|
+
margin-top: 10px;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
@media (min-width: 768px) {
|
|
199
|
+
.vue-query-builder .vqb-rule.form-inline .form-group {
|
|
200
|
+
display: block;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
</style>
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
export default class ConvertToOdata {
|
|
2
|
+
convertRule(rule) {
|
|
3
|
+
let operator = rule.operator;
|
|
4
|
+
|
|
5
|
+
if (operator === "igual" && rule.typeField === "text") return `${rule.name} eq '${rule.value}'`;
|
|
6
|
+
if (operator === "diferente" && rule.typeField === "text") return `${rule.name} ne '${rule.value}'`;
|
|
7
|
+
if (operator === "contem") return `contains(${rule.name},'${rule.value}')`;
|
|
8
|
+
|
|
9
|
+
if (operator === "igual" && rule.typeField === "numeric") return `${rule.name} eq ${rule.value}`;
|
|
10
|
+
if (operator === "diferente" && rule.typeField === "numeric") return `${rule.name} ne ${rule.value}`;
|
|
11
|
+
if (operator === "menor") return `${rule.name} lt ${rule.value}`;
|
|
12
|
+
if (operator === "menor ou igual") return `${rule.name} le ${rule.value}`;
|
|
13
|
+
if (operator === "maior") return `${rule.name} gt ${rule.value}`;
|
|
14
|
+
if (operator === "maior ou igual") return `${rule.name} ge ${rule.value}`;
|
|
15
|
+
|
|
16
|
+
if (rule.typeField === "dateTime") return this.convertDateTime(rule);
|
|
17
|
+
if (rule.typeField === "select") return this.convertSelect(rule.name, rule.value);
|
|
18
|
+
if (rule.typeField === "checkbox") return this.convertCheckbox(rule.name, rule.title, rule.type, rule.value);
|
|
19
|
+
|
|
20
|
+
}
|
|
21
|
+
convertDateTime(rule) {
|
|
22
|
+
let start = this.convertDate(rule.value[0]);
|
|
23
|
+
let end = this.convertDate(rule.value[1]);
|
|
24
|
+
|
|
25
|
+
if (rule.name.includes("&")) {
|
|
26
|
+
var parts = rule.name.split("&");
|
|
27
|
+
var first = parts[0];
|
|
28
|
+
var second = parts[1];
|
|
29
|
+
return `${first} ge ${start} and ${second} le ${end}`;
|
|
30
|
+
} else {
|
|
31
|
+
return `${rule.name} ge ${start} and ${rule.name} le ${end}`;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
convertSelect(name, value) {
|
|
35
|
+
return `${name} eq '${value.id}'`;
|
|
36
|
+
}
|
|
37
|
+
convertCheckbox(name, title, type, options) {
|
|
38
|
+
let query = "";
|
|
39
|
+
let seq = 0;
|
|
40
|
+
var size = options.length;
|
|
41
|
+
let self = this;
|
|
42
|
+
options.forEach(function (value) {
|
|
43
|
+
|
|
44
|
+
if (type == "field") {
|
|
45
|
+
query += `${name} eq ${value}`;
|
|
46
|
+
if (seq + 1 != size) query += ` or `;
|
|
47
|
+
}
|
|
48
|
+
if (type == "totalization") {
|
|
49
|
+
|
|
50
|
+
let field = value.split('_').pop();
|
|
51
|
+
field = field.charAt(0).toLowerCase() + field.slice(1);
|
|
52
|
+
|
|
53
|
+
query += `${field} with ${value.split('_')[0]} as ${value.replace(/_/g, '')}`;
|
|
54
|
+
if (seq + 1 != size) query += `,`;
|
|
55
|
+
}
|
|
56
|
+
seq++;
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
if (size > 1 && type == "field") return `(${query})`;
|
|
60
|
+
return `${query}`;
|
|
61
|
+
}
|
|
62
|
+
convertDate(data) {
|
|
63
|
+
// a verificação abaixo valida se tem valor, pois quando não tem está retornando um array com 3 posições em brando
|
|
64
|
+
if (data.length == 3) return;
|
|
65
|
+
|
|
66
|
+
let str = data.replace("/", "").replace("/", "");
|
|
67
|
+
|
|
68
|
+
let date = {
|
|
69
|
+
day: str.substr(0, 2),
|
|
70
|
+
month: str.substr(2, 2),
|
|
71
|
+
year: str.substr(4, 4),
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
var iso = date.year + "-" + date.month + "-" + date.day;
|
|
75
|
+
|
|
76
|
+
/*
|
|
77
|
+
iso += date.day + "T";
|
|
78
|
+
iso += "00:00:00.000Z";
|
|
79
|
+
iso += d.getHours().toString().padStart(2, "0") + ":";
|
|
80
|
+
iso += d.getMinutes().toString().padStart(2, "0") + ":";
|
|
81
|
+
iso += d.getSeconds().toString().padStart(2, "0");
|
|
82
|
+
*/
|
|
83
|
+
|
|
84
|
+
return iso;
|
|
85
|
+
}
|
|
86
|
+
}
|