import React,{Component,Fragment} from 'react'
import {Page,Validator,Notification,FormItem,DatePickerItem,TextAreaItem,CheckboxItem,Checkbox,
    InputItem,Input,Bind,SelectItem,Button,Label,Image,Table, Steps} from '@/components/Common-Library'
import Api from '@/service/api'
import mDitsel from '../model'
import CodeTableFactory from '@/components/CodeTable'
import "./index.less"
import { inject, observer } from 'mobx-react'
import { action, observable} from 'mobx'
import Xinyongzheng from './Xinyongzheng'
import Danju from './Danju'
import { Card } from 'antd'
import DateFormat from  '@/utils/DateUtil'

const CodeTable = CodeTableFactory.getInstance()
const StepItem = Steps.Item


@inject('UserContext')
@inject('i18n')
@observer
export default class DitselScreen extends Page
{
	@observable
	formBlur = false

	@observable
	extra = { inifrm: 'ditsel', sptinr: '', bchlevelLst: [] }



	constructor(props) {
		super(props)
		this.state = {
			flag: true
		}
		this.model = new mDitsel()
	}
	
	async componentWillMount() 
	{
		/*
		*添加初始化代码
		*/
		const rtnmsg = await Api.post('ditsel/init',{data:this.model})
		if(rtnmsg.retcod == SUCCESS)
		{
           const {data} = rtnmsg
          
                Object.assign(this.model,data)
         
        }
		//快照模式下，不必开启校验，否则，静默校验，和记录变动
		!this.loadDisplay() && this.model.openMonitor && this.model.openMonitor() //开启校验	
	}
    componentWillUnmount()
    {
        this.model.stopMonitor&&this.model.stopMonitor()//关闭校验
    }

    //交易内实现
    renderPage(){
		return (
			<Card title="国内证买方" size="small" className="transTitle">
				<Steps>
					<StepItem title="信用证到单">
						<Xinyongzheng model={this.model} extra={this.extra}  flg="0" />
					</StepItem>

					<StepItem title="单据拒付">
						<Danju model={this.model} extra={this.extra} flg="1"/>
					</StepItem>
					<StepItem title="单据退单">
						<Danju model={this.model} extra={this.extra} flg="7"/>
					</StepItem>
					<StepItem title="单据承兑">
						<Danju model={this.model} extra={this.extra} flg="2"/>
					</StepItem>
					<StepItem title="单据付款">
						<Danju model={this.model} extra={this.extra} flg="3"/>
					</StepItem>
					<StepItem title="信用证闭卷">
						<Xinyongzheng model={this.model} extra={this.extra} flg="4"/>
					</StepItem>
					<StepItem title="信用证其他">
						<Xinyongzheng model={this.model} extra={this.extra} flg="5" />
					</StepItem>
					<StepItem title="单据其他">
						<Danju model={this.model} extra={this.extra} flg="6"/>
					</StepItem>

				

				</Steps>
				<Button style={{ position:'absolute',right:'3em',top:'4em' }}  type="primary" size="small" onClick={()=>{this.props.history.push('ditopn')}}>
          <Label itext="开立信用证" />
        </Button>
				<Button style={{ position:'absolute',right:'10em',top:'4em' }}  type="primary" size="small" onClick={()=>{this.props.history.push('infdid')}}>
          <Label itext="信用证查询" />
        </Button>
			</Card>
		)
 
	}
}
