antd Upload的使用


  //導入模版
  handleUploadFile = info => {
    const { status, response } = info.file;
    const { pageIndex, pageSize, queryValue } = this.state
    if ( status === 'done' ) {
      defaultHandleResponse( response, () => {
        message.success(formatMessage({ id: 'COMMON_IMPORT_SUCCESS', defaultMessage: '導入成功' }));
        this.getQuery( queryValue, pageIndex, pageSize)
      });
    }
    this.setState({ uploadFileLoading: status === 'uploading' });
  };

//////////////////////////////////////////////////////////////////////////////////
          {/* 模版導入 */}
          <Upload
            name="file"
            action={"smartsafe/DatColWhiteListController/uploadTemplate"}
            headers={{ 'signature-sessionId': window.name }}
            accept=".csv"
            showUploadList={false}
            onChange={this.handleUploadFile}
            beforeUpload={() => {
              this.setState({ uploadFileLoading: true });
            }}
          >
          <Button type="default" className={styles.buttonUpload }>
           <MyIcon type="iconxiazai1x" />
            {formatMessage({ id: 'import.by.template', defaultMessage: '模板導入' })}
          </Button>
          </Upload>

  


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM