import React,{Component,Fragment} from 'react'
import {Page,Validator,Notification,FormItem,DatePickerItem,TextAreaItem,CheckboxItem,Checkbox,
    InputItem,Input,Bind,SelectItem,Button,Label,Image,Table} from '@/components/Common-Library'
import Api from '@/service/api'
import mDbifrm from '../model'
import CodeTableFactory from '@/components/CodeTable'
import "./index.less"
import { inject, observer } from 'mobx-react'
import { action, observable,runInAction } from 'mobx'
import { Col, Row ,Card,Divider } from 'antd'
import { Link } from 'react-router-dom'
import Moment from 'moment'
import { Popconfirm, message } from 'antd';

const CodeTable = CodeTableFactory.getInstance()


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

    constructor(props)
    {
        super(props)
        this.model = new mDbifrm()    
        this.bind = Bind.bind(this)
    }
	
	async componentWillMount() 
	{
		if(this.props.location.query){
			let selinr = this.props.location.query.inr
			const rtnmsg = await Api.post('dbefrm/init', { params: {selinr} })
			if (rtnmsg.retcod == SUCCESS) {
				//Notification.success({ message: '数据提交成功!' })
				Object.assign(this.model,rtnmsg.data)
			}
			else {
				Notification.error({ message: '服务端请求失败!' })
			}	
		}	
	}
    componentWillUnmount()
    {
        this.model.stopMonitor&&this.model.stopMonitor()//关闭校验
    }



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

    //交易内实现
    renderPage(){
    	const bind = this.bind
        const {i18n} = this.props
             
        return (
			<Card title="交易查看" size="small" className="transTitle">
        	<div style={{position:'relative'}}>
			
			<Row gutter={16} >
                <Col span={8} offset={3}>
                    <Col span={7} className='label'>
                    <Label itext="描述"  />	
                    </Col>
                    <Col span={17}>
                    <InputItem InputProps={{...bind("dsp"),readOnly:true} }  maxLength={100}  desp="描述" path="/frmgrp/rec/dsp" />
                    </Col>
                </Col>
                <Col span={8} offset={2}>
                    <Col span={7} className='label'>
                    <Label itext="索引"  />
                    </Col>
                    <Col span={17}>
                    <InputItem InputProps={{...bind("inr"),readOnly:true}}  maxLength={8}  desp="索引" path="/frmgrp/rec/inr" />
                    </Col>
                </Col>
            </Row>
			
			<Row gutter={16}>
                <Col span={8} offset={3}>
                    <Col span={7} className='label'>
                    <Label itext="显示类型"  />
                    </Col>
                    <Col span={17}>
                    <InputItem InputProps={{...bind("flg"),readOnly:true}}  maxLength={1}  desp="显示类型" path="/frmgrp/rec/flg" />
                    </Col>
                </Col>
                <Col span={8} offset={2}>
                    <Col span={7} className='label'>
                    <Label itext="交易代码"  />
                    </Col>
                    <Col span={17}>
                    <InputItem InputProps={{...bind("frm"),readOnly:true}}  maxLength={40}  desp="交易代码" path="/frmgrp/rec/frm" />
                    </Col>
                </Col>
            </Row>
			
			<Row gutter={16}>
                <Col span={8} offset={3}>
                    <Col span={7} className='label'>
                    <Label itext="交易类型"  />
                    </Col>
                    <Col span={17}>
                    <InputItem InputProps={{...bind("frmtyp"),readOnly:true}}  maxLength={1}  desp="交易类型" path="/frmgrp/rec/frmtyp" />
                    </Col>
                </Col>
                <Col span={8} offset={2}>
                    <Col span={7} className='label'>
                    <Label itext="父菜单"  />
                    </Col>
                    <Col span={17}>
                    <InputItem InputProps={{...bind("pntinr"),readOnly:true}} maxLength={8}  desp="父菜单" path="/frmgrp/rec/pntinr" />
                    </Col>
                </Col>
            </Row>
			
			
			<Row gutter={16}>
                <Col span={8} offset={3}>
                    <Col span={7} className='label'>
                    <Label itext="交易默认状态"  />	
                    </Col>
                    <Col span={17}>
                    <InputItem InputProps={{...bind("typ"),readOnly:true}}  maxLength={1}  desp="交易默认状态" path="/frmgrp/rec/typ" />
                    </Col>
                </Col>
                <Col span={8} offset={2}>
                    <Col span={7} className='label'>
                    <Label itext="授权级别"  />
                    </Col>
                    <Col span={17}>
                    <InputItem InputProps={{...bind("lvl"),readOnly:true}}  maxLength={1}  desp="授权级别" path="/frmgrp/rec/lvl" />
                    </Col>
                </Col>
            </Row>
			
	        <Row gutter={16}>
                <Col span={8} offset={3}>
                    <Col span={7}>
                    <Label itext="交易中文名"  />
                    </Col>
                    <Col span={17}>
                    <InputItem InputProps={{...bind("namcn"),readOnly:true}}  maxLength={60}  desp="交易中文名" path="/frmgrp/rec/namcn" />
                    </Col>
                </Col>
                <Col span={8} offset={2}>
                    <Col span={7} className='label'>
                    <Label itext="交易英文名"  />
                    </Col>
                    <Col span={17}>
                    <InputItem InputProps={{...bind("namen"),readOnly:true}}  maxLength={60}  desp="交易英文名" path="/frmgrp/rec/namen" />
                    </Col>
                </Col>
            </Row>
			
			<Row gutter={16}>
                <Col span={8} offset={3}>
                    <Col span={7} className='label'>
                    <Label itext="交易发起端"  />
                    </Col>
                    <Col span={17}>
                    <InputItem InputProps={{...bind("negflg"),readOnly:true}}  maxLength={1}  desp="交易发起端" path="/frmgrp/rec/negflg" />
                    </Col>
                </Col>
                <Col span={8} offset={2}>
                    <Col span={7} className='label'>
                    <Label itext="业务品种"  />	
                    </Col>
                    <Col span={17}>
                    <SelectItem InputProps={{...bind("busrou"),disabled:true}} code={CodeTable.busrou}  desp="业务品种" path="/frmgrp/rec/busrou"/>
                    </Col>
                </Col>
            </Row>

            <Row gutter={16}>
                <Col span={4} offset={10}>
                    <div className='bchbutton'>
					<Button  type="primary"  onClick={this.onRtn} desp="退出" path="/mtabut/rtn">
		                 <Label   itext="返回"/>
	                       </Button>
                    </div>
                   
                </Col>
            </Row>


	{/* <InputItem InputProps={bind("flg")}  maxLength={1}  desp="显示类型" path="/frmgrp/rec/flg" />
	<InputItem InputProps={bind("frm")}  maxLength={40}  desp="交易代码" path="/frmgrp/rec/frm" />
	<InputItem InputProps={bind("frmtyp")}  maxLength={1}  desp="交易类型" path="/frmgrp/rec/frmtyp" />
	<InputItem InputProps={bind("pntinr")}  maxLength={8}  desp="父菜单" path="/frmgrp/rec/pntinr" />
	<InputItem InputProps={bind("typ")}  maxLength={1}  desp="交易默认状态" path="/frmgrp/rec/typ" />
	<InputItem InputProps={bind("lvl")}  maxLength={1}  desp="授权级别" path="/frmgrp/rec/lvl" />
	<InputItem InputProps={bind("namcn")}  maxLength={60}  desp="交易中文名" path="/frmgrp/rec/namcn" />
	<InputItem InputProps={bind("namen")}  maxLength={60}  desp="交易英文名" path="/frmgrp/rec/namen" />
	<InputItem InputProps={bind("negflg")}  maxLength={1}  desp="交易发起端" path="/frmgrp/rec/negflg" />
	<SelectItem InputProps={bind("busrou")} code={CodeTable.busrou}  desp="业务品种" path="/frmgrp/rec/busrou"/>
	<Button  type="primary"  onClick={this.onRtn} desp="退出" path="/mtabut/rtn">
		<Label   itext="返回"/>
	</Button>

	
	<Label itext="显示类型"  />	

	
	<Label itext="交易代码"  />	

	
	<Label itext="交易类型"  />	

	
	<Label itext="父菜单"  />	

	
	<Label itext="交易默认状态"  />	

	
	<Label itext="授权级别"  />	

	
	<Label itext="交易中文名"  />	

	
	<Label itext="交易英文名"  />	

	
	<Label itext="交易发起端"  />	

	
		<Label itext="业务品种"  />	 */}
		</div>
		</Card>
		)
	}
}
