<template>
  <div class="eibs-tab">

    <c-col :span="24" style="height: 24px">
      <el-form-item label="外管信息" class="messageLabel"></el-form-item>
    </c-col>
    <c-col :span="24" style="height: 0px">
        <el-divider></el-divider>
    </c-col>

    <c-col :span="24" style="margin-top: 20px;">
      <c-col :span="12">
        <el-form-item label="申报类型" label-width="30%" prop="bopmod.szflg">
          <c-select
            v-model="model.bopmod.szflg"
            style="width: 100%"
            placeholder="请选择申报类型"
            @change="szflgChange"
          >
            <el-option
              v-for="item in codes.szflg"
              :key="item.value"
              :label="item.label"
              :value="item.value"
            ></el-option>
          </c-select>
        </el-form-item>
      </c-col>
      <c-col :span="7" :offset="1">
        <c-checkbox v-model="model.bopmod.basflg" :disabled="model.bopmod.szflg==='3'||model.bopmod.szflg===''">基础数据</c-checkbox>
      </c-col>
    </c-col>

    <c-col :span="12">
      <c-col :span="24">
        <el-form-item label="款项去向" prop="bopmod.acttyp" label-width="30%">
          <c-select
            v-model="model.bopmod.acttyp"
            style="width: 100%"
            placeholder="请选择"
            :disabled="model.bopmod.szflg==='3' || model.bopmod.szflg==='2'"
          >
          <el-option
            v-for="item in codes.acttyp"
            :key="item.value"
            :label="item.label"
            :value="item.value"
          ></el-option>
          </c-select>
        </el-form-item>
      </c-col>

      <c-col :span="24">
        <el-form-item label="地区机构号" prop="bopmod.ownextkey" label-width="30%">
          <c-select
            v-model="model.bopmod.ownextkey"
            style="width: 100%"
            placeholder="请选择"
            :disabled="model.bopmod.szflg==='3'"
          >
          <el-option
            v-for="item in codesOwnextkey"
            :key="item.value"
            :label="item.label"
            :value="item.value"
          ></el-option>
          </c-select>
        </el-form-item>
      </c-col>
    </c-col>

  

    <!-- <c-col :span="8" :offset="1">
      <c-col :span="3">
        <c-checkbox v-model="model.bopmod.basflg" >基础数据</c-checkbox>
      </c-col> -->

      <!-- <c-col :span="3">
        <c-checkbox v-model="model.bopmod.dclflg">申报数据</c-checkbox>
      </c-col>

      <c-col :span="3">
        <c-checkbox v-model="model.bopmod.vrfflg">核销数据</c-checkbox>
      </c-col> -->
    <c-col :span="24" style="height: 24px;margin-top: 20px;">
      <el-form-item label="跨境人民币申报" class="messageLabel"></el-form-item>
    </c-col>
    <c-col :span="24" style="height: 0px">
        <el-divider></el-divider>
    </c-col>

    <c-col :span="12" style="margin-top: 20px;">
        <c-col :span="24">
            <el-form-item label="是否报送跨境人民币2101表" label-width="30%">
                <c-select
                v-model="model.cnybop.cnyflg"
                style="width: 100%;"
                placeholder="请选择"
                disabled
                >
                <el-option
                    v-for="item in codes.cnyflg"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value"
                ></el-option>
                </c-select>
            </el-form-item>
            </c-col>

            <c-col :span="24">
            <el-form-item label="是否报送跨境人民币2107表" label-width="30%">
                <c-select
                v-model="model.cnybop.traflg"
                style="width: 100%;"
                placeholder="请选择"
                disabled
                >
                <el-option
                    v-for="item in codes.traflg"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value"
                ></el-option>
                </c-select>
            </el-form-item>
            </c-col>

            <c-col :span="24">
            <el-form-item label="是否报送跨境人民币2111表" label-width="30%" prop="cnybop.outflg">
                <c-select
                v-model="model.cnybop.outflg"
                style="width: 100%;"
                placeholder="请选择"
                >
                <el-option
                    v-for="item in codes.outflg"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value"
                ></el-option>
                </c-select>
            </el-form-item>
            </c-col>

            <c-col :span="24">
            <el-form-item label="是否报送跨境人民币2106表" label-width="30%">
                <c-select
                v-model="model.cnybop.libflg"
                style="width: 100%;"
                placeholder="请选择"
                disabled
                >
                <el-option
                    v-for="item in codes.libflg"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value"
                ></el-option>
                </c-select>
            </el-form-item>
            </c-col>

            <c-col :span="24">
            <el-form-item label="是否报送跨境人民币2122表" label-width="30%">
                <c-select
                v-model="model.cnybop.vouflg"
                placeholder="请选择"
                style="width: 100%;"
                disabled
                >
                <el-option
                    v-for="item in codes.vouflg"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value"
                ></el-option>
                </c-select>
            </el-form-item>
            </c-col>
    </c-col>
 
  </div>
</template>
<script>
import Api from "~/service/Api";
import commonProcess from "~/mixin/commonProcess";
import CodeTable from "~/config/CodeTable";
import Event from "~/model/Cptopn/Event";

export default {
  inject: ['root'],
  props: ["model", "codes"],
  mixins: [commonProcess],
  data() {
    return {
      temp:'不申报',
      options: [
        {
          value: "1",
          label: "申报",
        },
        {
          value: "2",
          label: "不申报",
        },
      ],
      codesOwnextkey:[
          {
            value: "",
            label: "",
          }
      ],
    };
  },
  methods: { ...Event ,
    async szflgChange(){
        let rtnmsg = await this.executeRule("bopmod.szflg")
        if(rtnmsg.respCode == SUCCESS){
            this.model.bopmod.ownextkey = rtnmsg.data.bopmod_ownextkey
        }
        if(this.model.bopmod.szflg==='2'){
            this.model.bopmod.acttyp = '';
        }
        if(this.model.bopmod.szflg==='3'){
            this.model.bopmod.ownextkey = '';
            this.model.bopmod.acttyp = '';
        }
    }
  },
  created: function () {
  },
  watch: {
      "model.bopmod.ownextkey": function(){
          if(this.model.bopmod.ownextkey != ''){
              var instName = window.sessionStorage.instName || "北京分行";
              this.codesOwnextkey[0].value = this.model.bopmod.ownextkey;
              this.codesOwnextkey[0].label = this.model.bopmod.ownextkey + instName;
          }else{
              this.codesOwnextkey[0].value = '';
              this.codesOwnextkey[0].label = '';
          }
      }
  },
};
</script>
<style>
</style>
