import React from 'react';
import { WeaSteps, WeaDatePicker, WeaInput, WeaSelect } from 'ecCom';
import { Upload, Icon, Modal, Row, Col, Button } from "antd";
import { inject, observer } from 'mobx-react';
import { toJS } from 'mobx';
import ModalStep1 from './modalStep1'
import ModalStep2 from './modalStep2'
import ModalStep3 from './modalStep3'
import { columns } from './columns'
const Dragger = Upload.Dragger;
const Step = WeaSteps.Step;
@inject("taxAgentStore", "cumDeductStore")
@observer
export default class ImportModal extends React.Component {
constructor(props) {
super(props)
this.state = {
currentStep: 0,
datetime: "",
taxAgentId: "",
fileId: ""
}
}
componentWillMount() { // 初始化渲染页面
const { taxAgentStore: {fetchTaxAgentOption} } = this.props;
fetchTaxAgentOption();
}
nextStep() {
const { cumDeductStore: { step, setStep }} = this.props;
setStep(step + 1)
}
preStep() {
const { cumDeductStore: { step, setStep }} = this.props;
setStep(step - 1);
}
renderFormComponent() {
const { datetime, taxAgentId } = this.state
const { taxAgentStore: {taxAgentOption} } = this.props;
return (
税款所属期
this.setState({ datetime: value })}
/>
个税扣缴义务人
{
this.setState({ taxAgentId: v });
}}
/>
)
}
handleStep1Next() {
const { cumDeductStore: { importFile, setStep }} = this.props;
const { fileId, datetime, taxAgentId} = this.state;
setStep(1)
}
handlePreviewDate() {
const { cumDeductStore: { previewImport }} = this.props;
const { fileId, datetime, taxAgentId } = this.state;
previewImport({
imageId: fileId,
declareMonth: datetime,
taxAgentId: taxAgentId
})
}
hanleImportData() {
const { cumDeductStore: { importFile }} = this.props;
const { fileId, datetime, taxAgentId } = this.state;
importFile({
imageId: fileId,
declareMonth: datetime,
taxAgentId: taxAgentId
})
}
render() {
const { cumDeductStore: { step, slideDataSource, importResult, setSlideVisiable, setStep, setModalVisiable }} = this.props;
return (
{
step == 0 && ( {this.setState({fileId})}}
onStep1Next={() => {
this.handleStep1Next();
}}/>)
}
{
step == 1 && ( this.handlePreviewDate()}
dataSource={slideDataSource}
columns={columns}
onStep2Next={() => {this.nextStep()}} onStep2Pre={() => {this.preStep()}}/>)
}
{
step == 2 && ( this.hanleImportData()}
importResult={toJS(importResult)}
onFinish={() => {setModalVisiable(false); setStep(0)}}/>)
}
)
}
}