<template>
  <div class="eContainer">
    <c-page title="保函详情">
      <el-form :model="model" :rules="(this.opentyp == 'GJBH' && 'OC|OL|OT'.includes(this.hndtyp)) ? rules1 : (this.opentyp == 'GNBH' && 'OC|OL|OT'.includes(this.hndtyp)? rules2 :(this.opentyp == 'HGBH' && 'OC|OL|OT'.includes(this.hndtyp) ? rules3 :(this.opentyp == 'GJBH' && 'FA|FR|FI'.includes(this.hndtyp) ? rules4 :(this.opentyp == 'GNBH' && 'FA|FR|FI'.includes(this.hndtyp) ? rules5 : rules)))) " 
      ref="modelForm" label-width="120px" label-position="right" size="small" :validate-on-rule-change="false">

        <c-tabs v-model="tabVal" ref="elment" type="card" @tab-click="tabClick">
          <!--PD000001 -->
          <!-- <el-tab-pane label="业务信息" name="ovwp" >
            <c-content>
              <m-ovwp :model="model" :codes="codes" />
            </c-content>
          </el-tab-pane> -->
          <el-tab-pane label="业务信息" name="ovwp">
            <c-content>
              <div v-if="opentyp == 'GJBH' && 'OC|OL|OT'.includes(hndtyp)">
                <m-ovwpgitopn :model="model" :codes="codes" />
              </div>
              <div v-else-if="opentyp == 'GNBH' && 'OC|OL|OT'.includes(hndtyp)">
                <m-ovwpnitopn :model="model" :codes="codes" />
              </div>
              <div v-else-if="opentyp == 'HGBH' && 'OC|OL|OT'.includes(hndtyp)">
                <m-ovwphitopn :model="model" :codes="codes" />
              </div>
              <div v-else-if="opentyp == 'GJBH' && 'FA|FR|FI'.includes(hndtyp)">
                <m-ovwpgetopn :model="model" :codes="codes" />
              </div>
              <div v-else-if="opentyp == 'GNBH' && 'FA|FR|FI'.includes(hndtyp)">
                <m-ovwpnetopn :model="model" :codes="codes" />
              </div>
            </c-content>
          </el-tab-pane>

          <el-tab-pane label="保函文本" name="gidtxtp"> 
            <!-- <m-gidtxtp :model="model" :codes="codes" /> -->
            <c-content>
              <div v-if="opentyp == 'GJBH' && 'OC|OL|OT'.includes(hndtyp)">
                <m-gidtxtpgitopn :model="model" :codes="codes" />
              </div>
              <div v-else-if="opentyp == 'GNBH' && 'OC|OL|OT'.includes(hndtyp)">
                <m-gidtxtpnitopn :model="model" :codes="codes" />
              </div>
              <div v-else-if="opentyp == 'HGBH' && 'OC|OL|OT'.includes(hndtyp)">
                <m-gidtxtphitopn :model="model" :codes="codes" />
              </div>
              <div v-else-if="opentyp == 'GJBH' && 'FA|FR|FI'.includes(hndtyp)">
                <m-gidtxtpgetopn :model="model" :codes="codes" />
              </div>
              <div v-else-if="opentyp == 'GNBH' && 'FA|FR|FI'.includes(hndtyp)">
                <m-gidtxtpnetopn :model="model" :codes="codes" />
              </div>
            </c-content>
          </el-tab-pane>

          <el-tab-pane label="授信/表外" name="liacombo">
            <!-- <c-content>
              <m-ccvpan :model="model" :codes="codes" :ccvtableData="ccvtableData" />
            </c-content> -->
             <c-content>
              <div class="eibs-tab">
                <c-collapse ref="liacombo" v-model="activeNames" style="margin-bottom: 5px;">
                  <el-collapse-item :title="$t('commonCollapse.保证金')" name="ccvpan">
                    <m-ccvpan :model="model" :codes="codes" :ccvtableData="ccvtableData" />
                  </el-collapse-item>

                  <el-collapse-item :title="$t('commonCollapse.统一授信')" name="limitbody">
                    <m-limitbody :model="model" :codes="codes" :feptableData1="feptableData1" />
                  </el-collapse-item>

                  <el-collapse-item :title="$t('commonCollapse.表外信息')" name="engp">
                    <m-engp :model="model" :codes="codes" :liatableData="liatableData"/>
                  </el-collapse-item>
                </c-collapse>
              </div>
            </c-content>
          </el-tab-pane>

          <el-tab-pane label="余额信息" name="cbsp">
            <c-content>
              <m-cbsp :model="model" :codes="codes" :obj="obj" @changeCbsData="changeCbsData" :cbstableData="cbstableData" :cbbtyp="cbbtyp" />
            </c-content>
          </el-tab-pane>

          <el-tab-pane label="发生额信息" name="cbep">
            <c-content>
              <m-cbep :model="model" :codes="codes" :cbetableData="cbetableData" />
            </c-content>
          </el-tab-pane>

          <el-tab-pane label="费用" name="fep">
            <c-content>
              <m-fep :model="model" :codes="codes" :obj="obj" @changeFepData="changeFepData" @changeFcpData="changeFcpData" :feptableData="feptableData" :fcptableData="fcptableData" />
            </c-content>
          </el-tab-pane>

          <el-tab-pane label="历史信息" name="trnp">
            <c-content>
              <m-trnp :model="model" :codes="codes" :obj="obj"  @changeVal="changeVal" @changeData="changeData" @changeTrnData="changeTrnData" :trntableData="trntableData" />
            </c-content>
          </el-tab-pane>

          <el-tab-pane v-if="this.model.trnShow" label="历史详细信息" name="trnp0">
            <c-content>
              <m-trnp0 :model="model" :codes="codes" :smhtableDataT="smhtableDataT" :trstableData="trstableData" />
            </c-content>
          </el-tab-pane>

          <el-tab-pane label="报文/面函" name="smhp">
            <c-content>
              <m-smh :model="model" :obj="obj" :codes="codes" @changeSmhData="changeSmhData" :smhtableData="smhtableData" />
            </c-content>
          </el-tab-pane>
        </c-tabs>
      </el-form>
    </c-page>
  </div>
</template>
<script>
import Api from "~/service/Api";
import CodeTable from "~/config/CodeTable";
import Gidinf from "../model";
import Ovwp from "./Ovwp";
import Gidtxtp from "./Gidtxtp";
import Trnpan from "./Trnpan";
import Trnp0 from "./Trnp0";
import Cbsinfp from "./Cbsinfp";
import Cbeinfp from "./Cbeinfp";
import Fepinfp from "./Fepinfp";
import Smhinfp from "./Smhinfp";
import event from "../event";
import Check from "../model/check";
import Default from "../model/default";
import Ccvpan from "./Ccvinfp";
import Engp from "./Engp";
import operationFunc from "~/mixin/operationFunc";
import commonDepend from "~/mixin/commonDepend";
import limitbody from "./Limp1";
  // import Engp from "~/components/business/engp/views";
// import OvwpGitopn from "../../Gitopn/views/Ovwpq";
import OvwpGitopn from "./gitopn/Ovwpq";
import OvwpNitopn from "./nitopn/Ovwp";
import OvwpHitopn from "./hitopn/Ovwp";
import OvwpGetopn from "./getopn/Ovwp";
import OvwpNetopn from "./netopn/Ovwp";
import GidtxtpGitopn from "./gitopn/Gidtxtp";
import GidtxtpNitopn from "./nitopn/Nidtxtp";
import GidtxtpHitopn from "./hitopn/Nidtxtp";
import GidtxtpGetopn from "./getopn/Gidtxtp";
import GidtxtpNetopn from "./netopn/Nidtxtp";
import Check1 from  "../model/gitopn/check";
import Check2 from  "../model/nitopn/check";
import Check3 from  "../model/hitopn/check";
import Check4 from  "../model/getopn/check";
import Check5 from  "../model/netopn/check";

export default {
  name: "Gidinf",
  components: {
    "m-ovwp": Ovwp,
    "m-ovwpgitopn": OvwpGitopn,
    "m-ovwpnitopn": OvwpNitopn,
    "m-ovwphitopn": OvwpHitopn,
    "m-ovwpgetopn": OvwpGetopn,
    "m-ovwpnetopn": OvwpNetopn,
    "m-gidtxtp": Gidtxtp,
    "m-gidtxtpgitopn": GidtxtpGitopn,
    "m-gidtxtpnitopn": GidtxtpNitopn,
    "m-gidtxtphitopn": GidtxtpHitopn,
    "m-gidtxtpgetopn": GidtxtpGetopn,
    "m-gidtxtpnetopn": GidtxtpNetopn,
    "m-trnp": Trnpan,
    "m-trnp0": Trnp0,
    "m-ccvpan": Ccvpan,
    "m-engp": Engp,
    "m-limitbody": limitbody,
    "m-cbsp": Cbsinfp,
    "m-cbep": Cbeinfp,
    "m-fep": Fepinfp,
    "m-smh": Smhinfp
  },
  provide() {
    return {
      root: this,
      activeNames: ["ovwp"]
    };
  },
  mixins: [Check, Check1,Check2,Check3,Check4,Check5,Default, operationFunc, event, commonDepend],
  data() {
    return {
      tabVal: "ovwp",
      trnName: "gidinf",
      model: new Gidinf().data,
      activeNames: ["ccvpan", "limitbody", "engp"],
      codes: {
        ...CodeTable
      },
      // trnShow:false,
      opentyp: "",
      hndtyp: "",
      cbbtyp: [],
      cbstableData: [],
      cbetableData: [],
      feptableData: [],
      fcptableData: [],
      trntableData: [],
      smhtableDataT: [],
      trstableData: [],
      smhtableData: [],
      ccvtableData: [],
      liatableData: [],
      feptableData1: [],
      obj:{
        objtyp: "",
        objinr: "",
        subobjtyp:"",
      },
    };
  },
  methods: {},
  mounted() {
    this.getgtxInfo()
    this.opentyp = this.$route.query.opentyp;
    this.hndtyp = this.$route.query.hndtyp;
    this.model.inifrm = this.$route.query.inifrm;
    this.obj.objtyp = this.opentyp == "GJBH" ? "GID" : "NID";
    this.obj.objinr = this.$route.query.inr
    this.obj.subobjtyp = this.opentyp == "GJBH" ? "GCD" : "NCD";
    if (this.opentyp === "GJBH") {
      this.model.gidgrp.rec.inr = this.$route.query.inr;
    } else {
      this.model.nidgrp.rec.inr = this.$route.query.inr;
    }
    this.getGidDataByInr(this.opentyp);
    this.getdbCode("feetxt", "", "feetxt");
    this.getdbCode("fepdsp", "", "fepdsp");
    this.getdbCode("relsta", "", "relsta");
    this.getdbCode("actsta", "", "actsta");
    this.getdbCode("cortyp", "", "cortyp");
    this.getdbCode("smhdir", "", "smhdir");
    this.getdbCode("cbctxt", "", "cbctyp");
    this.getdbCode("cbttxt", "", "cbttxt");
    this.getdbCode('LIMTYP','CN','LIMTYP');
    this.getdbCode("LIMSTA", "CN", "LIMSTA");
    this.getdbCode("LMSTXT", "CN", "LMSTXT");
    this.getdbCode("YWCJ", "CN", "YWCJ");
    this.getdbCode("CAOZBZ", "CN", "CAOZBZ");
    this.getdbCode("trntyp", "CN", "trntyp");
    this.getdbCode("cbtpfx", "CN", "cbtpfx");
    this.getdbCode("CURKEY", "CN", "CURKEY");
  }
};
</script>
<style scoped>
.eContainer {
  padding-top: 20px !important;
}
</style>