<template>
  <div class="eContainer">
     <div style="padding:0 15px">
    <el-form :model="model" :rules="rules" ref="modelForm" label-width="110px" label-position="right" size="small" :validate-on-rule-change="false">
       
        
            <!--PD000006 -->
           <!-- <el-tab-pane label="信用证查询" name="infsea"> -->
                <!-- <c-content> -->
                <m-infsea v-show="!showPanel" @updateShowPanel="updateShowPanel($event)"  :model="model" :codes="codes"/>
                
                <!-- </c-content> -->
           <!-- </el-tab-pane> -->
          <c-tabs v-model="tabVal" v-show="showPanel" ref="elment" type="card" @tab-click="tabClick">
            <!--PD000001 -->
           <el-tab-pane label="基本信息" name="ovwp">
                <m-ovwp :model="model" :codes="codes"/>
           </el-tab-pane>

           <!--PD000452 -->
           <el-tab-pane label="其他当事人" name="detp1">
                <m-detp1 :model="model" :codes="codes"/>
           </el-tab-pane>
 
            <!--PD000077 -->
           <el-tab-pane label="详细信息" name="detp">
                <m-detp :model="model" :codes="codes"/>
           </el-tab-pane>
 
            <!--PD000342 -->
           <el-tab-pane label="单据要求" name="tk">
                <m-tk :model="model" :codes="codes"/>
           </el-tab-pane>
 
            <!--PD000000 -->
           <el-tab-pane label="附言" name="coninfp">
                <m-coninfp :model="model" :codes="codes"/>
           </el-tab-pane>
 
            <!--PD000013 -->
           <!-- <el-tab-pane label="PD000013" name="trnpan">
                <m-trnpan :model="model" :codes="codes"/>
           </el-tab-pane> -->
 
            <!--PD000019 -->
           <!-- <el-tab-pane label="PD000019" name="cbsinfp">
                <m-cbsinfp :model="model" :codes="codes"/>
           </el-tab-pane> -->
 
            <!--PD000028 -->
           <!-- <el-tab-pane label="PD000028" name="cbeinfp">
                <m-cbeinfp :model="model" :codes="codes"/>
           </el-tab-pane> -->
 
            <!-- FEP /FCP Info -->
           <el-tab-pane label="FEP /FCP Info" name="fepinfp">
                <m-fepinfp :model="model" :codes="codes"/>
           </el-tab-pane>
 
            <!--PD000162 -->
           <!-- <el-tab-pane label="PD000162" name="sepinfp">
                <m-sepinfp :model="model" :codes="codes"/>
           </el-tab-pane> -->
 
            <!--PD000177 -->
           <!-- <el-tab-pane label="PD000177" name="gleinfp">
                <m-gleinfp :model="model" :codes="codes"/>
           </el-tab-pane> -->
 
            <!--PD000119 -->
           <!-- <el-tab-pane label="PD000119" name="smhinfp">
                <m-smhinfp :model="model" :codes="codes"/>
           </el-tab-pane> -->
 
            <!--PD000130 -->
           <!-- <el-tab-pane label="PD000130" name="peninfp">
                <m-peninfp :model="model" :codes="codes"/>
           </el-tab-pane> -->
 
            <!--PD000147 -->
           <!-- <el-tab-pane label="PD000147" name="liainfp">
                <m-liainfp :model="model" :codes="codes"/>
           </el-tab-pane> -->
 
            <!--PD000005 -->
           <!-- <el-tab-pane label="PD000005" name="prtpan">
                <m-prtpan :model="model" :codes="codes"/>
           </el-tab-pane> -->
 
            <!--PD000185 -->
           <!-- <el-tab-pane label="PD000185" name="ordpan">
                <m-ordpan :model="model" :codes="codes"/>
           </el-tab-pane> -->
 
            
 
            <!--PD000488 -->
           <el-tab-pane label="声明" name="stament">
                <m-stament :model="model" :codes="codes"/>
           </el-tab-pane> 
       </c-tabs>
    </el-form>
    </div>
  </div>
</template>
<script>
import Utils from "~/utils/index";
import Api from "~/service/Api"
import CodeTable from "~/config/CodeTable"
import Infdid from "~/model/Infdid"
import CommonProcess from "~/mixin/CommonProcess"
import Check from "~/model/Infdid/Check"
import Default from "~/model/Infdid/Default"
import Pattern from "~/model/Infdid/Pattern"
import Infsea from "./Infsea"
import Ovwp from "./Ovwp"
import Detp from "./Detp"
import Tk from "./Tk"
import Coninfp from "./Coninfp";
import Trnpan from "./Trnpan"
import Cbsinfp from "./Cbsinfp"
import Cbeinfp from "./Cbeinfp"
import Fepinfp from "./Fepinfp"
import Sepinfp from "./Sepinfp"
import Gleinfp from "./Gleinfp"
import Smhinfp from "./Smhinfp"
import Peninfp from "./Peninfp"
import Liainfp from "./Liainfp"
import Prtpan from "./Prtpan"
import Ordpan from "./Ordpan"
import Detp1 from "./Detp1"
import Stament from "./Stament"


export default {
    name: "Infdid",
    components:{
        "m-infsea" : Infsea,
        "m-ovwp" : Ovwp,
        "m-detp" : Detp,
        "m-tk" : Tk,
        "m-coninfp" : Coninfp,
        "m-trnpan" : Trnpan,
        "m-cbsinfp" : Cbsinfp,
        "m-cbeinfp" : Cbeinfp,
        "m-fepinfp" : Fepinfp,
        "m-sepinfp" : Sepinfp,
        "m-gleinfp" : Gleinfp,
        "m-smhinfp" : Smhinfp,
        "m-peninfp" : Peninfp,
        "m-liainfp" : Liainfp,
        "m-prtpan" : Prtpan,
        "m-ordpan" : Ordpan,
        "m-detp1" : Detp1,
        "m-stament" : Stament,
    },
    provide() {
        return {
            root: this
        }
    },
    mixins: [CommonProcess],    // 里面包含了Default、Check等的公共处理
    data(){
        return {
            tabVal: "",
            trnName: "infdid",
            model: new Infdid().data,
            checkRules: Check,
            defaultRules: Default,
            pattern: Pattern,
            showPanel:false,
            rules: null,
            codes: { ...CodeTable },
        }
    },
    methods:{
     //    tabClick(){
     //    },
        tabClick(tab) {

          const name = tab.name
          let rulePath;
          
          if (name === "fepinfp") {
          rulePath = "infcon.fepinfp";
          }
          if (name === "coninfp") {
          rulePath = "coninf.coninfp";
          }
          
          
          if (!!rulePath) {
          this.executeRule(rulePath).then(res => {
               if (res.respCode == SUCCESS) {
                 this.updateModel(res.data);
               }
          })
          }
        },
        initPanel(val){
            if(val){
            this.tabVal = "ovwp"
          //   
          }else{
            this.tabVal = ""
          }
        },
        async updateShowPanel(value) {
            this.showPanel = value;
            this.initPanel(value);
        }

    },
    created:async function(){
        console.log("进入infdid交易");
        let rtnmsg = await this.init({})
        if(rtnmsg.respCode == SUCCESS)
        {
             Utils.copyValueFromVO(this.model, rtnmsg.data);
        }
        else
        {
            this.$notify.error({title: '错误',message: '服务请求失败！'});
        }
    },
    watch:{
         
    }
}
</script>
<style scoped>
    .eContainer {
  padding: 3px 15px;
}

</style>
