| | |
| | | import PropTypes from 'prop-types' |
| | | import { is, fromJS } from 'immutable' |
| | | import { DndProvider, DragSource, DropTarget } from 'react-dnd' |
| | | import { Table, Input, Popconfirm, Form, notification } from 'antd' |
| | | import { Table, Input, Popconfirm, Form, notification, message } from 'antd' |
| | | import { PlusOutlined, EditOutlined, DeleteOutlined, SwapOutlined } from '@ant-design/icons' |
| | | |
| | | import Utils from '@/utils/utils.js' |
| | |
| | | {editing ? ( |
| | | <Form.Item style={{ margin: '0 -5px 0 -5px' }}> |
| | | {getFieldDecorator(dataIndex, { |
| | | rules: [ |
| | | { |
| | | required: dataIndex === '$value', |
| | | message: `Please Input ${title}!`, |
| | | }, |
| | | ], |
| | | // rules: [ |
| | | // { |
| | | // required: dataIndex === '$value', |
| | | // message: `Please Input ${title}!`, |
| | | // }, |
| | | // ], |
| | | initialValue: _val, |
| | | })(this.getInput(form))} |
| | | </Form.Item> |
| | |
| | | } |
| | | |
| | | onSave = (record) => { |
| | | const { type } = this.props |
| | | const newData = [...this.state.data] |
| | | const index = newData.findIndex(item => record.key === item.key) |
| | | |
| | | if (type === 'link') { |
| | | if (newData.filter(m => record.key !== m.key && record.$value === m.$value && record.ParentID === m.ParentID).length > 0) { |
| | | message.warning('相同ParentID下,此Value值已存在!') |
| | | } |
| | | } else { |
| | | if (newData.filter(m => record.key !== m.key && record.$value === m.$value).length > 0) { |
| | | message.warning('此Value值已存在!') |
| | | } |
| | | } |
| | | |
| | | if (index > -1) { |
| | | newData.splice(index, 1, record) |
| | | this.setState({ data: newData, editingKey: '' }, () => { |
| | |
| | | } |
| | | |
| | | save(form, key) { |
| | | const { type } = this.props |
| | | |
| | | form.validateFields((error, row) => { |
| | | if (error) { |
| | | return; |
| | |
| | | |
| | | const newData = [...this.state.data] |
| | | const index = newData.findIndex(item => key === item.key) |
| | | |
| | | if (type === 'link') { |
| | | if (newData.filter(m => key !== m.key && row.$value === m.$value && row.ParentID === m.ParentID).length > 0) { |
| | | message.warning('相同ParentID下,此Value值已存在!') |
| | | } |
| | | } else { |
| | | if (newData.filter(m => key !== m.key && row.$value === m.$value).length > 0) { |
| | | message.warning('此Value值已存在!') |
| | | } |
| | | } |
| | | |
| | | if (index > -1) { |
| | | const item = newData[index] |
| | | newData.splice(index, 1, { |