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



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

    constructor(props)
    {
        super(props)
        this.model = new mDbipty()
        this.bind = Bind.bind(this)
    }

    componentWillUnmount()
    {
      
    }
	
	async componentWillMount() {
		if(this.props.location.query){
			let selinr = this.props.location.query.inr
			const rtnmsg = await Api.post('dbipty/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={"PTYP_LT000181"}/>
                  </Col>
                  <Col span={14}>
                  <InputItem InputProps={bind("extkey")} disabled={true} />
                  </Col>
                </Row>
              </Col>
              <Col span={12}>
                <Row className="row">
                  <Col span={5} offset={2}>
                  <Label i18nId={"PTYP_LT000043"}/>
                  </Col>
                  <Col span={14}>
                  <InputItem InputProps={bind("namcn")} disabled={true} />
                  </Col>
                </Row>
              </Col>
            </Row>

            <Row>
              <Col span={12}>
                <Row className="row">
                  <Col span={5} offset={2}>
                  <Label i18nId={"PTYP_LT000037"}/>
                  </Col>
                  <Col span={14}>
                  <InputItem InputProps={bind("nam1")} disabled={true} />
                  </Col>
                </Row>
              </Col>
              <Col span={12}>
                <Row className="row">
                  <Col span={5} offset={2}>
                  <Label i18nId={"PTYP_LT000037"}/>
                  </Col>
                  <Col span={14}>
                  <InputItem InputProps={bind("nam2")} disabled={true} />
                  </Col>
                </Row>
              </Col>
            </Row>

            <Row>
              <Col span={12}>
                <Row className="row">
                  <Col span={5} offset={2}>
                  <Label i18nId={"PTYP_LT000046"}/>
                  </Col>
                  <Col span={14}>
                  <InputItem InputProps={bind("str1")} disabled={true} />
                  </Col>
                </Row>
              </Col>
              <Col span={12}>
                <Row className="row">
                  <Col span={5} offset={2}>
                  <Label i18nId={"PTYP_LT000046"}/>
                  </Col>
                  <Col span={14}>
                  <InputItem InputProps={bind("str2")} disabled={true} />
                  </Col>
                </Row>
              </Col>
            </Row>

            <Row>
              <Col span={12}>
                <Row className="row">
                  <Col span={5} offset={2}>
                  <Label i18nId={"PTYP_LT000036"}/>
                  </Col>
                  <Col span={14}>
                  <SelectItem InputProps={bind("ptytyp")} code={CodeTable.ptytyp} disabled={true} />
                  </Col>
                </Row>
              </Col>
              <Col span={12}>
                <Row className="row">
                  <Col span={5} offset={2}>
                  <Label i18nId={"PTYP_LT000038"}/>
                  </Col>
                  <Col span={14}>
                  <SelectItem InputProps={bind("idtyp")} code={CodeTable.idtyp} disabled={true} />
                  </Col>
                </Row>
              </Col>
            </Row>

            <Row>
              <Col span={12}>
                <Row className="row">
                  <Col span={5} offset={2}>
                  <Label i18nId={"PTYP_LT000040"}/>
                  </Col>
                  <Col span={14}>
                  <InputItem InputProps={bind("juscod")} disabled={true} />
                  </Col>
                </Row>
              </Col>
              <Col span={12}>
                <Row className="row">
                  <Col span={5} offset={2}>
                  <Label i18nId={"PTYP_LT000039"}/>
                  </Col>
                  <Col span={14}>
                  <InputItem InputProps={bind("idcod")} disabled={true} />
                  </Col>
                </Row>
              </Col>
            </Row>

            <Row>
              <Col span={12}>
                <Row className="row">
                  <Col span={5} offset={2}>
                  <Label i18nId={"PTYP_LT000041"}/>
                  </Col>
                  <Col span={14}>
                  <SelectItem InputProps={bind("sta")} code={CodeTable.sta} disabled={true}  />
                  </Col>
                </Row>
              </Col>
              <Col span={12}>
                <Row className="row">
                  <Col span={5} offset={2}>
                  <Label i18nId={"PTYP_LT000042"}/>	
                  </Col>
                  <Col span={14}>
                  <InputItem InputProps={bind("ownusr")} disabled={true} />
                  </Col>
                </Row>
              </Col>
            </Row>

            <Row>
              <Col span={12}>
                <Row className="row">
                  <Col span={5} offset={2}>
                  <Label i18nId={"PTYP_LT000048"}/>
                  </Col>
                  <Col span={14}>
                  <InputItem InputProps={bind("adrcn")} disabled={true} />
                  </Col>
                </Row>
              </Col>
              <Col span={12}>
                <Row className="row">
                  <Col span={5} offset={2}>
                  <Label i18nId={"PTYP_LT000049"}/>	
                  </Col>
                  <Col span={14}>
                  <InputItem InputProps={bind("loccty")} disabled={true} />
                  </Col>
                </Row>
              </Col>
            </Row>

            <Row>
              <Col span={12}>
                <Row className="row">
                  <Col span={5} offset={2}>
                  <Label i18nId={"PTYP_LT000050"}/>
                  </Col>
                  <Col span={14}>
                  <InputItem InputProps={bind("loczip")} disabled={true} />
                  </Col>
                </Row>
              </Col>
              <Col span={12}>
                <Row className="row">
                  <Col span={5} offset={2}>
                  <Label i18nId={"PTYP_LT000051"}/>	
                  </Col>
                  <Col span={14}>
                  <InputItem InputProps={bind("loctxt")} disabled={true} />
                  </Col>
                </Row>
              </Col>
            </Row>

            <Row>
              <Col span={12}>
                <Row className="row">
                  <Col span={5} offset={2}>
                  <Label i18nId={"PTYP_LT000052"}/>
                  </Col>
                  <Col span={14}>
                  <InputItem InputProps={bind("swfno")} disabled={true} />
                  </Col>
                </Row>
              </Col>
              <Col span={12}>
                <Row className="row">
                  <Col span={5} offset={2}>
                  <Label i18nId={"PTYP_LT000053"}/>	
                  </Col>
                  <Col span={14}>
                  <InputItem InputProps={bind("email")} disabled={true} />
                  </Col>
                </Row>
              </Col>
            </Row>

            <Row>
              <Col span={12}>
                <Row className="row">
                  <Col span={5} offset={2}>
                    <Label itext="电话" trn="dbapty" />
                  </Col>
                  <Col span={14}>
                    <InputItem InputProps={bind("tel")}  maxLength={30} disabled={true} />
                  </Col>
                </Row>
              </Col>
            </Row>

			      <Row gutter={16}>
                <Col offset={11}>
                    <Button type="primary" onClick={this.onRtn}>
                       <Label i18nId="MTABUT_BT000020" />      
                    </Button>
                </Col>
            </Row>
		</div>
		</Card>
		)
	}
}
