<template>
  <div class="eibs-tab">
    <c-collapse v-model="activeNames">
      <el-collapse-item name="info" title="基本信息">
        <c-col :span="24">
          <!-- ==================左边================ -->
          <c-col :span="12" style="padding-right: 20px">
            <c-col :span="24">
              <c-ptap13 :requiredExtkey="true" :disabledNam="true" :model="model" payuil="CN" :isMyClient="true" :argadr="{title: '签约人', grp:'signinfo', rol:'pye'}" :isShowCard="true" ptytyp="C"></c-ptap13>
            </c-col>
          </c-col>
          <!-- ============右边================= -->
          <c-col :span="12" style="padding-left: 20px">
            <c-col :span="24">
              <el-form-item label="汇款类型" prop="signinfo.paytyp">
                <c-select :disabled="isZHbch" v-model="model.signinfo.paytyp" dbCode="PAYTYP" sort="SRT" @change="changePaytyp" :isShowKeyAndLabel="false" style="width: 100%" placeholder="请输入汇款类型"></c-select>
              </el-form-item>
            </c-col>
            <c-col :span="24">
              <el-form-item label="签约场景" prop="signinfo.scenecode">
                <c-select  :disabled="isZHbch" v-model="model.signinfo.scenecode" dbCode="SITRTP" @change="ruleHandleSearch" :filterKey="this.model.signinfo.paytyp=='I'?['CPTECI','CPTHYI']:['CPTECO','CPTHYF']" sort="SRT" :isShowKeyAndLabel="false" style="width: 100%" placeholder="请输入签约场景"></c-select>
              </el-form-item>
            </c-col>
            <!-- 勿删!!!勿删!!!勿删!!! -->
            <!-- <c-col :span="24">
              <el-form-item label="交易对手是否必输" :label-width="formLabelWidth" prop="signinfo.hascountpty">
                <c-select v-model="model.signinfo.hascountpty" dbCode="ISYN" sort="SRT" :isShowKeyAndLabel="true" style="width: 100%" placeholder="请输入交易对手是否必输"></c-select>
              </el-form-item>
            </c-col> -->
          </c-col>
        </c-col>
      </el-collapse-item>
      <el-collapse-item name="signrules" title="业务规则">
        <m-rule :codes="codes" :model="model" />
      </el-collapse-item>
      <!-- 勿删!!!勿删!!!勿删!!! -->
      <!-- <el-collapse-item name="countpty" title="交易对手信息">
        <m-countpty :codes="codes" :model="model" />
      </el-collapse-item> -->
    </c-collapse>
  </div>
</template>
<script>
import Api from "~/service/Api";
import event from "../event";
import Check from "../model/check";

import Rule from "./rule";
import Countpty from "./countpty";

export default {
  components: {
    "m-rule": Rule,
    "m-countpty": Countpty
  },
  inject: ["root"],
  props: ["model", "codes"],
  mixins: [event],
  data() {
    return {
      activeNames: ["info", "signrules", "countpty"],
      formLabelWidth: "120px",
      isZHbch: false,
    };
  },
  computed: {},
  created() {
    //this.getBopcodItems();
    this.model.signinfo.paytyp = "I";
    this.model.signinfo.hascountpty = "N";
    let bchLev = JSON.parse(window.sessionStorage.currentOrg).level;
    if (bchLev != "0") {
      this.isZHbch = true;
      this.model.signinfo.paytyp = "I";
      this.model.signinfo.scenecode = "CPTHYI";
      this.ruleHandleSearch();
    }
  },
  watch: {
    "model.signinfo.cbs.nom1.cur": {
      immediate: true,
      handler(newVal) {
        if (newVal) {
          this.model.signinfo.cur = newVal;
        }
      }
    },
    "model.signinfo.pye.pts.extkey": {
      immediate: true,
      handler(newVal) {
        if (newVal) {
          this.model.signinfo.extkey = newVal;
          this.model.signinfo.act = this.model.signinfo.rec.pyeact;
          this.model.signinfo.ptainr = this.model.signinfo.pye.pts.ptainr;
          this.model.signinfo.ptyinr = this.model.signinfo.pye.pts.ptyinr;
          this.model.signinfo.nam =
            this.model.signinfo.pye.pts.cnnam != ""
              ? this.model.signinfo.pye.pts.cnnam
              : this.model.signinfo.pye.pts.ennam;
        }
      }
    },
    "model.signinfo.rec.pyeact": {
      immediate: true,
      handler(newVal) {
        if (newVal) {
          this.model.signinfo.act = newVal;
          this.model.signinfo.extkey = this.model.signinfo.pye.pts.extkey;
          this.model.signinfo.ptainr = this.model.signinfo.pye.pts.ptainr;
          this.model.signinfo.ptyinr = this.model.signinfo.pye.pts.ptyinr;
          this.model.signinfo.nam =
            this.model.signinfo.pye.pts.cnnam != ""
              ? this.model.signinfo.pye.pts.cnnam
              : this.model.signinfo.pye.pts.ennam;
        }
      }
    }
  },
  methods: {}
};
</script>
<style>
</style>