@@ -417,16 +417,16 @@ export default {
417
417
}
418
418
419
419
// 隐藏属性
420
- Object .keys (desc[field]).forEach (key => {
421
- if (key .startsWith (' _' )) {
422
- Object .defineProperty (desc[field], key, {
423
- enumerable: false ,
424
- writable: true ,
425
- configurable: true ,
426
- value: desc[field][key]
427
- })
428
- }
429
- })
420
+ // Object.keys(desc[field]).forEach(key => {
421
+ // if (key.startsWith('_')) {
422
+ // Object.defineProperty(desc[field], key, {
423
+ // enumerable: false,
424
+ // writable: true,
425
+ // configurable: true,
426
+ // value: desc[field][key]
427
+ // })
428
+ // }
429
+ // })
430
430
})
431
431
return desc
432
432
}
@@ -553,13 +553,15 @@ export default {
553
553
let type = formItem .type
554
554
if (typeof formItem .type === ' function' ) {
555
555
type = this .getComponentName (formItem .type (formData))
556
- if (formItem ._type && formItem ._type !== type) {
556
+
557
+ // 是否需要载入旧数据
558
+ if (formItem .isTypeChangeReloadValue !== false && formItem ._type && formItem ._type !== type) {
557
559
// 保存老数据
558
- this .computedFormDesc [field][' _oldValue' ][' type-' + type ] =
560
+ this .computedFormDesc [field][' _oldValue' ][' type-' + formItem . _type ] =
559
561
formData[field]
560
562
// 并获取新类型的数据
561
563
const newVal =
562
- formItem[' _oldValue' ][' type-' + formItem . _type ] || null
564
+ formItem[' _oldValue' ][' type-' + type ] || null
563
565
this .setValue (field, newVal)
564
566
}
565
567
} else {
@@ -698,7 +700,7 @@ export default {
698
700
this .$set (this .computedFormDesc [field], ' _options' , newOptions)
699
701
700
702
// 判断是否需要重置值
701
- if (reloadOptions && oldOptions !== undefined ) {
703
+ if (this . computedFormDesc [field]. isOptionsChangeReloadValue !== false && reloadOptions && oldOptions !== undefined ) {
702
704
const newOptionValues = new Set (
703
705
Array .isArray (newOptions) ? newOptions .map (item => item .value ) : []
704
706
)
0 commit comments