free-fe-core-modules 0.0.1
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 +7 -0
- package/components/.gitkeep +0 -0
- package/components/Basic/BreadCrumbs.vue +87 -0
- package/components/Basic/EIcon.vue +84 -0
- package/components/Basic/LeveledMenus.vue +92 -0
- package/components/Basic/SummaryHead.vue +312 -0
- package/components/Dialog/BasicDialog.vue +442 -0
- package/components/Dialog/index.js +38 -0
- package/components/Dialog/index1.js +49 -0
- package/components/FloatingWindow/index.vue +140 -0
- package/components/SelectLocales/index.vue +47 -0
- package/components/SlidingCarousel/index.vue +86 -0
- package/components/SlidingNews/index.vue +138 -0
- package/components/StickyButtons/index.vue +98 -0
- package/components/ThemeSwitch/index.vue +77 -0
- package/field-components/Display/index.js +3 -0
- package/field-components/Fields/AgreementCheck.vue +161 -0
- package/field-components/Fields/ApiCall.vue +139 -0
- package/field-components/Fields/Boolean.vue +112 -0
- package/field-components/Fields/Category.vue +33 -0
- package/field-components/Fields/Check.vue +131 -0
- package/field-components/Fields/Customize.vue +103 -0
- package/field-components/Fields/Date.vue +142 -0
- package/field-components/Fields/DateRange.vue +199 -0
- package/field-components/Fields/DynamicList.vue +575 -0
- package/field-components/Fields/FieldEditor.vue +379 -0
- package/field-components/Fields/File.vue +382 -0
- package/field-components/Fields/FileList.vue +405 -0
- package/field-components/Fields/FileListCombined.vue +142 -0
- package/field-components/Fields/FixedList.vue +372 -0
- package/field-components/Fields/Image.vue +328 -0
- package/field-components/Fields/ImageList.vue +285 -0
- package/field-components/Fields/ImageListCombined.vue +76 -0
- package/field-components/Fields/InputFieldList.vue +299 -0
- package/field-components/Fields/Labels.vue +182 -0
- package/field-components/Fields/MixedTable.vue +367 -0
- package/field-components/Fields/Number.vue +247 -0
- package/field-components/Fields/Password.vue +79 -0
- package/field-components/Fields/Permission.vue +83 -0
- package/field-components/Fields/PermissionEditor.vue +205 -0
- package/field-components/Fields/QueryFilters.vue +162 -0
- package/field-components/Fields/RadioList.vue +81 -0
- package/field-components/Fields/Rich.vue +369 -0
- package/field-components/Fields/Search.vue +499 -0
- package/field-components/Fields/Select.vue +376 -0
- package/field-components/Fields/SelectionChain.vue +198 -0
- package/field-components/Fields/Separator.vue +26 -0
- package/field-components/Fields/SingleList.vue +125 -0
- package/field-components/Fields/Static.vue +22 -0
- package/field-components/Fields/String.vue +185 -0
- package/field-components/Fields/Text.vue +89 -0
- package/field-components/Fields/Time.vue +160 -0
- package/field-components/Fields/TimeRange.vue +348 -0
- package/field-components/Fields/UltimateFile.vue +100 -0
- package/field-components/Fields/Year.vue +124 -0
- package/field-components/Fields/YearRange.vue +188 -0
- package/field-components/Fields/components/FieldTypeOptions.vue +248 -0
- package/field-components/Fields/index.js +117 -0
- package/field-components/components/FieldComponents.vue +246 -0
- package/field-components/index.js +13 -0
- package/field-components/style.sass +11 -0
- package/free-fields/AutoHide.js +66 -0
- package/free-fields/CenterContent.js +15 -0
- package/free-fields/Draggable.js +30 -0
- package/free-fields/Droppable.js +114 -0
- package/free-fields/EditableString.js +63 -0
- package/free-fields/FieldCategory.js +83 -0
- package/free-fields/FieldTypeSelect.js +94 -0
- package/free-fields/fieldEditors/arrayEditor.js +3 -0
- package/free-fields/fieldEditors/boolEditor.js +22 -0
- package/free-fields/fieldEditors/dateEditor.js +23 -0
- package/free-fields/fieldEditors/datetimeEditor.js +23 -0
- package/free-fields/fieldEditors/index.js +21 -0
- package/free-fields/fieldEditors/jsonEditor.js +371 -0
- package/free-fields/fieldEditors/labeledField.js +74 -0
- package/free-fields/fieldEditors/numberEditor.js +51 -0
- package/free-fields/fieldEditors/objectEditor.js +3 -0
- package/free-fields/fieldEditors/selectEditor.js +0 -0
- package/free-fields/fieldEditors/stringEditor.js +49 -0
- package/free-fields/fieldEditors/textEditor.js +50 -0
- package/free-fields/fieldEditors/timeEditor.js +23 -0
- package/free-fields/index.js +402 -0
- package/i18n/en-us/index.js +73 -0
- package/i18n/fields/en-us/index.js +9 -0
- package/i18n/fields/zh-cn/index.js +9 -0
- package/i18n/zh-cn/index.js +73 -0
- package/index.js +367 -0
- package/package.json +11 -0
- package/router/dict/api.js +18 -0
- package/router/dict/data.js +48 -0
- package/router/dict/index.js +7 -0
- package/router/error/api.js +14 -0
- package/router/error/data.js +33 -0
- package/router/error/index.js +9 -0
- package/router/index.js +13 -0
- package/router/menu/api.js +24 -0
- package/router/menu/data.js +85 -0
- package/router/menu/index.js +7 -0
- package/router/system/api.js +10 -0
- package/router/system/data.js +46 -0
- package/router/system/index.js +7 -0
- package/stores/index.js +17 -0
- package/stores/module-mourning/actions.js +3 -0
- package/stores/module-mourning/getters.js +1 -0
- package/stores/module-mourning/index.js +11 -0
- package/stores/module-mourning/state.js +3 -0
- package/stores/mourning.js +3 -0
- package/view/dict/index.vue +284 -0
- package/view/error/list.vue +197 -0
- package/view/menu/index.vue +332 -0
- package/view/mourning/mourning.vue +45 -0
- package/view/system/index.vue +149 -0
|
@@ -0,0 +1,376 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<span :class="(Field && Field.AsCheck) ? 'input-field-select' :
|
|
3
|
+
'input-field-select simple-field row'">
|
|
4
|
+
<span
|
|
5
|
+
v-if="!Field.AsCheck"
|
|
6
|
+
class="row no-wrap items-center full-width inline-block"
|
|
7
|
+
>
|
|
8
|
+
<span
|
|
9
|
+
v-if="Field.ReadOnly"
|
|
10
|
+
class="full-width"
|
|
11
|
+
>
|
|
12
|
+
<span
|
|
13
|
+
:class="`field-label field-label-readonly ${(Field.Label && Field.Label.trim().length)
|
|
14
|
+
? '' : 'field-label-empty'} ${Field.Required ? 'required' : ''}`"
|
|
15
|
+
v-if="typeof Field.Label !== 'undefined'"
|
|
16
|
+
>
|
|
17
|
+
<q-tooltip
|
|
18
|
+
v-if="Field.Description"
|
|
19
|
+
anchor="top right"
|
|
20
|
+
>{{Field.Description}}</q-tooltip>
|
|
21
|
+
{{Field.Label || ''}}
|
|
22
|
+
<span
|
|
23
|
+
v-if="Field.Required"
|
|
24
|
+
class="required-mark"
|
|
25
|
+
>*</span>
|
|
26
|
+
</span>
|
|
27
|
+
<span class="readonly-content">
|
|
28
|
+
<span
|
|
29
|
+
class="prefix"
|
|
30
|
+
v-if="Field.Options && Field.Options.Prefix"
|
|
31
|
+
>
|
|
32
|
+
{{Field.Options.Prefix}}
|
|
33
|
+
</span>
|
|
34
|
+
<span :style="(Field.Info && Field.Info.Style) ? Field.Info.Style : ''">
|
|
35
|
+
{{readonlyContent}}
|
|
36
|
+
</span>
|
|
37
|
+
<span
|
|
38
|
+
class="postfix"
|
|
39
|
+
v-if="Field.Options && Field.Options.Postfix"
|
|
40
|
+
>{{Field.Options.Postfix}}</span>
|
|
41
|
+
</span>
|
|
42
|
+
</span>
|
|
43
|
+
|
|
44
|
+
<q-select
|
|
45
|
+
v-else
|
|
46
|
+
popup-content-class="input-field-select-control"
|
|
47
|
+
hide-bottom-space
|
|
48
|
+
v-model="fieldData"
|
|
49
|
+
:options="Field.Options || []"
|
|
50
|
+
option-value="Value"
|
|
51
|
+
option-label="Label"
|
|
52
|
+
map-options
|
|
53
|
+
:label="Field.Placeholder"
|
|
54
|
+
emit-value
|
|
55
|
+
v-bind="$attrs"
|
|
56
|
+
:multiple="Field.Multiple"
|
|
57
|
+
:readonly="Field.ReadOnly"
|
|
58
|
+
:ref="`input_field_validator_${Field.Name || Field.Label}`"
|
|
59
|
+
:use-input="Field && Field.UseInput"
|
|
60
|
+
:use-chip="Field && Field.UseChip"
|
|
61
|
+
>
|
|
62
|
+
<template v-slot:before>
|
|
63
|
+
<span
|
|
64
|
+
:class="`field-label ${(Field.Label && Field.Label.trim().length)
|
|
65
|
+
? '' : 'field-label-empty'} ${Field.Required ? 'required' : ''}`"
|
|
66
|
+
v-if="typeof Field.Label !== 'undefined'"
|
|
67
|
+
>
|
|
68
|
+
<q-tooltip
|
|
69
|
+
v-if="Field.Description"
|
|
70
|
+
anchor="top right"
|
|
71
|
+
>{{Field.Description}}</q-tooltip>
|
|
72
|
+
{{Field.Label || ''}}
|
|
73
|
+
<span
|
|
74
|
+
v-if="Field.Required"
|
|
75
|
+
class="required-mark"
|
|
76
|
+
>*</span>
|
|
77
|
+
</span>
|
|
78
|
+
</template>
|
|
79
|
+
|
|
80
|
+
<template v-slot:option="scope">
|
|
81
|
+
{{scope.itemProps}}
|
|
82
|
+
<q-item
|
|
83
|
+
v-bind="scope.itemProps"
|
|
84
|
+
>
|
|
85
|
+
<q-item-section
|
|
86
|
+
avatar
|
|
87
|
+
v-if="scope.opt.Icon"
|
|
88
|
+
>
|
|
89
|
+
<e-icon :name="scope.opt.Icon" />
|
|
90
|
+
</q-item-section>
|
|
91
|
+
|
|
92
|
+
<q-item-section>
|
|
93
|
+
<q-item-label>{{ scope.opt.Label }}</q-item-label>
|
|
94
|
+
<q-tooltip v-if="scope.opt.Tooltip">
|
|
95
|
+
{{scope.opt.Tooltip}}
|
|
96
|
+
</q-tooltip>
|
|
97
|
+
<!-- <q-item-label caption v-if="scope.opt.Description" class="ellipsis">
|
|
98
|
+
{{ scope.opt.Description }}
|
|
99
|
+
</q-item-label> -->
|
|
100
|
+
</q-item-section>
|
|
101
|
+
</q-item>
|
|
102
|
+
</template>
|
|
103
|
+
</q-select>
|
|
104
|
+
<slot name="warning"></slot>
|
|
105
|
+
</span>
|
|
106
|
+
<span
|
|
107
|
+
v-else
|
|
108
|
+
class="input-field-select-ascheck row items-start no-wrap"
|
|
109
|
+
>
|
|
110
|
+
<span
|
|
111
|
+
:class="`field-label ${(Field.Label && Field.Label.trim().length)
|
|
112
|
+
? '' : 'field-label-empty'} ${Field.Required ? 'required' : ''}`"
|
|
113
|
+
v-if="typeof Field.Label !== 'undefined'"
|
|
114
|
+
>
|
|
115
|
+
<q-tooltip
|
|
116
|
+
v-if="Field.Description"
|
|
117
|
+
anchor="top right"
|
|
118
|
+
>{{Field.Description}}</q-tooltip>
|
|
119
|
+
{{Field.Label || ''}}
|
|
120
|
+
<span
|
|
121
|
+
v-if="Field.Required"
|
|
122
|
+
class="required-mark"
|
|
123
|
+
>*</span>
|
|
124
|
+
</span>
|
|
125
|
+
<span class="column items-start no-wrap">
|
|
126
|
+
<div>
|
|
127
|
+
<slot name="warning"></slot>
|
|
128
|
+
</div>
|
|
129
|
+
<div
|
|
130
|
+
class="checkbox-list"
|
|
131
|
+
:class="hasError ? 'input-field--error' : ''"
|
|
132
|
+
>
|
|
133
|
+
|
|
134
|
+
<div
|
|
135
|
+
class="input-field--error-tag"
|
|
136
|
+
v-if="hasError"
|
|
137
|
+
>
|
|
138
|
+
<e-icon name="error"></e-icon>
|
|
139
|
+
</div>
|
|
140
|
+
|
|
141
|
+
<q-checkbox
|
|
142
|
+
v-for="(option, index) in Field.Options"
|
|
143
|
+
:key="index"
|
|
144
|
+
hide-bottom-space
|
|
145
|
+
:label="option.Label || ''"
|
|
146
|
+
v-model="checked"
|
|
147
|
+
:val="option.Value"
|
|
148
|
+
:disable="Field.ReadOnly"
|
|
149
|
+
@input="checkChanged(option.Value)"
|
|
150
|
+
></q-checkbox>
|
|
151
|
+
</div>
|
|
152
|
+
</span>
|
|
153
|
+
</span>
|
|
154
|
+
</span>
|
|
155
|
+
</template>
|
|
156
|
+
|
|
157
|
+
<script>
|
|
158
|
+
import { defineComponent } from 'vue';
|
|
159
|
+
import mixins from 'free-fe-mixins';
|
|
160
|
+
|
|
161
|
+
export default defineComponent({
|
|
162
|
+
name: 'InputFieldSelect',
|
|
163
|
+
mixins: [mixins.InputFieldMixin],
|
|
164
|
+
emits:['udpate:fieldData', 'input'],
|
|
165
|
+
fieldInfo: {
|
|
166
|
+
Category: 'Simple',
|
|
167
|
+
Label: '选择',
|
|
168
|
+
Value: 'Select',
|
|
169
|
+
Description: '',
|
|
170
|
+
Extra: [
|
|
171
|
+
{
|
|
172
|
+
Type: 'Check',
|
|
173
|
+
Label: '展开单选',
|
|
174
|
+
Name: 'AsRadio',
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
Type: 'Check',
|
|
178
|
+
Label: '展开勾选',
|
|
179
|
+
Name: 'AsCheck',
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
Type: 'Check',
|
|
183
|
+
Label: '可多选',
|
|
184
|
+
Name: 'Multiple',
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
Type: 'String',
|
|
188
|
+
Name: 'Info.Url',
|
|
189
|
+
Label: '获取选项的url',
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
Type: 'String',
|
|
193
|
+
Name: 'Info.Params',
|
|
194
|
+
Label: '获取选项的参数字段',
|
|
195
|
+
Placeholder: '逗号分割多个参数字段名',
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
Type: 'DynamicList',
|
|
199
|
+
Label: '选项',
|
|
200
|
+
Name: 'Options',
|
|
201
|
+
Options: {
|
|
202
|
+
Columns: [
|
|
203
|
+
{
|
|
204
|
+
Label: 'Label',
|
|
205
|
+
Name: 'Label',
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
Label: 'Value',
|
|
209
|
+
Name: 'Value',
|
|
210
|
+
},
|
|
211
|
+
{
|
|
212
|
+
Label: 'Extra',
|
|
213
|
+
Name: 'Extra',
|
|
214
|
+
Type: 'FieldList',
|
|
215
|
+
Options: {
|
|
216
|
+
Columns: [
|
|
217
|
+
{
|
|
218
|
+
Label: '#',
|
|
219
|
+
Name: 'Index',
|
|
220
|
+
sortable: true,
|
|
221
|
+
},
|
|
222
|
+
{
|
|
223
|
+
Label: '名称',
|
|
224
|
+
Name: 'Name',
|
|
225
|
+
style: 'max-width: 200px;',
|
|
226
|
+
sortable: true,
|
|
227
|
+
},
|
|
228
|
+
{
|
|
229
|
+
Label: '标题',
|
|
230
|
+
Name: 'Label',
|
|
231
|
+
style: 'max-width: 200px;',
|
|
232
|
+
sortable: true,
|
|
233
|
+
},
|
|
234
|
+
],
|
|
235
|
+
},
|
|
236
|
+
},
|
|
237
|
+
],
|
|
238
|
+
},
|
|
239
|
+
},
|
|
240
|
+
],
|
|
241
|
+
},
|
|
242
|
+
data() {
|
|
243
|
+
return {
|
|
244
|
+
checked: [],
|
|
245
|
+
dependencies: {},
|
|
246
|
+
};
|
|
247
|
+
},
|
|
248
|
+
computed: {
|
|
249
|
+
readonlyContent() {
|
|
250
|
+
if (this.Field && this.Field.Options && Array.isArray(this.Field.Options)) {
|
|
251
|
+
let valueList;
|
|
252
|
+
if (this.Field.Multiple) {
|
|
253
|
+
if (Array.isArray(this.fieldData)) {
|
|
254
|
+
valueList = this.fieldData;
|
|
255
|
+
} else if (typeof this.fieldData === 'string') {
|
|
256
|
+
valueList = this.fieldData.split(',');
|
|
257
|
+
}
|
|
258
|
+
} else {
|
|
259
|
+
valueList = [this.fieldData];
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
const labelList = [];
|
|
263
|
+
(valueList || []).forEach((vl) => {
|
|
264
|
+
const theOpt = this.Field.Options.find((opt) => opt.Value === vl);
|
|
265
|
+
if (theOpt) labelList.push(theOpt.Label || this.fieldData);
|
|
266
|
+
});
|
|
267
|
+
|
|
268
|
+
return labelList.join(',');
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
return this.fieldData;
|
|
272
|
+
},
|
|
273
|
+
},
|
|
274
|
+
watch: {
|
|
275
|
+
fieldData() {
|
|
276
|
+
if (this.Field.AsCheck) {
|
|
277
|
+
if (this.fieldData) {
|
|
278
|
+
this.checked = this.fieldData.toString().split(',');
|
|
279
|
+
} else {
|
|
280
|
+
this.checked = [];
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
this.$emit('update:fieldData');
|
|
284
|
+
},
|
|
285
|
+
data: {
|
|
286
|
+
handler() {
|
|
287
|
+
if (!this.Field || !this.Field.Info || !this.Field.Info.Url || !this.data) return;
|
|
288
|
+
|
|
289
|
+
this.Field.Info.Params = this.Field.Info.Params || '';
|
|
290
|
+
if (this.Field.Info.Params) {
|
|
291
|
+
const paramList = typeof this.Field.Info.Params === 'string' ? this.Field.Info.Params.split(',') : this.Field.Info.Params;
|
|
292
|
+
|
|
293
|
+
for (let i = 0; i < paramList.length; i += 1) {
|
|
294
|
+
if (Object.nestValue(this.data, paramList[i])
|
|
295
|
+
!== Object.nestValue(this.dependencies, paramList[i])) {
|
|
296
|
+
// changed
|
|
297
|
+
this.apiCall();
|
|
298
|
+
return;
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
},
|
|
303
|
+
deep: true,
|
|
304
|
+
immediate: true,
|
|
305
|
+
},
|
|
306
|
+
},
|
|
307
|
+
methods: {
|
|
308
|
+
selfValidate() {
|
|
309
|
+
if (this.Field && this.Field.AsCheck && this.Field.Required) {
|
|
310
|
+
const isValid = this.checked && this.checked.length > 0;
|
|
311
|
+
this.hasError = !isValid;
|
|
312
|
+
return isValid;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
return true;
|
|
316
|
+
},
|
|
317
|
+
checkChanged(v) {
|
|
318
|
+
this.selfValidate();
|
|
319
|
+
|
|
320
|
+
if (!this.Field.Multiple) {
|
|
321
|
+
this.checked = [v];
|
|
322
|
+
}
|
|
323
|
+
this.fieldData = this.checked.join(',');
|
|
324
|
+
this.$emit('input');
|
|
325
|
+
},
|
|
326
|
+
apiCall() {
|
|
327
|
+
if (!this.Field.Info || !this.Field.Info.Url) {
|
|
328
|
+
return;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
const paramObj = {};
|
|
332
|
+
this.Field.Info.Params = this.Field.Info.Params || '';
|
|
333
|
+
if (this.Field.Info.Params.length > 0) {
|
|
334
|
+
if (typeof this.Field.Info.Params === 'string') {
|
|
335
|
+
this.Field.Info.Params = this.Field.Info.Params.split(',');
|
|
336
|
+
}
|
|
337
|
+
for (let i = 0; i < this.Field.Info.Params.length; i += 1) {
|
|
338
|
+
const param = this.Field.Info.Params[i];
|
|
339
|
+
|
|
340
|
+
if (param) {
|
|
341
|
+
Object.setValue(paramObj, param, Object.nestValue(this.data, param));
|
|
342
|
+
Object.setValue(this.dependencies, param, Object.nestValue(this.data, param));
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
this.postRequest(this.Field.Info.Url, paramObj).then((d) => {
|
|
348
|
+
if (d && d.msg === 'OK') {
|
|
349
|
+
if (d.data && d.data.options) {
|
|
350
|
+
this.Field.Options = d.data.options;
|
|
351
|
+
if (d.data.options.findIndex((o) => o.Value === this.fieldData) < 0) {
|
|
352
|
+
this.fieldData = undefined;
|
|
353
|
+
}
|
|
354
|
+
} else {
|
|
355
|
+
this.Field.Options = [];
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
});
|
|
359
|
+
},
|
|
360
|
+
},
|
|
361
|
+
});
|
|
362
|
+
</script>
|
|
363
|
+
|
|
364
|
+
<style lang="sass">
|
|
365
|
+
.input-field-select
|
|
366
|
+
.q-field__native
|
|
367
|
+
white-space: nowrap
|
|
368
|
+
&>span
|
|
369
|
+
white-space: nowrap
|
|
370
|
+
overflow: hidden
|
|
371
|
+
.checkbox-list
|
|
372
|
+
position: relative
|
|
373
|
+
margin-left: 12px
|
|
374
|
+
&.input-field--error
|
|
375
|
+
padding-right: 24px
|
|
376
|
+
</style>
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="input-field-select-chain row items-start no-wrap">
|
|
3
|
+
<span
|
|
4
|
+
:class="`field-label ${(Field.Label && Field.Label.trim().length)
|
|
5
|
+
? '' : 'field-label-empty'} ${Field.Required ? 'required' : ''}`"
|
|
6
|
+
v-if="typeof Field.Label !== 'undefined'"
|
|
7
|
+
>
|
|
8
|
+
<q-tooltip
|
|
9
|
+
v-if="Field.Description"
|
|
10
|
+
anchor="top right"
|
|
11
|
+
>{{Field.Description}}</q-tooltip>
|
|
12
|
+
{{Field.Label || ''}}
|
|
13
|
+
<span
|
|
14
|
+
v-if="Field.Required"
|
|
15
|
+
class="required-mark"
|
|
16
|
+
>*</span>
|
|
17
|
+
</span>
|
|
18
|
+
<span style="margin-left: 12px;">
|
|
19
|
+
<slot name="warning"></slot>
|
|
20
|
+
<span
|
|
21
|
+
v-if="Field && Field.Options && Field.Options.Fields && !Field.ReadOnly"
|
|
22
|
+
class="row q-gutter-sm no-wrap"
|
|
23
|
+
>
|
|
24
|
+
<q-select
|
|
25
|
+
class="simple-field"
|
|
26
|
+
hide-bottom-space
|
|
27
|
+
v-for="(option, index) in Field.Options.Fields"
|
|
28
|
+
:key="index"
|
|
29
|
+
v-model="valuesList[index]"
|
|
30
|
+
:options="optionsList[index]"
|
|
31
|
+
option-value="Value"
|
|
32
|
+
option-label="Label"
|
|
33
|
+
map-options
|
|
34
|
+
:label="valuesList[index] ? '' : option.Placeholder"
|
|
35
|
+
emit-value
|
|
36
|
+
v-bind="$attrs"
|
|
37
|
+
@input="selectionChanged(index)"
|
|
38
|
+
:ref="`input_field_validator_${index}`"
|
|
39
|
+
></q-select>
|
|
40
|
+
</span>
|
|
41
|
+
<span v-if="Field && Field.ReadOnly">
|
|
42
|
+
<span
|
|
43
|
+
class="readonly-content"
|
|
44
|
+
v-for="(option, index) in Field.Options.Fields"
|
|
45
|
+
:key="index"
|
|
46
|
+
>
|
|
47
|
+
<span v-if="valuesList[index] && !option.Hide">
|
|
48
|
+
{{optionsList[index] ?
|
|
49
|
+
(optionsList[index].find(o => o.Value === valuesList[index]) || {}).Label : ''}}
|
|
50
|
+
</span>
|
|
51
|
+
</span>
|
|
52
|
+
</span>
|
|
53
|
+
</span>
|
|
54
|
+
</div>
|
|
55
|
+
</template>
|
|
56
|
+
|
|
57
|
+
<script>
|
|
58
|
+
import { defineComponent } from 'vue';
|
|
59
|
+
import mixins from 'free-fe-mixins';
|
|
60
|
+
|
|
61
|
+
export default defineComponent({
|
|
62
|
+
name: 'InputFieldSelectChain',
|
|
63
|
+
mixins: [mixins.InputFieldMixin],
|
|
64
|
+
emits:['input'],
|
|
65
|
+
fieldInfo: {
|
|
66
|
+
Category: 'Advanced',
|
|
67
|
+
Label: '选择链',
|
|
68
|
+
Value: 'SelectionChain',
|
|
69
|
+
Extra: [
|
|
70
|
+
{
|
|
71
|
+
Type: 'String',
|
|
72
|
+
Label: '数据获取地址',
|
|
73
|
+
Name: 'Options.Url',
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
Type: 'String',
|
|
77
|
+
Label: '上级数据名',
|
|
78
|
+
Name: 'Options.ParentName',
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
Type: 'DynamicList',
|
|
82
|
+
Label: '列',
|
|
83
|
+
Name: 'Options.Fields',
|
|
84
|
+
Options: {
|
|
85
|
+
Columns: [
|
|
86
|
+
{
|
|
87
|
+
Label: 'Name',
|
|
88
|
+
Name: 'Name',
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
Label: 'Placeholder',
|
|
92
|
+
Name: 'Placeholder',
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
Label: 'Default',
|
|
96
|
+
Name: 'Default',
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
Label: 'Hide',
|
|
100
|
+
Name: 'Hide',
|
|
101
|
+
Type: 'Boolean',
|
|
102
|
+
Default: false,
|
|
103
|
+
},
|
|
104
|
+
],
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
],
|
|
108
|
+
Description: '',
|
|
109
|
+
},
|
|
110
|
+
data() {
|
|
111
|
+
return {
|
|
112
|
+
optionsList: [],
|
|
113
|
+
valuesList: [],
|
|
114
|
+
};
|
|
115
|
+
},
|
|
116
|
+
watch: {
|
|
117
|
+
Field() {
|
|
118
|
+
this.initOptions();
|
|
119
|
+
},
|
|
120
|
+
fieldData(v) {
|
|
121
|
+
if(typeof v === 'undefined'){
|
|
122
|
+
this.valuesList = [];
|
|
123
|
+
}
|
|
124
|
+
this.initOptions();
|
|
125
|
+
},
|
|
126
|
+
},
|
|
127
|
+
created() {
|
|
128
|
+
this.fieldData = this.fieldData || {};
|
|
129
|
+
this.initOptions();
|
|
130
|
+
},
|
|
131
|
+
methods: {
|
|
132
|
+
initOptions() {
|
|
133
|
+
if (this.optionsList.length > 0) return;
|
|
134
|
+
|
|
135
|
+
if (this.Field && this.Field.Options && this.Field.Options.Fields) {
|
|
136
|
+
for (let i = 0; i < this.Field.Options.Fields.length; i += 1) {
|
|
137
|
+
const fld = this.Field.Options.Fields[i];
|
|
138
|
+
|
|
139
|
+
if (this.fieldData) this.fieldData[fld.Name] = this.fieldData[fld.Name] || fld.Default || '';
|
|
140
|
+
|
|
141
|
+
this.valuesList[i] = this.fieldData[fld.Name];
|
|
142
|
+
if (i === 0 || this.valuesList[i - 1]) {
|
|
143
|
+
this.getOptions(i);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
},
|
|
148
|
+
getOptions(index) {
|
|
149
|
+
if (!this.Field || !this.Field.Options || !this.Field.Options.Fields) {
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
if (index > 0 && !this.valuesList[index - 1]) return;
|
|
154
|
+
|
|
155
|
+
if(this.Field.Options.Url){
|
|
156
|
+
const obj = {};
|
|
157
|
+
obj[this.Field.Options.ParentName] = this.Field.Options.Fields[index - 1]
|
|
158
|
+
? this.valuesList.slice(0, index).join('.')
|
|
159
|
+
: '';
|
|
160
|
+
|
|
161
|
+
this.getRequest(this.Field.Options.Url, obj).then((d) => {
|
|
162
|
+
if (d && d.msg === 'OK' && Array.isArray(d.data)) {
|
|
163
|
+
//this.$set(this.optionsList, index, d.data);
|
|
164
|
+
this.optionsList[index] = d.data;
|
|
165
|
+
}
|
|
166
|
+
});
|
|
167
|
+
} else if(this.Field.Options.Data){
|
|
168
|
+
let parent = this.Field.Options.Fields[index - 1]
|
|
169
|
+
? this.valuesList.slice(0, index).join('.')
|
|
170
|
+
: '';
|
|
171
|
+
|
|
172
|
+
parent = parent && parent.split('.');
|
|
173
|
+
parent = parent && parent.pop();
|
|
174
|
+
parent = parent || '';
|
|
175
|
+
|
|
176
|
+
//this.$set(this.optionsList, index, this.Field.Options.Data.filter(dd => dd[this.Field.Options.ParentName] === parent));
|
|
177
|
+
this.optionsList[index] = this.Field.Options.Data.filter(dd => dd[this.Field.Options.ParentName] === parent);
|
|
178
|
+
}
|
|
179
|
+
},
|
|
180
|
+
selectionChanged(index) {
|
|
181
|
+
this.fieldData = this.fieldData || {};
|
|
182
|
+
if (index < this.Field.Options.Fields.length - 1) {
|
|
183
|
+
for (let i = index + 1; i < this.Field.Options.Fields.length; i += 1) {
|
|
184
|
+
delete this.valuesList[i];
|
|
185
|
+
delete this.optionsList[i];
|
|
186
|
+
this.fieldData[this.Field.Options.Fields[i].Name] = '';
|
|
187
|
+
}
|
|
188
|
+
this.getOptions(index + 1);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
this.fieldData[this.Field.Options.Fields[index].Name] = this.valuesList[
|
|
192
|
+
index
|
|
193
|
+
];
|
|
194
|
+
this.$emit('input');
|
|
195
|
+
},
|
|
196
|
+
},
|
|
197
|
+
});
|
|
198
|
+
</script>
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<q-separator :inset="inset" class="input-field-separator"/>
|
|
3
|
+
</template>
|
|
4
|
+
|
|
5
|
+
<script>
|
|
6
|
+
import { defineComponent } from 'vue';
|
|
7
|
+
|
|
8
|
+
export default defineComponent({
|
|
9
|
+
name: 'InputFieldSeparator',
|
|
10
|
+
props: {
|
|
11
|
+
inset: { type: Boolean, default: true },
|
|
12
|
+
},
|
|
13
|
+
fieldInfo: {
|
|
14
|
+
Category: 'Static',
|
|
15
|
+
Label: '分割线',
|
|
16
|
+
Value: 'Separator',
|
|
17
|
+
Description: '',
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
</script>
|
|
21
|
+
|
|
22
|
+
<style lang="sass" scoped>
|
|
23
|
+
.input-field-separator
|
|
24
|
+
height: 1px
|
|
25
|
+
background: $grey-4
|
|
26
|
+
</style>
|