index.js 5.85 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 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178
import Api from '~/service/Api';
import commonFunctions from '~/mixin/commonFunctions.js';
import buildFn from './buildCommons.js';
import Utils from "~/utils";
import Pts from '~/components/business/commonModel/Pts';
import moment from "moment";

export default {
  mixins: [commonFunctions],
  methods: {
    // rmbrol角色改变,则将相应的角色的值赋值给偿付信息的rmbrmb角色
    rmbrolChange(){

      switch (this.model.rmbclm.rmbrol) {
        case "ADV":
          Utils.copyValueFromVoData(this.model.rmbclm.rmbrmb.pts, this.model.ledgrp.adv.pts);
          break;
        case "AVB":
          Utils.copyValueFromVoData(this.model.rmbclm.rmbrmb.pts, this.model.ledgrp.avb.pts);
          break;
        case "ISS":
          Utils.copyValueFromVoData(this.model.rmbclm.rmbrmb.pts, this.model.ledgrp.iss.pts);
          break;
        case "CON":
          Utils.copyValueFromVoData(this.model.rmbclm.rmbrmb.pts, this.model.ledgrp.con.pts);
          break;
        case "RMB":
          Utils.copyValueFromVoData(this.model.rmbclm.rmbrmb.pts, this.model.ledgrp.rmb.pts);
          break;
        case "OTH":
          this.model.rmbclm.rmbrmb.pts = new Pts().data;
          break;
        default:
          this.model.rmbclm.rmbrmb.pts = new Pts().data;
          break;
      }

      if(this.model.rmbclm.rmbrmb.pts.ptainr!=''){
        this.model.rmbclm.rmbrmb.pts.rol = "RMBRMB";
      }
    },

    // 如果rmbclnow的值改变,且rmbrol的角色没有被修改过,如果rmbclnow没有被选中,则rmbrol为“ISS”,如果选中了,则修改rmbrol值为“RMB”
    // 值改变时,addphr的值需要改变
    rmbclmnowChange(){

      if(this.model.rmbclmnow ==='X'){
        // rmbrol is not modifed
        if(this.model.rmbclm.modifySet==null || !this.model.rmbclm.modifySet.includes("rmbrol")){
          this.model.rmbclm.rmbrol = "RMB";
          this.rmbrolChange();
        }
      } else{
        this.model.rmbclm.rmbrol = "";
        this.rmbrolChange();
      }

      this.defaultBedsndAddphrN1000();

    },

    // 值改变时,addphr的值需要改变
    rmbclmlateChange(){
      this.defaultBedsndAddphrN1000();
    },

    // matdat改变,如果不为空,则会disable matper,且清空其值
    matdatChanged(value){
      if(value != null && value != '' || this.model.bedgrp.rec.doctypcod == 'P'){
        this.model.bedgrp.blk.matper = '';
      }

      // 到期日matdat 小于 交单日rcvdat,给出提示
      if (value != '' && value != null) {

        if (this.model.bedgrp.rec.rcvdat != '' && this.model.bedgrp.rec.rcvdat != null) {

          if (moment(value).diff(moment(this.model.bedgrp.rec.rcvdat), 'days') <0) {

            this.$confirm('The Maturity Date is before the Received on date, are you sure? ', '', {
              confirmButtonText: 'Yes',
              cancelButtonText: 'No',
              type: 'warning',
              showClose: false
            }).then(() => {//yes的执行在这里写
              // do nothing
            }).catch(() => {//No的功能在这里写
              // clear the matdat
              this.model.bedgrp.rec.matdat = ''
            });
          }
        }

      }

    },

    // matper改变,如果不为空,则会disable matdat,且清空其值
    matperChanged(value){
      if(value != '' || this.model.bedgrp.rec.doctypcod == 'P'){
        this.model.bedgrp.rec.matdat = '';
      }
    },

    docrolChange(value){

      switch (this.model.bedgrp.rec.docrol) {
        case "APL":
          Utils.copyValueFromVoData(this.model.bedgrp.doc.pts, this.model.ledgrp.apl.pts);
          break;
        case "BEN":
          Utils.copyValueFromVoData(this.model.bedgrp.doc.pts, this.model.ledgrp.ben.pts);
          break;
        case "ADV":
          Utils.copyValueFromVoData(this.model.bedgrp.doc.pts, this.model.ledgrp.adv.pts);
          break;
        case "AVB":
          Utils.copyValueFromVoData(this.model.bedgrp.doc.pts, this.model.ledgrp.avb.pts);
          break;
        case "ISS":
          Utils.copyValueFromVoData(this.model.bedgrp.doc.pts, this.model.ledgrp.iss.pts);
          break;
        case "CON":
          Utils.copyValueFromVoData(this.model.bedgrp.doc.pts, this.model.ledgrp.con.pts);
          break;
        case "RMB":
          Utils.copyValueFromVoData(this.model.bedgrp.doc.pts, this.model.ledgrp.rmb.pts);
          break;
        case "TRB":
          Utils.copyValueFromVoData(this.model.bedgrp.doc.pts, this.model.ledgrp.trb.pts);
          break;
        case "A2B":
          Utils.copyValueFromVoData(this.model.bedgrp.doc.pts, this.model.ledgrp.a2b.pts);
          break;
        case "APB":
          Utils.copyValueFromVoData(this.model.bedgrp.doc.pts, this.model.ledgrp.apb.pts);
          break;
        case "DRW":
          Utils.copyValueFromVoData(this.model.bedgrp.doc.pts, this.model.ledgrp.drw.pts);
          break;
        case "OTH":
          this.model.bedgrp.doc.pts = new Pts().data;
          break;
        default:
          this.model.bedgrp.doc.pts = new Pts().data;
          break;
      }

      // 如果doc角色有值,则将其角色赋值为'DOC'
      if(this.model.bedgrp.doc.pts.extkey!=''){
        this.model.bedgrp.doc.pts.rol = "DOC";
      }
    },

    /**
     *   source:betsnd.0034.script
     */

    defaultBedsndAddphrN1000(){

      if(!this.model.bedsnd.modifySet || (this.model.bedsnd.modifySet!=null && !this.model.bedsnd.modifySet.includes("addphr")))
      {
        if( this.model.rmbclmlate!=null && this.model.rmbclmlate!='' )
        {
          this.model.bedsnd.addphr = 'WE SHALL CLAIM ON THE REIMBURSING BANK ACCORDING TO YOUR INSTRUCTIONS';
        }
        else
        {
          if( this.model.rmbclmnow!=null && this.model.rmbclmnow!='' )
          {
            this.model.bedsnd.addphr = 'WE HAVE TODAY CLAIMED ON THE REIMBURSING BANK ACCORDING TO YOUR INSTRUCTIONS';
          }
        }
      }
    }

  },
};