| | |
| | | import React, {Component} from 'react' |
| | | import { fromJS } from 'immutable' |
| | | import { Table, Input, Popconfirm, Form } from 'antd' |
| | | import { ArrowUpOutlined, ArrowDownOutlined, PlusOutlined, DeleteOutlined } from '@ant-design/icons' |
| | | import Utils from '@/utils/utils.js' |
| | |
| | | this.setState({ |
| | | dataSource: _data |
| | | }) |
| | | |
| | | this.props.onChange(fromJS(_data).toJS()) |
| | | } |
| | | |
| | | handleDelete = key => { |
| | | const dataSource = [...this.state.dataSource] |
| | | this.setState({ dataSource: dataSource.filter(item => item.key !== key) }) |
| | | const dataSource = [...this.state.dataSource].filter(item => item.key !== key) |
| | | this.setState({ dataSource: dataSource }) |
| | | this.props.onChange(fromJS(dataSource).toJS()) |
| | | } |
| | | |
| | | handleAdd = () => { |
| | |
| | | Value: `${count}`, |
| | | Text: `${count}` |
| | | } |
| | | let list = [...dataSource, newData] |
| | | |
| | | this.setState({ |
| | | dataSource: [...dataSource, newData], |
| | | dataSource: list, |
| | | count: count + 1 |
| | | }) |
| | | this.props.onChange(fromJS(list).toJS()) |
| | | } |
| | | |
| | | handleSave = row => { |
| | |
| | | ...row |
| | | }) |
| | | this.setState({ dataSource: newData }) |
| | | } |
| | | |
| | | UNSAFE_componentWillReceiveProps () { |
| | | |
| | | this.props.onChange(fromJS(newData).toJS()) |
| | | } |
| | | |
| | | render() { |