daily pastebin goal
42%
SHARE
TWEET

Untitled

a guest Jul 17th, 2017 52 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import React, { Component, PropTypes } from 'react';
  2. import AdmindataService from '../services/AdmindataService'
  3.  
  4.  
  5. import ImportFileV2 from "./importFileV2";
  6. import TransactionImportV1 from "./TransactionImportV1";
  7.  
  8. class ImportShop extends Component {
  9.  
  10.  
  11.     constructor(props){
  12.         super(props)
  13.  
  14.         this.state = {
  15.             fileName : "",
  16.             rowAll: 0,
  17.             rowImport: 0,
  18.             rowError : 0,
  19.             start : "",
  20.             status: "",
  21.             intervalId:0
  22.         }
  23.  
  24.         this.getUploadTransaction = this.getUploadTransaction.bind(this)
  25.  
  26.         this.getUploadTransaction
  27.     }
  28.  
  29.     componentDidMount(){
  30.         let intervalId = setInterval(this.getUploadTransaction,10000);
  31.         this.setState({intervalId: intervalId});
  32.     }
  33.     componentWillUnmount(){
  34.         clearInterval(this.state.intervalId);
  35.     }
  36.  
  37.     getUploadTransaction(){
  38.         AdmindataService.getTransactionUpload(this,"uploadShop")
  39.     }
  40.  
  41.     setUploadTransaction(response) {
  42.  
  43.         this.setState({
  44.             fileName : response.data.fileName,
  45.             rowAll: response.data.rowAll,
  46.             rowImport: response.data.rowSuccess,
  47.             rowError : response.data.rowError,
  48.             start : response.data.start,
  49.             status: response.data.status
  50.         })
  51.  
  52.     }
  53.  
  54.     render() {
  55.  
  56.         return (
  57.  
  58.             /*<ImportFile title="shop" url ="webAdmin/upload/shop" titleHead ="Shop"/>*/
  59.             <div>
  60.                 <ImportFileV2 title="shop" url ="webAdmin/upload/shop" titleHead ="Shop"/>
  61.                 <TransactionImportV1 fileName={this.state.fileName}
  62.                                      rowAll={this.state.rowAll}
  63.                                      rowImport={this.state.rowImport}
  64.                                      rowError={this.state.rowError}
  65.                                      start={this.state.start}
  66.                                      status={this.state.status}
  67.                 />
  68.             </div>
  69.  
  70.         );
  71.     }
  72. }
  73.  
  74. export default ImportShop;
RAW Paste Data
Top