@nixweb/nixloc-ui 0.0.138 → 0.0.139
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/component/shared/Report.vue +36 -5
- package/src/component/shared/TotalizationReport.vue +4 -0
- package/src/component/shared/query-builder/AddRule.vue +1 -1
- package/src/component/shared/query-builder/DynamicComponent.vue +91 -9
- package/src/component/shared/query-builder/DynamicComponentList.vue +8 -4
- package/src/component/template/ViewTemplateReportPreview.vue +16 -4
- package/src/component/template/ViewTemplateReportPreviewCOPIASEGURANCA.vue +0 -497
package/package.json
CHANGED
|
@@ -27,25 +27,33 @@
|
|
|
27
27
|
<tr v-for="(row, index) in data" :key="index" :style="row.rowCss">
|
|
28
28
|
<td v-for="(obj, ind) in header" :key="ind">
|
|
29
29
|
<div
|
|
30
|
-
:class="
|
|
30
|
+
:class="
|
|
31
|
+
convertClass(row[obj.fieldComparison], obj.classCssBody)
|
|
32
|
+
"
|
|
31
33
|
v-if="obj.type === 'text'"
|
|
32
34
|
>
|
|
33
35
|
{{ row[obj.field] }}
|
|
34
36
|
</div>
|
|
35
37
|
<div
|
|
36
|
-
:class="
|
|
38
|
+
:class="
|
|
39
|
+
convertClass(row[obj.fieldComparison], obj.classCssBody)
|
|
40
|
+
"
|
|
37
41
|
v-if="obj.type === 'date'"
|
|
38
42
|
>
|
|
39
43
|
{{ row[obj.field] | moment("DD/MM/YYYY") }}
|
|
40
44
|
</div>
|
|
41
45
|
<div
|
|
42
|
-
:class="
|
|
46
|
+
:class="
|
|
47
|
+
convertClass(row[obj.fieldComparison], obj.classCssBody)
|
|
48
|
+
"
|
|
43
49
|
v-if="obj.type === 'dateTime'"
|
|
44
50
|
>
|
|
45
51
|
{{ row[obj.field] | moment("DD/MM/YYYY HH:mm") }}
|
|
46
52
|
</div>
|
|
47
53
|
<div
|
|
48
|
-
:class="
|
|
54
|
+
:class="
|
|
55
|
+
convertClass(row[obj.fieldComparison], obj.classCssBody)
|
|
56
|
+
"
|
|
49
57
|
v-if="obj.type === 'currency'"
|
|
50
58
|
>
|
|
51
59
|
{{ row[obj.field] | currency }}
|
|
@@ -62,7 +70,10 @@
|
|
|
62
70
|
</tbody>
|
|
63
71
|
</table>
|
|
64
72
|
<div>
|
|
65
|
-
<TotalizationReport
|
|
73
|
+
<TotalizationReport
|
|
74
|
+
:totalization="totalization"
|
|
75
|
+
:totalRecords="data.length"
|
|
76
|
+
/>
|
|
66
77
|
</div>
|
|
67
78
|
</div>
|
|
68
79
|
</ScrollBar>
|
|
@@ -184,4 +195,24 @@ table tbody tr td {
|
|
|
184
195
|
.icon-excel {
|
|
185
196
|
color: green;
|
|
186
197
|
}
|
|
198
|
+
|
|
199
|
+
.danger {
|
|
200
|
+
color: #f0134d;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
.progress-rent {
|
|
204
|
+
color: #4bb4e2;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
.accepted {
|
|
208
|
+
color: #38a169;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
.rejected {
|
|
212
|
+
color: #f0134d;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
.receipt {
|
|
216
|
+
color: darkblue;
|
|
217
|
+
}
|
|
187
218
|
</style>
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
</label>
|
|
8
8
|
<div style="margin-right: 20px">
|
|
9
9
|
<RadioGroup
|
|
10
|
+
v-if="index > 0"
|
|
10
11
|
:options="[
|
|
11
12
|
{ text: 'e', value: 'and' },
|
|
12
13
|
{ text: 'ou', value: 'or' },
|
|
@@ -36,13 +37,36 @@
|
|
|
36
37
|
:initialValue="rule.value"
|
|
37
38
|
v-model="rule.value"
|
|
38
39
|
/>
|
|
39
|
-
<
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
40
|
+
<div v-if="rule.typeField == 'dateTime'">
|
|
41
|
+
<div class="side-by-side">
|
|
42
|
+
<DateTime
|
|
43
|
+
:format="rule.props.format"
|
|
44
|
+
:type="rule.props.type"
|
|
45
|
+
:range="rule.props.range"
|
|
46
|
+
v-model="rule.value"
|
|
47
|
+
/>
|
|
48
|
+
</div>
|
|
49
|
+
<div class="side-by-side margin">ou</div>
|
|
50
|
+
<div class="side-by-side margin">
|
|
51
|
+
<select
|
|
52
|
+
@change="verifyCalculate"
|
|
53
|
+
v-model="rule.value[2]"
|
|
54
|
+
class="form-control mr-2"
|
|
55
|
+
>
|
|
56
|
+
<option v-for="period in optionsPeriodCustom" :key="period">
|
|
57
|
+
{{ period }}
|
|
58
|
+
</option>
|
|
59
|
+
</select>
|
|
60
|
+
</div>
|
|
61
|
+
<div v-if="rule.props.filterByField">
|
|
62
|
+
<RadioGroup
|
|
63
|
+
v-if="rule.props.filterByField"
|
|
64
|
+
:options="rule.props.filterByField"
|
|
65
|
+
v-model="rule.name"
|
|
66
|
+
/>
|
|
67
|
+
</div>
|
|
68
|
+
</div>
|
|
69
|
+
|
|
46
70
|
<Select
|
|
47
71
|
v-if="rule.typeField == 'select'"
|
|
48
72
|
:url="rule.props.url"
|
|
@@ -61,7 +85,7 @@ import Select from "@nixweb/nixloc-ui/src/component/forms/Select";
|
|
|
61
85
|
import CheckboxGroup from "@nixweb/nixloc-ui/src/component/forms/CheckboxGroup";
|
|
62
86
|
import RadioGroup from "@nixweb/nixloc-ui/src/component/forms/RadioGroup.vue";
|
|
63
87
|
|
|
64
|
-
import { mapMutations } from "vuex";
|
|
88
|
+
import { mapMutations, mapActions } from "vuex";
|
|
65
89
|
|
|
66
90
|
export default {
|
|
67
91
|
name: "DynamicComponent",
|
|
@@ -71,10 +95,38 @@ export default {
|
|
|
71
95
|
CheckboxGroup,
|
|
72
96
|
RadioGroup,
|
|
73
97
|
},
|
|
74
|
-
props: ["rule"],
|
|
98
|
+
props: ["rule", "index"],
|
|
99
|
+
created() {
|
|
100
|
+
if (this.rule.typeField == "dateTime") {
|
|
101
|
+
if (this.rule.value == null) {
|
|
102
|
+
this.rule.value = ["", "", ""];
|
|
103
|
+
} else {
|
|
104
|
+
if (this.rule.value.length == 3) {
|
|
105
|
+
this.verifyCalculate();
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
data() {
|
|
111
|
+
return {
|
|
112
|
+
urlCalculate: "/api/v1/rental/period-rent/calculate-period-query-builder",
|
|
113
|
+
optionsPeriodCustom: [
|
|
114
|
+
"hoje",
|
|
115
|
+
"próximos 7 dias",
|
|
116
|
+
"próximos 15 dias",
|
|
117
|
+
"próximos 30 dias",
|
|
118
|
+
"próximos 45 dias",
|
|
119
|
+
"últimos 7 dias",
|
|
120
|
+
"últimos 15 dias",
|
|
121
|
+
"últimos 30 dias",
|
|
122
|
+
"últimos 45 dias",
|
|
123
|
+
],
|
|
124
|
+
};
|
|
125
|
+
},
|
|
75
126
|
methods: {
|
|
76
127
|
...mapMutations("generic", ["addEvent"]),
|
|
77
128
|
...mapMutations("report", ["removeSelectedRule"]),
|
|
129
|
+
...mapActions("generic", ["postApi"]),
|
|
78
130
|
removeRule() {
|
|
79
131
|
this.removeSelectedRule(this.rule.id);
|
|
80
132
|
this.addEvent({
|
|
@@ -82,6 +134,31 @@ export default {
|
|
|
82
134
|
data: { id: this.rule.id },
|
|
83
135
|
});
|
|
84
136
|
},
|
|
137
|
+
verifyCalculate() {
|
|
138
|
+
let title = this.rule.value[2];
|
|
139
|
+
if (title == "hoje") this.calculate(0, title);
|
|
140
|
+
if (title == "próximos 7 dias") this.calculate(7, title);
|
|
141
|
+
if (title == "próximos 15 dias") this.calculate(15, title);
|
|
142
|
+
if (title == "próximos 30 dias") this.calculate(30, title);
|
|
143
|
+
if (title == "próximos 45 dias") this.calculate(45, title);
|
|
144
|
+
if (title == "últimos 7 dias") this.calculate(-7, title);
|
|
145
|
+
if (title == "últimos 15 dias") this.calculate(-15, title);
|
|
146
|
+
if (title == "últimos 30 dias") this.calculate(-30, title);
|
|
147
|
+
if (title == "últimos 45 dias") this.calculate(-45, title);
|
|
148
|
+
},
|
|
149
|
+
calculate(days, title) {
|
|
150
|
+
let params = {
|
|
151
|
+
url: this.urlCalculate,
|
|
152
|
+
obj: { days: days },
|
|
153
|
+
notNotifyToast: true,
|
|
154
|
+
};
|
|
155
|
+
this.postApi(params).then((response) => {
|
|
156
|
+
this.rule.value = [];
|
|
157
|
+
this.rule.value[0] = response.content.start;
|
|
158
|
+
this.rule.value[1] = response.content.end;
|
|
159
|
+
this.rule.value[2] = title;
|
|
160
|
+
});
|
|
161
|
+
},
|
|
85
162
|
},
|
|
86
163
|
computed: {
|
|
87
164
|
options() {
|
|
@@ -109,4 +186,9 @@ export default {
|
|
|
109
186
|
.div-select {
|
|
110
187
|
width: 330px;
|
|
111
188
|
}
|
|
189
|
+
|
|
190
|
+
.margin {
|
|
191
|
+
margin-left: 30px;
|
|
192
|
+
padding: 10px;
|
|
193
|
+
}
|
|
112
194
|
</style>
|
|
@@ -10,11 +10,14 @@
|
|
|
10
10
|
v-for="(rule, index) in selectedRules"
|
|
11
11
|
:key="index"
|
|
12
12
|
:rule="rule"
|
|
13
|
+
:index="index"
|
|
13
14
|
/>
|
|
14
15
|
</draggable>
|
|
15
16
|
<br />
|
|
16
17
|
<div v-if="selectedRules.length == 0">
|
|
17
|
-
<Alert type="info">
|
|
18
|
+
<Alert type="info">
|
|
19
|
+
Selecione o filtro desejado e clique em +Adicionar</Alert
|
|
20
|
+
>
|
|
18
21
|
</div>
|
|
19
22
|
</div>
|
|
20
23
|
</div>
|
|
@@ -41,7 +44,8 @@ export default {
|
|
|
41
44
|
...mapState("report", ["selectedRules"]),
|
|
42
45
|
},
|
|
43
46
|
mounted() {
|
|
44
|
-
this.dynamicComponent =
|
|
47
|
+
this.dynamicComponent =
|
|
48
|
+
this.$parent.$options.components["DynamicComponent"];
|
|
45
49
|
},
|
|
46
50
|
methods: {
|
|
47
51
|
...mapMutations("report", ["mountFinalQueryFormatOData"]),
|
|
@@ -62,8 +66,8 @@ export default {
|
|
|
62
66
|
|
|
63
67
|
<style scoped>
|
|
64
68
|
.component {
|
|
65
|
-
min-height:
|
|
66
|
-
max-height:
|
|
69
|
+
min-height: 450px;
|
|
70
|
+
max-height: 450px;
|
|
67
71
|
overflow-y: visible;
|
|
68
72
|
overflow-x: hidden;
|
|
69
73
|
padding-left: 10px;
|
|
@@ -9,7 +9,10 @@
|
|
|
9
9
|
>
|
|
10
10
|
<div slot="content-main">
|
|
11
11
|
<br />
|
|
12
|
-
<div
|
|
12
|
+
<div
|
|
13
|
+
class="div-progress"
|
|
14
|
+
v-if="liveTotalRecords != baseParams.totalRecords"
|
|
15
|
+
>
|
|
13
16
|
<ProgressBar
|
|
14
17
|
:text="`Carregando ${liveTotalRecords} registro(s) de ${baseParams.totalRecords}`"
|
|
15
18
|
:value="liveTotalRecords"
|
|
@@ -96,7 +99,10 @@
|
|
|
96
99
|
:width="modalOptions.width"
|
|
97
100
|
v-show="showModal('templateReport')"
|
|
98
101
|
>
|
|
99
|
-
<ReportCreateUpdate
|
|
102
|
+
<ReportCreateUpdate
|
|
103
|
+
:module="panel.module"
|
|
104
|
+
v-show="modalOptions.name == 'save'"
|
|
105
|
+
/>
|
|
100
106
|
<Fields v-if="modalOptions.name == 'fields'" />
|
|
101
107
|
<Rules v-show="modalOptions.name == 'rules'" />
|
|
102
108
|
<div
|
|
@@ -201,7 +207,12 @@ export default {
|
|
|
201
207
|
"addInitialReportCustom",
|
|
202
208
|
"removeInitialReportCustom",
|
|
203
209
|
]),
|
|
204
|
-
...mapMutations("generic", [
|
|
210
|
+
...mapMutations("generic", [
|
|
211
|
+
"addEvent",
|
|
212
|
+
"openModal",
|
|
213
|
+
"hideModal",
|
|
214
|
+
"removeLoading",
|
|
215
|
+
]),
|
|
205
216
|
getById() {
|
|
206
217
|
let params = { url: this.urlGetById, obj: { id: this.id } };
|
|
207
218
|
this.getApi(params).then((response) => {
|
|
@@ -238,7 +249,8 @@ export default {
|
|
|
238
249
|
totalRecords / this.baseParams.totalPerPage
|
|
239
250
|
);
|
|
240
251
|
|
|
241
|
-
if (this.baseParams.totalPage <= 1)
|
|
252
|
+
if (this.baseParams.totalPage <= 1)
|
|
253
|
+
this.loadingOnlyIfOnePage(response.value);
|
|
242
254
|
if (this.baseParams.totalPage > 1) this.loadingOnlyIfManyPages();
|
|
243
255
|
|
|
244
256
|
this.content.headerTable = this.headerTable;
|
|
@@ -1,497 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div>
|
|
3
|
-
<Panel
|
|
4
|
-
:module="panel.module"
|
|
5
|
-
:title="panel.title"
|
|
6
|
-
:showVerticalFilter="panel.showVerticalFilter"
|
|
7
|
-
:showSearch="panel.showSearch"
|
|
8
|
-
:showButtons="panel.showButtons"
|
|
9
|
-
>
|
|
10
|
-
<div slot="content-main">
|
|
11
|
-
<br />
|
|
12
|
-
<!-- <div class="div-progress" v-if="loading && liveTotalRecords > 0">
|
|
13
|
-
<ProgressBar
|
|
14
|
-
:text="`Carregando ${liveTotalRecords} registro(s) de ${content.totalRecords}`"
|
|
15
|
-
:value="liveTotalRecords"
|
|
16
|
-
:max="content.totalRecords"
|
|
17
|
-
size="medium"
|
|
18
|
-
/>
|
|
19
|
-
</div>
|
|
20
|
-
<Modal title="Salvar" :width="550" v-show="showModal('saveReport')">
|
|
21
|
-
<ReportCreateUpdate :module="panel.module" />
|
|
22
|
-
</Modal>
|
|
23
|
-
<Molded>
|
|
24
|
-
<div>
|
|
25
|
-
<div slot="content-filter-horizontal">
|
|
26
|
-
<b-row>
|
|
27
|
-
<b-col sm="6">
|
|
28
|
-
<div class="side-by-side">
|
|
29
|
-
<Button
|
|
30
|
-
_key="searchReport"
|
|
31
|
-
type="primary"
|
|
32
|
-
title="Buscar"
|
|
33
|
-
classIcon="fas fa-file-search"
|
|
34
|
-
size="medium"
|
|
35
|
-
:disabled="invalid || btnDisabled"
|
|
36
|
-
:clicked="getAll"
|
|
37
|
-
/>
|
|
38
|
-
</div>
|
|
39
|
-
<div class="side-by-side">
|
|
40
|
-
<Button
|
|
41
|
-
v-if="!invalid"
|
|
42
|
-
_key="btnSaveReport"
|
|
43
|
-
type="success"
|
|
44
|
-
title="Salvar Modelo"
|
|
45
|
-
classIcon="fas fa-save"
|
|
46
|
-
:disabled="loading || invalid"
|
|
47
|
-
size="small"
|
|
48
|
-
:clicked="openSaveReport"
|
|
49
|
-
/>
|
|
50
|
-
</div>
|
|
51
|
-
</b-col>
|
|
52
|
-
<b-col class="text-right" sm="6">
|
|
53
|
-
<div class="side-by-side">
|
|
54
|
-
<Button
|
|
55
|
-
_key="btnOpenFields"
|
|
56
|
-
type="info"
|
|
57
|
-
title="Campos"
|
|
58
|
-
classIcon="fas fa-database"
|
|
59
|
-
size="small"
|
|
60
|
-
:disabled="loading"
|
|
61
|
-
:clicked="openFields"
|
|
62
|
-
/>
|
|
63
|
-
</div>
|
|
64
|
-
<div class="side-by-side">
|
|
65
|
-
<Button
|
|
66
|
-
_key="btnOpenFilters"
|
|
67
|
-
type="info"
|
|
68
|
-
title="Filtros"
|
|
69
|
-
classIcon="fas fa-filter"
|
|
70
|
-
size="small"
|
|
71
|
-
:disabled="loading"
|
|
72
|
-
:clicked="openFilters"
|
|
73
|
-
/>
|
|
74
|
-
</div>
|
|
75
|
-
</b-col>
|
|
76
|
-
</b-row>
|
|
77
|
-
<Modal title="Campos" :width="600" v-if="showModal('fields')">
|
|
78
|
-
<Fields />
|
|
79
|
-
<b-row>
|
|
80
|
-
<b-col class="text-right" sm="12">
|
|
81
|
-
<div class="side-by-side">
|
|
82
|
-
<Button
|
|
83
|
-
_key="btnApplyFilters"
|
|
84
|
-
type="primary"
|
|
85
|
-
title="Aplicar"
|
|
86
|
-
classIcon="fas fa-filter"
|
|
87
|
-
size="small"
|
|
88
|
-
:disabled="fields.selected.length == 0"
|
|
89
|
-
:clicked="applyFilters"
|
|
90
|
-
/>
|
|
91
|
-
</div>
|
|
92
|
-
</b-col>
|
|
93
|
-
</b-row>
|
|
94
|
-
</Modal>
|
|
95
|
-
<Modal title="Filtros" :width="900" v-show="showModal('filters')">
|
|
96
|
-
<Rules :rules="rules" />
|
|
97
|
-
<br />
|
|
98
|
-
<b-row>
|
|
99
|
-
<b-col class="text-right" sm="12">
|
|
100
|
-
<div class="side-by-side">
|
|
101
|
-
<Button
|
|
102
|
-
_key="btnApplyFilters"
|
|
103
|
-
type="primary"
|
|
104
|
-
title="Aplicar"
|
|
105
|
-
classIcon="fas fa-filter"
|
|
106
|
-
size="small"
|
|
107
|
-
:clicked="applyFilters"
|
|
108
|
-
/>
|
|
109
|
-
</div>
|
|
110
|
-
</b-col>
|
|
111
|
-
</b-row>
|
|
112
|
-
</Modal>
|
|
113
|
-
</div>
|
|
114
|
-
</div>
|
|
115
|
-
</Molded>
|
|
116
|
-
<div class="div-required" v-show="invalid">
|
|
117
|
-
<Alert type="info" v-for="item in requiredRules" :key="item.id">
|
|
118
|
-
É necessário informar o filtro
|
|
119
|
-
<span class="filter-required">{{ item.title }}</span
|
|
120
|
-
>, clique no botão "Filtros" para adicionar.
|
|
121
|
-
</Alert>
|
|
122
|
-
</div>
|
|
123
|
-
<div class="div-tags">
|
|
124
|
-
<Tags eventName="tagReport" />
|
|
125
|
-
</div>
|
|
126
|
-
<div class="g-div-molded div-table" v-if="!loading && liveTotalRecords > 0">
|
|
127
|
-
<b-row>
|
|
128
|
-
<b-col sm="6">
|
|
129
|
-
<div class="div-button">
|
|
130
|
-
<div class="side-by-side">
|
|
131
|
-
<ExportExcel
|
|
132
|
-
:button="{ type: 'edit', title: 'Excel', size: 'small' }"
|
|
133
|
-
fileName="Auditoria"
|
|
134
|
-
:cabecalho="content.headerTable"
|
|
135
|
-
:data="content.data"
|
|
136
|
-
/>
|
|
137
|
-
</div>
|
|
138
|
-
<div class="side-by-side">
|
|
139
|
-
<div>
|
|
140
|
-
<Button
|
|
141
|
-
v-print="'#printMe'"
|
|
142
|
-
_key="btnApplyFilters"
|
|
143
|
-
type="edit"
|
|
144
|
-
title="Imprimir"
|
|
145
|
-
classIcon="fas fa-print"
|
|
146
|
-
size="small"
|
|
147
|
-
:clicked="applyFilters"
|
|
148
|
-
/>
|
|
149
|
-
</div>
|
|
150
|
-
</div>
|
|
151
|
-
</div>
|
|
152
|
-
</b-col>
|
|
153
|
-
<b-col sm="6">
|
|
154
|
-
<TableTotalRecords :totalRecords="content.totalRecords" />
|
|
155
|
-
</b-col>
|
|
156
|
-
</b-row>
|
|
157
|
-
<ScrollBar :minHeight="400" :maxHeight="600">
|
|
158
|
-
<div id="printMe">
|
|
159
|
-
<HeaderPrint />
|
|
160
|
-
{{ content.headerTable }}
|
|
161
|
-
<Table
|
|
162
|
-
:headerTable="content.headerTable"
|
|
163
|
-
:data="content.data"
|
|
164
|
-
:showChecks="templateList.showChecks"
|
|
165
|
-
/>
|
|
166
|
-
</div>
|
|
167
|
-
</ScrollBar>
|
|
168
|
-
</div>
|
|
169
|
-
<div class="div-sem-data" v-if="noDataReturned">
|
|
170
|
-
<Alert type="info">
|
|
171
|
-
<span> Nenhum registro foi encontrato!</span>
|
|
172
|
-
</Alert>
|
|
173
|
-
</div>
|
|
174
|
-
<div class="div-Totalization" v-if="content.totalization.length > 0">
|
|
175
|
-
<Totalization :data="content.totalization" />
|
|
176
|
-
</div>
|
|
177
|
-
</div> -->
|
|
178
|
-
</div>
|
|
179
|
-
</Panel>
|
|
180
|
-
</div>
|
|
181
|
-
</template>
|
|
182
|
-
|
|
183
|
-
<script>
|
|
184
|
-
import Alert from "@nixweb/nixloc-ui/src/component/layout/Alert";
|
|
185
|
-
import Modal from "@nixweb/nixloc-ui/src/component/forms/Modal";
|
|
186
|
-
import Button from "@nixweb/nixloc-ui/src/component/forms/Button";
|
|
187
|
-
import ExportExcel from "@nixweb/nixloc-ui/src/component/shared/ExportExcel";
|
|
188
|
-
import Table from "../shared/Table.vue";
|
|
189
|
-
import HeaderPrint from "../shared/HeaderPrint.vue";
|
|
190
|
-
import TableTotalRecords from "../shared/TableTotalRecords.vue";
|
|
191
|
-
import Panel from "@nixweb/nixloc-ui/src/component/layout/Panel.vue";
|
|
192
|
-
import ScrollBar from "@nixweb/nixloc-ui/src/component/layout/ScrollBar.vue";
|
|
193
|
-
import Molded from "@nixweb/nixloc-ui/src/component/layout/Molded";
|
|
194
|
-
import ProgressBar from "@nixweb/nixloc-ui/src/component/shared/ProgressBar";
|
|
195
|
-
import Totalization from "@nixweb/nixloc-ui/src/component/shared/query-builder/Totalization.vue";
|
|
196
|
-
import Tags from "@nixweb/nixloc-ui/src/component/shared/query-builder/Tags.vue";
|
|
197
|
-
import ReportCreateUpdate from "@nixweb/nixloc-ui/src/component/template/ReportCreateUpdate.vue";
|
|
198
|
-
import Fields from "@nixweb/nixloc-ui/src/component/shared/query-builder/Fields.vue";
|
|
199
|
-
import Rules from "@nixweb/nixloc-ui/src/component/shared/query-builder/Rules.vue";
|
|
200
|
-
import print from "vue-print-nb";
|
|
201
|
-
|
|
202
|
-
import { mapState, mapGetters, mapActions, mapMutations } from "vuex";
|
|
203
|
-
|
|
204
|
-
export default {
|
|
205
|
-
name: "TemplateReportView",
|
|
206
|
-
directives: {
|
|
207
|
-
print,
|
|
208
|
-
},
|
|
209
|
-
props: {
|
|
210
|
-
panel: Object,
|
|
211
|
-
templateList: Object,
|
|
212
|
-
templateReport: Object,
|
|
213
|
-
},
|
|
214
|
-
components: {
|
|
215
|
-
Alert,
|
|
216
|
-
Modal,
|
|
217
|
-
Button,
|
|
218
|
-
TableTotalRecords,
|
|
219
|
-
Table,
|
|
220
|
-
Panel,
|
|
221
|
-
ScrollBar,
|
|
222
|
-
Molded,
|
|
223
|
-
Totalization,
|
|
224
|
-
ProgressBar,
|
|
225
|
-
Tags,
|
|
226
|
-
ReportCreateUpdate,
|
|
227
|
-
ExportExcel,
|
|
228
|
-
HeaderPrint,
|
|
229
|
-
Fields,
|
|
230
|
-
Rules,
|
|
231
|
-
},
|
|
232
|
-
data() {
|
|
233
|
-
return {
|
|
234
|
-
content: {
|
|
235
|
-
headerTable: [],
|
|
236
|
-
data: [],
|
|
237
|
-
totalization: [],
|
|
238
|
-
pagination: 0,
|
|
239
|
-
currentPage: 1,
|
|
240
|
-
totalPerPage: 100,
|
|
241
|
-
totalRecords: 0,
|
|
242
|
-
},
|
|
243
|
-
btnDisabled: true,
|
|
244
|
-
loading: false,
|
|
245
|
-
noDataReturned: false,
|
|
246
|
-
};
|
|
247
|
-
},
|
|
248
|
-
mounted() {
|
|
249
|
-
this.addReport(this.templateReport);
|
|
250
|
-
this.removeLoading(["panel"]);
|
|
251
|
-
},
|
|
252
|
-
beforeDestroy() {
|
|
253
|
-
/* this.updateOptionsInitValue({});
|
|
254
|
-
this.atualizaCampoOrdenado({});
|
|
255
|
-
this.atualizaFiltroSelecionado({ children: [] });*/
|
|
256
|
-
},
|
|
257
|
-
computed: {
|
|
258
|
-
...mapGetters("generic", ["showModal", "event"]),
|
|
259
|
-
...mapGetters("report", [
|
|
260
|
-
"headerTable",
|
|
261
|
-
"selectedRules",
|
|
262
|
-
"requiredRules",
|
|
263
|
-
"requiredRulesAlreadyAdded",
|
|
264
|
-
"hasSelectedFields",
|
|
265
|
-
"oDataSelect",
|
|
266
|
-
"oDataFilter",
|
|
267
|
-
"oDataOrderBy",
|
|
268
|
-
]),
|
|
269
|
-
...mapState("report", ["report", "fields", "totalization"]),
|
|
270
|
-
urlQuery() {
|
|
271
|
-
let baseUrl = `${this.templateList.urlGetApi}?${this.oDataSelect}&${this.oDataOrderBy}&${this.oDataFilter.query}&$skip=${this.skip}&$top=${this.content.totalPerPage}&$count=true`;
|
|
272
|
-
return baseUrl.replace("&&", "&");
|
|
273
|
-
},
|
|
274
|
-
urlTotalization() {
|
|
275
|
-
let query = this.oDataFilter.totalization
|
|
276
|
-
? `$apply=filter(${this.oDataFilter.query.replace("$filter=", "")})/`
|
|
277
|
-
: "$apply=";
|
|
278
|
-
let baseUrl = `${this.templateList.urlGetApi}?${query}aggregate(${this.oDataFilter.totalization})`;
|
|
279
|
-
return baseUrl;
|
|
280
|
-
},
|
|
281
|
-
skip() {
|
|
282
|
-
return (this.content.currentPage - 1) * this.content.totalPerPage;
|
|
283
|
-
},
|
|
284
|
-
invalid() {
|
|
285
|
-
let ret = true;
|
|
286
|
-
this.requiredRules.forEach((rule) => {
|
|
287
|
-
ret = this.requiredRulesAlreadyAdded(rule);
|
|
288
|
-
});
|
|
289
|
-
|
|
290
|
-
if (this.requiredRules.length == 0) ret = false;
|
|
291
|
-
|
|
292
|
-
return ret;
|
|
293
|
-
},
|
|
294
|
-
liveTotalRecords() {
|
|
295
|
-
return this.content.data.length;
|
|
296
|
-
},
|
|
297
|
-
},
|
|
298
|
-
methods: {
|
|
299
|
-
...mapActions("generic", ["getApiOdata"]),
|
|
300
|
-
...mapMutations("generic", ["addEvent", "openModal", "hideModal", "removeLoading"]),
|
|
301
|
-
...mapMutations("report", [
|
|
302
|
-
"addReport",
|
|
303
|
-
"atualizaFiltroSelecionado",
|
|
304
|
-
"atualizaCampoOrdenado",
|
|
305
|
-
"updateOptionsInitValue",
|
|
306
|
-
"atualizaCabecalhoTabela",
|
|
307
|
-
]),
|
|
308
|
-
getAll() {
|
|
309
|
-
this.content.data = [];
|
|
310
|
-
this.content.totalization = [];
|
|
311
|
-
this.btnDisabled = true;
|
|
312
|
-
|
|
313
|
-
if (!this.invalid) {
|
|
314
|
-
this.showHideFields();
|
|
315
|
-
this.pagination();
|
|
316
|
-
this.removeLoading(["searchReport"]);
|
|
317
|
-
|
|
318
|
-
if (this.oDataFilter.totalization) this.totalizationOData();
|
|
319
|
-
if (!this.oDataFilter.totalization) this.content.totalization = [];
|
|
320
|
-
}
|
|
321
|
-
},
|
|
322
|
-
pagination() {
|
|
323
|
-
let paramsQuery = { url: this.urlQuery };
|
|
324
|
-
this.resetData();
|
|
325
|
-
|
|
326
|
-
this.getApiOdata(paramsQuery).then((response) => {
|
|
327
|
-
let totalRecords = response["@odata.count"];
|
|
328
|
-
if (totalRecords == 0) this.noDataReturned = true;
|
|
329
|
-
this.content.totalRecords = totalRecords;
|
|
330
|
-
this.content.pagination = Math.round(totalRecords / this.content.totalPerPage);
|
|
331
|
-
|
|
332
|
-
if (totalRecords <= this.content.totalPerPage) {
|
|
333
|
-
this.queryOData();
|
|
334
|
-
this.content.headerTable = this.headerTable;
|
|
335
|
-
}
|
|
336
|
-
if (this.content.pagination == 0) this.loading = false;
|
|
337
|
-
});
|
|
338
|
-
},
|
|
339
|
-
resetData() {
|
|
340
|
-
this.loading = true;
|
|
341
|
-
this.content.data = [];
|
|
342
|
-
this.content.currentPage = 1;
|
|
343
|
-
this.noDataReturned = false;
|
|
344
|
-
},
|
|
345
|
-
queryOData() {
|
|
346
|
-
let paramsQuery = { url: this.urlQuery };
|
|
347
|
-
this.getApiOdata(paramsQuery).then((response) => {
|
|
348
|
-
let self = this;
|
|
349
|
-
response.value.forEach(function (obj) {
|
|
350
|
-
self.content.data.push(obj);
|
|
351
|
-
});
|
|
352
|
-
this.content.currentPage++;
|
|
353
|
-
});
|
|
354
|
-
this.content.headerTable = this.headerTable;
|
|
355
|
-
},
|
|
356
|
-
totalizationOData() {
|
|
357
|
-
let paramsResumo = { url: this.urlTotalization };
|
|
358
|
-
this.getApiOdata(paramsResumo).then((response) => {
|
|
359
|
-
this.content.totalization = [];
|
|
360
|
-
const result = Object.entries(response[0]);
|
|
361
|
-
let self = this;
|
|
362
|
-
result.forEach(function (value) {
|
|
363
|
-
self.totalization.forEach(function (totalization) {
|
|
364
|
-
let obj = {
|
|
365
|
-
title: "",
|
|
366
|
-
value: value[1],
|
|
367
|
-
classCss: totalization.classCss,
|
|
368
|
-
type: totalization.type,
|
|
369
|
-
};
|
|
370
|
-
if (totalization.value == value[0]) {
|
|
371
|
-
obj.title = totalization.title;
|
|
372
|
-
self.content.totalization.push(obj);
|
|
373
|
-
}
|
|
374
|
-
});
|
|
375
|
-
});
|
|
376
|
-
});
|
|
377
|
-
},
|
|
378
|
-
openSaveReport() {
|
|
379
|
-
this.addEvent({ nome: "changeReport" });
|
|
380
|
-
this.openModal("saveReport");
|
|
381
|
-
this.removeLoading(["btnSaveReport"]);
|
|
382
|
-
},
|
|
383
|
-
openFields() {
|
|
384
|
-
this.openModal("fields");
|
|
385
|
-
this.removeLoading(["btnOpenFields"]);
|
|
386
|
-
},
|
|
387
|
-
openFilters() {
|
|
388
|
-
this.openModal("filters");
|
|
389
|
-
this.removeLoading(["btnOpenFilters"]);
|
|
390
|
-
},
|
|
391
|
-
applyFilters() {
|
|
392
|
-
this.hideModal();
|
|
393
|
-
this.removeLoading(["btnApplyFilters"]);
|
|
394
|
-
},
|
|
395
|
-
showHideFields() {
|
|
396
|
-
let self = this;
|
|
397
|
-
this.report.fields.forEach(function (field) {
|
|
398
|
-
/* if (self.hasSelectedFields(field.field, self.selectedFields)) {
|
|
399
|
-
field.show = true;
|
|
400
|
-
} else {
|
|
401
|
-
field.show = false;
|
|
402
|
-
}*/
|
|
403
|
-
});
|
|
404
|
-
},
|
|
405
|
-
},
|
|
406
|
-
watch: {
|
|
407
|
-
event: {
|
|
408
|
-
handler(event) {
|
|
409
|
-
if (event.nome == "tagReport") this.openModal("filters");
|
|
410
|
-
},
|
|
411
|
-
deep: true,
|
|
412
|
-
},
|
|
413
|
-
selectedFields: {
|
|
414
|
-
handler() {
|
|
415
|
-
this.showHideFields();
|
|
416
|
-
},
|
|
417
|
-
deep: true,
|
|
418
|
-
},
|
|
419
|
-
"content.currentPage": {
|
|
420
|
-
handler(currentPage) {
|
|
421
|
-
if (currentPage <= this.content.pagination - 1) {
|
|
422
|
-
let self = this;
|
|
423
|
-
setTimeout(function () {
|
|
424
|
-
self.queryOData();
|
|
425
|
-
}, 200);
|
|
426
|
-
}
|
|
427
|
-
if (currentPage == this.content.pagination && currentPage != 0)
|
|
428
|
-
this.loading = false;
|
|
429
|
-
},
|
|
430
|
-
deep: true,
|
|
431
|
-
},
|
|
432
|
-
"content.pagination": {
|
|
433
|
-
handler() {
|
|
434
|
-
this.queryOData();
|
|
435
|
-
},
|
|
436
|
-
deep: true,
|
|
437
|
-
},
|
|
438
|
-
"oDataFilter.query": {
|
|
439
|
-
handler() {
|
|
440
|
-
this.btnDisabled = false;
|
|
441
|
-
},
|
|
442
|
-
deep: true,
|
|
443
|
-
},
|
|
444
|
-
oDataSelect: {
|
|
445
|
-
handler() {
|
|
446
|
-
this.btnDisabled = false;
|
|
447
|
-
},
|
|
448
|
-
deep: true,
|
|
449
|
-
},
|
|
450
|
-
oDataOrderBy: {
|
|
451
|
-
handler() {
|
|
452
|
-
this.btnDisabled = false;
|
|
453
|
-
},
|
|
454
|
-
deep: true,
|
|
455
|
-
},
|
|
456
|
-
},
|
|
457
|
-
};
|
|
458
|
-
</script>
|
|
459
|
-
|
|
460
|
-
<style scoped>
|
|
461
|
-
.div-button {
|
|
462
|
-
padding-bottom: 15px;
|
|
463
|
-
}
|
|
464
|
-
|
|
465
|
-
.div-progress {
|
|
466
|
-
margin-bottom: 10px;
|
|
467
|
-
}
|
|
468
|
-
|
|
469
|
-
.div-sem-data {
|
|
470
|
-
margin-top: 20px;
|
|
471
|
-
}
|
|
472
|
-
|
|
473
|
-
.div-table {
|
|
474
|
-
margin-top: 20px;
|
|
475
|
-
}
|
|
476
|
-
|
|
477
|
-
.div-separacao {
|
|
478
|
-
margin-left: 10px;
|
|
479
|
-
margin-right: 5px;
|
|
480
|
-
}
|
|
481
|
-
|
|
482
|
-
.div-Totalization {
|
|
483
|
-
margin-top: 20px;
|
|
484
|
-
}
|
|
485
|
-
|
|
486
|
-
.div-tags {
|
|
487
|
-
margin-top: 15px;
|
|
488
|
-
}
|
|
489
|
-
|
|
490
|
-
.div-required {
|
|
491
|
-
margin-top: 20px;
|
|
492
|
-
}
|
|
493
|
-
|
|
494
|
-
.filter-required {
|
|
495
|
-
font-weight: 500;
|
|
496
|
-
}
|
|
497
|
-
</style>
|