From 02b9e988b456c4e7d7f077c613fcc1092d93803f Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期三, 29 九月 2021 19:02:43 +0800 Subject: [PATCH] 2021-09-29 --- src/menu/components/form/normal-form/index.jsx | 30 +++++++++--------------------- 1 files changed, 9 insertions(+), 21 deletions(-) diff --git a/src/menu/components/form/normal-form/index.jsx b/src/menu/components/form/normal-form/index.jsx index 4444f91..14b0bce 100644 --- a/src/menu/components/form/normal-form/index.jsx +++ b/src/menu/components/form/normal-form/index.jsx @@ -282,6 +282,14 @@ this.props.updateConfig(card) } + plusFields = (items) => { + let _group = fromJS(this.state.group).toJS() + + _group.fields.push(...items) + + this.updateGroup(_group) + } + changecols = (type) => { let card = fromJS(this.state.card).toJS() let config = fromJS(this.state.group).toJS() @@ -504,13 +512,10 @@ this.formRef.handleConfirm().then(res => { let _config = fromJS(this.state.group).toJS() let fieldrepet = false // 瀛楁閲嶅 - let labelrepet = false // 鎻愮ず鏂囧瓧閲嶅 _config.fields = _config.fields.map(item => { if (item.uuid !== res.uuid && res.field && item.field && item.field.toLowerCase() === res.field.toLowerCase()) { fieldrepet = true - } else if (res.label && item.uuid !== res.uuid && item.label === res.label) { - labelrepet = true } if (item.uuid === res.uuid) { @@ -524,13 +529,6 @@ notification.warning({ top: 92, message: '瀛楁宸插瓨鍦紒', - duration: 10 - }) - return - } else if (labelrepet) { - notification.warning({ - top: 92, - message: '鍚嶇О宸插瓨鍦紒', duration: 10 }) return @@ -586,13 +584,10 @@ pasteForm = (res) => { let _config = fromJS(this.state.group).toJS() let fieldrepet = false // 瀛楁閲嶅 - let labelrepet = false // 鎻愮ず鏂囧瓧閲嶅 _config.fields.forEach(item => { if (res.field && item.field && item.field.toLowerCase() === res.field.toLowerCase()) { fieldrepet = true - } else if (res.label && item.label === res.label) { - labelrepet = true } }) @@ -600,13 +595,6 @@ notification.warning({ top: 92, message: '瀛楁宸插瓨鍦紒', - duration: 10 - }) - return - } else if (labelrepet) { - notification.warning({ - top: 92, - message: '鍚嶇О宸插瓨鍦紒', duration: 10 }) return @@ -671,7 +659,7 @@ /> {group ? <div className="form-area"> <Icon className="plus" title="娣诲姞琛ㄥ崟" onClick={this.addForm} type="plus" /> - <FieldsComponent config={group} type="form" updatefield={this.updateGroup} /> + <FieldsComponent config={group} type="form" plusFields={this.plusFields} /> <Switch checkedChildren={dict['model.switch.open']} unCheckedChildren={dict['model.switch.close']} defaultChecked={this.state.showField} onChange={(val) => this.setState({showField: val})} /> {appType !== 'mob' ? <Button className="mk-cols-change" onClick={() => this.changecols(1)}>1鍒�</Button> : null} {appType !== 'mob' ? <Button className="mk-cols-change" onClick={() => this.changecols(2)}>2鍒�</Button> : null} -- Gitblit v1.8.0