<template>
  <c-page 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>
    </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="tabClick">
        <!--PD000001 -->
        <el-tab-pane label="修改" name="amep">
          <c-content>
            <m-amep :model="model" :codes="codes" />
          </c-content>
        </el-tab-pane>

        <!--PD000017 -->
        <el-tab-pane label="基本信息" name="ovwp">
          <c-content>
            <m-ovwp :model="model" :codes="codes" />
          </c-content>
        </el-tab-pane>

        <!--PD000001 -->
        <el-tab-pane
          v-if="model.letp.aamp.aammod.addamtflg"
          label="附加金额"
          name="aamp"
        >
          <m-aamp :model="model" :codes="codes" />
        </el-tab-pane>

        <!--PD000063 -->
        <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>

        <!--PD000347 -->
        <el-tab-pane label="PD000347" name="inspame">
          <m-inspame :model="model" :codes="codes" />
        </el-tab-pane>

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

        <!--PD000001 -->
        <el-tab-pane label="分录信息" name="glepan">
          <m-glepan :model="model" :codes="codes" />
        </el-tab-pane>

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

        <!--PD000546 -->
        <el-tab-pane label="附件" name="doctre">
          <m-doctre :model="model" :codes="codes" />
        </el-tab-pane>

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

        <!--PD000094 -->
        <el-tab-pane label="货物描述修改" name="dogpame">
          <!-- <m-dogpame :model="model" :codes="codes" /> -->
          <c-content>
            <m-doxpame
              :model="model"
              :codes="codes"
              :recgrp="'ledgrp'"
              :ametyp="'lcrgod'"
            />
          </c-content>
        </el-tab-pane>

        <!--PD000102 -->
        <el-tab-pane label="附加条款修改" name="adcpame">
          <c-content>
            <m-doxpame
              :model="model"
              :codes="codes"
              :recgrp="'ledgrp'"
              :ametyp="'adlcnd'"
            />
          </c-content>
        </el-tab-pane>

        <!--PD000098 -->
        <el-tab-pane label="单据要求修改" name="dorpame">
          <c-content>
            <m-doxpame
              :model="model"
              :codes="codes"
              :recgrp="'ledgrp'"
              :ametyp="'lcrdoc'"
            />
          </c-content>
        </el-tab-pane>

        <!--PD000001 -->
        <el-tab-pane label="统一授信" name="limitbody">
          <m-limitbody :model="model" :codes="codes" />
        </el-tab-pane>

        <!--PD000317 -->
        <!-- <el-tab-pane label="PD000317" name="revp">
          <m-revp :model="model" :codes="codes" />
        </el-tab-pane> -->

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

        <!--PD000400 -->
        <el-tab-pane
          v-if="model.ledgrp.rec.spcrcbflg"
          label="Spc.Pay Conditions for Ban"
          name="sprpame"
        >
          <c-content>
            <m-doxpame
              :model="model"
              :codes="codes"
              :recgrp="'ledgrp'"
              :ametyp="'spcrcb'"
            />
          </c-content>
        </el-tab-pane>

        <!--PD000396 -->
        <el-tab-pane
          v-if="model.ledgrp.rec.spcbenflg"
          label="Spc.Pay Conditions for Ben"
          name="spbpame"
        >
          <c-content>
            <m-doxpame
              :model="model"
              :codes="codes"
              :recgrp="'ledgrp'"
              :ametyp="'spcben'"
            />
          </c-content>
        </el-tab-pane>
      </c-tabs>
    </el-form>
  </c-page>
</template>
<script>
import Api from "~/service/Api";
import CodeTable from "~/config/CodeTable";
import Letame from "~/model/Letame";
import CommonProcess from "~/mixin/CommonProcess";
import CommonFuncs from "~/mixin/CommonFuncs";
import Check from "~/model/Letame/Check";
import Default from "~/model/Letame/Default";
import Pattern from "~/model/Letame/Pattern";
import Amep from "./Amep";
import Ovwp from "./Ovwp";
import Detp from "./Detp";
import Aamp from "./Aamp";
import Ptyp from "./Ptyp";
//import Dogpame from "./Dogpame";
//import Dorpame from "./Dorpame";
//import Adcpame from "./Adcpame";
import Inspame from "./Inspame";
import Revp from "./Revp";
//import Engp from "./Engp";
import Setpan from "./Setpan";
//import Glepan from "./Glepan";
//import Coninfp from "./Coninfp";
//import Docpan from "./Docpan";
import Doctre from "./Doctre";
import Limitbody from "./Limitbody";
//import Sprpame from "./Sprpame";
//import Spbpame from "./Spbpame";

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

export default {
  components: {
    "m-amep": Amep,
    "m-ovwp": Ovwp,
    "m-detp": Detp,
    "m-aamp": Aamp,
    "m-ptyp": Ptyp,
    //"m-dogpame": Dogpame,
    //"m-dorpame": Dorpame,
    //"m-adcpame": Adcpame,
    "m-inspame": Inspame,
    "m-revp": Revp,
    "m-engp": Engp,
    "m-setpan": Setpan,
    "m-glepan": Glepan,
    "m-coninfp": Coninfp,
    "m-docpan": Docpan,
    "m-doctre": Doctre,
    "m-limitbody": Limitbody,
    //"m-sprpame": Sprpame,
    //"m-spbpame": Spbpame,
    "m-doxpame": Doxpame,
  },
  provide() {
    return {
      root: this,
    };
  },
  mixins: [CommonProcess, CommonFuncs], // 里面包含了Default、Check等的公共处理
  data() {
    return {
      tabVal: "amep",
      trnName: "letame",
      model: new Letame().data,
      checkRules: Check,
      defaultRules: Default,
      pattern: Pattern,
      rules: null,
      codes: { ...CodeTable },
    };
  },
  methods: {
    tabClick() {},
  },
  created: async function () {
    console.log("进入letame交易");
    let rtnmsg = await this.init({});
    if (rtnmsg.respCode == SUCCESS) {
      //更新数据
      this.updateModel(rtnmsg.data);
      //Utils.copyValueFromVO(this.model, rtnmsg.data);
      if (this.isInDisplay) {
        this.restoreDisplay();
      }
    } else {
      this.$notify.error({ title: "错误", message: "服务请求失败！" });
    }
  },
};
</script>
<style>
</style>
