import commonFunctions from '~/mixin/commonFunctions.js';


export default {
  mixins: [commonFunctions],
  methods: {
		//model.bopmod.szflg
	   changeSzflg(){
			if (this.model.bopmod.szflg == "3") {
				this.model.bopmod.ownextkey = "";
			}
			if (this.model.bopmod.szflg == "2") {
				this.model.bopmod.ownextkey = "08350012";
			}
			if (this.model.bopmod.szflg == "1") {
				this.model.bopmod.ownextkey = "08350012";
			}
     },
     mt769Sndflg(){
       let arr = this.model.docpan.doceot;
       this.model.mt769SndFlg='';
       arr.forEach(item=>{
          if(item.id.substr(0,7)=="TRNAPL1"){
            if(item.cortyp=="SWT"&&(item.ADRBICAUT=='A'||item.ADRBICAUT=='S')){
              this.model.mt769SndFlg='X';
            }
          }
       })
       if(this.model.mt769SndFlg=='X'){
         this.model.gidgrp.rec.reddat= new Date();
       }else{
        this.model.gidgrp.rec.reddat='';
       }
     },
     changeHndtyp(){
      if(!!this.model.gcdgrp.rec.frepayflg||this.model.gidgrp.rec.hndtyp=='OT'){
        this.model.paypsb='';
    }
     },
     getRolList() {
			//------------docprbroList-------------------
			if (this.model.gidgrp.ben.pts.ptainr != "") {
				this.docprbroList.push(this.model.gidgrp.ben.pts.rol);
			}
			if (this.model.gidgrp.atb.pts.ptainr != "") {
				this.docprbroList.push(this.model.gidgrp.atb.pts.rol);
			}
			if (this.model.gidgrp.at2.pts.ptainr != "") {
				this.docprbroList.push(this.model.gidgrp.at2.pts.rol);
			}
			if (this.model.gidgrp.adv.pts.ptainr != "") {
				this.docprbroList.push(this.model.gidgrp.adv.pts.rol);
			}
			this.docprbroList.push("PRB");
			if (this.docprbroList.indexOf("ADV") >= 0) {
				this.model.gcdgrp.rec.docprbrol = "ADV";
			}
			else if (this.docprbroList.indexOf("ATB") >= 0) {
				this.model.gcdgrp.rec.docprbrol = "ATB";
			}
			else if (this.docprbroList.indexOf("BEN") >= 0) {
				this.model.gcdgrp.rec.docprbrol = "BEN";
			}
			//------------payrolList-------------------
			//----BEN、ISS、ATB、AT2、OWN 除外--- 
			if (this.model.gidgrp.ada.pts.ptainr != "") {
				this.payrolList.push(this.model.gidgrp.ada.pts.rol);
			}
			if (this.model.gidgrp.adv.pts.ptainr != "") {
				this.payrolList.push(this.model.gidgrp.adv.pts.rol);
			}
			if (this.model.gidgrp.apl.pts.ptainr != "") {
				this.payrolList.push(this.model.gidgrp.apl.pts.rol);
			}
			this.payrolList.push("OTH");
			if (this.payrolList.indexOf("ADA") >= 0) {
				this.model.gcdgrp.rec.payrol = "ADV";
			}
			else if (this.payrolList.indexOf("APL") >= 0) {
				this.model.gcdgrp.rec.payrol = "APL";
			}
    },
    onClsflg(){
    if((this.model.setmod.docamt==this.model.gcdgrp.cbs.opn1.amt + this.model.gcdgrp.cbs.opn2.amt)||(this.model.paypsb=="")){
        this.model.clsflg="C"
    }else{
      this.model.clsflg="O"
     }
  }
}
}