From 5515a793e08f2c9f0c8116960d3043f5bd32ccad Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期二, 15 六月 2021 11:07:02 +0800
Subject: [PATCH] 2021-06-15

---
 src/menu/components/form/normal-form/index.jsx |   44 +++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 43 insertions(+), 1 deletions(-)

diff --git a/src/menu/components/form/normal-form/index.jsx b/src/menu/components/form/normal-form/index.jsx
index 7ccde07..7c7771e 100644
--- a/src/menu/components/form/normal-form/index.jsx
+++ b/src/menu/components/form/normal-form/index.jsx
@@ -450,6 +450,7 @@
     group.fields = group.fields.filter(item => !item.focus)
 
     this.setState({group, visible: false, editform: null})
+    this.updateGroup(group)
   }
 
   /**
@@ -622,6 +623,47 @@
     })
   }
 
+  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
+      }
+    })
+
+    if (fieldrepet) {
+      notification.warning({
+        top: 92,
+        message: '瀛楁宸插瓨鍦紒',
+        duration: 10
+      })
+      return
+    } else if (labelrepet) {
+      notification.warning({
+        top: 92,
+        message: '鍚嶇О宸插瓨鍦紒',
+        duration: 10
+      })
+      return
+    }
+    _config.fields.push(res)
+
+    this.updateGroup(_config)
+
+    this.handleForm(res)
+
+    notification.success({
+      top: 92,
+      message: '绮樿创鎴愬姛锛�',
+      duration: 2
+    })
+  }
+
   clickComponent = (e) => {
     if (sessionStorage.getItem('style-control') === 'true' || sessionStorage.getItem('style-control') === 'component') {
       e.stopPropagation()
@@ -639,7 +681,7 @@
             <Icon className="plus" title="娣诲姞鍒嗙粍" onClick={this.addCard} type="plus" />
             <WrapComponent config={card} updateConfig={this.updateComponent} />
             <CopyComponent type="propcard" card={card}/>
-            <PasteComponent config={card} options={['cardcell']} updateConfig={this.updateComponent} />
+            <PasteComponent config={card} options={['form']} updateConfig={this.pasteForm} />
             <Icon className="style" title="璋冩暣鏍峰紡" onClick={this.changeStyle} type="font-colors" />
             <UserComponent config={card}/>
             <Icon className="close" title="鍒犻櫎缁勪欢" type="delete" onClick={() => this.props.deletecomponent(card.uuid)} />

--
Gitblit v1.8.0