<template>
	<div class="eibs-tab">
		<c-row>
			<c-col :span="24">
				<c-col :span="12" style="padding-right: 20px">
					<!--========================== 不为swift格式左边 =========================================-->
					<c-col :span="24" v-if="model.nidgrp.rec.othersno =='F0000002'">
						<el-card class="box-card">
							<el-form-item prop="nidgrp.rec.idcode" :required="model.nidgrp.rec.othersno =='F0000002'">
								<span slot="label">
									<div>申请人</div>
									<div>社会统一信用代码</div>
								</span>
								<c-input v-model="model.nidgrp.rec.idcode" maxlength="18"
										 placeholder="请输入申请人社会统一信用代码"></c-input>
							</el-form-item>
					  <c-ptap :isShowCard='false' :model="model" :isAdrblk="false" :haveAdrLabel="true"  :requiredExtkey="true"
						:disabled="model.nidgrp.rec.hndtyp != 'OT'||comper=='X'" :disabledRef="comper=='X'" :disabledExtkey="comper=='X'" :argadr="{ title: $t('ptap.申请人'), grp: 'nidgrp', rol: 'apl'}"
						:ptytyp="model.nidgrp.rec.hndtyp=='OT'?'B,F':'C'" @clear="clearDeleteData(true)" @handleChange="getBilvvvData"></c-ptap>
						</el-card>
					</c-col>

					<c-col :span="24" v-if="model.nidgrp.rec.othersno !='F0000002'">
						<!-- :requiredNam="model.nidgrp.rec.hndtyp =='OT'"  -->
						<c-ptap 
							:model="model" 
							:isAdrblk="false" 
							:haveAdrLabel="true" 
							:disabled="model.nidgrp.rec.hndtyp != 'OT'||comper=='X'" 
							:disabledRef="comper=='X'" 
							:disabledExtkey="comper=='X'" 
							:requiredExtkey="true"
							:argadr="{ title: $t('ptap.申请人'), grp: 'nidgrp', rol: 'apl'}"
							:ptytyp="model.nidgrp.rec.hndtyp=='OT'?'B,F':'C'"
							@clear="clearDeleteData(true)"
							@handleChange="getBilvvvData"
						></c-ptap>
					</c-col>

					<!-- 增加判断nidgrp.rec.fenlishi有值时被保证人亮,为空时灰 -->
<!--						<el-card class="box-card">
							<c-col :span="24">
								<el-form-item :label="$t('nitopn.被保证人社会统一信用代码')" prop="nidgrp.rec.grtjuscod" :required="model.nidgrp.rec.fenlishi!='' && model.nidgrp.rec.hndtyp == 'OL'">
									<c-input :disabled="!model.nidgrp.rec.fenlishi"  v-model="model.nidgrp.rec.grtjuscod" @change='changeValues' maxlength="18"
									  placeholder="请输入被保证人社会统一信用代码"></c-input>
								</el-form-item>
							</c-col>
							<c-col :span="24">
								<el-form-item label="名称" prop="nidgrp.bdb.pts.nam">
									<c-mul-row-input type="textarea" :rows="2" :cols="35" :autosize="{minRows: 1,	maxRows: 2}" :charmod=" 0" v-model="model.nidgrp.bdb.pts.nam"
									  placeholder="" :disabled="( model.nidgrp.rec.hndtyp == 'OL' && !model.nidgrp.rec.fenlishi)||(model.nidgrp.rec.hndtyp == 'OT')||(model.nidgrp.rec.hndtyp == 'OC')" maxlength="70" show-word-limit></c-mul-row-input>
								</el-form-item>
							</c-col>

							<c-col :span="24">
								<el-form-item label="地址" prop="nidgrp.bdb.pts.adrblk">
									<c-mul-row-input type="textarea" :rows="2" :cols="35" :autosize="{minRows: 1,	maxRows: 2}" :charmod="0" v-model="model.nidgrp.bdb.pts.adrblk"
									  placeholder="" :disabled="!model.nidgrp.rec.fenlishi && model.nidgrp.rec.hndtyp != 'OT'" maxlength="150" show-word-limit></c-mul-row-input>
								</el-form-item>
							</c-col>
						</el-card>-->

					<c-col :span="24">
						<el-card class="box-card">
							<el-form-item prop="nidgrp.rec.grtjuscod" >
								<span slot="label">
									<div>被保证人</div>
									<div>社会统一信用代码</div>
								</span>
								<c-input 	:disabled="!( (model.nidgrp.rec.hndtyp == 'OL' || model.nidgrp.rec.hndtyp == 'OC') && model.nidgrp.rec.fenlishi!='')"
										 v-model="model.nidgrp.rec.grtjuscod" @change='changeValues' maxlength="18"
										 placeholder="请输入被保证人社会统一信用代码"></c-input>
							</el-form-item>
							<c-ptap
								:model="model"
								:isAdrblk="false" :haveAdrLabel="true"
								:no-extkey="true"
								:disabled="(model.nidgrp.rec.hndtyp == 'OC' || model.nidgrp.rec.hndtyp == 'OL' || model.nidgrp.rec.hndtyp == 'OT') && model.nidgrp.rec.fenlishi == ''"
								:noEditNameAndAddress="this.codes.judgeFlg"
								:argadr="{ title:'被保证人', grp: 'nidgrp', rol: 'bdb'}"
								ptytyp="C"
								:isShowCard="false"
                :requiredNam="model.nidgrp.rec.hndtyp == 'OL' && model.nidgrp.rec.fenlishi !== ''"
							></c-ptap>
							<!-- 灰显状态下清空ptap内容 -->
							<el-button class="el-bu" icon="el-icon-close" circle @click="clearBdbData"></el-button>

						</el-card>
					</c-col>

					<!-- <c-col :span="24" v-if="model.nidgrp.rec.hndtyp != 'OT'">
						<c-ptap :model="model" :isAdrblk="true" :haveAdrLabel="true" :disabled="true" :disabledExtkey="model.nidgrp.rec.hndtyp == 'OL'"
							:argadr="{ title: $t('ptap.反担保行'), grp: 'nidgrp', rol: 'ctr'}" ptytyp="B">
						</c-ptap>
					</c-col> -->

					<!-- <c-col :span="24">
						<el-card class="box-card">
							<c-ptap
								:model="model"
								:isAdrblk="false"
								:requiredExtkey="model.nidgrp.rec.hndtyp == 'OL' && model.nidgrp.rec.fenlishi=='2' "
								:disabledExtkey="!(model.nidgrp.rec.hndtyp == 'OL' && model.nidgrp.rec.fenlishi=='2')"
								:disabled="!(model.nidgrp.rec.hndtyp == 'OL' && model.nidgrp.rec.fenlishi=='2')"
								:argadr="{ title:'被保证人', grp: 'nidgrp', rol: 'bdb'}"
								ptytyp="B"
								:isShowCard="false"
							></c-ptap>
							<el-form-item label="社会统一信用代码" prop="nidgrp.rec.grtjuscod" :required="model.nidgrp.rec.hndtyp == 'OL' && model.nidgrp.rec.fenlishi=='2' ">
									<c-input :disabled="!(model.nidgrp.rec.hndtyp == 'OL' && model.nidgrp.rec.fenlishi=='2')" v-model="model.nidgrp.rec.grtjuscod" @change='changeValues' maxlength="18"
									  placeholder="请输入社会统一信用代码"></c-input>
							</el-form-item>
						</el-card>
					</c-col> -->
				</c-col>

				<c-col :span="12" style="padding-left: 20px">
					<!-- ==========================不为swift格式右边=================================== -->
					<c-col :span="24">
            <c-col :span="24" v-if="model.nidgrp.rec.othersno =='F0000002'">
						  <el-card class="box-card">
							<el-form-item prop="nidgrp.rec.benecreditcode" :required="model.nidgrp.rec.othersno =='F0000002'">
								<span slot="label">
									<div>受益人</div>
									<div>社会统一信用代码</div>
								</span>
								<c-input v-model="model.nidgrp.rec.benecreditcode" maxlength="18"
										 placeholder="请输入受益人社会统一信用代码"></c-input>
							</el-form-item>
					  <c-ptap :isShowCard='false'
								:model="model" 
								:isAdrblk="false"
								:haveAdrLabel="true"
								:argadr="{title:$t('ptap.受益人'), grp: 'nidgrp', rol: 'ben'}"
								:disabled="model.nidgrp.rec.hndtyp == 'OT'||comper=='X' || (model.nidgrp.rec.gartyp == 'F' && model.nidgrp.rec.segtyp == '01')" 
								:disabledRef="comper=='X'"
								 :noEditNameAndAddress="!(model.nidgrp.rec.hndtyp == 'OT' && model.nidgrp.rec.beyzd6=='Y')"
								:disabledExtkey="comper=='X'" 
								:ptytyp="model.nidgrp.rec.gartyp == 'F'?'H':(model.nidgrp.rec.hndtyp=='OT'?'C':'F')"
								@clear="clearDeleteData(true)" 
								@handleChange="getBilvvvDatas"
								:requiredExtkey="true"
                :requiredNam="(model.nidgrp.rec.hndtyp == 'OL' || model.nidgrp.rec.hndtyp == 'OT') || (model.nidgrp.rec.hndtyp == 'OC' && model.nidgrp.rec.fenlishi == '')"
							></c-ptap>
						</el-card>
					</c-col>

						<c-col :span="24" v-if="model.nidgrp.rec.othersno !='F0000002'">
							<c-ptap 
								:model="model" 
								:isAdrblk="false"
								:haveAdrLabel="true" 
								:argadr="{title: '受益人', grp: 'nidgrp', rol: 'ben'}" 
								:disabled="model.nidgrp.rec.hndtyp == 'OT' || (model.nidgrp.rec.gartyp == 'F' && model.nidgrp.rec.segtyp == '01')"
								:ptytyp="model.nidgrp.rec.gartyp == 'F'?'H':(model.nidgrp.rec.hndtyp=='OT'?'C':'F')"
								 :noEditNameAndAddress="!(model.nidgrp.rec.hndtyp == 'OT' && model.nidgrp.rec.beyzd6=='Y')"
								@clear="clearDeleteData(true)"
								@handleChange="getBilvvvDatas"
								:requiredExtkey="true"
                :requiredNam="(model.nidgrp.rec.hndtyp == 'OL' || model.nidgrp.rec.hndtyp == 'OT') || (model.nidgrp.rec.hndtyp == 'OC' && model.nidgrp.rec.fenlishi == '')"
						></c-ptap>
						</c-col>
						
						<c-col :span="24" v-if="model.nidgrp.rec.hndtyp == 'OC'">
							<c-ptap :model="model" :isAdrblk="true" :haveAdrLabel="true" :argadr="{
									title: $t('ptap.转开行'), grp: 'nidgrp', rol: 'iss'}" ptytyp="B" 
									:requiredExtkey="model.nidgrp.rec.hndtyp == 'OC'">
							</c-ptap>
						</c-col>

           <c-col :span="24" v-if="model.nidgrp.rec.hndtyp == 'OT'">
							<c-ptap 
								:model="model" 
								:isAdrblk="true" 
								:haveAdrLabel="true" 
								:disabled="true" 
								:argadr="{title: $t('ptap.反担保行'), grp: 'nidgrp', rol: 'iss'}" 
								ptytyp="B"
								:requiredExtkey="model.nidgrp.rec.hndtyp == 'OT'"
							>
							</c-ptap>
						</c-col>

						<c-col :span="24" v-if="model.nidgrp.rec.hndtyp =='OL'">
							<c-ptap :model="model" @handleChange="setAdvBankChange" :isAdrblk="true" :haveAdrLabel="true" :argadr="{
									title: '通知行', grp: 'nidgrp', rol: 'adv'}" ptytyp="B">
							</c-ptap>
						</c-col>
						
					</c-col>
				</c-col>
			</c-col>
		</c-row>
	</div>
</template>
<script>
    import event from "../event";
    import Default from "../model/default";

    export default {
  inject: ["root"],
  props: ["model", "codes"],
  mixins: [event, Default],
  data() {
    return {};
  },
	methods: {},
	mounted(){
		this.$set(this.codes, 'judgeFlg', true);
	},
	watch:{
		"model.nidgrp.bdb.pts.extkey"(newVal,oldVal){
			if(!newVal && this.model.nidgrp.rec.fenlishi != ''){
				this.$set(this.codes, 'judgeFlg', false);
			}else{
				this.$set(this.codes, 'judgeFlg', true);
			}
		},
		immediate:true
	},
  created: function() {},
  computed: {
    comper() {
			let isHasDepartmentNumber = this.$store.state.UserContext.currentOrg && this.$store.state.UserContext.currentOrg.departmentNumber == 1000;
      if (isHasDepartmentNumber && this.codes.sndflgJudgement =='X') {
        return "X";
      } else {
        return "";
      }
    }
  }
};
</script>
<style scoped lang="less">
.box-card {
	position: relative;
  margin-bottom: 10px;
  /deep/ .el-form-item--mini.el-form-item,
  .el-form-item--small.el-form-item {
    margin-bottom: 10px;
  }
  /deep/ .el-card__body {
    padding: 10px 10px 10px 0px;
	}
	.el-bu {
		position: absolute;
    right: 20px;
    top: 60px;
    max-width: 20px;
    max-height: 20px;
    display: flex;
    justify-content: center;
		align-items: center;
		opacity: 0;
	}
	.el-bu:hover{
		opacity: 1;
	}
}
</style>