free-fe-core-modules 0.0.2 → 0.0.3
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/components/Basic/EIcon.vue +2 -4
- package/components/Basic/LeveledMenus.vue +0 -5
- package/components/Basic/SummaryHead.vue +10 -1
- package/components/Dialog/BasicDialog.vue +1 -1
- package/components/SlidingCarousel/index.vue +0 -1
- package/components/SlidingNews/index.vue +0 -1
- package/components/ThemeSwitch/index.vue +7 -5
- package/composible/useObjectData.js +69 -0
- package/free-field/Fields/AgreementCheck.js +170 -0
- package/free-field/Fields/ApiCall.js +123 -0
- package/{field-components/Fields/Boolean.vue → free-field/Fields/Boolean.js} +40 -46
- package/free-field/Fields/Category.js +28 -0
- package/free-field/Fields/Check.js +106 -0
- package/free-field/Fields/Customize.js +87 -0
- package/free-field/Fields/Date.js +133 -0
- package/free-field/Fields/DateRange.js +226 -0
- package/free-field/Fields/DynamicList.js +565 -0
- package/{field-components → free-field}/Fields/File.vue +1 -1
- package/{field-components → free-field}/Fields/FileList.vue +1 -1
- package/{field-components → free-field}/Fields/FileListCombined.vue +1 -1
- package/{field-components → free-field}/Fields/FixedList.vue +78 -83
- package/{field-components → free-field}/Fields/ImageList.vue +1 -1
- package/{field-components → free-field}/Fields/ImageListCombined.vue +1 -1
- package/free-field/Fields/InputFieldList.vue +324 -0
- package/{field-components → free-field}/Fields/Labels.vue +24 -15
- package/{field-components → free-field}/Fields/MixedTable.vue +53 -61
- package/free-field/Fields/Number.js +167 -0
- package/free-field/Fields/Password.js +81 -0
- package/{field-components → free-field}/Fields/Permission.vue +17 -13
- package/{field-components → free-field}/Fields/PermissionEditor.vue +63 -105
- package/{field-components → free-field}/Fields/QueryFilters.vue +65 -48
- package/{field-components → free-field}/Fields/RadioList.vue +36 -12
- package/{field-components → free-field}/Fields/Rich.vue +104 -114
- package/{field-components → free-field}/Fields/Search.vue +35 -26
- package/{field-components → free-field}/Fields/Select.vue +116 -87
- package/{field-components → free-field}/Fields/SelectionChain.vue +89 -67
- package/{field-components/Fields/Separator.vue → free-field/Fields/Separator.js} +11 -16
- package/{field-components → free-field}/Fields/SingleList.vue +27 -21
- package/free-field/Fields/Static.js +27 -0
- package/free-field/Fields/String.js +105 -0
- package/free-field/Fields/Text.js +80 -0
- package/{field-components → free-field}/Fields/Time.vue +59 -43
- package/{field-components → free-field}/Fields/TimeRange.vue +107 -92
- package/{field-components → free-field}/Fields/UltimateFile.vue +1 -1
- package/free-field/Fields/Year.js +137 -0
- package/{field-components → free-field}/Fields/YearRange.vue +63 -73
- package/{field-components → free-field}/Fields/index.js +16 -18
- package/free-field/composible/fieldWrapper.js +221 -0
- package/free-field/composible/freeFieldLabel.js +22 -0
- package/free-field/composible/readonlyContent.js +36 -0
- package/free-field/composible/useFileSizeUtils.js +52 -0
- package/free-field/composible/useFreeField.js +143 -0
- package/{field-components → free-field}/index.js +3 -3
- package/i18n/en-us/index.js +1 -1
- package/i18n/zh-cn/index.js +1 -1
- package/index.js +1 -4
- package/package.json +1 -1
- package/router/error/data.js +4 -1
- package/view/dict/index.vue +13 -2
- package/view/error/list.vue +22 -14
- package/view/menu/index.vue +19 -4
- package/view/system/index.vue +15 -2
- package/field-components/Fields/AgreementCheck.vue +0 -161
- package/field-components/Fields/ApiCall.vue +0 -139
- package/field-components/Fields/Category.vue +0 -33
- package/field-components/Fields/Check.vue +0 -131
- package/field-components/Fields/Customize.vue +0 -103
- package/field-components/Fields/Date.vue +0 -142
- package/field-components/Fields/DateRange.vue +0 -199
- package/field-components/Fields/DynamicList.vue +0 -575
- package/field-components/Fields/FieldEditor.vue +0 -379
- package/field-components/Fields/InputFieldList.vue +0 -299
- package/field-components/Fields/Number.vue +0 -247
- package/field-components/Fields/Password.vue +0 -79
- package/field-components/Fields/Static.vue +0 -22
- package/field-components/Fields/String.vue +0 -185
- package/field-components/Fields/Text.vue +0 -89
- package/field-components/Fields/Year.vue +0 -124
- package/field-components/Fields/components/FieldTypeOptions.vue +0 -248
- package/field-components/components/FieldComponents.vue +0 -246
- package/free-fields/AutoHide.js +0 -66
- package/free-fields/CenterContent.js +0 -15
- package/free-fields/Draggable.js +0 -30
- package/free-fields/Droppable.js +0 -114
- package/free-fields/EditableString.js +0 -63
- package/free-fields/FieldCategory.js +0 -83
- package/free-fields/FieldTypeSelect.js +0 -94
- package/free-fields/fieldEditors/arrayEditor.js +0 -3
- package/free-fields/fieldEditors/boolEditor.js +0 -22
- package/free-fields/fieldEditors/dateEditor.js +0 -23
- package/free-fields/fieldEditors/datetimeEditor.js +0 -23
- package/free-fields/fieldEditors/index.js +0 -21
- package/free-fields/fieldEditors/jsonEditor.js +0 -371
- package/free-fields/fieldEditors/labeledField.js +0 -74
- package/free-fields/fieldEditors/numberEditor.js +0 -51
- package/free-fields/fieldEditors/objectEditor.js +0 -3
- package/free-fields/fieldEditors/selectEditor.js +0 -0
- package/free-fields/fieldEditors/stringEditor.js +0 -49
- package/free-fields/fieldEditors/textEditor.js +0 -50
- package/free-fields/fieldEditors/timeEditor.js +0 -23
- package/free-fields/index.js +0 -402
- /package/{field-components → free-field}/Fields/Image.vue +0 -0
- /package/{field-components/Display → free-field/Layout}/index.js +0 -0
- /package/{field-components → free-field}/style.sass +0 -0
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
<span
|
|
13
13
|
:class="`field-label field-label-readonly ${(Field.Label && Field.Label.trim().length)
|
|
14
14
|
? '' : 'field-label-empty'} ${Field.Required ? 'required' : ''}`"
|
|
15
|
-
v-if="
|
|
15
|
+
v-if="Field.Label !== void 0"
|
|
16
16
|
>
|
|
17
17
|
<q-tooltip
|
|
18
18
|
v-if="Field.Description"
|
|
@@ -45,14 +45,14 @@
|
|
|
45
45
|
v-else
|
|
46
46
|
popup-content-class="input-field-select-control"
|
|
47
47
|
hide-bottom-space
|
|
48
|
-
|
|
48
|
+
:modelValue="fieldData.value"
|
|
49
|
+
@update:modelValue="setFieldData"
|
|
49
50
|
:options="Field.Options || []"
|
|
50
51
|
option-value="Value"
|
|
51
52
|
option-label="Label"
|
|
52
53
|
map-options
|
|
53
54
|
:label="Field.Placeholder"
|
|
54
55
|
emit-value
|
|
55
|
-
v-bind="$attrs"
|
|
56
56
|
:multiple="Field.Multiple"
|
|
57
57
|
:readonly="Field.ReadOnly"
|
|
58
58
|
:ref="`input_field_validator_${Field.Name || Field.Label}`"
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
<span
|
|
64
64
|
:class="`field-label ${(Field.Label && Field.Label.trim().length)
|
|
65
65
|
? '' : 'field-label-empty'} ${Field.Required ? 'required' : ''}`"
|
|
66
|
-
v-if="
|
|
66
|
+
v-if="Field.Label !== void 0"
|
|
67
67
|
>
|
|
68
68
|
<q-tooltip
|
|
69
69
|
v-if="Field.Description"
|
|
@@ -109,7 +109,7 @@
|
|
|
109
109
|
<span
|
|
110
110
|
:class="`field-label ${(Field.Label && Field.Label.trim().length)
|
|
111
111
|
? '' : 'field-label-empty'} ${Field.Required ? 'required' : ''}`"
|
|
112
|
-
v-if="
|
|
112
|
+
v-if="Field.Label !== void 0"
|
|
113
113
|
>
|
|
114
114
|
<q-tooltip
|
|
115
115
|
v-if="Field.Description"
|
|
@@ -154,12 +154,14 @@
|
|
|
154
154
|
</template>
|
|
155
155
|
|
|
156
156
|
<script>
|
|
157
|
-
import { defineComponent } from 'vue';
|
|
158
|
-
import
|
|
157
|
+
import { ref, computed, defineComponent, getCurrentInstance, watch, watchEffect } from 'vue';
|
|
158
|
+
import { useFreeField, freeFieldProps } from '../composible/useFreeField';
|
|
159
159
|
|
|
160
160
|
export default defineComponent({
|
|
161
161
|
name: 'InputFieldSelect',
|
|
162
|
-
|
|
162
|
+
props: {
|
|
163
|
+
...freeFieldProps,
|
|
164
|
+
},
|
|
163
165
|
emits:['udpate:fieldData', 'input'],
|
|
164
166
|
fieldInfo: {
|
|
165
167
|
Category: 'Simple',
|
|
@@ -238,124 +240,151 @@ export default defineComponent({
|
|
|
238
240
|
},
|
|
239
241
|
],
|
|
240
242
|
},
|
|
241
|
-
|
|
242
|
-
return
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
243
|
+
setup(props, { emit, expose }) {
|
|
244
|
+
if (!props.Field) return () => null;
|
|
245
|
+
|
|
246
|
+
const { proxy:vm } = getCurrentInstance();
|
|
247
|
+
|
|
248
|
+
const { fieldData, getFieldData, setFieldData } = useFreeField(props);
|
|
249
|
+
|
|
250
|
+
const hasError = ref(false);
|
|
251
|
+
const checked = ref([]);
|
|
252
|
+
const dependencies = ref({});
|
|
253
|
+
const selectOptions = ref([]);
|
|
254
|
+
|
|
255
|
+
watchEffect(() => {
|
|
256
|
+
if (Array.isArray(props.Field.Options)) {
|
|
257
|
+
selectOptions.value = props.Field.Options;
|
|
258
|
+
}
|
|
259
|
+
});
|
|
260
|
+
|
|
261
|
+
const readonlyContent = computed(() => {
|
|
262
|
+
if (Array.isArray(props.Field.Options)) {
|
|
250
263
|
let valueList;
|
|
251
|
-
if (
|
|
252
|
-
if (Array.isArray(
|
|
253
|
-
valueList =
|
|
254
|
-
} else if (typeof
|
|
255
|
-
valueList =
|
|
264
|
+
if (props.Field.Multiple) {
|
|
265
|
+
if (Array.isArray(fieldData.value)) {
|
|
266
|
+
valueList = fieldData.value;
|
|
267
|
+
} else if (typeof fieldData.value === 'string') {
|
|
268
|
+
valueList = fieldData.value.split(',');
|
|
256
269
|
}
|
|
257
270
|
} else {
|
|
258
|
-
valueList = [
|
|
271
|
+
valueList = [fieldData.value];
|
|
259
272
|
}
|
|
260
273
|
|
|
261
274
|
const labelList = [];
|
|
262
275
|
(valueList || []).forEach((vl) => {
|
|
263
|
-
const theOpt =
|
|
264
|
-
if (theOpt) labelList.push(theOpt.Label ||
|
|
276
|
+
const theOpt = props.Field.Options.find((opt) => opt.Value === vl);
|
|
277
|
+
if (theOpt) labelList.push(theOpt.Label || fieldData.value);
|
|
265
278
|
});
|
|
266
279
|
|
|
267
280
|
return labelList.join(',');
|
|
268
281
|
}
|
|
269
282
|
|
|
270
|
-
return
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
fieldData() {
|
|
275
|
-
if (
|
|
276
|
-
if (
|
|
277
|
-
|
|
283
|
+
return fieldData.value;
|
|
284
|
+
});
|
|
285
|
+
|
|
286
|
+
|
|
287
|
+
watch(fieldData, () => {
|
|
288
|
+
if (props.Field.AsCheck) {
|
|
289
|
+
if (fieldData.value) {
|
|
290
|
+
checked.value = `${fieldData.value}`.split(',');
|
|
278
291
|
} else {
|
|
279
|
-
|
|
292
|
+
checked.value = [];
|
|
280
293
|
}
|
|
281
294
|
}
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
this.Field.Info.Params = this.Field.Info.Params || '';
|
|
289
|
-
if (this.Field.Info.Params) {
|
|
290
|
-
const paramList = typeof this.Field.Info.Params === 'string' ? this.Field.Info.Params.split(',') : this.Field.Info.Params;
|
|
291
|
-
|
|
292
|
-
for (let i = 0; i < paramList.length; i += 1) {
|
|
293
|
-
if (Object.nestValue(this.data, paramList[i])
|
|
294
|
-
!== Object.nestValue(this.dependencies, paramList[i])) {
|
|
295
|
-
// changed
|
|
296
|
-
this.apiCall();
|
|
297
|
-
return;
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
}
|
|
301
|
-
},
|
|
302
|
-
deep: true,
|
|
303
|
-
immediate: true,
|
|
304
|
-
},
|
|
305
|
-
},
|
|
306
|
-
methods: {
|
|
307
|
-
selfValidate() {
|
|
308
|
-
if (this.Field && this.Field.AsCheck && this.Field.Required) {
|
|
309
|
-
const isValid = this.checked && this.checked.length > 0;
|
|
310
|
-
this.hasError = !isValid;
|
|
295
|
+
});
|
|
296
|
+
|
|
297
|
+
const selfValidate = () => {
|
|
298
|
+
if (props.Field.AsCheck && props.Field.Required) {
|
|
299
|
+
const isValid = checked.value && checked.value.length > 0;
|
|
300
|
+
hasError.value = !isValid;
|
|
311
301
|
return isValid;
|
|
312
302
|
}
|
|
313
303
|
|
|
314
304
|
return true;
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
|
|
305
|
+
};
|
|
306
|
+
|
|
307
|
+
expose ({
|
|
308
|
+
selfValidate,
|
|
309
|
+
})
|
|
310
|
+
|
|
311
|
+
const checkChanged = (v) => {
|
|
312
|
+
selfValidate();
|
|
318
313
|
|
|
319
|
-
if (!
|
|
320
|
-
|
|
314
|
+
if (!props.Field.Multiple) {
|
|
315
|
+
checked.value = [v];
|
|
321
316
|
}
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
|
|
317
|
+
setFieldData(checked.value.join(','));
|
|
318
|
+
emit('input');
|
|
319
|
+
};
|
|
320
|
+
|
|
321
|
+
const apiCall = () => {
|
|
322
|
+
if (!props.Field.Info?.Url) {
|
|
327
323
|
return;
|
|
328
324
|
}
|
|
329
325
|
|
|
330
326
|
const paramObj = {};
|
|
331
|
-
|
|
332
|
-
if (
|
|
333
|
-
if (typeof
|
|
334
|
-
|
|
327
|
+
const params = props.Field.Info.Params || '';
|
|
328
|
+
if (params.length > 0) {
|
|
329
|
+
if (typeof params === 'string') {
|
|
330
|
+
params = params.split(',');
|
|
335
331
|
}
|
|
336
|
-
for (let i = 0; i <
|
|
337
|
-
const param =
|
|
332
|
+
for (let i = 0; i < params.length; i += 1) {
|
|
333
|
+
const param = params[i];
|
|
338
334
|
|
|
339
335
|
if (param) {
|
|
340
|
-
|
|
341
|
-
|
|
336
|
+
paramObj[param] = getFieldData(param);
|
|
337
|
+
dependencies.value[param] = getFieldData(param);
|
|
342
338
|
}
|
|
343
339
|
}
|
|
344
340
|
}
|
|
345
341
|
|
|
346
|
-
|
|
342
|
+
vm.postRequest(props.Field.Info.Url, paramObj).then((d) => {
|
|
347
343
|
if (d && d.msg === 'OK') {
|
|
348
344
|
if (d.data && d.data.options) {
|
|
349
|
-
|
|
350
|
-
if (d.data.options.findIndex((o) => o.Value ===
|
|
351
|
-
|
|
345
|
+
selectOptions.value = d.data.options;
|
|
346
|
+
if (d.data.options.findIndex((o) => o.Value === fieldData.value) < 0) {
|
|
347
|
+
setFieldData(undefined);
|
|
348
|
+
emit('input');
|
|
352
349
|
}
|
|
353
350
|
} else {
|
|
354
|
-
|
|
351
|
+
selectOptions.value = [];
|
|
355
352
|
}
|
|
356
353
|
}
|
|
357
354
|
});
|
|
358
|
-
}
|
|
355
|
+
};
|
|
356
|
+
|
|
357
|
+
watchEffect(() => {
|
|
358
|
+
if (!props.Field.Info?.Url || !props.values) return;
|
|
359
|
+
|
|
360
|
+
const params = props.Field.Info?.Params || '';
|
|
361
|
+
if (params) {
|
|
362
|
+
const paramList = typeof params === 'string' ? params.split(',') : params;
|
|
363
|
+
|
|
364
|
+
for (let i = 0; i < paramList.length; i += 1) {
|
|
365
|
+
if (getFieldData(paramList[i]) !== Object.nestValue(dependencies.value, paramList[i])) {
|
|
366
|
+
// changed
|
|
367
|
+
apiCall();
|
|
368
|
+
return;
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
});
|
|
373
|
+
|
|
374
|
+
return {
|
|
375
|
+
fieldData,
|
|
376
|
+
setFieldData,
|
|
377
|
+
|
|
378
|
+
hasError,
|
|
379
|
+
checked,
|
|
380
|
+
dependencies,
|
|
381
|
+
|
|
382
|
+
selectOptions,
|
|
383
|
+
|
|
384
|
+
readonlyContent,
|
|
385
|
+
|
|
386
|
+
checkChanged,
|
|
387
|
+
};
|
|
359
388
|
},
|
|
360
389
|
});
|
|
361
390
|
</script>
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
<span
|
|
4
4
|
:class="`field-label ${(Field.Label && Field.Label.trim().length)
|
|
5
5
|
? '' : 'field-label-empty'} ${Field.Required ? 'required' : ''}`"
|
|
6
|
-
v-if="
|
|
6
|
+
v-if="Field.Label !== void 0"
|
|
7
7
|
>
|
|
8
8
|
<q-tooltip
|
|
9
9
|
v-if="Field.Description"
|
|
@@ -33,7 +33,6 @@
|
|
|
33
33
|
map-options
|
|
34
34
|
:label="valuesList[index] ? '' : option.Placeholder"
|
|
35
35
|
emit-value
|
|
36
|
-
v-bind="$attrs"
|
|
37
36
|
@input="selectionChanged(index)"
|
|
38
37
|
:ref="`input_field_validator_${index}`"
|
|
39
38
|
></q-select>
|
|
@@ -55,12 +54,14 @@
|
|
|
55
54
|
</template>
|
|
56
55
|
|
|
57
56
|
<script>
|
|
58
|
-
import { defineComponent } from 'vue';
|
|
59
|
-
import
|
|
57
|
+
import { defineComponent, ref, watch, getCurrentInstance, } from 'vue';
|
|
58
|
+
import { useFreeField, freeFieldProps } from '../composible/useFreeField';
|
|
60
59
|
|
|
61
60
|
export default defineComponent({
|
|
62
61
|
name: 'InputFieldSelectChain',
|
|
63
|
-
|
|
62
|
+
props: {
|
|
63
|
+
...freeFieldProps,
|
|
64
|
+
},
|
|
64
65
|
emits:['input'],
|
|
65
66
|
fieldInfo: {
|
|
66
67
|
Category: 'Advanced',
|
|
@@ -77,6 +78,11 @@ export default defineComponent({
|
|
|
77
78
|
Label: '上级数据名',
|
|
78
79
|
Name: 'Options.ParentName',
|
|
79
80
|
},
|
|
81
|
+
{
|
|
82
|
+
Type: 'String',
|
|
83
|
+
Label: '数据名',
|
|
84
|
+
Name: 'Options.DataName',
|
|
85
|
+
},
|
|
80
86
|
{
|
|
81
87
|
Type: 'DynamicList',
|
|
82
88
|
Label: '列',
|
|
@@ -107,92 +113,108 @@ export default defineComponent({
|
|
|
107
113
|
],
|
|
108
114
|
Description: '',
|
|
109
115
|
},
|
|
110
|
-
|
|
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;
|
|
116
|
+
setup(props, { emit }) {
|
|
117
|
+
if (!props.Field) return () => null;
|
|
134
118
|
|
|
135
|
-
|
|
136
|
-
for (let i = 0; i < this.Field.Options.Fields.length; i += 1) {
|
|
137
|
-
const fld = this.Field.Options.Fields[i];
|
|
119
|
+
const { proxy:vm } = getCurrentInstance();
|
|
138
120
|
|
|
139
|
-
|
|
121
|
+
const { fieldData, setFieldData } = useFreeField(props);
|
|
140
122
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
}
|
|
147
|
-
},
|
|
148
|
-
getOptions(index) {
|
|
149
|
-
if (!this.Field || !this.Field.Options || !this.Field.Options.Fields) {
|
|
123
|
+
const optionsList = ref([]);
|
|
124
|
+
const valuesList = ref([]);
|
|
125
|
+
|
|
126
|
+
const getOptions = (index) => {
|
|
127
|
+
if (!props.Field.Options?.Fields) {
|
|
150
128
|
return;
|
|
151
129
|
}
|
|
152
130
|
|
|
153
|
-
if (index > 0 && !
|
|
131
|
+
if (index > 0 && !valuesList.value[index - 1]) return;
|
|
154
132
|
|
|
155
|
-
if(
|
|
133
|
+
if(props.Field.Options?.Url){
|
|
156
134
|
const obj = {};
|
|
157
|
-
obj[
|
|
158
|
-
?
|
|
135
|
+
obj[props.Field.Options.ParentName] = props.Field.Options.Fields[index - 1]
|
|
136
|
+
? valuesList.value.slice(0, index).join('.')
|
|
159
137
|
: '';
|
|
160
138
|
|
|
161
|
-
|
|
162
|
-
if (d && d.msg === 'OK'
|
|
163
|
-
|
|
164
|
-
|
|
139
|
+
vm.getRequest(props.Field.Options.Url, obj).then((d) => {
|
|
140
|
+
if (d && d.msg === 'OK') {
|
|
141
|
+
const dd = props.Field.Options?.DataName ? Object.nestValue(d.data, props.Field.Options.DataName) : d.data;
|
|
142
|
+
|
|
143
|
+
if (Array.isArray(dd)) {
|
|
144
|
+
optionsList.value[index] = dd;
|
|
145
|
+
}
|
|
165
146
|
}
|
|
166
147
|
});
|
|
167
|
-
} else if(
|
|
168
|
-
let parent =
|
|
169
|
-
?
|
|
148
|
+
} else if(props.Field.Options.Data){
|
|
149
|
+
let parent = props.Field.Options.Fields[index - 1]
|
|
150
|
+
? valuesList.value.slice(0, index).join('.')
|
|
170
151
|
: '';
|
|
171
152
|
|
|
172
153
|
parent = parent && parent.split('.');
|
|
173
154
|
parent = parent && parent.pop();
|
|
174
155
|
parent = parent || '';
|
|
175
156
|
|
|
176
|
-
|
|
177
|
-
|
|
157
|
+
optionsList.value[index] = props.Field.Options.Data.filter(dd => dd[props.Field.Options.ParentName] === parent);
|
|
158
|
+
}
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
const initOptions = () => {
|
|
162
|
+
if (optionsList.value.length > 0) return;
|
|
163
|
+
|
|
164
|
+
if (props.Field.Options?.Fields) {
|
|
165
|
+
for (let i = 0; i < props.Field.Options.Fields.length; i += 1) {
|
|
166
|
+
const fld = props.Field.Options.Fields[i];
|
|
167
|
+
|
|
168
|
+
if (fieldData.value) {
|
|
169
|
+
fieldData.value[fld.Name] = fieldData.value[fld.Name] || fld.Default || '';
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
valuesList.value[i] = fieldData.value && fieldData.value[fld.Name];
|
|
173
|
+
if (i === 0 || valuesList.value[i - 1]) {
|
|
174
|
+
getOptions(i);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
178
177
|
}
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
const selectionChanged = (index) => {
|
|
181
|
+
setFieldData(fieldData.value || {});
|
|
182
|
+
|
|
183
|
+
if (index < props.Field.Options?.Fields?.length - 1) {
|
|
184
|
+
for (let i = index + 1; i < props.Field.Options.Fields.length; i += 1) {
|
|
185
|
+
delete valuesList.value[i];
|
|
186
|
+
delete optionsList.value[i];
|
|
187
|
+
fieldData.value[props.Field.Options.Fields[i].Name] = '';
|
|
187
188
|
}
|
|
188
|
-
|
|
189
|
+
getOptions(index + 1);
|
|
189
190
|
}
|
|
190
191
|
|
|
191
|
-
|
|
192
|
+
fieldData.value[props.Field.Options.Fields[index].Name] = valuesList.value[
|
|
192
193
|
index
|
|
193
194
|
];
|
|
194
|
-
|
|
195
|
-
}
|
|
195
|
+
emit('input');
|
|
196
|
+
};
|
|
197
|
+
|
|
198
|
+
watch(fieldData, () => {
|
|
199
|
+
if(typeof fieldData.value === 'undefined'){
|
|
200
|
+
valuesList.value = [];
|
|
201
|
+
}
|
|
202
|
+
initOptions();
|
|
203
|
+
});
|
|
204
|
+
|
|
205
|
+
return {
|
|
206
|
+
fieldData,
|
|
207
|
+
setFieldData,
|
|
208
|
+
initOptions,
|
|
209
|
+
|
|
210
|
+
optionsList,
|
|
211
|
+
valuesList,
|
|
212
|
+
|
|
213
|
+
selectionChanged,
|
|
214
|
+
};
|
|
215
|
+
},
|
|
216
|
+
created() {
|
|
217
|
+
this.initOptions();
|
|
196
218
|
},
|
|
197
219
|
});
|
|
198
220
|
</script>
|
|
@@ -1,26 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
</template>
|
|
4
|
-
|
|
5
|
-
<script>
|
|
6
|
-
import { defineComponent } from 'vue';
|
|
1
|
+
import { defineComponent, h } from 'vue';
|
|
2
|
+
import { QSeparator } from 'quasar';
|
|
7
3
|
|
|
8
4
|
export default defineComponent({
|
|
9
5
|
name: 'InputFieldSeparator',
|
|
10
|
-
props: {
|
|
11
|
-
inset: { type: Boolean, default: true },
|
|
12
|
-
},
|
|
13
6
|
fieldInfo: {
|
|
14
7
|
Category: 'Static',
|
|
15
8
|
Label: '分割线',
|
|
16
9
|
Value: 'Separator',
|
|
17
10
|
Description: '',
|
|
18
11
|
},
|
|
12
|
+
props: {
|
|
13
|
+
inset: { type: Boolean, default: true },
|
|
14
|
+
},
|
|
15
|
+
setup(props){
|
|
16
|
+
return () => h(QSeparator, {
|
|
17
|
+
class: 'input-field-separator',
|
|
18
|
+
inset: props.inset,
|
|
19
|
+
});
|
|
20
|
+
},
|
|
19
21
|
});
|
|
20
|
-
</script>
|
|
21
|
-
|
|
22
|
-
<style lang="sass" scoped>
|
|
23
|
-
.input-field-separator
|
|
24
|
-
height: 1px
|
|
25
|
-
background: $grey-4
|
|
26
|
-
</style>
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
<span
|
|
4
4
|
:class="`field-label ${(Field.Label && Field.Label.trim().length)
|
|
5
5
|
? '' : 'field-label-empty'} ${Field.Required ? 'required' : ''}`"
|
|
6
|
-
v-if="
|
|
6
|
+
v-if="Field.Label !== void 0"
|
|
7
7
|
>
|
|
8
8
|
<q-tooltip
|
|
9
9
|
v-if="Field.Description"
|
|
@@ -34,12 +34,11 @@
|
|
|
34
34
|
</template>
|
|
35
35
|
|
|
36
36
|
<script>
|
|
37
|
-
import { defineComponent } from 'vue';
|
|
38
|
-
import
|
|
37
|
+
import { defineComponent, ref, computed } from 'vue';
|
|
38
|
+
import { useFreeField, freeFieldProps } from '../composible/useFreeField';
|
|
39
39
|
|
|
40
40
|
export default defineComponent({
|
|
41
41
|
name: 'InputFieldSingleList',
|
|
42
|
-
mixins: [mixins.InputFieldMixin],
|
|
43
42
|
fieldInfo: {
|
|
44
43
|
Category: 'Table',
|
|
45
44
|
Label: '单列表',
|
|
@@ -71,27 +70,29 @@ export default defineComponent({
|
|
|
71
70
|
],
|
|
72
71
|
Description: '',
|
|
73
72
|
},
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
tableData: [],
|
|
77
|
-
};
|
|
73
|
+
props: {
|
|
74
|
+
...freeFieldProps,
|
|
78
75
|
},
|
|
79
|
-
|
|
80
|
-
|
|
76
|
+
setup(props) {
|
|
77
|
+
if (!props.Field) return () => null;
|
|
78
|
+
|
|
79
|
+
const { fieldData } = useFreeField(props);
|
|
80
|
+
|
|
81
|
+
const localData = computed(() => {
|
|
81
82
|
let list = [];
|
|
82
|
-
if (
|
|
83
|
-
if (Array.isArray(
|
|
84
|
-
list =
|
|
85
|
-
} else if (typeof
|
|
86
|
-
const newStr =
|
|
83
|
+
if (fieldData.value !== void 0 && fieldData.value !== '') {
|
|
84
|
+
if (Array.isArray(fieldData.value)) {
|
|
85
|
+
list = fieldData.value;
|
|
86
|
+
} else if (typeof fieldData.value === 'string') {
|
|
87
|
+
const newStr = fieldData.value.replace(/,/g, ',');
|
|
87
88
|
list = newStr.split(',');
|
|
88
89
|
} else {
|
|
89
|
-
list = [
|
|
90
|
+
list = [fieldData.value];
|
|
90
91
|
}
|
|
91
92
|
}
|
|
92
93
|
|
|
93
|
-
if (
|
|
94
|
-
if (
|
|
94
|
+
if (props.Field.Options) {
|
|
95
|
+
if (props.Field.Options.NoSpace) {
|
|
95
96
|
for (let i = 0; i < list.length; i += 1) {
|
|
96
97
|
const l = list[i];
|
|
97
98
|
|
|
@@ -101,11 +102,11 @@ export default defineComponent({
|
|
|
101
102
|
}
|
|
102
103
|
}
|
|
103
104
|
|
|
104
|
-
if (
|
|
105
|
+
if (props.Field.Options.NoEmpty) {
|
|
105
106
|
list = list.filter((l) => !!l);
|
|
106
107
|
}
|
|
107
108
|
|
|
108
|
-
if (
|
|
109
|
+
if (props.Field.Options.NoDup) {
|
|
109
110
|
const newList = [];
|
|
110
111
|
for (let i = 0; i < list.length; i += 1) {
|
|
111
112
|
const l = list[i];
|
|
@@ -119,7 +120,12 @@ export default defineComponent({
|
|
|
119
120
|
}
|
|
120
121
|
|
|
121
122
|
return list;
|
|
122
|
-
}
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
return {
|
|
127
|
+
localData,
|
|
128
|
+
};
|
|
123
129
|
},
|
|
124
130
|
});
|
|
125
131
|
</script>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { defineComponent, h } from 'vue';
|
|
2
|
+
import { useFreeField, freeFieldProps } from '../composible/useFreeField';
|
|
3
|
+
|
|
4
|
+
export default defineComponent({
|
|
5
|
+
name: 'InputFieldStatic',
|
|
6
|
+
fieldInfo: {
|
|
7
|
+
Category: 'Static',
|
|
8
|
+
Label: '固定内容',
|
|
9
|
+
Value: 'Static',
|
|
10
|
+
Description: '',
|
|
11
|
+
},
|
|
12
|
+
props: {
|
|
13
|
+
...freeFieldProps,
|
|
14
|
+
},
|
|
15
|
+
setup(props, { slots }){
|
|
16
|
+
if (!props.Field) return {};
|
|
17
|
+
|
|
18
|
+
const { fieldData } = useFreeField(props);
|
|
19
|
+
|
|
20
|
+
return () => h('div', {
|
|
21
|
+
class: 'input-field-static',
|
|
22
|
+
}, [
|
|
23
|
+
slots.warning && slots.warning(),
|
|
24
|
+
fieldData.value,
|
|
25
|
+
]);
|
|
26
|
+
},
|
|
27
|
+
});
|