| | |
| | | |
| | | class ExcelIn extends Component { |
| | | static propTpyes = { |
| | | btn: PropTypes.object, // 按钮信息 |
| | | MenuID: PropTypes.string, // 菜单ID |
| | | returndata: PropTypes.func // 获取返回数据 |
| | | btn: PropTypes.object, // 按钮信息 |
| | | MenuID: PropTypes.string, // 菜单ID |
| | | returndata: PropTypes.func, // 获取返回数据 |
| | | triggerExcelIn: PropTypes.func // 修改上传状态 |
| | | } |
| | | |
| | | state = { |
| | |
| | | const { files } = file.target |
| | | const fileReader = new FileReader() |
| | | |
| | | this.props.triggerExcelIn() |
| | | fileReader.onload = event => { |
| | | try { |
| | | const { result } = event.target |
| | |
| | | render() { |
| | | return ( |
| | | <span> |
| | | {this.state.excelId ? <input className="excel-in-input" id={this.state.excelId + this.props.MenuID} type='file' accept='.xlsx, .xls' onChange={this.onImportExcel} /> : null} |
| | | {this.state.excelId ? <input className="excel-in-input" id={this.state.excelId + this.props.MenuID} type='file' accept='.xlsx, .xls' onAbort={this.onImportExcel} onChange={this.onImportExcel} /> : null} |
| | | </span> |
| | | ) |
| | | } |