/***
 * 
 * 明细  
 * 
***/

import React, { Component, Fragment } from 'react'
import {
	Page, Validator, Notification, FormItem,
	InputItem, Input, Bind, SelectItem, Button, Label, DatePickerItem, Section, ConfirmButton, Steps
} from '@/components/Common-Library'
import Api from '@/service/api'
import CodeTableFactory from '@/components/CodeTable'
import "./index.less"
import { inject, observer } from 'mobx-react'
import { action, observable } from 'mobx'
import { Row, Col, Popconfirm, Modal ,Spin} from 'antd';
import { PtyPicker } from '@/components/Business-Library'
import { Link, withRouter } from 'react-router-dom'
import Ptspta1 from '@/views/Public/Ptspta1'
import Business from '@/views/Public/Business'

const { Pre, Next, StepWrapper } = Steps
const CodeTable = CodeTableFactory.getInstance()
const confirm = Modal.confirm
  
@withRouter
@inject('UserContext')
@inject('i18n')
@observer
export default class OvwpScreen extends Page {
	@observable
	formBlur = false

	constructor(props) {
		super(props)
		this.model = props.model
	this.bind = Bind.bind(this)
	this.pageHide = true

	}

	//交易内实现
	renderPage() {
		const bind = this.bind
		const { i18n } = this.props
		const { bchlevelLst } = this.props.extra
		//const {next,pre} = this.props.steps
		if(this.props.flag==true){
			return <Spin style={{width:"100%", justifyContent:"center"}} spinning={this.props.flag} />
		}
		return (
			<div style={{ position: 'relative' }}>
			   <Business  wrappedComponentRef={ref => (this.com = ref)} page={this} extra={this.props.extra}  model={this.model} />
				{/* 第一行 */}
				<Row>
					<Col span={12}>
						<Row className="row">
							<Col span={5} offset={2}>
								{/* 业务编号 */}
								<Label i18nId={"CPTP_LT000022"} />
							</Col>
							<Col span={14}>
								<InputItem InputProps={bind("ownref")} disabled={true} />
							</Col>
						</Row>
					</Col>
					<Col span={12}>
						<Row className="row">
							<Col span={5} offset={2}>
								{/* 概要描述 */}
								<Label itext="概要描述"  />	
							</Col>
							<Col span={14}>
							  <InputItem InputProps={bind("nam")}  maxLength={40}  desp="概要描述" path="/dedgrp/rec/nam" />
							</Col>
						</Row>
					</Col>
				</Row>
				
				<Row>
					<Col span={12}>
						<Row className="row">
							<Col span={5} offset={2}>
								{/* 归属机构*/}
								<Label itext="归属机构"  />	
							</Col>
							<Col span={14}>
              	<SelectItem InputProps={bind("ownbch")} code={bchlevelLst} desp="归属机构" path="/dedgrp/rec/ownbch"  />
							</Col>
						</Row>
					</Col>
				</Row>
				{/* 第二行 */}
				<Row>
					<Col span={12}>
						<Row className="row" type="flex">
							<Col span={5} offset={2}>
								{/* 客户经理 */}
								<Label itext="客户经理"  />	
							</Col>
							<Col span={14}>
                <InputItem InputProps={bind("accusr")}  maxLength={8}  desp="客户经理" path="/dedgrp/rec/accusr" />
							</Col>
							<Col span={3}></Col>
							<Col span={5} offset={2}>
								{/* 开立日期 */}
								<Label itext="开立日期"  />
							</Col>
							<Col span={14}>
								<DatePickerItem InputProps={bind("opndat")}  desp="开立日期" path="/dedgrp/rec/opndat" />
							</Col>
							<Col span={3}></Col>
						{/**信用证金额 */}
							<Col span={5} offset={2}>
								<Label itext="信用证金额" />
							</Col>
							<Col span={6}>
								<SelectItem InputProps={{
									...bind("nom1_cur"), onChange: val => {
										this.model.nom1_cur = val
										this.model.liqtyp = ""
										this.model.swftyp = ""
									}
								}}
									code={CodeTable.curtxt} />
							</Col>
							<Col span={7} offset={1}>
								<InputItem InputProps={bind("nom1_amt")} />
							</Col>
							<Col span={3}></Col>
						</Row>
					</Col>
					<Col span={12}>
						{/**受益人 */}
						<Ptspta1 model={this.model} argArr={{ desc: "受益人", prefix: 'pts3', url: 'detopn/benp_ptysel', flg: 'C', datakey: '\\detp\\benp\\ptslst' }}  />
						
					</Col>
				</Row>

				{/* 第四行 */}
				<Row>
					{/**上下浮动比例 */}
					<Col span={12}>
						<Row className="row">
							<Col span={5} offset={2}>
								<Label itext="上下浮动比例+/-% "  />
							</Col>
							<Col span={6}>
								<InputItem InputProps={bind("nomtop")}  maxLength={8}  desp="上浮" path="\dedgrp\rec\nomtop" />
							</Col>
							<Col span={1} offset={1}>
								<Label itext="/"  />
							</Col>
							<Col span={6}>
								<InputItem InputProps={bind("nomton")}  maxLength={8}  desp="下浮" path="\dedgrp\rec\nomton" />
							</Col>
						</Row>
					</Col>
					<Col span={12}></Col>
				</Row>


				{/* 第五行 */}
				<Row>
					<Col span={12}>
						<Row className="row">
							<Row>
								<Col span={5} offset={2}>
									<Label itext="信用证最大金额" />
								</Col>
								<Col span={6}>
									<SelectItem InputProps={{
										...bind("max_cur"), onChange: val => {
											this.model.max_cur = val
											this.model.liqtyp = ""
											this.model.swftyp = ""
										}
									}}
										code={CodeTable.curtxt} />
								</Col>
								<Col span={7} offset={1}>
									<InputItem InputProps={bind("max_amt")} />
								</Col>
							</Row>
							<Row>
								{/**开证类型 */}
								<Col span={5} offset={2}>
									<Label itext="开证类型"  />
								</Col>
								<Col span={14}>
									<SelectItem InputProps={bind("isstyp")} code={CodeTable.isstyp}  desp="开证类型" path="\dedgrp\rec\isstyp"/>
								</Col>
							</Row>
							<Row>
								{/**贸易方式 */}
								<Col span={5} offset={2}>
									<Label itext="贸易方式"  />
								</Col>
								<Col span={14}>
									<SelectItem InputProps={bind("trdtyp")} code={CodeTable.trdtyp}  desp="贸易方式" path="/dedgrp/rec/trdtyp"/>
								</Col>
							</Row> 
						</Row>
					</Col>
					
					<Col span={12}>
						{/**开证行 */}
						<Ptspta1 model={this.model} argArr={{ desc: "开证行", prefix: 'pts5', url: 'detopn/issp_ptysel', flg: 'B', datakey: '\\detp\\issp\\ptslst' }}  />
					</Col>
				</Row>


				{/* 第六行 */}
				<Row>
					<Col span={12}>
						<Row className="row">
							<Col span={13} offset={2}>
								{/* 最迟货物装运 */}
								<Label itext="最迟货物装运/服务提供日期 "  />
							</Col>
							<Col span={6}>
								<DatePickerItem InputProps={bind("shpdat")}  desp="最迟货物装运/服务提供日期 " path="/dedgrp/rec/shpdat" />
							</Col>
						</Row>
					</Col>
					<Col span={12}>

					</Col>
				</Row>

				{/* 第七行 */}
				<Row>
					<Col span={12}>
						<Row className="row">
							<Col span={24}>
								<Col span={5} offset={2}>
									<Label itext="信用证对付方式"  />
								</Col>
								<Col span={6}>
									<SelectItem InputProps={bind("avbby")} code={CodeTable.avbby}  desp="信用证对付方式" path="/dedgrp/rec/avbby"/>
								</Col>
								<Col span={4} offset={2}>
									<InputItem InputProps={bind("tenmaxday")} desp="期限" path="/didgrp/rec/tenmaxday" />
								</Col>
								<Col span={4} offset={1}>
									<Label itext="天" />
								</Col>
							</Col>

						</Row>
						<Row className="row">
							<Col span={24}>
								<Col span={5} offset={2}>
									<Label itext="有效日期" />
								</Col>
								<Col span={14}>
									<DatePickerItem InputProps={bind("expdat")}  desp="有效日期" path="/dedgrp/rec/expdat" />
								</Col>
							</Col>
						</Row>
						<Row className="row">
							<Col span={24}>
								<Col span={5} offset={2}>
									<Label itext="远期付款指示"  />
								</Col>
								<Col span={14}>
									<InputItem InputProps={bind("defdet")}  maxLength={60}  desp="远期付款指示" path="/dedgrp/rec/defdet" />
								</Col>
							</Col>
						</Row>
					</Col>
					<Col span={12}>
						<Ptspta1 model={this.model} argArr={{ desc: "申请人", prefix: 'pts2', url: 'detopn/aplp_ptysel', flg: 'C', datakey: '\\detp\\aplp\\ptslst' }}  />
					</Col>
				</Row>

				
				</div>
		)
	}
}
