<template>
  <div class="eContainer">
    <c-bus-button :$pntvm="this"></c-bus-button>
    <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="tabClick">
        <!--PD000001 -->
        <el-tab-pane label="基本信息" name="ovwp">
          <c-content>
          <m-ovwp :model="model" :codes="codes" />
          </c-content>
        </el-tab-pane>

        <!--PD000077 -->
        <el-tab-pane label="信用证详情" name="detp">
          <c-content>
          <m-detp :model="model" :codes="codes" />
          </c-content>
        </el-tab-pane>

        <!--PD000042 -->
        <el-tab-pane label="其他当事人" name="ptyp">
          <c-content>
          <m-ptyp :model="model" :codes="codes" />
          </c-content>
        </el-tab-pane>

        <!--PD000057 -->
        <el-tab-pane label="货物说明" name="dogp">
          <!-- <m-dogp :model="model" :codes="codes" /> -->
          <c-content>
            <m-doxp :model="model" :codes="codes" :dtyp="'dogp'" :rec="'ltd'" />
          </c-content>
        </el-tab-pane>
          <!--PD000394 -->
          <el-tab-pane
            v-if="model.ltdgrp.rec.spcbenflg"
            label="受益人特殊付款条款"
            name="spcbenp"
          >
          <c-content>
            <m-spcbenp :model="model" :codes="codes" />
          </c-content>
          </el-tab-pane>

          <!--PD000395 -->
          <el-tab-pane
            v-if="model.ltdgrp.rec.spcrcbflg"
            label="收款银行特殊付款条款"
            name="spcrcvp"
          >
          <c-content>
            <m-spcrcvp :model="model" :codes="codes"  />
          </c-content>
          </el-tab-pane>
        <!--PD000065 -->
        <el-tab-pane label="Rbip" name="rbip">
          <c-content>
          <m-rbip :model="model" :codes="codes" />
          </c-content>
        </el-tab-pane>

        <!--PD000073 -->
        <el-tab-pane label="附加条款" name="adcp">
          <!-- <m-adcp :model="model" :codes="codes" /> -->
          <c-content>
           <m-doxp :model="model" :codes="codes" :dtyp="'adcp'"  :rec="'ltd'"/>
          </c-content>
        </el-tab-pane>

        <!--PD000169 -->
        <el-tab-pane label="Lttinf" name="lttinf">
          <c-content>
          <m-lttinf :model="model" :codes="codes" />
          </c-content>
        </el-tab-pane>

        <!--PD000060 -->
        <el-tab-pane label="单据要求" name="dorp">
          <!-- <m-dorp :model="model" :codes="codes" /> -->
          <c-content>
           <m-doxp :model="model" :codes="codes" :dtyp="'dorp'" :rec="'ltd'" />
          </c-content>
        </el-tab-pane>

      </c-tabs>
    </el-form>
  </div>
</template>
<script>
import Api from "~/service/Api";
import CodeTable from "~/config/CodeTable";
import Lttopn from "~/model/Lttopn";
import CommonProcess from "~/mixin/CommonProcess";
import Check from "~/model/Lttopn/Check";
import Default from "~/model/Lttopn/Default";
import Pattern from "~/model/Lttopn/Pattern";
import Ovwp from "./Ovwp";
import Detp from "./Detp";
import Ptyp from "./Ptyp";
//import Dogp from "./Dogp";
import Rbip from "./Rbip";
//import Adcp from "./Adcp";
import Lttinf from "./Lttinf";
//import Dorp from "./Dorp";
import Doxp from "~/views/Public/Doxp";

export default {
  components: {
    "m-ovwp": Ovwp,
    "m-detp": Detp,
    "m-ptyp": Ptyp,
    // "m-dogp": Dogp,
    "m-rbip": Rbip,
    // "m-adcp": Adcp,
    "m-lttinf": Lttinf,
    // "m-dorp": Dorp,
        "m-doxp": Doxp,
  },
  provide() {
    return {
      root: this,
    };
  },
  mixins: [CommonProcess], // 里面包含了Default、Check等的公共处理
  data() {
    return {
      tabVal: "ovwp",
      trnName: "lttopn",
      model: new Lttopn().data,
      checkRules: Check,
      defaultRules: Default,
      pattern: Pattern,
      rules: null,
      codes: {...CodeTable},
    };
  },
  methods: {
    tabClick() {},
  },
  created: async function () {
    console.log("进入lttopn交易");
    let rtnmsg = await this.init({});
    
    if (rtnmsg.respCode == SUCCESS) {
     this.updateModel(rtnmsg.data);
      // Utils.copyValueFromVO(this.model, rtnmsg.data);
      if (this.isInDisplay) {
        this.restoreDisplay();
      }
      console.log("1111", this.model);
    } else {
      this.$notify.error({ title: "错误", message: "服务请求失败！" });
    }
  },
};
</script>
<style>
</style>
