From 4c6bdfe1f3557e49a315c1564bcb6164c0bc7faa Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期五, 03 四月 2020 18:27:22 +0800
Subject: [PATCH] 2020-04-03

---
 src/templates/subtableconfig/index.jsx |   52 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 52 insertions(+), 0 deletions(-)

diff --git a/src/templates/subtableconfig/index.jsx b/src/templates/subtableconfig/index.jsx
index 48fb0fa..1d4e75b 100644
--- a/src/templates/subtableconfig/index.jsx
+++ b/src/templates/subtableconfig/index.jsx
@@ -496,13 +496,39 @@
           })
         }
 
+        let fieldrepet = false // 瀛楁閲嶅
+        let labelrepet = false // 鎻愮ず鏂囧瓧閲嶅
+
         let _search = config.search.map(item => {
+          if (item.uuid !== res.uuid && item.field === res.field) {
+            fieldrepet = true
+          } else if (item.uuid !== res.uuid && item.field && item.label === res.label) {
+            labelrepet = true
+          }
+
           if (item.uuid === res.uuid) {
             return res
           } else {
             return item
           }
         })
+
+        if (fieldrepet) {
+          notification.warning({
+            top: 92,
+            message: '瀛楁宸插瓨鍦紒',
+            duration: 10
+          })
+          return
+        } else if (labelrepet) {
+          notification.warning({
+            top: 92,
+            message: '鍚嶇О宸插瓨鍦紒',
+            duration: 10
+          })
+          return
+        }
+
         _search = _search.filter(item => !item.origin)
 
         this.setState({
@@ -610,13 +636,39 @@
       })
     } else if (modaltype === 'columns' || modaltype === 'colspan') {
       this.columnFormRef.handleConfirm().then(res => {
+        let fieldrepet = false // 瀛楁閲嶅
+        let labelrepet = false // 鎻愮ず鏂囧瓧閲嶅
+
         let _columns = config.columns.map(item => {
+          if (item.uuid !== res.uuid && item.field === res.field) {
+            fieldrepet = true
+          } else if (item.uuid !== res.uuid && item.field && item.label === res.label) {
+            labelrepet = true
+          }
+
           if (item.uuid === res.uuid) {
             return res
           } else {
             return item
           }
         })
+
+        if (fieldrepet) {
+          notification.warning({
+            top: 92,
+            message: '瀛楁宸插瓨鍦紒',
+            duration: 10
+          })
+          return
+        } else if (labelrepet) {
+          notification.warning({
+            top: 92,
+            message: '鍚嶇О宸插瓨鍦紒',
+            duration: 10
+          })
+          return
+        }
+
         _columns = _columns.filter(item => !item.origin)
 
         this.setState({

--
Gitblit v1.8.0