default.js 5.3 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 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137

/**
* Gitdla Default规则
*/
import moment from 'moment';
import BigNumber from "bignumber.js";
export default {
	methods:{
  
		defaultFunc () {
			// 根据max2的值是否大于0判断是否勾选附加金额字段
			let oldMax2Amt = this.model.gidgrp.cbs.max2.amt
			if (Number(oldMax2Amt) != 0) {
				this.model.adaflg = 'X'
			}
		},
		// 初始化备份保函文本字段
		getGtxgidtxtMark () {
			this.$set(this.codes, 'gtxgidtxtMark', this.model.gidgrp.blk.gidtxt)
			this.$set(this.codes, 'gtxgidtxtcMark', this.model.gidgrp.blk.gidtxtc)
		},
		// model.gidgrp.rec.expflg
		changeExpflg (){
			if (
        this.model.gidgrp.rec.expflg == "X" &&
        this.model.gidgrp.rec.hndtyp == "OC"
      ) {
        this.model.gidgrp.rec.liaflg = "X";
      }
		},
		// model.gidgrp.rec.gartyp
		changeGartyp (){
			if (this.model.gidgrp.rec.gartyp == "1") {
        this.model.gidgrp.rec.gtxinr = "<NILTXT>";
      }
		},
		changeCfaflg() {
			if((this.model.cfagit.recgrp == null || this.model.cfagit.recgrp.bas.exguarancode == null || this.model.cfagit.recgrp.bas.exguarancode == '') || this.model.ameflg != 'Y') {
				this.model.cfagit.cfaflg = '4';
			}
		},
		formatTableData () {
			let list = this.model.decstm.rows || []
			let resList = []
			if (list) {
				list.map((item, ind) => {
					let tempItem = item.split("\t")
					resList.push({
						'IDX': ind,
						'修改次数': tempItem[0],
						'编号': tempItem[1],
						'币种': tempItem[2],
            '修改金额': tempItem[3],
            '附加金额变化值':tempItem[4],
						'修改日期': tempItem[5],
						'新有效期到期类型': tempItem[6],
            '新有效期': tempItem[7],
            '新有效期敞口': tempItem[8]==""?"":"Y",
            '新有效期到期条件': tempItem[9].replace(/<br>/g, "\n"),
            '新反担保有效期到期类型': tempItem[10],
            '新反担保有效期': tempItem[11],
            '新反担保有效期敞口': tempItem[12]==""?"":"Y",
            '新反担保有效期到期条件': tempItem[13].replace(/<br>/g, "\n"),
            'checked': (list.length === 1 || this.model.amenbr == tempItem[0])
					})
				})
			}
			if (resList && resList.length === 1) {
				this.decstmRowSelected(resList[0])
			}
			this.$set(this.codes, 'tableData', resList)
		},
		decstmRowSelected(row) {
			if (row === undefined) {
				return
			}
      this.model.amenbr = row.修改次数;
      this.model.amecur = row.币种;
      this.model.ameamt = row.修改金额;
      this.model.addamecur = row.币种;
      this.model.addameamt = row.附加金额变化值;
      this.model.amedat = moment(row.修改日期).format("YYYY-MM-DD");
      this.model.gidgrp.cbs.max.amt = new BigNumber(this.model.oldgidgrp.cbs.max.amt).plus(new BigNumber(this.model.ameamt)).toFormat(2).replace(/,/g, "");
      this.model.gidgrp.cbs.max2.amt = new BigNumber(this.model.oldgidgrp.cbs.max2.amt).plus(new BigNumber(this.model.addameamt)).toFormat(2).replace(/,/g, "");
      this.model.gidgrp.cbs.opn1.amt = new BigNumber(this.model.oldgidgrp.cbs.opn1.amt).plus(new BigNumber(this.model.ameamt)).toFormat(2).replace(/,/g, "");
      this.model.gidgrp.cbs.opn2.amt = new BigNumber(this.model.oldgidgrp.cbs.opn2.amt).plus(new BigNumber(this.model.addameamt)).toFormat(2).replace(/,/g, "");
      this.model.swiadd.addnewamt=this.model.gidgrp.cbs.max2.amt;
      this.model.swiadd.newamt=this.model.gidgrp.cbs.max.amt;
      if(this.model.gidgrp.cbs.max2.amt>0){
        this.model.adaflg="X";
      }
      this.model.ameflg = "Y";
      this.model.cfagit.dclflg == "X";
      if (row.新有效期 == "") {
        this.model.swiadd.newexpdat = "";
        this.model.gidgrp.rec.expdat = "";
      } else {
        this.model.swiadd.newexpdat = moment(row.新有效期).format(
          "YYYY-MM-DD"
        );
        this.model.gidgrp.rec.expdat = moment(row.新有效期).format(
          "YYYY-MM-DD"
        );
        this.date = moment(row.新有效期).format("YYYY-MM-DD");
      }
      this.model.swiadd.newexpflg=(row.新有效期敞口=="Y"?"X":"");
      this.model.swiadd.exptyp=row.新有效期到期类型;
      this.model.swiadd.exptxt=row.新有效期到期条件;
      this.model.gidgrp.rec.expflg=(row.新有效期敞口=="Y"?"X":"");
      this.model.gidgrp.rec.exptyp=row.新有效期到期类型;
      this.model.gidgrp.rec.exptxt=row.新有效期到期条件;

      if (row.新反担保有效期 == "") {
        this.model.swiadd.newliadat = "";
        this.model.gidgrp.rec.liadat = "";
      } else {
        this.model.swiadd.newliadat = moment(row.新反担保有效期).format(
          "YYYY-MM-DD"
        );
        this.model.gidgrp.rec.liadat = moment(row.新反担保有效期).format(
          "YYYY-MM-DD"
        );
        this.date = moment(row.新反担保有效期).format("YYYY-MM-DD");
      }
      this.model.swiadd.newliaflg=(row.新反担保有效期敞口=="Y"?"X":"");
      this.model.swiadd.liatypc=row.新反担保有效期到期类型;
      this.model.swiadd.liatxtc=row.新反担保有效期到期条件;
      this.model.gidgrp.rec.liaflg=(row.新反担保有效期敞口=="Y"?"X":"");
      this.model.gidgrp.rec.liatypc=row.新反担保有效期到期类型;
      this.model.gidgrp.rec.liatxtc=row.新反担保有效期到期条件;
      

      this.changeAccp(this.date);
    }
	}
}
//你可以添加自动default处理