index.js 2.87 KB
import Api from '~/service/Api';
import commonFunctions from '~/mixin/commonFunctions.js';
import BigNumber from 'bignumber.js';
import { cloneDeep } from "lodash";
import Pts from '~/components/business/commonModel/Pts.js';

export default {
	mixins: [commonFunctions],
    methods: {
        changeOpnbe1amt(){
            this.model.btdgrp.cbs.max.amt =new BigNumber(this.model.btdgrp.be2amt).plus(
                new BigNumber(this.model.btdgrp.cbs.opnbe1amt.amt));
            this.model.btdgrp.cbs.maxbe1amt.amt =new BigNumber(this.model.btdgrp.cbs.opnbe1amt.amt);
        },
        changeBe2amt(){
          this.model.btdgrp.cbs.max.amt =new BigNumber(this.model.btdgrp.be2amt).plus(
              new BigNumber(this.model.btdgrp.cbs.opnbe1amt.amt));
          this.model.btdgrp.cbs.maxbe1amt.amt =new BigNumber(this.model.btdgrp.cbs.opnbe1amt.amt);
        },
        changeMaxamt(){
            this.model.btdgrp.cbs.opnbe1amt.amt =new BigNumber(this.model.btdgrp.cbs.max.amt).minus(
                new BigNumber(this.model.btdgrp.be2amt));
            this.model.btdgrp.cbs.maxbe1amt.amt =new Number(this.model.btdgrp.cbs.opnbe1amt.amt);
        },
        changeOpnbe1amt2(){
            this.model.btdgrp.cbs.max2.amt =new BigNumber(this.model.btdgrp.be2amt2).plus(
                new BigNumber(this.model.btdgrp.cbs.opnbe1amt2.amt));
            this.model.btdgrp.cbs.maxbe1amt2.amt =new BigNumber(this.model.btdgrp.cbs.opnbe1amt2.amt);
        },
        changeMax2Amt(){
            if(this.model.btdgrp.cbs.max2.amt != null && this.model.btdgrp.cbs.max2.amt !="0.00"){
                this.model.swiadd.addamtflg = "X";
            }else{
                this.model.swiadd.addamtflg = "";
            }
            this.model.btdgrp.cbs.opnbe1amt2.amt =new BigNumber(this.model.btdgrp.cbs.max2.amt).minus(
                new BigNumber(this.model.btdgrp.be2amt2));
            this.model.btdgrp.cbs.maxbe1amt2.amt =new BigNumber(this.model.btdgrp.cbs.opnbe1amt2.amt);
        },
        onDocdisflgChange() {
          if (this.model.btdgrp.blk.docdisflg == "") {
            this.model.btdgrp.blk.docdis =  this.model.oldbtdgrp.blk.docdis;
          } 
        },
        paybrolDefault() {
          let ptsList = [];
          ptsList.push(this.model.ledgrp.adv);
          ptsList.push(this.model.ledgrp.avb);
          ptsList.push(this.model.ledgrp.iss);
          ptsList.push(this.model.ledgrp.con);
          let res = ptsList.find((item) => item.pts.rol == this.model.btdgrp.rec.payrol);
          if (res != null && res != "") {
            let newRes = cloneDeep(res);
            this.model.btdgrp.oth = newRes;
            this.model.btdgrp.oth.pts.rol = "OTH";
          }else{
            const objpta = {
              pts : new Pts().data,
            }
            this.model.btdgrp.oth = cloneDeep(objpta);
            this.model.btdgrp.oth.pts.rol = "OTH";
    
          }
        },

    }
}