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 mDbitrm 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 DbitrmScreen extends Page
{
    @observable
    formBlur=false

    constructor(props)
    {
        super(props)
        this.model = new mDbitrm()
        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('dbitrm/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
             
      return (
        <Card title="科目维护" size="small" className="transTitle">
          <div style={{position:'relative'}}>
            <Row>
              <Col span={12}>
                <Row className={12}>
                  <Col span={5} offset={2}>
                    <Label i18nId={"TRMP_LT000007"}/>	
                  </Col>
                  <Col span={14}>
                    <InputItem  InputProps={bind("trmtyp")} disabled={true} />
                  </Col>
                </Row>
              </Col>
              <Col span={12}>
                <Row className={12}>
                  <Col span={5} offset={2}>
                    <Label i18nId={"TRMP_LT000008"}/>	
                  </Col>
                  <Col span={14}>
                    <InputItem  InputProps={bind("nam")} disabled={true} />
                  </Col>
                </Row>
              </Col>
            </Row>
  
            <Row>
              <Col span={12}>
                <Row className={12}>
                  <Col span={5} offset={2}>
                    <Label i18nId={"TRMP_LT000009"}/>	
                  </Col>
                  <Col span={14}>
                    <InputItem  InputProps={bind("trmcod")} disabled={true} />
                  </Col>
                </Row>
              </Col>
              <Col span={12}>
                <Row className={12}>
                  <Col span={5} offset={2}>
                    <Label i18nId={"TRMP_LT000010"}/>	
                  </Col>
                  <Col span={14}>
                    <InputItem  InputProps={bind("trnseq")} disabled={true} />
                  </Col>
                </Row>
              </Col>
            </Row>
          
            <Row>
              <Col span={12}>
                <Row className={12}>
                  <Col span={5} offset={2}>
                    <Label i18nId={"TRMP_LT000012"}/>	
                  </Col>
                  <Col span={14}>
                    <SelectItem InputProps={bind("trmflg")} code={CodeTable.trmflg} disabled={true}/>
                  </Col>
                </Row>
              </Col>
            </Row>
  
            <Row type="flex" justify="center">
              <Col>
                <div className="button0">
                  <div className='button2'>
                    {/* 退出按钮 */}
                    <Button type="primary" onClick={this.onRtn} >
                      <Label i18nId="MTABUT_BT000464" />
                    </Button>
                  </div>
                </div>
              </Col>
            </Row>
          </div>
        </Card>
    )
	}
}
