<template>
  <div class="eContainer">
    <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">
        <!--PD000000 -->
        <el-tab-pane label="接口信息选择" name="selp">
          <m-selp :model="model" :codes="codes" />
        </el-tab-pane>

        <!--PD000000 -->
        <el-tab-pane label="接口反馈文件差错返回" name="errp">
          <m-errp :model="model" :codes="codes" />
        </el-tab-pane>
      </c-tabs>
    </el-form>
  </div>
</template>
<script>
import Api from "~/service/Api";
import CodeTable from "~/config/CodeTable";
import Bopsel from "~/model/Bopsel";
import CommonProcess from "~/mixin/CommonProcess";
import Check from "~/model/Bopsel/Check";
import Default from "~/model/Bopsel/Default";
import Pattern from "~/model/Bopsel/Pattern";
import Selp from "./Selp";
import Errp from "./Errp";

export default {
  name: "Bopsel",
  components: {
    "m-selp": Selp,
    "m-errp": Errp,
  },
  provide() {
    return {
      root: this,
    };
  },
  mixins: [CommonProcess], // 里面包含了Default、Check等的公共处理
  data() {
    return {
      tabVal: "selp",
      trnName: "bopsel",
      model: new Bopsel().data,
      checkRules: Check,
      defaultRules: Default,
      pattern: Pattern,
      rules: null,
      codes: {
        boptyp: [],
        dattyp: [
          { label: "按收付汇日期", value: "A" },
          { label: "按经办日期", value: "B" },
        ],
        ptytyp: [
          { label: "对公", value: "C" },
          { label: "对私中国居民", value: "D" },
          { label: "对私非中国居民", value: "F" },
        ],
        medtyp:[
		{label:"票汇",value:"D" },
		{label:"信用证",value:"L" },
		{label:"托收",value:"C" },
		{label:"保函",value:"G" },
		{label:"光票托收",value:"Y" },
		{label:"其他",value:"O" },
		{label:"电汇",value:"T" },
		{label:"支票代收",value:"Z" },
		{label:"信汇",value:"M" },
	],
    staflg:[
        {label:"待确认",value:"P" },
        {label:"待发送",value:"W" },
		{label:"已发送",value:"S" },
        {label:"已撤销",value:"D" },
		{label:"已删除",value:"G" },
		{label:"待修改",value:"E" },
	],
      },
    };
  },
  methods: {
    tabClick() {},
  },
  created: async function () {
    console.log("进入bopsel交易");

    // 查询码表
    Api.post("getCodetable", { tbl: "BOPTYP", lang: "EN" }).then((res) => {
      if (res.respCode == SUCCESS) {
        this.codes.boptyp = res.data;
      }
    });

    let rtnmsg = await this.init({});
    if (rtnmsg.respCode == SUCCESS) {
      //TODO 处理数据逻辑
    } else {
      this.$notify.error({ title: "错误", message: "服务请求失败！" });
    }
  },
};
</script>
<style>
</style>
