diff --git a/src/components/form-render/index.vue b/src/components/form-render/index.vue index e7fb9e7..3d726b8 100644 --- a/src/components/form-render/index.vue +++ b/src/components/form-render/index.vue @@ -484,7 +484,19 @@ getFieldValue(fieldName) { //单个字段获取值 let fieldRef = this.getWidgetRef(fieldName) if (!!fieldRef && !!fieldRef.getValue) { - fieldRef.getValue() + return fieldRef.getValue() + } + + if (!fieldRef) { //如果是子表单字段 + let result = [] + this.findWidgetNameInSubForm(fieldName).forEach(wn => { + let sw = this.getWidgetRef(wn) + if (!!sw && !!sw.getValue) { + result.push( sw.getValue() ) + } + }) + + return result } }, @@ -493,6 +505,15 @@ if (!!fieldRef && !!fieldRef.setValue) { fieldRef.setValue(fieldValue) } + + if (!fieldRef) { //如果是子表单字段 + this.findWidgetNameInSubForm(fieldName).forEach(wn => { + let sw = this.getWidgetRef(wn) + if (!!sw && !!sw.setValue) { + sw.setValue(fieldValue) + } + }) + } }, getSubFormValues(subFormName, needValidation = true) {