<template>
<c-page title="出口非我行通知及收单行登记">
  <div 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">inc to Ben</el-button>
        <el-button size="small">imgyge</el-button>
        <!-- <el-button size="small">拆分报文</el-button> -->
        <el-button size="small">img</el-button>
        <el-button size="small">His.img</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="Overview" 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="Additional Amount"
            name="aamp"
          >
          <c-content>
            <m-aamp :model="model" :codes="codes" />
          </c-content>

          </el-tab-pane>

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

          <!--PD000042 银行信息-->
          <el-tab-pane label="Parties" name="ptyp">
            <c-content>
              <m-ptyp :model="model" :codes="codes" />
            </c-content>
          </el-tab-pane>

        <!--PD000002 -->
        <el-tab-pane label="Docs.Received" name="drv">
          <c-content>
          <m-drv :model="model" :codes="codes" />
          </c-content>
        </el-tab-pane>

        <!--PD000034 -->
        <el-tab-pane label="Discr./Instr." name="dscins"
          v-if="model.bedgrp.rec.dscinsflg=='X'">
          <c-content>
            <m-dscins :model="model" :codes="codes" />
          </c-content>
        </el-tab-pane>

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

        </el-tab-pane>

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

          </c-content>

        </el-tab-pane>

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

        </el-tab-pane>

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

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

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

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

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

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

        <!--PD000394 -->
        <el-tab-pane label="Special Payment Con. Beneficiary" name="spcbenp"
          v-if="model.ledgrp.rec.spcbenflg">
          <c-content>
          <!-- <m-spcbenp :model="model" :codes="codes" /> -->
            <m-doxp
              :model="model"
              :codes="codes"
              :dtyp="'spcbenp'"
              :rec="'led'"
            />
          </c-content>
        </el-tab-pane>

        <!--PD000422 -->
        <el-tab-pane label="Special Payment Con. Bank only" name="spcrcvp"
          v-if="model.ledgrp.rec.spcrcbflg">
          <c-content>
          <!-- <m-spcrcvp :model="model" :codes="codes" /> -->
          <m-doxp
              :model="model"
              :codes="codes"
              :dtyp="'spcrcvp'"
              :rec="'led'"
            />
          </c-content>
        </el-tab-pane>

        <!--PD000001 -->
        <el-tab-pane label="货权单据" name="srmp">
          <c-content>
          <m-srmp :model="model" :codes="codes" />
          </c-content>
        </el-tab-pane>

        <!--PD000001 -->
        <el-tab-pane label="统一授信" name="limitbody">
          <c-content>
          <m-limitbody :model="model" :codes="codes" />
          </c-content>
        </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 CodeTable from '~/config/CodeTable'
import Letdrw from '~/model/Letdrw'
import commonProcess from '~/mixin/commonProcess'
import commonFuncs from '~/mixin/commonFuncs'
import Check from '~/model/Letdrw/Check'
import Default from '~/model/Letdrw/Default'
import Pattern from '~/model/Letdrw/Pattern'
import Ovwp from './Ovwp'
import Aamp from './Aamp'
import Detp from './Detp'
import Ptyp from './Ptyp'
import Drv from './Drv'
import Dscins from './Dscins'
// import Dogp from './Dogp'
// import Dorp from './Dorp'
// import Adcp from './Adcp'
import Revp from './Revp'
// import Engp from './Engp'
// import Setpan from './Setpan'
// import Coninfp from './Coninfp'
// import Docpan from './Docpan'
// import Doctre from './Doctre'
// import Spcbenp from './Spcbenp'
// import Spcrcvp from './Spcrcvp'
import Srmp from './Srmp'
// import Limitbody from './Limitbody'

import Doxp from '~/views/Public/Doxp'
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 Limitbody from '~/views/Public/Limitbody'


export default {
  name: 'Letdrw',
  components: {
    'm-ovwp': Ovwp,
    'm-aamp': Aamp,
    'm-detp': Detp,
    'm-ptyp': Ptyp,
    'm-drv': Drv,
    'm-dscins': Dscins,
    // 'm-dogp': Dogp,
    // 'm-dorp': Dorp,
    // 'm-adcp': Adcp,
    'm-doxp': Doxp,
    'm-revp': Revp,
    'm-engp': Engp,
    'm-setpan': Setpan,
    'm-coninfp': Coninfp,
    'm-docpan': Docpan,
    'm-doctre': Doctre,
    // 'm-spcbenp': Spcbenp,
    // 'm-spcrcvp': Spcrcvp,
    'm-srmp': Srmp,
    'm-limitbody': Limitbody,
  },
  provide() {
    return {
      root: this,
    }
  },
  mixins: [commonProcess, commonFuncs], // 里面包含了Default、Check等的公共处理
  data() {
    return {
      tabVal: 'ovwp',
      trnName: 'letdrw',
      model: new Letdrw().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('进入letdrw交易')
    let rtnmsg = await this.init({})
    if (rtnmsg.respCode == SUCCESS) {
      this.updateModel(rtnmsg.data)
      //TODO 处理数据逻辑
      if (this.isInDisplay) {
        this.restoreDisplay()
      }
    } else {
      this.$notify.error({ title: '错误', message: '服务请求失败！' })
    }
  },
}
</script>
<style></style>
