From 7a5502884c004b829bf881dc304215a16755de6c Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期二, 01 十一月 2022 14:21:04 +0800
Subject: [PATCH] 2022-11-01

---
 src/menu/components/table/base-table/columns/index.jsx |   28 +++++++++++++++++++++++++---
 1 files changed, 25 insertions(+), 3 deletions(-)

diff --git a/src/menu/components/table/base-table/columns/index.jsx b/src/menu/components/table/base-table/columns/index.jsx
index 8f97633..cc47ae6 100644
--- a/src/menu/components/table/base-table/columns/index.jsx
+++ b/src/menu/components/table/base-table/columns/index.jsx
@@ -2,7 +2,7 @@
 import PropTypes from 'prop-types'
 import { is, fromJS } from 'immutable'
 import { DndProvider, DragSource, DropTarget } from 'react-dnd'
-import { Table, Popover, Modal, message } from 'antd'
+import { Table, Popover, Modal, message, notification } from 'antd'
 import { PlusOutlined, EditOutlined, CopyOutlined, DeleteOutlined, FontColorsOutlined, CloseCircleOutlined, AntDesignOutlined } from '@ant-design/icons'
 
 import asyncComponent from '@/utils/asyncComponent'
@@ -371,8 +371,8 @@
     }
   }
 
-  submitCol = (col) => {
-    const { card } = this.state
+  submitCol = (col, resolve) => {
+    const { card, columns } = this.state
 
     col.uuid = card.uuid
     col.isSub = card.isSub === true
@@ -386,6 +386,28 @@
       col.elements = card.type === 'action' ? (card.elements || []) : []
     }
 
+    if (!col.field || col.isSub) {
+      resolve()
+    } else {
+      let _cols = []
+      columns.forEach(c => {
+        if (c.field && col.uuid !== c.uuid) {
+          _cols.push(c.field.toLowerCase())
+        }
+      })
+
+      if (_cols.includes(col.field.toLowerCase())) {
+        notification.warning({
+          top: 92,
+          message: '瀛楁宸插瓨鍦紒',
+          duration: 5
+        })
+        return
+      } else {
+        resolve()
+      }
+    }
+
     this.setState({card: null})
     this.updateCol(col)
   }

--
Gitblit v1.8.0