default.js 14.6 KB
/**
 * Default规则
 */
import Api from '~/service/Api';
import Utils from "~/utils/index"
import commonFunctions from '~/mixin/commonFunctions.js';
import commonDepend from "~/mixin/commonDepend";
import Pts from '~/components/business/commonModel/Pts';
import dateFormat from '@/util/date/dateFormat.js'



export default {
    mixins: [commonFunctions],
    methods: {
        defaultFuc() {
            if (this.model.ptsptaList == undefined || this.model.ptsptaList == null) {
                this.model.ptsptaList = [];
            }
            this.calcName();
            this.model.gidgrp.rec.orddat = this.model.gidgrp.rec.opndat
            if (this.model.gidgrp.rec.purposin != "" && this.model.gidgrp.rec.purpos =="") {
                if (this.model.gidgrp.rec.purposin == "ISCO") {
                    this.model.gidgrp.rec.purpos = "ISSU"
                    this.model.gidgrp.rec.hndtyp = "OT"
                }
                if (this.model.gidgrp.rec.purposin == "ICCO") {
                    this.model.gidgrp.rec.purpos = "ISCO"
                    this.model.gidgrp.rec.hndtyp = "OT"
                }
            }
            if(this.model.gidgrp.cbs.max.amt!='' && this.model.gidgrp.cbs.max2.amt!=''){
                this.model.gidgrp.cbs.total.amt = parseFloat(this.model.gidgrp.cbs.max.amt) + parseFloat(this.model.gidgrp.cbs.max2.amt);
                this.model.gidgrp.cbs.total.cur = this.model.gidgrp.cbs.max.cur;
            }
            if(this.model.gidgrp.cbs.opn1.amt!='' && this.model.gidgrp.cbs.opn2.amt!=''){
                this.model.gidgrp.cbs.total2.amt = parseFloat(this.model.gidgrp.cbs.opn1.amt) + parseFloat(this.model.gidgrp.cbs.opn2.amt);
                this.model.gidgrp.cbs.total2.cur = this.model.gidgrp.cbs.max2.cur;
            }

            if (this.model.gidgrp.ben && this.model.gidgrp.ben.pts && this.model.gidgrp.ben.pts.ennam && this.model.gidgrp.ben.pts.enadr) {
                this.model.gidgrp.benadrlin = this.model.gidgrp.ben.pts.ennam.replace(/[\n]/g, ",") + "," + this.model.gidgrp.ben.pts.enadr.replace(/[\n]/g, ",");
            }

            if (this.model.gidgrp.rec.purpos.indexOf("CO") > -1) {
                this.model.gidgrp.cbs.mac.cur = this.model.gidgrp.cbs.max.cur;
                this.model.gidgrp.cbs.mac.amt = this.model.gidgrp.cbs.max.amt;
            }

            if(this.model.gidgrp.rec.atxinr!=""){
                this.handleChangeGartyp();
            }
            if(this.model.gidgrp.rec.gtxinrc!=""){
                this.handleChangeGartypc();
            }
            if(!this.isInDisplay){
              if(this.model.gidgrp.rec.hndtyp != "OT"){
                this.model.gitp.prepermodflg ='X';
                this.model.gitp.covgodsrvmodflg = 'X';
              }
              if(this.model.addbcb.bccls1 == ''){
                this.model.addbcb.bccls1 = '2';
              }
            }
      
            if(this.model.gidgrp.ben.pts.adrblk!="" && this.model.gidgrp.ben.pts.ennam==""){
              let ennam = this.model.gidgrp.ben.pts.adrblk.split("\n")
						  this.$set(this.model.gidgrp.ben.pts, 'ennam',  ennam[0]+"\n"+ennam[1])
            }
        },

        // 对于来报来报来说,需要先获取角色的详细信息
        async dealStaPtsptaInfo(){
          if(this.model.spt && this.model.spt.sta && this.model.spt.sta !='CMB' && this.model.spt.sta !='BLK'){
						if(this.model.gidgrp.rec.fromflg && (this.model.gidgrp.rec.fromflg == 'Y' || this.model.gidgrp.rec.fromflg == 'E')){
							if(this.model.gidgrp.atb && !this.model.gidgrp.atb.ptainr){
							// e结算或者云平台对通知行进行赋值操作
							let databic = {
								extkey: this.model.gidgrp.atb.pts.extkey,
								rol: 'atb'
							}
							let resbic = await Api.post('/business/nitopnRule/getDataByBicCode', databic);
							if (resbic.respCode === SUCCESS) {
								if(resbic.data){
										this.model.gidgrp.atb.nam = resbic.data.data.nam
										this.model.gidgrp.atb.ptyinr = resbic.data.data.ptyinr
										this.model.gidgrp.atb.ptainr = resbic.data.data.ptainr
										this.model.gidgrp.atb.extkey =resbic.data.data.objkey
										this.model.gidgrp.atb.rol = 'ATB'
										this.model.gidgrp.atb.pts.extkey = resbic.data.data.objkey
										this.model.gidgrp.atb.pts.rol = 'ATB'
										this.model.gidgrp.atb.pts.ptainr = resbic.data.data.ptainr
										this.model.gidgrp.atb.pts.ptyinr = resbic.data.data.ptyinr
										this.model.gidgrp.atb.pts.ptytyp = resbic.data.data.ptytyp
										this.model.gidgrp.atb.pts.nam = resbic.data.data.nam
										this.model.gidgrp.atb.pts.adrblk = resbic.data.data.ennamadr
									}
							}
						}
					}
            if(this.model.gidgrp.apl.pts.extkey){
              let data = {
								extkey: this.model.gidgrp.apl.pts.extkey,
								deptNo: this.$store.state.UserContext.currentOrg.departmentNumber,
								gartyp: this.model.gidgrp.rec.gartyp
              }
              let res = await Api.post('/business/nitopnRule/getStaPtsptaInfo', data);
              if (res.respCode === SUCCESS) {
                if(res.data && res.data.data){
                  this.model.gidgrp.apl.name = res.data.data.nam
                  this.model.gidgrp.apl.nam = res.data.data.nam
                  this.model.gidgrp.apl.ptyinr = res.data.data.ptyinr
                  this.model.gidgrp.apl.ptainr = res.data.data.ptainr
                  // this.model.gidgrp.apl.extkey =extkey
                  this.model.gidgrp.apl.rol = 'APL'
                  // this.model.gidgrp.apl.pts.extkey = extkey
                  this.model.gidgrp.apl.pts.rol = 'APL'
                  this.model.gidgrp.apl.pts.ptainr = res.data.data.ptainr
                  this.model.gidgrp.apl.pts.ptyinr = res.data.data.ptyinr
                  this.model.gidgrp.apl.pts.nam = res.data.data.nam
                  this.model.gidgrp.apl.pts.ptynam1 = res.data.data.ptynam1
                  this.model.gidgrp.apl.pts.cnnam = res.data.data.cnnam
                  this.model.gidgrp.apl.pts.cnadr = res.data.data.cnadr
                  this.model.gidgrp.apl.pts.ennam = res.data.data.ennam
                  this.model.gidgrp.apl.pts.enadr = res.data.data.enadr
                }
              }
            }
            if(this.model.gidgrp.ben.pts.extkey){
              let data = {
								extkey: this.model.gidgrp.ben.pts.extkey,
								deptNo: this.$store.state.UserContext.currentOrg.departmentNumber,
								gartyp: this.model.gidgrp.rec.gartyp
              }
              let res = await Api.post('/business/nitopnRule/getStaPtsptaInfo', data);
              if (res.respCode === SUCCESS) {
                if(res.data && res.data.data){
                  this.model.gidgrp.ben.name = res.data.data.nam
                  this.model.gidgrp.ben.nam = res.data.data.nam
                  this.model.gidgrp.ben.ptyinr = res.data.data.ptyinr
                  this.model.gidgrp.ben.ptainr = res.data.data.ptainr
                  // this.model.gidgrp.ben.extkey =extkey
                  this.model.gidgrp.ben.rol = 'BEN'
                  // this.model.gidgrp.ben.pts.extkey = extkey
                  this.model.gidgrp.ben.pts.rol = 'BEN'
                  this.model.gidgrp.ben.pts.ptainr = res.data.data.ptainr
                  this.model.gidgrp.ben.pts.ptyinr = res.data.data.ptyinr
                  this.model.gidgrp.ben.pts.nam = res.data.data.nam
                  this.model.gidgrp.ben.pts.ptynam1 = res.data.data.ptynam1
                  this.model.gidgrp.ben.pts.cnnam = res.data.data.cnnam
                  this.model.gidgrp.ben.pts.cnadr = res.data.data.cnadr
                  this.model.gidgrp.ben.pts.ennam = res.data.data.ennam
                  this.model.gidgrp.ben.pts.enadr = res.data.data.enadr
                }
              }
            }
          }
        },
        //获取当前用户机构是否自贸区
        getZmqflg(){
            let _this = this
            _this.model.zmqflg = JSON.parse(window.sessionStorage.accbch).zmqflg;
            if (_this.model.gidgrp.rec.oppbnk !== "")//如果对手行有信息就设置X
                _this.model.zmqflg = "X";
            //赋值opbnk
            if(this.model.zmqflg === "X" && this.model.gidgrp.atb.pts.extkey !== "")
                this.model.gidgrp.rec.oppbnk = this.model.gidgrp.atb.pts.extkey.substring(0, 11);
        },
        // 获取记账机构下拉列表
        queryOrgList() {
            let _this = this
            const loading = _this.loading();
            Api.post('/business/userinfo/user/getAccBchList', {
                bchkeyinr: _this.model.gidgrp.rec.bchkeyinr
            }).then(res => {
                loading.close();
                if (res.respCode === SUCCESS) {
                    _this.model.markOrgList = res.data;
                    if (_this.model.markOrgList.length == 1) {
                        _this.model.gidgrp.rec.bchkeyinr = _this.model.markOrgList[0].inr;
                        return Api.post('/business/gitopn/needcuscomopn', {
                            trnName: _this.trnName,
                            bchinr: _this.model.markOrgList[0].inr
                        })
                    }
                }
            }).then(res2 => {
                loading.close();
                _this.model.needcuscomopn = res2.data;
            })
        },
        // 获取当前用户权限信息
        queryBaseAuth() {
            let _this = this
            const loading = this.loading();
            Api.post(`/business/base/auth`, {
                transName: _this.trnName
            }).then(res => {
                if (res.data.lev == '0' && res.data.bchtyp == '1') {
                    _this.model.zhjb = true;
                }
            })
        },
        async loadBopCtyList() {
            const loading = this.loading();
            let res = await Api.post('/business/gitopn/loadBopCtyList');
            loading.close();
            if (res.respCode === SUCCESS) {
                this.model.bopCtyList = res.data;
            }
        },

        // model.gidgrp.rec.gartyp
        handleChangeGartyp(e) {
            if (e === undefined) {
                return
            }
            let _this = this
            let data = {
                gtxpurpos: _this.model.gidgrp.rec.purpos,
                gartyp: _this.model.gidgrp.rec.gartyp,
                hndtyp: _this.model.gidgrp.rec.hndtyp,
                gtxinr: _this.model.gidgrp.rec.gtxinr,
                giduil: _this.model.gidgrp.rec.giduil,
                segtyp: _this.model.gidgrp.ghd.segtyp,
                objinr: _this.model.trnmod.swiadd.objinr || "",
                msgtyp: ""
            }
            Api.post(`/business/gitopn/defaultGidgrpRecGtxinrN1000`, data).then(res => {
                _this.model.atxinrList = res.data
                if(res.data!=null && res.data.length>0){
                    _this.model.gidgrp.rec.atxinr = res.data[0].value
                }
                _this.changeAtxinr(_this.model.gidgrp.rec.atxinr)
            })

            // _this.defaultGidgrpCbsMaxCurN1000();
        },
        handleChangeGartypc(e) {
            if (e === undefined) {
                return
            }
            let _this = this
            let data = {
                gtxpurpos: _this.model.gidgrp.rec.purpos,
                legfrmc: _this.model.gidgrp.rec.legfrmc,
                liatypc: _this.model.gidgrp.rec.liatypc,
                purpos: _this.model.gidgrp.rec.purpos,
                gartypc: _this.model.gidgrp.rec.gartypc,
                hndtyp: _this.model.gidgrp.rec.hndtyp,
                stdwrduilc: _this.model.gidgrp.rec.stdwrduilc,
                apcPtsPtyInr: _this.model.gidgrp.apc.pts.ptyinr,
                becPtsPtyInr: "",
                issPtsPtyInr: "",
            }
            Api.post(`/business/gitopn/defaultGidgrpRecGtxinrcN200`, data).then(res => {
                _this.model.atxinrcList = res.data
                if(res.data!=null && res.data.length>0){
                    _this.model.gidgrp.rec.gtxinrc = res.data[0].value
                }
                _this.changeAtxinrc(_this.model.gidgrp.rec.gtxinrc)
            })

            // _this.defaultGidgrpCbsMaxCurN1000();
        },
        getConfigData(gtxinr, type) {
            if (gtxinr === undefined) {
                return;
            }
            return new Promise(async (resolve) => {
                let params = {
                    objinr: gtxinr,
                    objtyp: 'atx'
                };
                const loading = this.loading();
                let res = await Api.post("/manager/gtxUse/listGidTmplVar", params);
                if (res.respCode == SUCCESS) {
                    let list = []
                    res.data.map((item) => {
                        if (item.showflg === 'Y') {
                            list.push(item)
                            if (type) {
															if (this.model.textTempDatac && !this.model.textTempDatac[`#${item.cod}`]) {
																this.$set(this.model.textTempDatac, `#${item.cod}`, '')
															}
                            } else {
															if (this.model.textTempData && !this.model.textTempData[`#${item.cod}`]) {
																this.$set(this.model.textTempData, `#${item.cod}`, '')
															}
                            }
                        }
                    })
                    if (type) {
                        this.$set(this.codes, 'frameListc', list)
                    } else {
                        this.$set(this.codes, 'frameList', list)
                    }
                } else {
                    this.$notify.error({
                        title: "错误",
                        message: "服务请求失败!"
                    });
                }
                resolve()
                loading.close();
            })
        },
        refreshInDirectSwiAdd() {
            // if (this.model.gidgrp.rec.hndtyp == "OC") {
            //   Systems.setEnabled(this.getGitp(), "indirectswiadd");
            //   if (!Systems.isModified(this.getGitp(), "indirectswiadd")) {
            //     Streams.streamSet(this.getGitp().getIndirectswiadd(), this.getGitp().getInitindirectswiadd());
            //   }
            // } else {
            //   Systems.resetEnabled(this.getGitp(), "indirectswiadd");
            //   Systems.resetModified(this.getGitp(), "indirectswiadd");
            //   Streams.streamClear(this.getGitp().getIndirectswiadd());
            // }
            // Streams.streamSetAdditional(this.getGitp().getIndirectswiadd(), "BLOCKFILL", "", "\\");
            // //Platform.StreamSetAdditional( $gidgrp\\blk\\gtxgidtxt.getValue(), "CREATE", "" );
            // Streams.streamSetAdditional(this.getGidgrp().getBlk().getGtxgidtxt(), "CREATE", "", "\\");
        },

    }
}
//你可以添加自动default处理