king
2022-11-07 af6486b3629d23e426ce85b87dbc20dfa15b1afe
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'
@@ -313,6 +313,10 @@
      let config = {...this.props.config, cols: _columns}
      if (btn) {
        config.action = config.action.filter(item => item.uuid !== btn.uuid)
        setTimeout(() => {
          MKEmitter.emit('revert', config.uuid)
        }, 200)
      }
      this.props.updatecolumn(config)
@@ -371,8 +375,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 +390,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)
  }