From a3d64171508d15e2730a1bf1a152676a3d9f12ef Mon Sep 17 00:00:00 2001 From: catchonme Date: Tue, 14 May 2019 10:09:36 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dcombo=E6=8F=90=E4=BA=A4?= =?UTF-8?q?=E9=AA=8C=E8=AF=81=E5=A4=B1=E8=B4=A5=E5=90=8E=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=EF=BC=8C=E5=8F=AA=E9=AA=8C=E8=AF=81=E5=BD=93=E5=89=8Ditem?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/renderers/Form/Control.tsx | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/renderers/Form/Control.tsx b/src/renderers/Form/Control.tsx index ffcaea7d..febd9289 100644 --- a/src/renderers/Form/Control.tsx +++ b/src/renderers/Form/Control.tsx @@ -9,7 +9,8 @@ import { } from '../../factory'; import { ComboStore, - IComboStore + IComboStore, + IUniqueGroup } from '../../store/combo'; import { anyChanged, @@ -302,11 +303,15 @@ export default class FormControl extends React.Component } = this.props; if (this.model) { - this.model.validate(this.hook); - - // 可能出现同名的表单项 - form.getItemsByName(this.model.name) - .forEach(item => item !== this.model && item.validate()) + if (form.parentStore && form.parentStore.storeType === 'ComboStore') { + const combo = form.parentStore as IComboStore; + const group = combo.uniques.get(this.model.name) as IUniqueGroup; + group.items.forEach(item => item.validate()); + } else { + this.model.validate(this.hook); + form.getItemsByName(this.model.name) + .forEach(item => item !== this.model && item.validate()) + } } } From a14efce20a3f9e7272daf1997578ad0d4858d231 Mon Sep 17 00:00:00 2001 From: catchonme Date: Tue, 14 May 2019 10:34:15 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dcombo=E9=AA=8C=E8=AF=81?= =?UTF-8?q?=E5=94=AF=E4=B8=80=E5=80=BC=E6=97=B6=EF=BC=8C=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E9=9D=9E=E5=94=AF=E4=B8=80=E5=80=BC=E6=8A=A5=E9=94=99=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/renderers/Form/Control.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/renderers/Form/Control.tsx b/src/renderers/Form/Control.tsx index febd9289..36a30d69 100644 --- a/src/renderers/Form/Control.tsx +++ b/src/renderers/Form/Control.tsx @@ -306,7 +306,7 @@ export default class FormControl extends React.Component if (form.parentStore && form.parentStore.storeType === 'ComboStore') { const combo = form.parentStore as IComboStore; const group = combo.uniques.get(this.model.name) as IUniqueGroup; - group.items.forEach(item => item.validate()); + group && group.items.forEach(item => item.validate()); } else { this.model.validate(this.hook); form.getItemsByName(this.model.name)