pui9-docgen 1.16.4
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/README.md +20 -0
- package/dist/demo.html +10 -0
- package/dist/pui9-docgen.common.js +9533 -0
- package/dist/pui9-docgen.common.js.map +1 -0
- package/dist/pui9-docgen.css +1 -0
- package/dist/pui9-docgen.umd.js +9543 -0
- package/dist/pui9-docgen.umd.js.map +1 -0
- package/dist/pui9-docgen.umd.min.js +2 -0
- package/dist/pui9-docgen.umd.min.js.map +1 -0
- package/package-lock.json +15631 -0
- package/package.json +59 -0
- package/src/components/puidocgen/PuiDocgenTemplateActions.js +102 -0
- package/src/components/puidocgen/PuiDocgenTemplateFilter.vue +113 -0
- package/src/components/puidocgen/PuiDocgenTemplateFilterGroup.vue +291 -0
- package/src/components/puidocgen/PuiDocgenTemplateFilterRule.vue +352 -0
- package/src/components/puidocgen/PuiDocgenTemplateForm.vue +517 -0
- package/src/components/puidocgen/PuiDocgenTemplateGrid.vue +23 -0
- package/src/components/puidocgen/PuiDocgenTemplateMapping.vue +235 -0
- package/src/components/puidocgen/PuiDocgenTemplateMixin.vue +159 -0
- package/src/components/puidocgen/PuiDocgenTemplateModals.vue +112 -0
- package/src/components/puidocgen/PuiDocgenTemplateParameter.vue +104 -0
- package/src/index.js +15 -0
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<pui-field-set :title="title">
|
|
3
|
+
<h4 class="puidocgentemplate-subtitle">{{ subtitle }}</h4>
|
|
4
|
+
<div class="d-flex justify-space-around pa-4">
|
|
5
|
+
<v-btn color="primary" @click="doAutoMapping()">{{ $t('puidocgentemplatemapping.mappingAuto') }}</v-btn>
|
|
6
|
+
<v-btn v-if="!isCreatingElement" class="px-2" color="primary" @click="reloadDocGenTemplateConfig()">
|
|
7
|
+
<v-icon class="px-1">far fa-file-search</v-icon>
|
|
8
|
+
<v-icon class="px-1">fas fa-sync-alt</v-icon>
|
|
9
|
+
<v-icon class="px-1">fal fa-table</v-icon>
|
|
10
|
+
</v-btn>
|
|
11
|
+
</div>
|
|
12
|
+
<table class="puidocgentemplate-table" v-if="mappings.length > 0">
|
|
13
|
+
<thead>
|
|
14
|
+
<tr>
|
|
15
|
+
<th class="puidocgentemplate-table-column">{{ $t('puidocgentemplatemapping.tag') }}</th>
|
|
16
|
+
<th class="puidocgentemplate-table-column">{{ $t('puidocgentemplatemapping.origin') }}</th>
|
|
17
|
+
<th class="puidocgentemplate-table-column">{{ $t('puidocgentemplatemapping.field') }}</th>
|
|
18
|
+
</tr>
|
|
19
|
+
<tr>
|
|
20
|
+
<th>
|
|
21
|
+
<hr />
|
|
22
|
+
</th>
|
|
23
|
+
<th>
|
|
24
|
+
<hr />
|
|
25
|
+
</th>
|
|
26
|
+
<th>
|
|
27
|
+
<hr />
|
|
28
|
+
</th>
|
|
29
|
+
</tr>
|
|
30
|
+
</thead>
|
|
31
|
+
<tbody>
|
|
32
|
+
<tr v-for="item in mappings" :key="item.tag">
|
|
33
|
+
<td class="puidocgentemplate-table-column">
|
|
34
|
+
<label>{{ item.tag }}</label>
|
|
35
|
+
</td>
|
|
36
|
+
<td>
|
|
37
|
+
<v-autocomplete
|
|
38
|
+
class="pl-2 pr-2"
|
|
39
|
+
append-icon="fa fa-angle-down"
|
|
40
|
+
solo
|
|
41
|
+
flat
|
|
42
|
+
hide-details
|
|
43
|
+
:rules="getRules()"
|
|
44
|
+
:items="originItems"
|
|
45
|
+
item-value="id"
|
|
46
|
+
item-text="name"
|
|
47
|
+
v-model="item.origin"
|
|
48
|
+
:disabled="disabled"
|
|
49
|
+
>
|
|
50
|
+
</v-autocomplete>
|
|
51
|
+
</td>
|
|
52
|
+
<td>
|
|
53
|
+
<v-autocomplete
|
|
54
|
+
v-if="item.origin === 'V'"
|
|
55
|
+
class="pr-2"
|
|
56
|
+
append-icon="fa fa-angle-down"
|
|
57
|
+
solo
|
|
58
|
+
flat
|
|
59
|
+
hide-details
|
|
60
|
+
:rules="getRules()"
|
|
61
|
+
:items="columns"
|
|
62
|
+
item-value="name"
|
|
63
|
+
item-text="title"
|
|
64
|
+
v-model="item.field"
|
|
65
|
+
:disabled="disabled"
|
|
66
|
+
>
|
|
67
|
+
<template v-slot:append-outer>
|
|
68
|
+
<v-icon size="6" style="top: -10px; left: -5px" color="red">fas fa-asterisk</v-icon>
|
|
69
|
+
</template>
|
|
70
|
+
</v-autocomplete>
|
|
71
|
+
<v-autocomplete
|
|
72
|
+
v-else-if="item.origin === 'S'"
|
|
73
|
+
class="pr-2"
|
|
74
|
+
append-icon="fa fa-angle-down"
|
|
75
|
+
solo
|
|
76
|
+
flat
|
|
77
|
+
hide-details
|
|
78
|
+
:rules="getRules()"
|
|
79
|
+
:items="systemFields"
|
|
80
|
+
v-model="item.field"
|
|
81
|
+
:disabled="disabled"
|
|
82
|
+
>
|
|
83
|
+
<template v-slot:append-outer>
|
|
84
|
+
<v-icon size="6" style="top: -10px; left: -5px" color="red">fas fa-asterisk</v-icon>
|
|
85
|
+
</template>
|
|
86
|
+
</v-autocomplete>
|
|
87
|
+
<v-autocomplete
|
|
88
|
+
v-else-if="item.origin === 'T'"
|
|
89
|
+
class="pr-2"
|
|
90
|
+
append-icon="fa fa-angle-down"
|
|
91
|
+
solo
|
|
92
|
+
flat
|
|
93
|
+
hide-details
|
|
94
|
+
:rules="getRules()"
|
|
95
|
+
:items="tableFields"
|
|
96
|
+
item-value="id"
|
|
97
|
+
item-text="label"
|
|
98
|
+
v-model="item.field"
|
|
99
|
+
:disabled="disabled"
|
|
100
|
+
>
|
|
101
|
+
<template v-slot:append-outer>
|
|
102
|
+
<v-icon size="6" style="top: -10px; left: -5px" color="red">fas fa-asterisk</v-icon>
|
|
103
|
+
</template>
|
|
104
|
+
</v-autocomplete>
|
|
105
|
+
<v-text-field
|
|
106
|
+
v-else
|
|
107
|
+
class="pr-2 inputFilterText"
|
|
108
|
+
type="text"
|
|
109
|
+
solo
|
|
110
|
+
flat
|
|
111
|
+
outlined
|
|
112
|
+
hide-details
|
|
113
|
+
:rules="getRules()"
|
|
114
|
+
v-model="item.field"
|
|
115
|
+
:disabled="disabled"
|
|
116
|
+
>
|
|
117
|
+
<template v-slot:append-outer>
|
|
118
|
+
<v-icon size="6" style="top: -10px; left: -5px" color="red">fas fa-asterisk</v-icon>
|
|
119
|
+
</template>
|
|
120
|
+
</v-text-field>
|
|
121
|
+
</td>
|
|
122
|
+
</tr>
|
|
123
|
+
</tbody>
|
|
124
|
+
</table>
|
|
125
|
+
</pui-field-set>
|
|
126
|
+
</template>
|
|
127
|
+
|
|
128
|
+
<script>
|
|
129
|
+
export default {
|
|
130
|
+
name: 'PuiDocgenTemplateMapping',
|
|
131
|
+
data() {
|
|
132
|
+
return {
|
|
133
|
+
originItems: [
|
|
134
|
+
{ id: 'V', name: this.getOriginName('puidocgentemplatemapping.origin.view') },
|
|
135
|
+
{ id: 'S', name: this.getOriginName('puidocgentemplatemapping.origin.system') },
|
|
136
|
+
{ id: 'T', name: this.getOriginName('puidocgentemplatemapping.origin.table') },
|
|
137
|
+
{ id: 'U', name: this.getOriginName('puidocgentemplatemapping.origin.user') }
|
|
138
|
+
]
|
|
139
|
+
};
|
|
140
|
+
},
|
|
141
|
+
props: {
|
|
142
|
+
templateid: {
|
|
143
|
+
type: Number
|
|
144
|
+
},
|
|
145
|
+
title: {
|
|
146
|
+
type: String,
|
|
147
|
+
required: true
|
|
148
|
+
},
|
|
149
|
+
subtitle: {
|
|
150
|
+
type: String,
|
|
151
|
+
required: true
|
|
152
|
+
},
|
|
153
|
+
systemFields: {
|
|
154
|
+
type: Array,
|
|
155
|
+
required: true
|
|
156
|
+
},
|
|
157
|
+
tableFields: {
|
|
158
|
+
type: Array,
|
|
159
|
+
required: true
|
|
160
|
+
},
|
|
161
|
+
mappings: {
|
|
162
|
+
type: Array,
|
|
163
|
+
required: true
|
|
164
|
+
},
|
|
165
|
+
columns: {
|
|
166
|
+
type: Array,
|
|
167
|
+
required: true
|
|
168
|
+
},
|
|
169
|
+
disabled: {
|
|
170
|
+
type: Boolean,
|
|
171
|
+
required: true
|
|
172
|
+
},
|
|
173
|
+
isCreatingElement: {
|
|
174
|
+
type: Boolean,
|
|
175
|
+
required: true
|
|
176
|
+
},
|
|
177
|
+
modelName: {
|
|
178
|
+
type: String,
|
|
179
|
+
required: true
|
|
180
|
+
}
|
|
181
|
+
},
|
|
182
|
+
methods: {
|
|
183
|
+
getRules() {
|
|
184
|
+
return [(value) => !!value || 'Required'];
|
|
185
|
+
},
|
|
186
|
+
getOriginName(originName) {
|
|
187
|
+
return this.$t(originName);
|
|
188
|
+
},
|
|
189
|
+
doAutoMapping() {
|
|
190
|
+
for (let i = 0, mappingLength = this.mappings.length; i < mappingLength; i++) {
|
|
191
|
+
if (this.mappings[i].origin !== 'V') {
|
|
192
|
+
continue;
|
|
193
|
+
}
|
|
194
|
+
for (let j = 0, columnsLength = this.columns.length; j < columnsLength; j++) {
|
|
195
|
+
if (this.mappings[i].tag.toLowerCase() === this.columns[j].name.toLowerCase()) {
|
|
196
|
+
this.mappings[i].field = this.columns[j].name;
|
|
197
|
+
break;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
},
|
|
202
|
+
reloadDocGenTemplateConfig() {
|
|
203
|
+
this.refreshMapping();
|
|
204
|
+
this.$store.dispatch('reloadInfoModels');
|
|
205
|
+
},
|
|
206
|
+
refreshMapping() {
|
|
207
|
+
const modelDependency = this.$store.getters.getModelByName(this.modelName);
|
|
208
|
+
this.$puiRequests.postRequest(
|
|
209
|
+
modelDependency.url.getTemplateMappingFromId,
|
|
210
|
+
null,
|
|
211
|
+
(response) => {
|
|
212
|
+
if (response && response.data) {
|
|
213
|
+
const newMappings = response.data;
|
|
214
|
+
// remove not existent mappings
|
|
215
|
+
this.mappings.forEach((item, index, array) => {
|
|
216
|
+
var exist = newMappings.findIndex((mapping) => mapping.tag === item.tag) != -1;
|
|
217
|
+
if (!exist) array.splice(index, 1);
|
|
218
|
+
});
|
|
219
|
+
// add new mappings
|
|
220
|
+
newMappings.forEach((item) => {
|
|
221
|
+
var exist = this.mappings.findIndex((mapping) => mapping.tag === item.tag) != -1;
|
|
222
|
+
if (!exist) this.mappings.push(item);
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
},
|
|
226
|
+
() => {
|
|
227
|
+
this.$puiNotify.error(this.$puiI18n.t('puiaction.notifyError'));
|
|
228
|
+
},
|
|
229
|
+
null,
|
|
230
|
+
{ id: this.templateid }
|
|
231
|
+
);
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
};
|
|
235
|
+
</script>
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
export default {
|
|
3
|
+
data() {
|
|
4
|
+
return {
|
|
5
|
+
filterOperators: {
|
|
6
|
+
common: [
|
|
7
|
+
{
|
|
8
|
+
text: 'equal',
|
|
9
|
+
value: 'eq'
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
text: 'notEqual',
|
|
13
|
+
value: 'ne'
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
text: 'isNotNull',
|
|
17
|
+
value: 'nn'
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
text: 'isNull',
|
|
21
|
+
value: 'nu'
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
text: 'in',
|
|
25
|
+
value: 'in'
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
text: 'notIn',
|
|
29
|
+
value: 'ni'
|
|
30
|
+
}
|
|
31
|
+
],
|
|
32
|
+
numeric: [
|
|
33
|
+
{
|
|
34
|
+
text: 'lessThan',
|
|
35
|
+
value: 'lt'
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
text: 'greaterEqualThan',
|
|
39
|
+
value: 'ge'
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
text: 'lessEqualThan',
|
|
43
|
+
value: 'le'
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
text: 'greaterThan',
|
|
47
|
+
value: 'gt'
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
text: 'between',
|
|
51
|
+
value: 'bt'
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
text: 'notBetween',
|
|
55
|
+
value: 'nbt'
|
|
56
|
+
}
|
|
57
|
+
],
|
|
58
|
+
text: [
|
|
59
|
+
{
|
|
60
|
+
text: 'contains',
|
|
61
|
+
value: 'cn'
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
text: 'notContains',
|
|
65
|
+
value: 'nc'
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
text: 'endsWith',
|
|
69
|
+
value: 'ew'
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
text: 'notEndsWith',
|
|
73
|
+
value: 'en'
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
text: 'beginsWith',
|
|
77
|
+
value: 'bw'
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
text: 'notBeginsWith',
|
|
81
|
+
value: 'bn'
|
|
82
|
+
}
|
|
83
|
+
],
|
|
84
|
+
date: [], //son igual que los numericos, solo que tendran un datetime picker en el input,
|
|
85
|
+
datetime: [
|
|
86
|
+
{
|
|
87
|
+
text: 'equalToday',
|
|
88
|
+
value: 'eqt'
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
text: 'notEqualToday',
|
|
92
|
+
value: 'net'
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
text: 'lessThanToday',
|
|
96
|
+
value: 'ltt'
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
text: 'greaterThanToday',
|
|
100
|
+
value: 'gtt'
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
text: 'lessEqualThanToday',
|
|
104
|
+
value: 'let'
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
text: 'greaterEqualThanToday',
|
|
108
|
+
value: 'get'
|
|
109
|
+
}
|
|
110
|
+
], //idem
|
|
111
|
+
decimal: [] //idem
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
},
|
|
115
|
+
props: {
|
|
116
|
+
columns: {
|
|
117
|
+
type: Array,
|
|
118
|
+
required: true
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
created() {
|
|
122
|
+
this.translateFilterOperators();
|
|
123
|
+
this.addCommonAndDecimalAndDateFilterOperators();
|
|
124
|
+
},
|
|
125
|
+
methods: {
|
|
126
|
+
getRules() {
|
|
127
|
+
return [(value) => !!value || 'Required'];
|
|
128
|
+
},
|
|
129
|
+
translateFilterOperators() {
|
|
130
|
+
for (const colType in this.filterOperators) {
|
|
131
|
+
for (let i = 0, length = this.filterOperators[colType].length; i < length; i++) {
|
|
132
|
+
this.filterOperators[colType][i].text = this.$t(this.filterOperators[colType][i].text);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
},
|
|
136
|
+
addCommonAndDecimalAndDateFilterOperators() {
|
|
137
|
+
const commonKey = 'common';
|
|
138
|
+
for (const colType in this.filterOperators) {
|
|
139
|
+
if (colType === commonKey) {
|
|
140
|
+
continue;
|
|
141
|
+
} else if (colType === 'decimal') {
|
|
142
|
+
this.filterOperators[colType] = this.filterOperators.numeric;
|
|
143
|
+
} else if (colType === 'date' || colType === 'datetime') {
|
|
144
|
+
this.filterOperators[colType] = this.filterOperators[colType].concat(this.filterOperators.numeric);
|
|
145
|
+
}
|
|
146
|
+
this.filterOperators[colType] = this.filterOperators[colType].concat(this.filterOperators[commonKey]);
|
|
147
|
+
}
|
|
148
|
+
},
|
|
149
|
+
getColumnType(columnName) {
|
|
150
|
+
for (let i = 0, columnsLength = this.columns.length; i < columnsLength; i++) {
|
|
151
|
+
if (this.columns[i].name === columnName) {
|
|
152
|
+
return this.columns[i].type;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
return null;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
};
|
|
159
|
+
</script>
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<pui-modal-dialog-form
|
|
4
|
+
:titleText="$t('puiaction.docgen.uploadnewtemplate')"
|
|
5
|
+
:modelName="modelName"
|
|
6
|
+
:dialogName="dialogNameUploadNewTemplate"
|
|
7
|
+
:widthDialog="800"
|
|
8
|
+
:onOk="onOkUploadNewTemplate"
|
|
9
|
+
>
|
|
10
|
+
<template slot="message">
|
|
11
|
+
<v-layout wrap class="justify-center">
|
|
12
|
+
<v-flex xs12 md8 xl9>
|
|
13
|
+
<pui-text-field :label="$t('puidocgentemplate.filename')" v-model="fileName" toplabel required disabled></pui-text-field>
|
|
14
|
+
<input v-show="false" type="file" accept=".doc, .docx, .odt" ref="document" @change="onFilePicked" />
|
|
15
|
+
</v-flex>
|
|
16
|
+
<v-flex xs12 md4 xl3>
|
|
17
|
+
<v-btn color="primary" @click="pickFile" style="margin-top: 20px">{{ $t('puidocgentemplate.selectfile') }}</v-btn>
|
|
18
|
+
</v-flex>
|
|
19
|
+
</v-layout>
|
|
20
|
+
</template>
|
|
21
|
+
</pui-modal-dialog-form>
|
|
22
|
+
</div>
|
|
23
|
+
</template>
|
|
24
|
+
|
|
25
|
+
<script>
|
|
26
|
+
export default {
|
|
27
|
+
data() {
|
|
28
|
+
return {
|
|
29
|
+
dialogNameUploadNewTemplate: 'uploadNewTemplate',
|
|
30
|
+
fileTypes: {
|
|
31
|
+
'application/msword': 'fas fa-file-word',
|
|
32
|
+
'application/vnd.openxmlformats-officedocument.wordprocessingml.document': 'fas fa-file-word',
|
|
33
|
+
'application/vnd.oasis.opendocument.text': 'fas fa-file-word'
|
|
34
|
+
},
|
|
35
|
+
fileName: null,
|
|
36
|
+
selectedFile: null,
|
|
37
|
+
selectedFileType: null
|
|
38
|
+
};
|
|
39
|
+
},
|
|
40
|
+
props: {
|
|
41
|
+
modelName: {
|
|
42
|
+
required: true,
|
|
43
|
+
type: String
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
methods: {
|
|
47
|
+
pickFile() {
|
|
48
|
+
this.$refs.document.click();
|
|
49
|
+
},
|
|
50
|
+
onFilePicked(e) {
|
|
51
|
+
const files = e.target.files;
|
|
52
|
+
if (files[0] !== undefined) {
|
|
53
|
+
const file = files[0];
|
|
54
|
+
if (file.name.lastIndexOf('.') <= 0) {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
this.fileName = file.name;
|
|
59
|
+
const fr = new window.FileReader();
|
|
60
|
+
fr.addEventListener('load', () => {
|
|
61
|
+
this.selectedFile = file; // this is the file that can be sent to server...
|
|
62
|
+
this.selectedFileType = this.fileTypes[file.type];
|
|
63
|
+
});
|
|
64
|
+
fr.readAsDataURL(file);
|
|
65
|
+
} else {
|
|
66
|
+
this.fileName = null;
|
|
67
|
+
this.selectedFile = null;
|
|
68
|
+
this.selectedFileType = null;
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
onOkUploadNewTemplate(modalData) {
|
|
72
|
+
const formData = new window.FormData();
|
|
73
|
+
formData.append('id', modalData.id);
|
|
74
|
+
formData.append('file', this.selectedFile, this.selectedFile.name);
|
|
75
|
+
formData.append('filename', this.selectedFile.name);
|
|
76
|
+
|
|
77
|
+
const urlController = this.$store.getters.getModelByName(this.modelName).url.uploadTemplate;
|
|
78
|
+
const title = this.$puiI18n.t('puiaction.notifyTitle') + ' > ' + this.$puiI18n.t('puiaction.docgen.uploadnewtemplate');
|
|
79
|
+
return new Promise((resolve) => {
|
|
80
|
+
this.$puiRequests.uploadFileRequest(
|
|
81
|
+
urlController,
|
|
82
|
+
formData,
|
|
83
|
+
(response) => {
|
|
84
|
+
if (response.status === 200) {
|
|
85
|
+
this.$puiEvents.$emit('onPui-action-running-ended-' + this.modelName);
|
|
86
|
+
const message = this.$puiI18n.t('puiaction.notifySuccess');
|
|
87
|
+
this.$puiNotify.success(message, title);
|
|
88
|
+
resolve(true);
|
|
89
|
+
} else {
|
|
90
|
+
let message = this.$puiI18n.t('puiaction.notifyError');
|
|
91
|
+
if (response.data) {
|
|
92
|
+
message = response.data.message;
|
|
93
|
+
}
|
|
94
|
+
this.$puiNotify.error(message, title);
|
|
95
|
+
resolve(false);
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
(error) => {
|
|
99
|
+
this.$puiEvents.$emit('onPui-action-running-ended-' + this.modelName);
|
|
100
|
+
let message = this.$puiI18n.t('puiaction.notifyError');
|
|
101
|
+
if (error.response && error.response.data) {
|
|
102
|
+
message = error.response.data.message;
|
|
103
|
+
}
|
|
104
|
+
this.$puiNotify.error(message, title);
|
|
105
|
+
resolve(false);
|
|
106
|
+
}
|
|
107
|
+
);
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
</script>
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<pui-field-set :title="title">
|
|
3
|
+
<h4 class="puidocgentemplate-subtitle">{{ subtitle }}</h4>
|
|
4
|
+
<table class="puidocgentemplate-table" v-if="Array.isArray(parameters) && columns.length > 0">
|
|
5
|
+
<thead>
|
|
6
|
+
<tr>
|
|
7
|
+
<th class="puidocgentemplate-table-column">{{ $t('puidocgentemplateparameter.column') }}</th>
|
|
8
|
+
<th class="puidocgentemplate-table-column">{{ $t('puidocgentemplateparameter.operation') }}</th>
|
|
9
|
+
</tr>
|
|
10
|
+
<tr>
|
|
11
|
+
<th>
|
|
12
|
+
<hr />
|
|
13
|
+
</th>
|
|
14
|
+
<th>
|
|
15
|
+
<hr />
|
|
16
|
+
</th>
|
|
17
|
+
</tr>
|
|
18
|
+
</thead>
|
|
19
|
+
<tbody>
|
|
20
|
+
<tr v-for="(parameter, index) in parameters" :key="parameter.field">
|
|
21
|
+
<td>
|
|
22
|
+
<v-select
|
|
23
|
+
class="pr-2"
|
|
24
|
+
append-icon="fa fa-angle-down"
|
|
25
|
+
solo
|
|
26
|
+
flat
|
|
27
|
+
hide-details
|
|
28
|
+
required
|
|
29
|
+
:rules="getRules()"
|
|
30
|
+
:items="columns"
|
|
31
|
+
item-value="name"
|
|
32
|
+
item-text="title"
|
|
33
|
+
v-model="parameter.field"
|
|
34
|
+
:disabled="disabled"
|
|
35
|
+
></v-select>
|
|
36
|
+
</td>
|
|
37
|
+
<td>
|
|
38
|
+
<v-select
|
|
39
|
+
class="pl-2 pr-2"
|
|
40
|
+
append-icon="fa fa-angle-down"
|
|
41
|
+
solo
|
|
42
|
+
flat
|
|
43
|
+
hide-details
|
|
44
|
+
required
|
|
45
|
+
:rules="getRules()"
|
|
46
|
+
:items="filterOperators[getColumnType(parameter.field)]"
|
|
47
|
+
item-value="value"
|
|
48
|
+
item-text="text"
|
|
49
|
+
v-model="parameter.op"
|
|
50
|
+
:disabled="disabled"
|
|
51
|
+
></v-select>
|
|
52
|
+
</td>
|
|
53
|
+
<td>
|
|
54
|
+
<v-btn color="primary" @click="removeParameter(index)">{{ $t('puidocgentemplateparameter.remove') }}</v-btn>
|
|
55
|
+
</td>
|
|
56
|
+
</tr>
|
|
57
|
+
<tr>
|
|
58
|
+
<td colspan="2"></td>
|
|
59
|
+
<td>
|
|
60
|
+
<v-btn color="primary" @click="addParameter">{{ $t('puidocgentemplateparameter.add') }}</v-btn>
|
|
61
|
+
</td>
|
|
62
|
+
</tr>
|
|
63
|
+
</tbody>
|
|
64
|
+
</table>
|
|
65
|
+
</pui-field-set>
|
|
66
|
+
</template>
|
|
67
|
+
|
|
68
|
+
<script>
|
|
69
|
+
import PuiDocgenTemplateMixin from './PuiDocgenTemplateMixin';
|
|
70
|
+
|
|
71
|
+
export default {
|
|
72
|
+
name: 'PuiDocgenTemplateParameter',
|
|
73
|
+
mixins: [PuiDocgenTemplateMixin],
|
|
74
|
+
data() {
|
|
75
|
+
return {};
|
|
76
|
+
},
|
|
77
|
+
props: {
|
|
78
|
+
title: {
|
|
79
|
+
type: String,
|
|
80
|
+
required: true
|
|
81
|
+
},
|
|
82
|
+
subtitle: {
|
|
83
|
+
type: String,
|
|
84
|
+
required: true
|
|
85
|
+
},
|
|
86
|
+
parameters: {
|
|
87
|
+
type: [String, Array],
|
|
88
|
+
required: true
|
|
89
|
+
},
|
|
90
|
+
disabled: {
|
|
91
|
+
type: Boolean,
|
|
92
|
+
required: true
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
methods: {
|
|
96
|
+
addParameter() {
|
|
97
|
+
this.parameters.push({ field: null, op: null });
|
|
98
|
+
},
|
|
99
|
+
removeParameter(index) {
|
|
100
|
+
this.parameters.splice(index, 1);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
</script>
|
package/src/index.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import PuiDocgenTemplateForm from './components/puidocgen/PuiDocgenTemplateForm';
|
|
2
|
+
import PuiDocgenTemplateGrid from './components/puidocgen/PuiDocgenTemplateGrid';
|
|
3
|
+
|
|
4
|
+
const Components = {
|
|
5
|
+
PuiDocgenTemplateForm,
|
|
6
|
+
PuiDocgenTemplateGrid
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export default {
|
|
10
|
+
install(Vue) {
|
|
11
|
+
Object.keys(Components).forEach(name => {
|
|
12
|
+
Vue.component(name, Components[name]);
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
};
|