index.js 2.87 KB
Newer Older
fukai committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
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";
    
          }
        },

    }
}