<template>
	<div class="eibs-tab">
		<c-col :span="12" class="col-left">
			<!-- S0000004 : 保证金账户 -->
			<c-col :span="24">
				<c-col :span="20">
					<el-form-item label="保证金账户" prop="dnfmodVo.kehuzh">
						<c-select v-model="model.dnfmodVo.kehuzh" 
									@change="changeKehuzh('noInit')"
									style="width:100%" 
									placeholder="请选择保证金账户">
							<el-option v-for="item in accountList" :key="item.value" :label="item.label" :value="item.value">
							</el-option>
						</c-select>
					</el-form-item>
				</c-col>
				<c-col :span="4">
						<!--  @click="onDnfencGet()" -->
					<c-button style="margin: 0px 0px 0px 20px;" @click="onDnfencGet"
						:disabled="model.dnfmodVo.kehuzh === ''"
						type="primary" icon="el-icon-search"  size="small">
						查询
					</c-button>
				</c-col>
			</c-col>

			<!-- S0000102 : 支取类型 -->
			<c-col :span="24">
				<el-form-item label="支取类型" prop="dnfmodVo.zhqtyp" :required="model.dnfmodVo.ccvtyp == 'C'">
					<c-select 
					@change="changeZhqtyp('noInit')"
					v-model="model.dnfmodVo.zhqtyp" 
					style="width:100%" 
					placeholder="请选择支取类型" 
					dbCode="zhqtyp"
					:disabled="!(model.dnfmodVo.ccvtyp === 'C')"
					>
					</c-select>
				</el-form-item>
			</c-col>

			<!-- S0000103 : 部分提支金额 -->
			<c-col :span="24">
				<el-form-item label="部分提支金额" :required="model.dnfmodVo.zhqtyp == 'B'" prop="dnfmodVo.tizamt">
					<c-input-currency :disabled="!(model.dnfmodVo.zhqtyp === 'B')" 
					v-model="model.dnfmodVo.tizamt" 
					@change="changeTizamt('noInit')"
          :currency="model.dnfmodVo.cur"
					placeholder="请输入部分提支金额">
					</c-input-currency>
				</el-form-item>
			</c-col>

			<!-- S0000026 : 本金转入账户 -->
			<c-col :span="24">
				<c-col :span="12">
					<el-form-item label="本金转入账户" prop="dnfmodVo.pridsp">
						<c-select v-model="model.dnfmodVo.pridsp" :disabled="model.dnfmodVo.zhqtyp === ''" 
						 @change="changePridsp('noInit')" style="width:100%" placeholder="" dbCode="dspint">
						</c-select>
					</el-form-item>
				</c-col>
				<c-col :span="12">
					<el-form-item label="" :prop="model.dnfmodVo.zhqtyp != '' ? 'dnfmodVo.zhruzh' : null" :key="model.dnfmodVo.zhqtyp != '' ? 'dnfmodVo.zhruzh' : null" 
						label-width="10px">
						<c-select v-model="model.dnfmodVo.zhruzh" @blur="allowMinputZhruzh($event)" :filterable="true" :disabled="model.dnfmodVo.zhqtyp === ''" style="width:100%" placeholder="">
							<el-option v-for="item in zhruzhList" :key="item.value" :label="item.label" :value="item.value">
							</el-option>
						</c-select>
					</el-form-item>
				</c-col>
			</c-col>

			<!-- S0000106 : 利息转入账户 -->
			<c-col :span="24">
				<c-col :span="12">
					<el-form-item label="利息转入账户" prop="dnfmodVo.intdsp">
						<c-select v-model="model.dnfmodVo.intdsp" :disabled="model.dnfmodVo.zhqtyp === ''"
							@change="changeIntdsp('noInit')" style="width:100%" placeholder="" dbCode="DSPPRI">
						</c-select>
					</el-form-item>
				</c-col>
				<c-col :span="12">
					<el-form-item label="" prop="dnfmodVo.lxzyzh" label-width="10px">
						<c-select v-model="model.dnfmodVo.lxzyzh" @blur="allowMinputLxzyzh($event)" :filterable="true" :disabled="model.dnfmodVo.zhqtyp === ''"
							 style="width:100%" placeholder="">
							 <el-option v-for="item in lxzyzhList" :key="item.value" :label="item.label" :value="item.value">
							</el-option>
						</c-select>
					</el-form-item>
				</c-col>
			</c-col>
		</c-col>

		<c-col :span="12" class="col-right">
			<!-- S0000003 : 操作类型 -->
			<c-col :span="24">
				<el-form-item label="操作类型" prop="dnfmodVo.ccvtyp">
					<c-select  v-model="model.dnfmodVo.ccvtyp" style="width:100%" placeholder="请选择操作类型" @change="changeCcvtyp('noInit')">
						<!-- dbCode="ccvtyp1" -->
						<el-option v-for="item in codes.operationsList" :key="item.value" :label="item.label" :value="item.value">
							</el-option>
					</c-select>
				</el-form-item>
			</c-col>
			<!-- S0000105 : 支取次数 -->
			<c-col :span="24">
				<el-form-item label="支取次数" prop="dnfmodVo.zhqucs">
					<c-input v-model="model.dnfmodVo.zhqucs" maxlength="2" style="width:100%" placeholder="请输入支取次数" disabled></c-input>
				</el-form-item>
			</c-col>

			<!-- S0000108 : 业务代号 -->
			<c-col :span="24">
				<el-form-item label="业务代号" prop="dnfmodVo.yewudh">
					<c-input disabled v-model="model.dnfmodVo.yewudh" style="width:100%" maxlength="4" placeholder="请输入业务代号"></c-input>
				</el-form-item>
			</c-col>

			<!-- S0000111 : 起存金额 -->
			<c-col :span="24">
				<c-col :span="20">
					<el-form-item label="起存金额" prop="dnfmodVo.qicuje">
						<c-input-currency disabled v-model="model.dnfmodVo.qicuje"  placeholder="请输入起存金额" :currency="model.dnfmodVo.cur"></c-input-currency>
					</el-form-item>
				</c-col>
				<c-col :span="4">
					<c-button style="margin: 0px 0px 0px 20px" size="small" 
						@click="qicujeGet"
						type="primary" :disabled="!(model.dnfmodVo.ccvtyp === 'C')">
						获取
					</c-button>
				</c-col>
			</c-col>

			<!-- S0000104 : 账户余额 -->
			<c-col :span="24">
				<el-form-item label="账户余额" prop="dnfmodVo.zhhuye">
					<c-input-currency disabled  v-model="model.dnfmodVo.zhhuye" style="width:100%" placeholder="请输入账户余额" :currency="model.dnfmodVo.cur"></c-input-currency>
				</el-form-item>
			</c-col>
		</c-col>
		<!-- <c-col :span="24" style="text-align: right">
			<el-button type="primary" icon="el-icon-search"  @click="onDnfencGet" size="small">查询</el-button>
		</c-col> -->



		<c-col :span="24" style="margin-bottom: 35px">
			<el-table ref="table" :data="codes.tableDataList" border >
          <el-table-column property="kehuzh" label="账号" width="170"></el-table-column>
          <el-table-column property="kehzwm" label="客户中文名" width="150"></el-table-column>
					<el-table-column property="zhngjg" label="账务机构号" width="200"></el-table-column>
					<el-table-column property="yewudh" label="业务代号" width="80"></el-table-column>
					<el-table-column property="jixiff" label="计息方法" width="80"></el-table-column>
					<el-table-column property="lilvbh" label="利率编号" width="80"></el-table-column>
					<el-table-column property="jishuu" label="积数" width="100"></el-table-column>
					<el-table-column property="zuidje" label="最低金额" width="200"></el-table-column>
					<el-table-column property="zuigje" label="最高金额" width="80"></el-table-column>
					<el-table-column property="kaihrq" label="开户日期" width="100"></el-table-column>
					<el-table-column property="lilvll" label="利率" width="80"></el-table-column>
					<el-table-column property="jiluzt" label="记录状态" width="80"></el-table-column>
					<el-table-column property="kemucc" label="科目存储" width="80"></el-table-column>
					<el-table-column property="huobdh" label="货币代号" width="80"></el-table-column>
					<el-table-column property="xiohrq" label="销户日期" width="100"></el-table-column>
					<el-table-column property="ljzqje" label="累计支取金额" width="120"></el-table-column>
					<el-table-column property="kaihje" label="开户金额" width="80"></el-table-column>
					<el-table-column property="cunkzl" label="存款种类" width="80"></el-table-column>
					<el-table-column property="cunqii" label="存期" width="80"></el-table-column>
					<el-table-column property="daoqrq" label="到期日" width="100"></el-table-column>
					<el-table-column property="qixirq" label="起息日" width="100"></el-table-column>
					<el-table-column property="zhqucs" label="支取次数" width="80"></el-table-column>
					<el-table-column property="youhll" label="优惠利率" width="80"></el-table-column>
					<el-table-column property="zdzczh" label="自动转存账户" width="120"></el-table-column>
            </el-table>
			<!-- <el-table ref="table" :list="model.dnfmodVo.stm8023.rows || []" :columns="stmData.columns" prop="dnfmodVo.stm8023">
			</el-table> -->
		</c-col>
	</div>
</template>
<script>
import event from "../event";
import Defalut from "../model/default"
export default {
  inject: ["root"],
	props: ["model", "codes","accountList", "operations","tableData","ccvpanSelections"],
	mixins: [event, Defalut],
	watch:{
		operations: {
			handler(newValue){
        console.log(newValue,'newValue')
				this.operationsList = newValue
			},
			deep: true
    },
    tableData: {
      handler(newValue){
				this.tableDataList = newValue
			},
			deep: true
    },
    "model.dnfmodVo.zhqtyp":function(newVal,oldVal){
      if(newVal != oldVal){
        this.addZhruzh()
      }
    },
    "model.dnfmodVo.tizamt":function(newVal,oldVal){
      if(newVal != oldVal){
        this.addZhruzh()
      }
    },
    "model.dnfmodVo.pridsp":function(newVal,oldVal){
      if(newVal != oldVal){
        this.addZhruzh()
      }
    },
    "model.dnfmodVo.zhruzh":function(newVal,oldVal){
      if(newVal != oldVal){
        this.addZhruzh()
      }
    },
    
   },
  data() {
    return {
      stmData: {
        columns: [
          '1 1 "账号" 155',
          '2 2 "客户中文名" 155',
          '3 3 "账务机构" 155',
          '4 4 "业务代号" 155',
          '5 5 "计息方法" 155',
          '6 6 "利率编号" 155',
          '7 7 "积数" 155'
        ]
	  },
	  operationsList: [],
	  lxzyzhList: [],
    zhruzhList: [],
    tableDataList:[],
    };
  },
  methods: {
	   allowMinputZhruzh(e) {
      if (e.target.value && e.target.value.trim()) {
        this.model.dnfmod.zhruzh = e.target.value.trim();
      }
    },

    allowMinputLxzyzh(e) {
      if (e.target.value && e.target.value.trim()) {
        this.model.dnfmod.lxzyzh = e.target.value.trim();
      }
    },
  },
};
</script>
<style scoped lang="less">
::v-deep .c-highlight-content {
overflow: hidden;
}
</style>