import React,{Component,Fragment} from 'react'
import {Page,Validator,Notification,FormItem,
    InputItem,Input,Bind,SelectItem,Button,Label,Table,Section,DatePickerItem} from '@/components/Common-Library'
import {Divider} from 'antd'
import Api from '@/service/api'
import mDbifee from '../model'
import CodeTableFactory from '@/components/CodeTable'
import "./index.less"
import { inject, observer } from 'mobx-react'
import { action, observable } from 'mobx'
import { Col, Row,Card } from 'antd'
import {Link} from 'react-router-dom'
import Moment from 'moment'
const CodeTable = CodeTableFactory.getInstance()




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

    constructor(props)
    {
        super(props)
        this.model = new mDbifee()
        this.model.openValidate() //开启校验
        this.bind = Bind.bind(this)
    }

    componentWillUnmount()
    {
        this.model.closeValidate()//关闭校验
    }

	async componentWillMount() {
		if(this.props.location.query){
			let selinr = this.props.location.query.inr
			const rtnmsg = await Api.post('dbifee/init', { params: {selinr} })
			if (rtnmsg.retcod == SUCCESS) {
				//Notification.success({ message: '数据提交成功!' })
				Object.assign(this.model,rtnmsg.data)
			}
			else {
				Notification.error({ message: '服务端请求失败!' })
			}	
		}	
	}

    //按钮事件
     onRtn= ()=>{
		this.props.history.goBack();
    }


    //交易内实现
    renderPage(){
    	const bind = this.bind
        const {i18n} = this.props
        const CodeTable = CodeTableFactory.getInstance()
     
        return (
		<Card title="费用维护" size="small" className="transTitle">
      <div style={{position:'relative'}}>
      <Row>
          <Col span={12}>
            <Row className="row">
              <Col span={5} offset={2}>
                <Label i18nId={"FEEP_LT000014"}/>
              </Col>
              <Col span={14}>
                <InputItem InputProps={bind("feecod")} disabled={true} />
              </Col>
            </Row>
          </Col>
          <Col span={12}>
            <Row className="row">
              <Col span={5} offset={2}>
                <Label i18nId={"FEEP_LT000015"}/>	
              </Col>
              <Col span={14}>
                <SelectItem InputProps={bind("reltir")} code={CodeTable.feecbs} disabled={true} />
              </Col>
            </Row>
          </Col>
        </Row>

        <Row>
          <Col span={12}>
            <Row className="row">
              <Col span={5} offset={2}>
                <Label i18nId={"FEEP_LT000042"}/>	
              </Col>
              <Col span={14}>
                <InputItem InputProps={bind("feenam")} disabled={true} />
              </Col>
            </Row>
          </Col>
          <Col span={12}>
            <Row className="row">
              <Col span={5} offset={2}>
                <Label i18nId={"FEEP_LT000017"}/>	
              </Col>
              <Col span={14}>
                <SelectItem InputProps={bind("rol")} code={CodeTable.feerol} disabled={true} />
              </Col>
            </Row>
          </Col>
        </Row>

        <Row>
          <Col span={12}>
            <Row className="row">
              <Col span={5} offset={2}>
                <Label i18nId={"FEEP_LT000018"}/>	
              </Col>
              <Col span={14}>
                <InputItem InputProps={bind("acc")} disabled={true} />
              </Col>
            </Row>
          </Col>
          <Col span={12}>
            <Row className="row">
              <Col span={5} offset={2}>
                <Label i18nId={"FEEP_LT000016"}/>	
              </Col>
              <Col span={14}>
                <SelectItem InputProps={bind("staflg")} code={CodeTable.feesta} disabled={true} />
              </Col>
            </Row>
          </Col>
        </Row>

        <Row>
          <Col span={12}>
            <Row className="row">
              <Col span={5} offset={2}>
                <Label i18nId={"FEEP_LT000020"}/>	
              </Col>
              <Col span={14}>
                <InputItem InputProps={bind("accacr")} disabled={true} />
              </Col>
            </Row>
          </Col>
          <Col span={12}>
            <Row className="row">
              <Col span={5} offset={2}>
                <Label i18nId={"FEEP_LT000021"}/>	
              </Col>
              <Col span={14}>
                <InputItem InputProps={bind("accacr2")} disabled={true} />
              </Col>
            </Row>
          </Col>
        </Row>

        <Row>
          <Col span={12}>
            <Row className="row">
              <Col span={5} offset={2}>
                <Label i18nId={"FEEP_LT000022"}/>	
              </Col>
              <Col span={6}>
                <DatePickerItem InputProps={bind("begdat")} disabled={true} />
              </Col>
              <Col span={7} offset={1}>
                <DatePickerItem InputProps={bind("enddat")} disabled={true} />
              </Col>
            </Row>
          </Col>
          <Col span={12}>
            <Row className="row">
              <Col span={5} offset={2}>
                <Label i18nId={"FEEP_LT000019"}/>	
              </Col>
              <Col span={14}>
                <InputItem InputProps={bind("reltrn")} disabled={true} />
              </Col>
            </Row>
          </Col>
        </Row>

        <Row>
          <Col span={12}>
            <Row className="row">
              <Col span={5} offset={2}>
                <Label i18nId={"FEEP_LT000028"}/>	
              </Col>
              <Col span={6}>
                <SelectItem InputProps={bind("maxcur")} code={CodeTable.curtxt} disabled={true} />
              </Col>
              <Col span={7} offset={1}>
                <InputItem InputProps={bind("maxamt")} disabled={true} />
              </Col>
            </Row>
          </Col>
          <Col span={12}>
            <Row className="row">
              <Col span={5} offset={2}>
                <Label i18nId={"FEEP_LT000024"}/>	
              </Col>
              <Col span={14}>
                <SelectItem InputProps={bind("calrul")} code={CodeTable.calrul} disabled={true} />
              </Col>
            </Row>
          </Col>
        </Row>

        <Row>
          <Col span={12}>
            <Row className="row">
              <Col span={5} offset={2}>
                <Label i18nId={"FEEP_LT000026"}/>	
              </Col>
              <Col span={6}>
                <SelectItem InputProps={bind("mincur")} code={CodeTable.curtxt} disabled={true} />
              </Col>
              <Col span={7} offset={1}>
                <InputItem InputProps={bind("minamt")} disabled={true} />
              </Col>
            </Row>
          </Col>
          <Col span={12}>
            <Row className="row">
              <Col span={5} offset={2}>
                <Label i18nId={"FEEP_LT000025"}/>	
              </Col>
              <Col span={14}>
                <InputItem InputProps={bind("ratcal")} disabled={true} />
              </Col>
            </Row>
          </Col>
        </Row>

        <Row>
          <Col span={12}>
            <Row className="row">
              <Col span={5} offset={2}>
                <Label i18nId={"FEEP_LT000030"}/>	
              </Col>
              <Col span={14}>
                <SelectItem InputProps={bind("pertyp")} code={CodeTable.feeper} disabled={true} />
              </Col>
            </Row>
          </Col>
          <Col span={12}>
            <Row className="row">
              <Col span={5} offset={2}>
                <Label i18nId={"FEEP_LT000032"}/>	
              </Col>
              <Col span={14}>
                <InputItem InputProps={bind("permin")} disabled={true} />
              </Col>
            </Row>
          </Col>
        </Row>
				<Row gutter={16} className="line">
					<Col offset={11}>
						<Button type="primary" onClick={this.onRtn}>
   						<Label i18nId="MTABUT_BT000020" />      
            </Button>
					</Col>
				</Row>
		  </div>
		</Card>
		)
	}
}
