//附加


import React, { Component, Fragment } from 'react'
import {
	Page, Validator, Notification, FormItem, BottomBtn,
	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 { Link, withRouter } from 'react-router-dom'
import Business from '@/views/Public/Business'
import Ptspta1 from '@/views/Public/Ptspta1'

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

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

	//交易内实现
	renderPage() {
		const bind = this.bind
		const { i18n } = this.props
		const { bchlevelLst } = this.props.extra
    
    //将模型变量绑定到页签的bindSet对象中，才能在检核的时候被检查到变量所在页签，继而跳转到对应页签
    bind("pts_namcn")
    bind("pts1_namcn")
    bind("pts4_namcn")
    bind("pts6_namcn")

		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} steps={this.props.steps}  extra={this.props.extra}  model={this.model} />
				{/* 第一行 */}
				<Row> 
					<Col span={12}>
						<Ptspta1 model={this.model} argArr={{ desc: "委托行", prefix: 'pts1', url: 'detopn/agep_ptysel', flg: 'B', datakey: '\\detp\\agep\\ptslst' }} isDisabled={this.model.isstyp==='OWIS' || !this.model.isstyp} formBlur={this.formBlur}  />
					</Col>
					<Col span={12}>
            <Ptspta1 model={this.model} argArr={{ desc: "转让行", prefix: 'pts', url: 'detopn/a2bp_ptysel', flg: 'B', datakey: '\\detp\\a2bp\\ptslst' }} isDisabled={this.model.traflg=='FALS' || !this.model.traflg} formBlur={this.formBlur}  />
					</Col>
				</Row>

        {/* 第二行 */}
        <Row>
          <Col span={12}>
            <Row className="row">
              {/* 合同编号 */}
              <Col span={5} offset={2}>
                <Label itext="合同编号"  />
              </Col>
              <Col span={14}>
                <InputItem InputProps={bind("conno")}  maxLength={35}  desp="合同编号" path="/dedgrp/rec/conno" />
              </Col>
            </Row>
          </Col>
					<Col span={12}></Col>
        </Row>


        {/* 第三行 */}
				<Row>
          <Col span={12}>
						<Col span={24}>
							<Row className="row">
								<Col span={5} offset={2}>
									<Label itext="合同金额"  />
								</Col>
								<Col span={6}>
									<SelectItem InputProps={{
										...bind("concur"), onChange: val => {
											this.model.concur = val
											this.model.liqtyp = ""
											this.model.swftyp = ""
										}
									}}
										code={CodeTable.curtxt} />
								</Col>
								<Col span={7} offset={1}>
									<InputItem   InputProps={ {...bind("conamt"), type:"amount", cur:this.model.concur} } />
								</Col>
							</Row>
						</Col>
						<Col span={24}>
							<Row className="row">
								<Col span={5} offset={2}>
									<Label itext="分批装运货物"  />
								</Col>
								<Col span={14}>
									<SelectItem InputProps={bind("shppar")} code={CodeTable.allow}  desp="分批装运货物/分次提供服务" path="/dedgrp/rec/shppar"/>
								</Col>
							</Row>
						</Col>
						<Col span={24}>
							<Row className="row">
								<Col span={5} offset={2}>
									<Label itext="分期装运"  />  
								</Col>
								<Col span={14}>
									<SelectItem InputProps={bind("shpper")} code={CodeTable.allow}  desp="分期装运/提供服务" path="/dedgrp/rec/shpper"/>
								</Col>
							</Row>
						</Col>
          </Col>
          <Col span={12}>
            {/* 保兑行 */}
            <Ptspta1 model={this.model} argArr={{ desc: "保兑行", prefix: 'pts4', url: 'detopn/conp_ptysel', flg: 'B', datakey: '\\detp\\conp\\ptslst' }} isDisabled={this.model.cfmflg=='FALS' || !this.model.cfmflg} formBlur={this.formBlur} />
          </Col>
				</Row>
				{/* 第四行 */}
				<Row>
					<Col span={12}>
            <Row className="row">
              {/* 转运 */}
              <Col span={5} offset={2}>
                <Label itext="转运"  />
              </Col>
              <Col span={14}>
                <SelectItem InputProps={bind("shptrs")} code={CodeTable.allow}  desp="转运" path="/dedgrp/rec/shptrs"/>
              </Col>
            </Row>
					</Col>
					<Col span={12}></Col>
				</Row>

        {/* 第五行 */}
        
        <Row>
          <Col span={12}>
						<Col span={24}>
							<Row className="row">
								<Col span={5} offset={2}>
									<Label itext="是否可转让"  />
								</Col>
								<Col span={14}>
									<SelectItem InputProps={{...bind("traflg"),
										onAfterChange:(val)=>{
											if(val=='FALS' || !val){
												this.model.pts_extkey="";
												this.model.pts_namcn="";
												this.model.pts_adrcn="";
											}
										}}} 
										code={CodeTable.yesno}  
										desp="是否可转让" 
										path="/dedgrp/rec/traflg" 
									/>
								</Col>
							</Row>
						</Col>
						<Col span={24}>
							<Row className="row">
								<Col span={5} offset={2}>
									<Label itext="保兑标志"  />
								</Col>
								<Col span={14}>
									<SelectItem InputProps={{...bind("cfmflg"),
										onAfterChange:(val)=>{
											if(val=='FALS' || !val){
												this.model.pts4_extkey="";
												this.model.pts4_namcn="";
												this.model.pts4_adrcn="";
											}
										}}} 
										code={CodeTable.yesno}  desp="保兑标志" path="/dedgrp/rec/cfmflg" 
								/>
								</Col>
							</Row>
						</Col>
            <Col span={24}>
							<Row className="row">
								<Col span={5} offset={2}>
									<Label itext="是否可议付"  />
								</Col>
								<Col span={14}>
									<SelectItem InputProps={{...bind("negflg"),
										onAfterChange:(val)=>{
											if(val=='NULL' || !val){
												this.model.pts6_extkey="";
												this.model.pts6_namcn="";
												this.model.pts6_adrcn="";
											}
										}}} 
										code={CodeTable.negCode}  
										desp="是否可议付" 		
										path="/dedgrp/rec/negflg"
									/>
								</Col>
							</Row>
						</Col>
          </Col>
          <Col span={12}>
            {/* 议付行 */}
            <Ptspta1 model={this.model} argArr={{ desc: "议付行", prefix: 'pts6', url: 'detopn/negp_ptysel', flg: 'B', datakey: '\\detp\\negp\\ptslst' }} isDisabled={this.model.negflg=='NULL' || !this.model.negflg} formBlur={this.formBlur}  />
          </Col>
        </Row>

				{/* 第六行 */}
				<Row>
					<Col span={24}>
						<Row className="row">
							<Col span={4} offset={1}>
								<Label itext="货物运输或交货方式/服务方式"  />
							</Col>
							<Col span={10}>
								<InputItem InputProps={bind("tratyp")}  maxLength={20}  desp="货物运输或交货方式/方式" path="/dedgrp/rec/tratyp" />
							</Col>
						</Row>
					</Col>
				</Row>
 
				{/* 第七行 */}
				<Row>
					<Col span={24}>
						<Row className="row">
							<Col span={4} offset={1}>
								<Label itext="分期装运/提供服务约定"  />
							</Col>
							<Col span={10}>
								<InputItem InputProps={bind("trdapt")}  maxLength={100}  desp="分期装运/提供服务约定" path="/dedgrp/rec/trdapt" />
							</Col>
						</Row>
					</Col>
				</Row>

				{/* 第八行 */}
				<Row>
					<Col span={24}>
						<Row className="row">
							<Col span={4} offset={1}>
								<Label itext="交单期限"  />
							</Col>
							<Col span={10}>
								<InputItem InputProps={bind("preper")}  maxLength={100}  desp="交单期限" path="/dedgrp/rec/preper" />
							</Col>
						</Row>
					</Col>
				</Row>

				{/* 第九行 */}
				<Row>
					<Col span={24}>
						<Row className="row">
							<Col span={4} offset={1}>
								<Label itext="货物装运地(港)"  />
							</Col>
							<Col span={10}>
								<InputItem InputProps={bind("shpfro")}  maxLength={100}  desp="货物装运地(港)" path="/dedgrp/rec/shpfro" />
							</Col>
						</Row>
					</Col>
				</Row>

				{/* 第十行 */}
				<Row>
					<Col span={24}>
						<Row className="row">
							<Col span={4} offset={1}>
								<Label itext="货物目的地、交货地（港）"  />
							</Col>
							<Col span={10}>
								<InputItem InputProps={bind("shpto")}  maxLength={100}  desp="货物目的地、交货地（港）" path="/dedgrp/rec/shpto" />
							</Col>
						</Row>
					</Col>
				</Row>

				{/* 第十一行 */}
				<Row>
					<Col span={24}>
						<Row className="row">
							<Col span={4} offset={1}>
								<Label itext="服务提供地点"  />
							</Col>
							<Col span={10}>
								<InputItem InputProps={bind("shppro")}  maxLength={100}  desp="服务提供地点" path="/dedgrp/rec/shppro" />
							</Col>
						</Row>
					</Col>
				</Row>

				{/* 第十二行 */}
				<Row>
					<Col span={24}>
						<Row className="row">
							<Col span={4} offset={1}>
								<Label itext="有效地点"  />
							</Col>
							<Col span={10}>
								<InputItem InputProps={bind("expplc")}  maxLength={100}  desp="有效地点" path="/dedgrp/rec/expplc" />
							</Col>
						</Row>
					</Col>
				</Row>

				{/* 底部按钮 */}
        <BottomBtn _this={this} />
			</div >
		)
	}
}
