king
2020-08-11 ae6ce73e7abde1121a788f884e54ccd6cfad0460
src/tabviews/zshare/actionList/excelInbutton/excelin/index.jsx
@@ -7,9 +7,9 @@
class ExcelIn extends Component {
  static propTpyes = {
    btn: PropTypes.object,        // 按钮信息
    MenuID: PropTypes.string,     // 菜单ID
    returndata: PropTypes.func    // 获取返回数据
    btn: PropTypes.object,         // 按钮信息
    returndata: PropTypes.func,    // 获取返回数据
    triggerExcelIn: PropTypes.func // 修改上传状态
  }
  state = {
@@ -18,7 +18,7 @@
  exceltrigger = () => {
    const { excelId } = this.state
    let _excelInput = document.getElementById(excelId + this.props.MenuID)
    let _excelInput = document.getElementById(excelId)
    
    if (_excelInput) {
      _excelInput.click()
@@ -34,6 +34,7 @@
    const { files } = file.target
    const fileReader = new FileReader()
    this.props.triggerExcelIn()
    fileReader.onload = event => {
      try {
        const { result } = event.target
@@ -46,7 +47,7 @@
          errors = 'notexit'
        } else if (range === 1) {
          let header = XLSX.utils.sheet_to_json(workbook.Sheets[btn.verify.sheet], {header: columns})[0]
          if (!header) {
            errors = 'empty'
          } else {
@@ -88,7 +89,7 @@
        })
        notification.warning({
          top: 92,
          message: '文件解析错误,请检查文件格式!',
          message: '文件解析错误!',
          duration: 5
        })
        // 错误传递
@@ -103,7 +104,7 @@
  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} type='file' accept='.xlsx, .xls' onAbort={this.onImportExcel} onChange={this.onImportExcel} /> : null}
      </span>
    )
  }