index.js 15.3 KB
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 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476
import Api from "~/service/Api";
import Utils from "../../../../utils";
import commonFunctions from "~/mixin/commonFunctions.js";
export default {
  mixins: [commonFunctions],
  methods: {
    // 获取地区机构号
    async getOwnExtkeyCondition() {
      console.log("进入getOwnExtkeyCondition");
      const loading = this.loading();
      let body = { ownExtKey: "" };
      if (
        this.root.model.trnInfo &&
        this.root.model.trnInfo.sdhflg == "X" &&
        this.model.bopgat.ownextkey
      ) {
        body.ownExtKey = this.model.bopgat.ownextkey;
      }
      let res = await Api.post(
        `/${this.root.moduleRouter()}/bch/getBranchListByownExtKey`,
        body
      );
      loading.close();
      if (res.respCode === SUCCESS) {
        this.ownExtkeyList = res.data;
      }
    },

    //获取交易编码列列表
    async getBopcodItems(){
			console.log("进入getBopcodList");
			const loading = this.loading();
			let body = {iotyp:"I"};
			console.log(this.root.moduleRouter());
			let res = await Api.post(
				`/${this.root.moduleRouter()}/bopcod/getBopcodList`,
				body
			);
			loading.close();
			if (res.respCode === SUCCESS) {
				this.bopcodList = res.data;
			}

		},

    buildBopgat(commonData) {
      let transName =this.root ? this.root.trnName : this.trnName;
      let commetItems = null;
      if(transName.toUpperCase() == "CPTADV"){
       commetItems = {
            v72: this.model.swiadd.contag72,
            contag72: this.model.cpdgrp.blk.contag72,
            commet: this.model.cptp.commet,
            fuynh2: this.model.cipmod.fuynh2,
            fuynh3: this.model.cipmod.fuynh3,
            fuynh4: this.model.cipmod.fuynh4,
            fuyns1: this.model.cipmod.fuyns1,
            fuyns2: this.model.cipmod.fuyns2,
            fuyns3: this.model.cipmod.fuyns3,
            fuyns4: this.model.cipmod.fuyns4,
            covfuy1: this.model.cipmod.covfuy,
            covfuy2: this.model.cipmod.covfy2,
            covfuy3: this.model.cipmod.covfy3,
            covfuy4: this.model.cipmod.covfy4,
            fecomm: this.model.hvpmod.fecomm,
            attcommet: this.model.attp.commet,
            attcommet72: this.model.attp.com102,
      }
      }else{
        commetItems = {
          v72: "",
          contag72: "",
          commet: "",
          fuynh2: "",
          fuynh3: "",
          fuynh4: "",
          fuyns1: "",
          fuyns2: "",
          fuyns3: "",
          fuyns4: "",
          covfuy1: "",
          covfuy2: "",
          covfuy3: "",
          covfuy4: "",
          fecomm: "",
          attcommet: "",
          attcommet72: "",
      }
    }
        let params = {
          ...commonData,
          userId: window.sessionStorage.userId,
          ownextkey: this.model.bopgat.ownextkey,
          dclflg: this.model.bopgat.dclflg,
          szflg: this.model.bopgat.szflg,
          oldszflg: this.oldszflg,
          basflg: this.model.bopgat.basflg,
          vrfflg: this.model.bopgat.vrfflg,
          aloneflg: this.model.bopgat.aloneflg,
          acttyp: this.model.bopgat.acttyp,
          boptxcode: this.model.bopgat.boptxcode,
          zbxmszh: this.model.bopgat.zbxmszh,
          outchargeccy: this.model.bopgat.outchargeccy,
          outchargeamt: this.model.bopgat.outchargeamt,
          dbagrp: this.model.bopgat.dbagrp,
          dbdgrp: this.model.bopgat.dbdgrp,
          setFelList: this.model.setmod.setfeg.setfel,
          setFolList: this.model.setmod.setfog.setfol,
          setgll: this.model.setmod.setglg.setgll,
          ptydet: this.model.setmod.ptydet,
          doccur: this.model.setmod.doccur,
          feecorrol: this.model.setmod.feecorrol,
          commetItems: commetItems,
        };
        return params;
      },

      getSubTyp2(){
        let transName =this.root ? this.root.trnName : this.trnName;
        let preName = transName.toUpperCase().substring(0, 2);
        let subTyp = "";
        switch(preName){
          case "BO":
            subTyp = "bod";
            break;
          case "CC":
            subTyp = "ccd";
            break;
          case "BP":
            subTyp = "bpd";
            break;
          case "BE":
            subTyp = "bed";
            break;
          case "BT":
            subTyp = "btd";
            break;
          case "CP":
            subTyp = "cpd";
            break;
          case "GE":
            subTyp = "gcd";
            break;
          case "NE":
            subTyp = "ncd";
            break;
        }
        return subTyp;
      },

      async initBopgat(commonData) {
        const params = this.buildBopgat(commonData);
        const busTyp = "bopgat";
        let subTyp = this.getSubTyp2();
        let rtnmsg = await Api.post(`/${this.moduleRouter()}/${busTyp}/${subTyp}/bopGatMapping`, params);
        if (rtnmsg.respCode === SUCCESS) {
          Utils.copyValueFromVoData(this.model.bopgat, rtnmsg.data);
        }
        return rtnmsg;
        
      },

      async setAcctValue() {
        if (this.model.bopgat.dbdgrp.isyesc === "X") {
          this.dialogVisible = false;
          this.model.bopgat.dbdgrp.isyesc = "Y";
          // let trnName = this.root ? this.root.trnName : this.trnName;
          // let commonData = this.root.buildCommonData(this.root.model,trnName);
          // let param = {
          //   ...commonData,
          //   ...this.model.bopgat,
          // };
  
          // // let param = this.model.bopgat;
          // const busTyp = "bopgat";
          // let subTyp = this.getSubTyp2();
  
          // const rtnmsg = await Api.post(
          //   `/${this.root.moduleRouter()}/${busTyp}/${subTyp}/bopGatSetAcct`,
          //   param
          // );
          // if (rtnmsg.respCode === SUCCESS) {
          //   Utils.copyValueFromVoData(this.model.bopgat, rtnmsg.data);
          //   console.info(this.model.bopgat);
          // }
        }
      },  

    async setAcct() {
      if (this.model.bopgat.dbdgrp.isyesc === "Y") {
        // this.dialogVisible = false;
        // this.model.bopgat.dbdgrp.isyesc = "Y";
        let trnName = this.root ? this.root.trnName : this.trnName;
        let commonData = this.root.buildCommonData(this.root.model,trnName);
        let param = {
          ...commonData,
          ...this.model.bopgat,
        };

        // let param = this.model.bopgat;
        const busTyp = "bopgat";
        let subTyp = this.getSubTyp2();

        const rtnmsg = await Api.post(
          `/${this.root.moduleRouter()}/${busTyp}/${subTyp}/bopGatSetAcct`,
          param
        );
        if (rtnmsg.respCode === SUCCESS) {
          Utils.copyValueFromVoData(this.model.bopgat, rtnmsg.data);
          console.info(this.model.bopgat);
        }
      }
    },

    setCancel() {
      this.dialogVisible = false;
      this.model.bopgat.dbdgrp.isyesc = "N";
    },

    setOutchargeAmt(){
      this.model.bopgat.dbagrp.bas.outchargeccy = this.model.bopgat.outchargeccy;
      this.model.bopgat.dbagrp.bas.outchargeamt = this.model.bopgat.outchargeamt;
    },

	async bopgatMapping(){
    if(this.root.model.bopgat.aloneflg == ""){
      this.$notify.error({ title: '错误', message: '请选择是否随业务申报!' });
      return;
    }
    if(this.root.model.bopgat.ownextkey == ""){
      this.$notify.error({ title: '错误', message: '请选择地区机构号!' });
      return;
    }
    if(this.root.model.bopgat.szflg == "1"){
        if(this.root.model.bopgat.acttyp == ""){
          this.$notify.error({ title: '错误', message: '请选择款项来源!' });
				  return;
        } 
    }
    this.queryBopgat();
		// let trnName = this.root ? this.root.trnName : this.trnName;
    // let commonData = this.root.buildCommonData(this.root.model,trnName);
    // let param = this.buildBopgat(commonData);
    // const busTyp = "bopgat";
    // let subTyp = this.getSubTyp2();
    // const rtnmsg = await Api.post(
    //   `/${this.root.moduleRouter()}/${busTyp}/${subTyp}/bopGatMapping`,
    //   param
    // );
    // if (rtnmsg.respCode === SUCCESS) {
    //   Utils.copyValueFromVoData(this.model.bopgat, rtnmsg.data);
    // }
	},

  async queryBopgat(){
    let trnName = this.root ? this.root.trnName : this.trnName;
    let commonData = this.root.buildCommonData(this.root.model,trnName);
    let param = this.buildBopgat(commonData);
    const busTyp = "bopgat";
    let subTyp = this.getSubTyp2();
    const rtnmsg = await Api.post(
      `/${this.root.moduleRouter()}/${busTyp}/${subTyp}/bopGatMapping`,
      param
    );
    if (rtnmsg.respCode === SUCCESS) {
      Utils.copyValueFromVoData(this.model.bopgat, rtnmsg.data);
    }
  },
  //   async handleChangeBasFlg() {
  //     if (this.model.bopgat.basflg === "X") {
	// 	if(this.model.bopgat.szflg == "1"){
	// 		this.model.bopgat.dbagrp.bas.actiontype = "A";
	// 	}
	// 	if(this.model.bopgat.szflg == "2"){
	// 		this.model.bopgat.dbdgrp.bas.actiontype = "A";
	// 	}
  //       this.bopgatMapping();
  //     }
  //   },
	// async handleChangeDclFlg(){
  //   if(this.model.bopgat.dclflg === "X"){
  //     this.model.bopgat.dbagrp.dcl.actiontype = "A";
  //   }
	// 	if(this.model.bopgat.basflg === "X"){
	// 		this.bopgatMapping();
	// 	}
  // },

	// async handleChangeVrfFlg(){
  //   if(this.model.bopgat.vrfflg === "X"){
  //     this.model.bopgat.dbdgrp.vrf.actiontype = "A";
  //   }
	// 	if(this.model.bopgat.basflg === "X"){
	// 		this.bopgatMapping();
	// 	}
  // },

  //依据是否随业务申报 设置 basflg dclflg  vrfflg 以及操作类型
  setBopflg(){
    //随业务申报 需要将 基础信息  申报信息  管理信息填写完整
    if (this.model.bopgat.aloneflg === "1") {
      if(this.model.bopgat.szflg == "1"){
        this.model.bopgat.basflg = "X"
        this.model.bopgat.dclflg = "X"
        this.model.bopgat.vrfflg = ""
        this.model.bopgat.dbagrp.bas.actiontype = "A";
        this.model.bopgat.dbagrp.dcl.actiontype = "A";
      }else if(this.model.bopgat.szflg == "2"){
        this.model.bopgat.basflg = "X"
        this.model.bopgat.dclflg = ""
        this.model.bopgat.vrfflg = "X"
        this.model.bopgat.dbdgrp.bas.actiontype = "A";
        this.model.bopgat.dbdgrp.vrf.actiontype = "A";
      }else{
        this.model.bopgat.basflg = ""
        this.model.bopgat.dclflg = ""
        this.model.bopgat.vrfflg = ""
      }
    }else if(this.model.bopgat.aloneflg === "2" || this.model.bopgat.aloneflg === "3" || this.model.bopgat.aloneflg === "4"){
       //不随业务申报或客户自行申报 只需要出 基础信息  
      if(this.model.bopgat.szflg == "1"){
        this.model.bopgat.basflg = "X"
        this.model.bopgat.dclflg = ""
        this.model.bopgat.vrfflg = ""
        this.model.bopgat.dbagrp.bas.actiontype = "A";
        this.model.bopgat.dbagrp.dcl.actiontype = "";
      }else if(this.model.bopgat.szflg == "2"){
        this.model.bopgat.basflg = "X"
        this.model.bopgat.dclflg = ""
        this.model.bopgat.vrfflg = ""
        this.model.bopgat.dbdgrp.bas.actiontype = "A";
        this.model.bopgat.dbdgrp.vrf.actiontype = "";
      }else{
        this.model.bopgat.basflg = ""
        this.model.bopgat.dclflg = ""
        this.model.bopgat.vrfflg = ""

      }
    }else{
      //若清空则勾选全清空
        this.model.bopgat.basflg = ""
        this.model.bopgat.dclflg = ""
        this.model.bopgat.vrfflg = ""
    }
  },

  // 01 选择是否申报  若申报进行初步试算
  handleChangeSzflg(value) {
    if (value == undefined) {
      return;
    }
    //赋值上一次选择的收支申报类型
    this.model.bopgat.oldszflg = this.oldszflg;
    if (this.model.bopgat.szflg === "1") {
      this.getTranCur();
    }
    if (this.model.bopgat.szflg === "2") {
      this.model.bopgat.acttyp = "";
      this.model.bopgat.outchargeccy = "";
      this.model.bopgat.outchargeamt = "0";
    }

     //是否随业务申报选择 只申报基础信息时,若选择了跨境需要清空
     if(this.model.bopgat.szflg == "1" && this.model.bopgat.aloneflg == "4"){
      this.model.bopgat.aloneflg = "";
      this.model.bopgat.basflg = "";
      this.model.bopgat.dclflg = "";
      this.model.bopgat.vrfflg = "";
    }

    if (this.model.bopgat.szflg == "1" || this.model.bopgat.szflg == "2") {
      //设置勾选
      this.setBopflg();
      //触发试算
      this.queryBopgat();
    }
    if (this.model.bopgat.szflg == "" || this.model.bopgat.szflg == "3") {
      this.model.bopgat.acttyp = "";
      this.model.bopgat.basflg = "";
      this.model.bopgat.dclflg = "";
      this.model.bopgat.vrfflg = "";
      this.model.bopgat.ownextkey = "";
      this.model.bopgat.outchargeccy = "";
      this.model.bopgat.outchargeamt = "";
      this.model.bopgat.aloneflg = "";
      //触发试算
      this.queryBopgat();
    }
     //记录上一次收支申报类型
     this.oldszflg = this.model.bopgat.szflg;

   
  },

  
  
  //02 选择是否随业务申报  设置勾选,触发试算
   handleChangeBopflw() {
    
      //设置勾选
      this.setBopflg();

      //触发试算
      if(this.model.bopgat.aloneflg === "1" || this.model.bopgat.aloneflg === "2" || this.model.bopgat.aloneflg === "3" || this.model.bopgat.aloneflg === "4"){
        this.bopgatMapping();
      }
  },

  //03 境外需要选择款项来源  并触发试算
  handleChangeActtyp(){
    if(this.model.bopgat.szflg == "1" ){
      this.model.bopgat.dbagrp.bas.jwjn = this.model.bopgat.acttyp;
      this.bopgatMapping();
    }
  },
  
  // 通过业务品种获取 收款币种
    getTranCur() {
      let transName = this.root.trnName.toUpperCase();
      let prefixName = transName.substring(0, 2);
      switch (prefixName) {
        case "BR":
          this.model.bopgat.outchargeccy = this.root.model.brddgrp.cbs.opn1.cur;
          break;
        case "BC":
          this.model.bopgat.outchargeccy = this.root.model.bcdgrp.cbs.opn1.cur;
          break;
        case "BO":
          this.model.bopgat.outchargeccy = this.root.model.bodgrp.cbs.opn1.cur;
          break;
        case "BP":
          this.model.bopgat.outchargeccy = this.root.model.bpdgrp.cbs.max.cur;
          break;
        case "CP":
          this.model.bopgat.outchargeccy = this.root.model.cpdgrp.cbs.max.cur;
          break;
        case "TR":
          this.model.bopgat.outchargeccy = this.root.model.trdgrp.cbs.max.cur;
          break;
        case "GI":
        case "GE":
          this.model.bopgat.outchargeccy = this.root.model.gidgrp.cbs.max.cur;
          break;
        case "NE":
          this.model.bopgat.outchargeccy = this.root.model.nidgrp.cbs.max.cur;
          break;
        case "CC":
          this.model.bopgat.outchargeccy = this.root.model.ccdgrp.cbs.opn1.cur;
          break;
        case "BE":
          this.model.bopgat.outchargeccy = this.root.model.bedgrp.cbs.opn1.cur;
          break;
        case "BT":
          this.model.bopgat.outchargeccy = this.root.model.btdgrp.cbs.opn1.cur;
          break;
      }
    },
    setDbabasOwnextkey() {
      this.model.bopgat.dbagrp.bas.ownextkey = this.model.bopgat.ownextkey;
    },
    setDbdbasOwnextkey() {
      this.model.bopgat.dbdgrp.bas.ownextkey = this.model.bopgat.ownextkey;
    },

    //获取试点行标志 N-非试点  Y-试点
    async initPilotBchBop() {
      let params = {
        ownextkey: "",
      };
      let rtnmsg = await Api.post(`/${this.moduleRouter()}/bopcalcom/pilotbopbch`, params);
      if (rtnmsg.respCode == SUCCESS) {
        this.model.bopgat.enableflg = rtnmsg.data;
      }
    },
  },
};