PreView.js 3 KB
Newer Older
fukai committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
import React,{Component} from 'react'
import {bindActionCreators} from 'redux';
import {connect} from 'react-redux';
import {Input,Table,Steps,Row,Col,Button} from 'antd'
import { updateTreeValue,updateRcvBic,initSwiftMessageTree,updateSwiftMessage } from '../store/modules/swift/swift_action';


const Step = Steps.Step;

 class PreView extends Component{

    render()
    {
        return (<div>
                    <Row style={{marginTop:'3em'}}>
                        <Col span={3}/>
                        <Col span={18}>
                            {
                             this.props.params.kind=='0'? 
                                <Steps current={1}>
                                    <Step title="报文编辑" description="编辑报文栏位值" />
                                    <Step title="预览报文" description="预览报文" />
                                    <Step title="编辑完成" description="已完成提交" />
                                </Steps>
                                :
                                <Steps current={2}>
                                    <Step title="选择类型" description="选择报文类型" />
                                    <Step title="报文编辑" description="编辑报文栏位值" />
                                    <Step title="预览报文" description="预览报文" />
                                    <Step title="编辑完成" description="已完成提交" />
                                </Steps>
                            }
                        </Col>
                        <Col span={3}/>
                    </Row>
                    
                    <Row>
                        <Col span={3}>
                        </Col>
                        <Col span={18}>
                        {/*onChange={e=>this.props.actions.updateSwiftMessage(e.target.value)}*/}
                            <Input type="textarea" readOnly="readonly" value={this.props.value} rows={20} cols={50} />
                        </Col>
                        <Col span={3}>
                        </Col>
                    </Row>
                    <Row style={{marginTop:'3em'}}>
                        <Col span={24} style={{textAlign:'center'}}>
                            <Button  type="primary"   icon="check" title="save" style={{marginRight:'1em'}} onClick={()=>this.props.history.push(`result/${this.props.params.kind}`)} >Save</Button>
                            <Button  type="dangerous"   icon="cross" title="cancel" onClick={()=>this.props.history.goBack()}>Return</Button>
                        </Col>
                    </Row>
            </div>
            )
    }
} 

const mapStateToProps = (state) => {
  const {swift_message} = state.swift;
  return {
    value:swift_message
  };
};

function mapDispatchToProps(dispatch) {
  return {
    actions: bindActionCreators({ updateTreeValue,updateRcvBic,initSwiftMessageTree,updateSwiftMessage }, dispatch)
  };
}

export default connect(mapStateToProps, mapDispatchToProps)(PreView)