import commonFunctions from '~/mixin/commonFunctions.js';
import buildFn from '../event/buildCommons.js';
import Api from '~/service/Api';
import Utils from '~/utils';

export default {
  mixins: [commonFunctions, buildFn],
  methods: {
    async getOwnExtkeyCondition () {
      const loading = this.loading();
      let res = await Api.post('/business/nitopnRule/getOwnExtkeyCondition');
      loading.close();
      if (res.respCode === SUCCESS) {
        this.ownExtkeyList = res.data;

      }
    },
    change2101(val){
      if (val == '1'){
        this.model.rmbbop.rmb2112.rmbflg = '1'
      }else{
        this.model.rmbbop.rmb2112.rmbflg = '2'
        this.model.rmbbop.rmb2112.newnum = 0
      }
      let trnName = this.root.trnName.toUpperCase()
      if (this.model.rmbbop.rmb2101.rmbflg == '1') {
        let rmbbop = this.buildRobbop(this.model, trnName);
        Api.post('/business/rmbbopgcd/rmbbop2101Cal', rmbbop).then(res => {
          Utils.copyValueFromVoData(this.model.rmbbop.rmb2101, res.data.rmb2101);
          this.model.rmbbop.rmb2101.recgrp.ads.opertype = '1';
        });
      }
      if (this.model.rmbbop.rmb2112.rmbflg == '1') {
        let rmbbop = this.buildRobbop(this.model, trnName);
        Api.post('/business/rmbbopgcd/rmbbop2112Cal', rmbbop).then(res => {
          Utils.copyValueFromVoData(this.model.rmbbop.rmb2112, res.data.rmb2112);
          this.model.rmbbop.rmb2112.recgrp.ads.opertype = '1';
        });
      } else {
        this.model.rmbbop.rmb2112.newnum = 0
      }
    },
    query2112() {
      let trnName = this.root ? this.root.trnName : this.trnName
      if (this.model.rmbbop.rmb2112.rmbflg == '1') {
        let rmbbop = this.buildRobbop(this.model, trnName);
        Api.post('/business/rmbbopgcd/rmbbop2112Cal', rmbbop).then(res => {
          Utils.copyValueFromVoData(this.model.rmbbop.rmb2112, res.data.rmb2112);
          this.model.rmbbop.rmb2112.recgrp.ads.opertype = '1';
        });
      } else {
        this.model.rmbbop.rmb2112.newnum = 0
      }
    },
    query2123() {
      let trnName = this.root ? this.root.trnName : this.trnName
      if (this.model.rmbbop.rmbbop2123Vo.rmbflg == '1') {
        let rmbbop = this.buildRobbop(this.model, trnName);
        Api.post('/business/rmbbopgcd/rmbbop2123Cal', rmbbop).then(res => {
          Utils.copyValueFromVoData(this.model.rmbbop.rmbbop2123Vo, res.data.rmbbop2123Vo);
          this.model.rmbbop.rmbbop2123Vo.recgrp.ads.opertype = '1';
        });
      }
    },
    changeSzflg () {
      this.model.bopmod.acttyp = ""
    },
    changeFrepayflg () {
      if (this.model.gcdgrp.rec.frepayflg == "X") {
        this.model.clsflg = 'C'
      }
    },

    changeActflg () {
      if (this.model.lendoc.actflg == "") {
        this.model.lendoc.account = "";
      }
		},

		
		
  },
};