<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"
            size="small"
            :validate-on-rule-change="false"
        >
        <c-tabs :value="tabVal" ref="elment" type="card" @tab-click="tabClick">
          <el-tab-pane label="汇款信息" name="opnp1">
            <!--PD000020 -->
            <c-content>
              <m-opnp1 :model="model" :codes="codes" />
            </c-content>
          </el-tab-pane>

          <!-- <el-tab-pane label="Additional Info" name="AdditionalInfo">
            <m-AdditionalInfo :model="model" :codes="codes" />
          </el-tab-pane> -->

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

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

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

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

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

          <el-tab-pane label="Finance" name="finp">
            <!--PD000218 -->
            <m-finp :model="model" :codes="codes" />
          </el-tab-pane>

          <el-tab-pane label="申报信息" name="sbxx">
            <!--PD000009 -->
            <m-sbxx :model="model" :codes="codes"/>
          </el-tab-pane>
          
          <el-tab-pane label="境内汇款申请书-基础信息" name="dbe" v-if="model.bopmod.szflg === '2' && model.bopmod.basflg">
            <m-dbe :model="model" :codes="codes"></m-dbe>
          </el-tab-pane>
          <el-tab-pane label="境外汇款申请书-基础信息" name="dbb" v-if="model.bopmod.szflg === '1' && model.bopmod.basflg">
            <m-dbb :model="model" :codes="codes"></m-dbb>
          </el-tab-pane>

          <el-tab-pane label="2111跨境支出信息" name="outp" v-if="model.cnybop.outflg==='1'">
            <m-outp :model="model" :codes="codes"></m-outp>
          </el-tab-pane>

          <el-tab-pane label="Payment 103 PYE USD" name="Payment103" v-if="model.cpdgrp.rec.swftyp === '103' || model.cpdgrp.rec.swftyp === '202'">
            <m-Payment :model="model" :codes="codes" />
          </el-tab-pane>

          <!-- <el-tab-pane label="Payment 103 PYE USD" name="Payment103">
            <m-Payment103 :model="model" :codes="codes" />
          </el-tab-pane> -->

          <!-- <el-tab-pane label="Payment 202 PYE USD" name="Payment202">
            <m-Payment202 :model="model" :codes="codes" />
          </el-tab-pane> -->
        </c-tabs>
        </el-form>
    </div>
    
    <c-grid-ety-prompt-dialog ref="etyDialog" :promptData="promptData" v-on:select-ety="selectEty"></c-grid-ety-prompt-dialog>
  </c-page>
</template>
<script>
import Api from "~/service/Api";
import Utils from "~/utils/index"
import CodeTable from "~/config/CodeTable";
import Cptopn from "~/model/Cptopn";
import CommonProcess from "~/mixin/CommonProcess";
import Pattern from "~/model/Cptopn/Pattern";
import Default from "~/model/Cptopn/Default";
import Check from "~/model/Cptopn/Check";
import Opnp1 from "./Opnp1";
// import Coninfp from "./Coninfp";
import Finp from "./Finp";
import Sbxx from "./Sbxx";
import Dbe from "./Dbe.vue"
import Dbb from "./Dbb.vue"
import Outp from "./Outp.vue"
import AdditionalInfo from "./AdditionalInfo.vue"
import Payment from "./Payment103.vue"
// import Payment103 from "./Det103.vue"
// import Payment202 from "./Det202.vue"
import Coninfp from "~/views/Public/Coninfp";

import Doctre from "~/views/Public/Doctre";
import Glepan from "~/views/Public/Glepan"
import Setpan from "~/views/Public/Setpan"
import Docpan from "~/views/Public/Docpan"

import CommonFuncs from "~/mixin/CommonFuncs";

export default {
  name: 'Cptopn',
  components: {
    "m-opnp1": Opnp1,
    "m-setpan": Setpan,
    "m-glepan": Glepan,
    "m-coninfp": Coninfp,
    "m-docpan": Docpan,
    "m-doctre": Doctre,
    "m-finp": Finp,
    "m-sbxx": Sbxx,
    "m-dbe": Dbe,
    "m-dbb": Dbb,
    "m-outp": Outp,
    "m-AdditionalInfo": AdditionalInfo,
    "m-Payment": Payment,
    // "m-Payment103": Payment103,
    // "m-Payment202": Payment202

  },
    provide() {
        return {
            root: this
        }
    },
  mixins: [CommonProcess,CommonFuncs], // 里面包含了Default、Check等的公共处理
  data() {
    return {
      tabVal:"opnp1",
      trnName:"cptopn",
      model: new Cptopn().data,
      checkRules: Check,
      defaultRules: Default,
      pattern: Pattern,
      rules:null,
      codes: {...CodeTable},
    };
  },
  methods:{
  },
  created: async function () {
    console.log("进入cptopn交易");
    // let rtnmsg = await Api.post("cptopn/init", { params: {} });
    let rtnmsg = await this.init(this.$route.query);
    if (rtnmsg.respCode == SUCCESS) {
      Utils.copyValueFromVO(this.model,rtnmsg.data)
      if (this.isInDisplay) {
        this.restoreDisplay();
      }
    } else {
      this.$notify.error({ title: "错误", message: "服务请求失败！" });
    }
  },
  watch:{
    "model.cpdgrp.cbs.nom1.amt": {
      handler(val, oldVal) {
        this.changeFormItemRequired("cpdgrp.rec.swftyp", val != '0.000');
      },
      immediate: true,
    },
  }
};
</script>
<style>
.el-col .el-divider--horizontal {
    margin-top: 0;
}
.messageLabel .el-form-item__label {
    text-align: left;
    font-weight: bold;
    font-size: 12px;
}
</style>
