king
2022-11-01 7a5502884c004b829bf881dc304215a16755de6c
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)
  }