index.js 1.32 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
import Api from '~/service/Api';
import commonFunctions from '~/mixin/commonFunctions.js';
import moment from "moment";
import Utils from "~/utils";
import Pts from '~/components/business/commonModel/Pts';

export default {
  mixins: [commonFunctions],
  methods: {

    rcvdatChange(){
      if(this.model.bedgrp.rec.rcvdat == null || this.model.bedgrp.rec.rcvdat === ''){
        this.model.bedgrp.rec.rcvdat =  moment(new Date()).format("YYYY-MM-DD");
      }

      if(this.model.bedgrp.rec.doctypcod ==='E'){
        this.model.bedgrp.rec.rcvdat = '';
      }
    },


    // model.bedgrp.rec.docprbrol change, re-calculate PRB

    docprbrolChange() {
      //  re-calculate PRB
      // store the ref
      let  ref = this.model.bedgrp.prb.pts.ref;
      switch (this.model.bedgrp.rec.docprbrol) {
        case "BEN":
          Utils.copyValueFromVoData(this.model.bedgrp.prb.pts, this.model.ledgrp.ben.pts);
          break;
        case "A2B":
          Utils.copyValueFromVoData(this.model.bedgrp.prb.pts, this.model.ledgrp.a2b.pts);
          break;
        case "PRB":
          this.model.bedgrp.prb.pts = new Pts().data;
          break;
      }

      this.model.bedgrp.prb.pts.ref = ref;

      // 设置prb的rol
      if(this.model.bedgrp.prb.pts.extkey!=''){
        this.model.bedgrp.prb.pts.rol = "PRB";
      }
    },

  },
};