<template>
  <div class="eContainer">
     <c-function-btn
      :handleSubmit="handleSubmit"
      :handleCheck="handleCheck"
      :handleStash="handleStash"
    >
      <el-button size="small">流程附言</el-button>
      <el-button size="small">交易历史</el-button>
      <el-button size="small">备忘录</el-button>
      <el-button size="small">影像信息</el-button>
      <!-- <el-button size="small">保存模板</el-button> -->
      <!-- <el-button size="small">使用模板</el-button> -->
      <el-button size="small">制裁信息</el-button>
      <!-- <el-button size="small">拆分报文</el-button> -->
      <el-button size="small">智能提示</el-button>
    </c-function-btn>
    <el-form :model="model" :rules="rules" ref="modelForm" label-width="150px" label-position="right" size="small" :validate-on-rule-change="false">
       <c-tabs v-model="tabVal" ref="elment" type="card" @tab-click="myTabClick">
        
            <!--PD001291 -->
           <el-tab-pane label="开立方式" name="opnp">
                <m-opnp :model="model" :codes="codes"/>
           </el-tab-pane>
 
            <!--PD000002 -->
           <!-- <el-tab-pane v-if="model.gitp.swiftflg==''" label="Overview" name="ovwp">
               <c-content>
                     <m-ovwp :model="model" :codes="codes"/>
               </c-content>
           </el-tab-pane> -->

           <!-- <el-tab-pane v-if="model.gitp.swiftflg=='Y'" label="Overview" name="ovwp20">
                <c-content>
                     <m-ovwp20 :model="model" :codes="codes"/>
                </c-content>
           </el-tab-pane> -->
           
           <el-tab-pane label="Overview" name="ovwp">
                <c-content>
                    <m-ovwp :model="model" :codes="codes"/>
                </c-content>
           </el-tab-pane>
 
            <!--PD000043 -->
           <el-tab-pane label="Parties" name="ptyp">
                <m-ptyp :model="model" :codes="codes"/>
           </el-tab-pane>

            <el-tab-pane v-if="model.gitp.swiftflg=='Y'||model.gitp.swiftflg==''" label="Presentation/Delivery" name="preperp">
                <c-content>
                     <m-preperp :model="model" :codes="codes"/>
                </c-content>
            </el-tab-pane>
            <!--PD000389 -->
           <el-tab-pane label="Details" name="detp">
                <c-content>
                    <m-detp :model="model" :codes="codes"/>
                </c-content>
           </el-tab-pane>
 
            <!--PD000210 -->
           <el-tab-pane label="Undertaking Text" name="gidtxtp">
                <m-gidtxtp :model="model" :codes="codes"/>
           </el-tab-pane>

           <el-tab-pane v-if="model.gidgrp.rec.legfrm=='STBY'" label="Confirmation Details" name="confp">
                <m-confp :model="model" :codes="codes"/>
           </el-tab-pane>

           <el-tab-pane label="Liability" name="liability">
                <c-content>
                    <m-engp :model="model" :codes="codes"/>
                </c-content>
            </el-tab-pane>

            <el-tab-pane label="Cash Cover" name="Cash Cover">
                <c-content>
                    <m-ccvpan :model="model" :codes="codes"/>
                </c-content>
            </el-tab-pane>

             <el-tab-pane label="Settlement" name="Settlement">
                <c-content>
                    <m-setpan :model="model" :codes="codes"/>
                </c-content>
            </el-tab-pane>

            <el-tab-pane label="Bookings" name="Booking">
                <c-content>
                    <m-glepan :model="model" :codes="codes"/>
                </c-content>
            </el-tab-pane>

            <el-tab-pane label="Completion" name="Completion">
                <c-content>
                    <m-coninfp :model="model" :codes="codes"/>
                </c-content>
            </el-tab-pane>

            <el-tab-pane label="Messages" name="Messages">
                <c-content>
                    <m-docpan :model="model" :codes="codes"/>
                </c-content>
            </el-tab-pane>

            <el-tab-pane label="Attachments" name="Attachments">
                <c-content>
                    <m-doctre :model="model" :codes="codes"/>
                </c-content>
            </el-tab-pane>
 
           
 
            <!--PD000001 -->
           <el-tab-pane label="备查表" name="addbcb">
                <m-addbcb :model="model" :codes="codes"/>
           </el-tab-pane>
  
          <!--PD000002 -->
           <el-tab-pane label="跨境人民币申报" name="cnyp">
                <m-cnyp :model="model" :codes="codes"/>
           </el-tab-pane>

           <el-tab-pane v-if="model.cnybop.vouflg=='1'" label="2122跨境担保登记业务信息" name="voup">
                <m-voup :model="model" :codes="codes"/>
           </el-tab-pane>
            
            <el-tab-pane label="统一授信" name="limitbody">
                    <m-limitbody :model="model" :codes="codes"/>
            </el-tab-pane>

            <!-- <el-tab-pane  label="overview" name="Ovwp20">
                <c-content>
                    <m-ovwp20 :model="model" :codes="codes"/>
                </c-content>
            </el-tab-pane> -->
            <!--PD000136 -->
           <!-- <el-tab-pane label="PD000136" name="voup">
                <m-voup :model="model" :codes="codes"/>
           </el-tab-pane> -->
 
            <!--PD000001 -->
           <el-tab-pane v-if="model.gidgrp.rec.fingua=='Y'" label="对外担保数据采集" name="cfap">
                <m-cfap :model="model" :codes="codes"/>
           </el-tab-pane>
 

            <el-tab-pane v-if="model.cfagit.cfaflg=='1'" label="对外担保-签约信息1" name="conp">
                <m-conp :model="model" :codes="codes"/>
           </el-tab-pane>
            <!--PD000727 -->
           <!-- <el-tab-pane label="PD000727" name="preperp">
                <m-preperp :model="model" :codes="codes"/>
           </el-tab-pane> -->

           <el-tab-pane v-if="model.cfagit.cfaflg=='1'" label="对外担保-签约信息2" name="conp1">
                <m-conp1 :model="model" :codes="codes"/>
           </el-tab-pane>
 
            <el-tab-pane v-if="model.gidgrp.rec.purpos=='ISCO'||model.gidgrp.rec.purpos=='ICCO'" label="Seq C : Overview" name="ovwpc">
                <c-content>
                    <m-ovwpc :model="model" :codes="codes"/>
                </c-content>
            </el-tab-pane>

            <el-tab-pane v-if="model.gidgrp.rec.purpos=='ISCO'||model.gidgrp.rec.purpos=='ICCO'" label="Seq C : Parties" name="ptypc">
                <c-content>
                    <m-ptypc :model="model" :codes="codes"/>
                </c-content>
            </el-tab-pane>

            <el-tab-pane v-if="model.gidgrp.rec.purpos=='ISCO'||model.gidgrp.rec.purpos=='ICCO'" label="Seq C : Presentation/Delivery" name="preperpc">
                <c-content>
                    <m-preperpc :model="model" :codes="codes"/>
                </c-content>
            </el-tab-pane>

            <el-tab-pane v-if="model.gidgrp.rec.purpos=='ISCO'||model.gidgrp.rec.purpos=='ICCO'" label="Seq C : Details" name="detpc">
                <c-content>
                    <m-detpc :model="model" :codes="codes"/>
                </c-content>
            </el-tab-pane>

            <el-tab-pane v-if="model.gidgrp.rec.purpos=='ISCO'||model.gidgrp.rec.purpos=='ICCO'" label="Seq C : Undertaking Text" name="gidtxtpc">
                <c-content>
                    <m-gidtxtpc :model="model" :codes="codes"/>
                </c-content>
            </el-tab-pane>
           
           <!--PD000749 -->
           <!-- <el-tab-pane label="PD000749" name="ovwpc">
                <m-ovwpc :model="model" :codes="codes"/>
           </el-tab-pane> -->
 
            <!--PD000799 -->
           <!-- <el-tab-pane label="PD000799" name="ptypc">
                <m-ptypc :model="model" :codes="codes"/>
           </el-tab-pane> -->
 
            <!--PD000838 -->
           <!-- <el-tab-pane label="PD000838" name="detpc">
                <m-detpc :model="model" :codes="codes"/>
           </el-tab-pane> -->
 
            <!--PD000785 -->
           <!-- <el-tab-pane label="PD000785" name="gidtxtpc">
                <m-gidtxtpc :model="model" :codes="codes"/>
           </el-tab-pane> -->
 
            <!--PD000761 -->
           <!-- <el-tab-pane label="PD000761" name="preperpc">
                <m-preperpc :model="model" :codes="codes"/>
           </el-tab-pane> -->
       </c-tabs>
    </el-form>
    <c-grid-ety-prompt-dialog ref="etyDialog" :promptData="promptData" v-on:select-ety="selectEty">
    </c-grid-ety-prompt-dialog>
  </div>
</template>
<script>
import Api from "~/service/Api"
import CodeTable from "~/config/CodeTable"
import Gitopn from "~/model/Gitopn"
import commonProcess from "~/mixin/commonProcess"
import commonFuncs from "~/mixin/commonFuncs";
import Check from "~/model/Gitopn/Check"
import Default from "~/model/Gitopn/Default"
import Pattern from "~/model/Gitopn/Pattern"
import Opnp from "./Opnp"
import Ovwp from "./Ovwp"
import Ptyp from "./Ptyp"
import Detp from "./Detp"
import Gidtxtp from "./Gidtxtp"
import Cnyp from "./Cnyp"
import Addbcb from "./Addbcb"
import Voup from "./Voup"
import Cfap from "./Cfap"
import Preperp from "./Preperp"
import Ovwpc from "./Ovwpc"
import Ptypc from "./Ptypc"
import Detpc from "./Detpc"
import Gidtxtpc from "./Gidtxtpc"
import Preperpc from "./Preperpc"
import Ovwp20 from "./Ovwp20"
import Confp from "./Confp"
import Conp from "./Conp"
import Conp1 from "./Conp1"


import Engp from "~/views/Public/Engp";
import Ccvpan from "~/views/Public/Ccvpan";
import Setpan from "~/views/Public/Setpan";
import Glepan from "~/views/Public/Glepan";
import Coninfp from "~/views/Public/Coninfp";
import Docpan from "~/views/Public/Docpan";
import Doctre from "~/views/Public/Doctre";
import Limitbody from "~/views/Public/Limitbody";



export default {
    name: "Gitopn",
    components:{
        "m-opnp" : Opnp,
        "m-ovwp" : Ovwp,
        "m-ptyp" : Ptyp,
        "m-detp" : Detp,
        "m-gidtxtp" : Gidtxtp,
        "m-cnyp" : Cnyp,
        "m-addbcb" : Addbcb,
        "m-voup" : Voup,
        "m-cfap" : Cfap,
        "m-preperp" : Preperp,
        "m-ovwpc" : Ovwpc,
        "m-ptypc" : Ptypc,
        "m-detpc" : Detpc,
        "m-gidtxtpc" : Gidtxtpc,
        "m-preperpc" : Preperpc,
        "m-ovwp20" : Ovwp20,
        "m-confp" : Confp,
        "m-conp" : Conp,
        "m-conp1":Conp1,

        "m-engp" :Engp,
        "m-ccvpan" :Ccvpan,
        "m-setpan" : Setpan,
        "m-glepan" :Glepan,
        "m-coninfp" :Coninfp,
        "m-docpan" :Docpan,
        "m-doctre" :Doctre,
        "m-limitbody" : Limitbody,
    },
    provide() {
        return {
            root: this
        }
    },
    mixins: [commonProcess,commonFuncs],    // 里面包含了Default、Check等的公共处理
    data(){
        return {
            tabVal: "opnp",
            trnName: "gitopn",
            model: new Gitopn().data,
            checkRules: Check,
            defaultRules: Default,
            pattern: Pattern,
            rules: null,
            codes: {
                ...CodeTable,
            },
        }
    },
    methods:{
        myTabClick(tab) {
        this.tabClick(tab)
        const name = tab.name
        let rulePath;
        if (name === "conp") {
            rulePath = "recp.conp";
        }
        if(name==="cfap"){
            rulepath = "cfap";
        }
        // if (name === "glepan") {
        //     rulePath = "glepan";
        // }
        // if (name === "coninfp") {
        //     rulePath = "coninfp";
        // }
        // if (name === "docpan") {
        //     rulePath = "oit.inftxt";
        // }
        // if (name === "doctre") {
        //     rulePath = "doctre";
        // }
        // if (name === "sbxx") {
        //     rulePath = "trd.ownref,cnyp";
        // }
        if (!!rulePath) {
            this.executeRule(rulePath).then(res => {
            if (res.respCode == SUCCESS) {
                this.updateModel(res.data)
            }
            })
        }
    },
        // myTabClick(tab){
        //     this.tabClick(tab)
        //     /**
        //     *  do it yourself
        //     **/
        // }
    },
    created:async function(){
        console.log("进入gitopn交易");
        let rtnmsg = await this.init({})
        if(rtnmsg.respCode == SUCCESS)
        {
           this.updateModel(rtnmsg.data)
           //TODO 处理数据逻辑

        }
        else
        {
            this.$notify.error({title: '错误',message: '服务请求失败！'});
        }
    }
}
</script>
<style>

</style>
