From 54d01e6ef9ac31f10de4a0e92824eba50b77eda6 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期一, 27 九月 2021 18:40:51 +0800
Subject: [PATCH] 2021-09-27

---
 src/mob/modalconfig/index.jsx |   32 +++++++++++---------------------
 1 files changed, 11 insertions(+), 21 deletions(-)

diff --git a/src/mob/modalconfig/index.jsx b/src/mob/modalconfig/index.jsx
index 29c8e42..23be59f 100644
--- a/src/mob/modalconfig/index.jsx
+++ b/src/mob/modalconfig/index.jsx
@@ -91,8 +91,6 @@
     let _config = fromJS(this.state.config).toJS()
 
     if (list.length > _config.fields.length) {
-      _config.fields = list.filter(item => !item.origin)
-
       this.setState({
         config: _config
       }, () => {
@@ -195,13 +193,10 @@
     this.formRef.handleConfirm().then(res => {
       let _config = fromJS(this.state.config).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) {
@@ -218,16 +213,7 @@
           duration: 10
         })
         return
-      } else if (labelrepet) {
-        notification.warning({
-          top: 92,
-          message: '鍚嶇О宸插瓨鍦紒',
-          duration: 10
-        })
-        return
       }
-
-      _config.fields = _config.fields.filter(item => !item.origin)
 
       if (['select', 'multiselect', 'link', 'checkbox', 'radio', 'checkcard'].includes(res.type) && res.resourceType === '1' && /\s/.test(res.dataSource)) {
         this.setState({
@@ -369,9 +355,17 @@
   /**
    * @description 鏇存柊
    */
-  updateConfig = (config) => {
+  plusFields = (items) => {
+    let _config = fromJS(this.state.config).toJS()
+
+    _config.fields.push(...items)
+
     this.setState({
-      config
+      config: _config
+    }, () => {
+      if (items.length === 1 && items[0].focus) {
+        this.handleForm(items[0])
+      }
     })
   }
 
@@ -397,11 +391,7 @@
                     return (<SourceElement key={index} content={item}/>)
                   })}
                 </div>
-                <FieldsComponent
-                  config={config}
-                  type="form"
-                  updatefield={this.updateConfig}
-                />
+                <FieldsComponent config={config} type="form" plusFields={this.plusFields}/>
               </Panel>
             </Collapse>
           </div>

--
Gitblit v1.8.0