<template>
  <div class="eContainer">
    <c-page title="进口融资开立">
      <el-form :model="model" :rules="rules" :validate-on-rule-change="false" label-position="right" label-width="120px" ref="modelForm" size="small">
        <c-tabs @tab-click="tabClick" ref="elment" type="card" v-model="tabVal">

          <el-tab-pane label="业务信息" name="ovwp">
            <c-content>
              <m-ovwp :codes="codes" :model="model" />
            </c-content>
          </el-tab-pane>

          <el-tab-pane label="委托方代付" name="dftcre" v-if="model.dftcre.dfflag === 'X'">
            <c-content>
              <m-dftcre :codes="codes" :model="model" />
            </c-content>
          </el-tab-pane>

          <el-tab-pane label="定价系统" name="dinpan" v-if="model.finmod.dinjdm !== ''">
            <m-dinpan :codes="codes" :model="model" />
          </el-tab-pane>

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

                  <el-collapse-item name="engp" title="表外信息">
                    <m-engp :codes="codes" :model="model" />
                  </el-collapse-item>
                </c-collapse>
              </div>
            </c-content>
          </el-tab-pane>

          <el-tab-pane label="费用/账务" name="setpan">
            <c-content>
              <m-setmod :codes="codes" :model="model" />
            </c-content>
          </el-tab-pane>

          <el-tab-pane label="资本项目" name="cfabop">
            <c-content>
              <m-cfabop :codes="codes" :model="model" ref="cfabop" />
            </c-content>
          </el-tab-pane>

          <!-- 跨境人民币申报 -->
          <el-tab-pane label="跨境人民币申报" name="rmbbop">
            <c-content>
              <m-rmbbop :codes="codes" :model="model" ref="rmbbop" />
            </c-content>
          </el-tab-pane>

          <el-tab-pane :label="$t('commonModels.报文/面函')" name="docpan">
            <c-content>
              <m-docpan :codes="codes" :model="model" />
            </c-content>
          </el-tab-pane>

        </c-tabs>
      </el-form>
      <!-- 底部按钮 -->
      <c-function-btn :handleCheck="handleCheck" :handleStash="handleStash" :handleSubmit="handleSubmit" @handleSureWarning="handleSureWarning" ref="commonBtn"></c-function-btn>
    </c-page>
  </div>
</template>
<script>
import CodeTable from "~/config/CodeTable";
import operationFunc from "~/mixin/operationFunc";
import commonDepend from "~/mixin/commonDepend";

import event from "../event";
import Check from "../model/check";
import Default from "../model/default";
import buildFn from "../event/buildCommons.js";

import Trtopn from "../model";
import ovwp from "./ovwp";
import Dinpan from "./Dinpan";

import Engp from "~/components/business/engp/views";
import Setmod from "~/components/business/setmod/views";
import Docpan from "~/components/business/docpan/views";
import Rmbbop from "~/components/business/rmb/rmbbop/views";
import Dftcre from "~/components/business/dftcre/views";
import Cfabop from "~/components/business/cfa/cfabop/views";
import Limitbody from "~/components/business/limitbody/views";

export default {
  name: "Trtopn",
  components: {
    "m-ovwp": ovwp,
    "m-engp": Engp,
    "m-setmod": Setmod,
    "m-rmbbop": Rmbbop,
    "m-docpan": Docpan,
    "m-dftcre": Dftcre,
    "m-dinpan": Dinpan,
    "m-cfabop": Cfabop,
    "m-limitbody": Limitbody
  },
  provide() {
    return {
      root: this
    };
  },
  mixins: [Default, operationFunc, event, commonDepend, buildFn],
  data() {
    return {
      tabVal: "ovwp",
      trnName: "trtopn",
      model: new Trtopn().data,
      activeNames: ["limitbody", "engp"],
      codes: {
        ...CodeTable
      }
    };
  },
  computed: {
    rules() {
      return Check.apply(this);
    }
  },
  mounted() {
    console.log("this.$route", this.$route);
    let params = {
      transName: this.trnName,
      trdgrp: {
        rec: {
          inr: this.$route.query.inr || ""
        }
      }
    };
    this.init(params).then(res => {
      if (this.model.trtp.usr.extkey === "") {
        this.model.trtp.usr.extkey = window.sessionStorage.userName;
      }
    });
  },
  methods: {}
};
</script>
<style scoped>
</style>