<template>
  <c-page title="国内证承兑">
    <div class="eContainer">
      <el-form
        :model="model"
        :rules="rules"
        ref="modelForm"
        label-width="200px"
        size="small"
        :validate-on-rule-change="false"
      >
        <c-tabs
          :value="initPane"
          ref="elment"
          type="card"
          @tab-click="tabClick"
        >
          <!--PD000032 -->
          <el-tab-pane label="内容" name="payp">
            <m-payp :model="model" :codes="codes" />
          </el-tab-pane>

          <!--PD000062 -->
          <el-tab-pane label="单据详情" name="docpre">
            <m-docpre :model="model" :codes="codes" />
          </el-tab-pane>

          <!--PD000027 -->
          <el-tab-pane label="或有" name="engp">
            <m-engp :model="model" :codes="codes" />
          </el-tab-pane>

          <!--PD000001 -->
          <el-tab-pane label="保证金" name="ccvpan">
            <m-ccvpan :model="model" :codes="codes" />
          </el-tab-pane>

          <el-tab-pane label="帐务" name="setpan">
            <m-setpan :model="model" :codes="codes" />
          </el-tab-pane>

          <el-tab-pane label="分录" name="glepan">
            <m-glepan :model="model" :codes="codes" ref="glepan" />
          </el-tab-pane>

          <el-tab-pane label="附言" name="coninfp">
            <m-coninfp :model="model" :codes="codes" />
          </el-tab-pane>

          <el-tab-pane label="报文及面函" name="docpan">
            <m-docpan :model="model" :codes="codes" />
          </el-tab-pane>

          <el-tab-pane
            v-if="model.bddgrp.rec.advtyp === '750'"
            label="不符点通知"
            name="mt750p"
          >
            <m-mt750p :model="model" :codes="codes" />
          </el-tab-pane>
          <el-tab-pane
            v-else-if="model.bddgrp.rec.advtyp === 'oth'"
            label="Advice Details"
            name="othadvtypp"
          >
            <m-othadvtypp :model="model" :codes="codes" />
          </el-tab-pane>

          <el-tab-pane label="统一授信" name="limitbody">
            <m-limitbody :model="model" :codes="codes" />
          </el-tab-pane>
        </c-tabs>
        <c-bus-button :$pntvm="this"></c-bus-button>
      </el-form>
    </div>
  </c-page>
</template>
<script>
import Api from "~/service/Api";
import Utils from "~/utils/index";
import CodeTable from "~/config/CodeTable";
import Default from "~/model/Ditopn/Default";
import Bdtudp from "~/model/Bdtudp";
import CommonProcess from "~/mixin/CommonProcess";
import Pattern from "~/model/Bdtudp/Pattern";
import Payp from "./Payp";
import Ovwp from "./Ovwp";
import Docpre from "./Docpre";
import Shpdet from "./Shpdet";
import Mt750p from "./Mt750p";
//import Ccvpan from "./Ccvpan";
import Othadvtypp from "./Othadvtypp";
import Limitbody from "./Limitbody";

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

// import Event from "~/model/bdtudp/Event";

export default {
  components: {
    "m-payp": Payp,
    "m-payp": Payp,
    "m-ovwp": Ovwp,
    "m-docpre": Docpre,
    "m-shpdet": Shpdet,
    "m-engp": Engp,
    "m-mt750p": Mt750p,
    "m-ccvpan": Ccvpan,
    "m-setpan": Setpan,
    "m-glepan": Glepan,
    "m-coninfp": Coninfp,
    "m-docpan": Docpan,
    "m-othadvtypp": Othadvtypp,
    "m-limitbody": Limitbody,
  },
  provide() {
    return {
      root: this,
    };
  },
  mixins: [CommonProcess], // 里面包含了Default、Check等的公共处理
  data() {
    return {
      initPane: "payp",
      trnName: "bdtudp",
      model: new Bdtudp().data,
      defaultRule: Default,
      rules: Pattern,
      // Event: { ...Event },
      codes: { ...CodeTable },
    };
  },
  methods: {
    tabClick() {},
  },
  created: async function () {
    console.log("进入bdtudp交易");
    let rtnmsg = await Api.post("bdtudp/init", { params: {} });
    if (rtnmsg.respCode == SUCCESS) {
      //更新数据
      Utils.copyValueFromVO(this.model, rtnmsg.data);
      if (this.isInDisplay) {
        this.restoreDisplay();
      }
    } else {
      this.$notify.error({ title: "错误", message: "服务请求失败！" });
    }
  },
};
</script>
<style>

</style>
