default.js 3.2 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
/**
 * Hitpdl Default规则
 */
import commonFunctions from '~/mixin/commonFunctions.js';
import commonDepend from "~/mixin/commonDepend";
import BigNumber from "bignumber.js";
import moment from 'moment';

export default {
	mixins: [commonFunctions,commonDepend],
	methods: {
		// 初始化备份保函文本字段
		getGtxgidtxtMark () {
			this.$set(this.codes, 'gtxgidtxtMark', this.model.nidgrp.blk.gidtxt)
		},
		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]==""?"":"Y",
						'新反担保有效期': tempItem[7],
						'新反担保有效期敞口': tempItem[8]==""?"":"Y",
						'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.amedat = moment(row.修改日期).format("YYYY-MM-DD");
	  this.model.amedat = moment(row.修改日期).format("YYYY-MM-DD");
	  this.model.swiadd.amedat = moment(row.修改日期).format("YYYY-MM-DD");
	  this.model.nidgrp.cbs.max.amt = new BigNumber(this.model.oldnidgrp.cbs.max.amt).plus(new BigNumber(this.model.ameamt)).toFormat(2).replace(/,/g, "");
      this.model.swiadd.newamt=this.model.nidgrp.cbs.max.amt; 
      // this.model.nidgrp.cbs.max.amt = new BigNumber(this.model.oldnidgrp.cbs.max.amt).plus(new BigNumber(this.model.ameamt)).toFormat(2).replace(/,/g, "");
      // this.model.nidgrp.cbs.opn1.amt = new BigNumber(this.model.oldnidgrp.cbs.opn1.amt).plus(new BigNumber(this.model.ameamt)).toFormat(2).replace(/,/g, "");
      this.model.ameflg = "Y";
      // this.model.cfagit.dclflg == "X";
      if (row.新到期日 == "-"||row.新有效期 == "") {
        this.model.swiadd.newexpdat = "";
        //this.model.nidgrp.rec.expdat = "";
      } else {
        this.model.swiadd.newexpdat = moment(row.新有效期).format(
          "YYYY-MM-DD"
        );
        // this.model.nidgrp.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.nidgrp.rec.expflg=(row.新有效期敞口=="Y"?"X":"");
	  
	  if (row.新反担保有效期 == "-"||row.新反担保有效期 == "") {
        this.model.swiadd.newliadat = "";
      } else {
        this.model.swiadd.newliadat = moment(row.新反担保有效期).format(
          "YYYY-MM-DD"
        );
      }
	  this.model.swiadd.newliaflg=(row.新反担保有效期敞口=="Y"?"X":"");
	  
      this.changeAccp(this.date);
    }
	}
}
//你可以添加自动default处理