| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { is, fromJS } from 'immutable' |
| | | import { Table, Modal, Input, InputNumber, notification, message } from 'antd' |
| | | // import { EditOutlined } from '@ant-design/icons' |
| | | import { Table, Modal, Input, InputNumber, notification, message, AutoComplete } from 'antd' |
| | | |
| | | import Api from '@/api' |
| | | import Utils from '@/utils/utils.js' |
| | |
| | | this.setState({value: val}) |
| | | } |
| | | |
| | | complete = (key, option) => { |
| | | this.setState({value: option.props.value}) |
| | | } |
| | | |
| | | render() { |
| | | let { col, record, className } = this.props |
| | | const { editing } = this.state |
| | |
| | | colSpan = 2 |
| | | } else { |
| | | if (editing) { |
| | | children = <Input.TextArea id={col.uuid + record.uuid} autoSize={false} defaultValue={val} onChange={(e) => this.onChange(e.target.value)} onPressEnter={this.enterPress} onBlur={this.onBlur}/> |
| | | let options = ['现金', '发票'] |
| | | children = <AutoComplete |
| | | dataSource={options.map((cell, i) => <AutoComplete.Option value={cell} key={i}> |
| | | {cell} |
| | | </AutoComplete.Option>)} |
| | | filterOption={(input, option) => option.props.children.indexOf(input) > -1} |
| | | onSelect={this.complete} |
| | | defaultValue={val} |
| | | onChange={(val) => this.onChange(val)} |
| | | defaultOpen={true} |
| | | > |
| | | <Input.TextArea id={col.uuid + record.uuid} autoSize={false} defaultValue={val} onPressEnter={this.enterPress} onBlur={this.onBlur}/> |
| | | </AutoComplete> |
| | | } else { |
| | | children = <div className="content-wrap" onClick={this.focus}>{val}</div> |
| | | } |