<template>
  <c-page title="出口信用证通知">
    <div class="eContainer">
      <!-- <c-bus-button :$pntvm="this"></c-bus-button> -->
      <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="myTabClick"
        >
          <!--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>

          <!--PD000055 -->
          <el-tab-pane label="货物描述" name="dogp">
            <m-doxp :model="model" :codes="codes" :dtyp="'dogp'" :rec="'led'" 
            />
          </el-tab-pane>

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

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

          <!--PD000317 -->
          <el-tab-pane label="循环信用详情" name="revp"
            v-if="model.ledgrp.rec.revflg=='X'">
            <m-revp :model="model" :codes="codes" />
          </el-tab-pane>

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

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

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

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

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

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

          <!--PD000394 -->
          <el-tab-pane
            v-if="model.ledgrp.rec.spcbenflg"
            label="受益人特殊付款条款"
            name="spcbenp"
          >
            <m-doxp
              :model="model"
              :codes="codes"
              :dtyp="'spcbenp'"
              :rec="'led'"
            />
          </el-tab-pane>

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

          <!--PD000395 -->
          <el-tab-pane
            v-if="model.ledgrp.rec.spcrcbflg"
            label="收款银行特殊付款条款"
            name="spcrcvp"
          >
            <m-doxp
              :model="model"
              :codes="codes"
              :dtyp="'spcrcvp'"
              :rec="'led'"
            />
          </el-tab-pane>
          <!--PD000422 -->
          <!-- <el-tab-pane label="PD000422" name="spcrcvp">
          <m-spcrcvp :model="model" :codes="codes" />
        </el-tab-pane> -->
        </c-tabs>
      </el-form>
      <c-grid-ety-prompt-dialog
        ref="etyDialog"
        :promptData="promptData"
        @select-ety="selectEty"
      >
      </c-grid-ety-prompt-dialog>
      <c-grid-ety-prompt-dialog
        ref="doxpDialog"
        :isPty="false"
        :promptData="promptData"
        @select-ety="selectMsg"
      >
      </c-grid-ety-prompt-dialog>
    </div>
  </c-page>
</template>
<script>
import Api from '~/service/Api'
import Utils from '~/utils/index'

import CodeTable from '~/config/CodeTable'
import Letopn from '~/model/Letopn'
import commonProcess from '~/mixin/commonProcess'
import commonFuncs from '~/mixin/commonFuncs'
import Check from '~/model/Letopn/Check'
import Default from '~/model/Letopn/Default'
import Pattern from '~/model/Letopn/Pattern'
import Ovwp from './Ovwp'
import Detp from './Detp'
import Ptyp from './Ptyp'
// import Dogp from './Dogp';
// import Dorp from './Dorp';
// import Adcp from './Adcp';
// import Setpan from "./Setpan";
// import Coninfp from "./Coninfp";
// import Docpan from "./Docpan";
// import Glepan from "./Glepan";
// import Engp from "./Engp";
// import Doctre from "./Doctre";
import Revp from './Revp'
import Aamp from './Aamp'
// import Spcbenp from './Spcbenp'
// import Spcrcvp from './Spcrcvp'
// import Glepan from './Glepan'

import Coninfp from '~/views/Public/Coninfp'
import Setpan from '~/views/Public/Setpan'
import Docpan from '~/views/Public/Docpan'
import Doctre from '~/views/Public/Doctre'
import Engp from '~/views/Public/Engp'
import Glepan from '~/views/Public/Glepan'
import Doxp from '~/views/Public/Doxp'

export default {
  name: 'Letopn',
  components: {
    'm-ovwp': Ovwp,
    'm-detp': Detp,
    'm-ptyp': Ptyp,
    'm-setpan': Setpan,
    'm-coninfp': Coninfp,
    'm-docpan': Docpan,
    'm-doctre': Doctre,
    'm-engp': Engp,
    'm-revp': Revp,
    'm-aamp': Aamp,
    'm-glepan': Glepan,
    'm-doxp': Doxp,
  },
  provide() {
    return {
      root: this,
    }
  },
  mixins: [commonProcess, commonFuncs], // 里面包含了Default、Check等的公共处理
  data() {
    return {
      tabVal: 'ovwp',
      trnName: 'letopn',
      model: new Letopn().data,
      checkRules: Check,
      defaultRules: Default,
      pattern: Pattern,
      rules: null,
      codes: { ...CodeTable },
    }
  },
  methods: {
    myTabClick(tab) {
      this.tabClick(tab)
      /**
       *  do it yourself
       **/
    },
  },
  created: async function () {
    console.log('进入letopn交易')
    let rtnmsg = await this.init({})
    if (rtnmsg.respCode == SUCCESS) {
      //更新数据
      this.updateModel(rtnmsg.data)
      // Utils.copyValueFromVO(this.model, rtnmsg.data);
      //TODO 处理数据逻辑
      if (this.isInDisplay) {
        this.restoreDisplay()
      }
      console.log('1111', this.model)
    } else {
      this.$notify.error({ title: '错误', message: '服务请求失败！' })
    }
  },
}
</script>
<style></style>
