default.js 34.9 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 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 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053
import commonFunctions from '~/mixin/commonFunctions.js';
import Api from '~/service/Api';
import moment from 'moment';
import commonDepend from "~/mixin/commonDepend";
export default {
	mixins: [commonFunctions,commonDepend],
	methods: {
		dafaultGuatypAndCountryCode(){
			this.model.nidgrp.rec.guatyp = "2";//是否融资类 :否
			this.model.nidgrp.rec.countrycod = "CHN";//受益人国别 : 中国 CHN
		},
		// nidgrp.cbs.max.cur
		// "nidgrp.cbs.max.amt"
		// nidgrp.rec.stacty
		// nidgrp.apl.pts.nam
		// 保函币种和金额--nidgrp.cbs.max.cur
		// 对于来报来报来说,需要先获取角色的详细信息
		async dealStaPtsptaInfo(){
			if(this.model.spt && this.model.spt.sta && this.model.spt.sta !='CMB' && this.model.spt.sta !='BLK'){
				if (this.model.nitp.tempOwnref === '') {
					this.model.nitp.tempOwnref = this.model.nidgrp.rec.ownref;
				}
				// 如果是云平台来报,解析bdb角色信息
				if(this.model.nidgrp.rec.fromflg && (this.model.nidgrp.rec.fromflg == 'Y' || this.model.nidgrp.rec.fromflg == 'E')){
					let adrelc;
					let namelc;
					let language;
					if(this.model.nidgrp.rec.giduil){
						language = this.model.nidgrp.rec.giduil
					}else{
            language = 'CN'
					}
					if(language == 'CN'){
						if(this.model.nidgrp.bdb && this.model.nidgrp.bdb.pts && this.model.nidgrp.bdb.pts.cnnam){
							namelc = this.model.nidgrp.bdb.pts.cnnam
						}else{
							namelc = ''
						}
						if(this.model.nidgrp.bdb && this.model.nidgrp.bdb.pts && this.model.nidgrp.bdb.pts.cnadr){
							adrelc = this.model.nidgrp.bdb.pts.cnadr
						}else{
							adrelc = ''
						}
					}else{
						if(this.model.nidgrp.bdb && this.model.nidgrp.bdb.pts && this.model.nidgrp.bdb.pts.ennam){
							namelc = this.model.nidgrp.bdb.pts.ennam
						}else{
							namelc = ''
						}
						if(this.model.nidgrp.bdb && this.model.nidgrp.bdb.pts && this.model.nidgrp.bdb.pts.enadr){
							adrelc = this.model.nidgrp.bdb.pts.enadr
						}else{
							adrelc = ''
						}
					}
            let data = {
							adrelc: adrelc,
							flg: false,
							language:language,
							namelc:namelc,
							rol:'bdb',
							typflg:'C'
						}
						let ress = await Api.post('/business/ptspta/ptsTmpAdrAddAuto', data);
						if (ress.respCode === SUCCESS) {
							if(ress.data){
									this.model.nidgrp.bdb.name = ress.data.nam
									this.model.nidgrp.bdb.nam = ress.data.nam
									this.model.nidgrp.bdb.ptyinr = ress.data.ptyinr
									this.model.nidgrp.bdb.ptainr = ress.data.ptainr
									this.model.nidgrp.bdb.extkey =ress.data.extkey
									this.model.nidgrp.bdb.rol = 'BDB'
									this.model.nidgrp.bdb.pts.extkey = ress.data.extkey
									this.model.nidgrp.bdb.pts.rol = 'BDB'
									this.model.nidgrp.bdb.pts.ptainr = ress.data.ptainr
									this.model.nidgrp.bdb.pts.ptyinr = ress.data.ptyinr
									this.model.nidgrp.bdb.pts.cnnam = ress.data.namelc
									this.model.nidgrp.bdb.pts.cnadr = ress.data.adrelc
									this.model.nidgrp.bdb.pts.ennam = ress.data.namelc
									this.model.nidgrp.bdb.pts.enadr = ress.data.adrelc
								}
						}
						if(this.model.nidgrp.adv && !this.model.nidgrp.adv.ptainr){
						// e结算或者云平台对通知行进行赋值操作
						let databic = {
							extkey: this.model.nidgrp.adv.pts.extkey,
							rol: 'adv'
						}
						let resbic = await Api.post('/business/nitopnRule/getDataByBicCode', databic);
						if (resbic.respCode === SUCCESS) {
							if(resbic.data){
									this.model.nidgrp.adv.nam = resbic.data.data.nam
									this.model.nidgrp.adv.ptyinr = resbic.data.data.ptyinr
									this.model.nidgrp.adv.ptainr = resbic.data.data.ptainr
									this.model.nidgrp.adv.extkey =resbic.data.data.objkey
									this.model.nidgrp.adv.rol = 'ADV'
									this.model.nidgrp.adv.pts.extkey = resbic.data.data.objkey
									this.model.nidgrp.adv.pts.rol = 'ADV'
									this.model.nidgrp.adv.pts.ptainr = resbic.data.data.ptainr
									this.model.nidgrp.adv.pts.ptyinr = resbic.data.data.ptyinr
									this.model.nidgrp.adv.pts.ptytyp = resbic.data.data.ptytyp
									this.model.nidgrp.adv.pts.nam = resbic.data.data.nam
									if(this.model.nidgrp.rec.giduil && this.model.nidgrp.rec.giduil == 'CN'){
										this.model.nidgrp.adv.pts.adrblk = resbic.data.data.cnnamadr
									}else{
										this.model.nidgrp.adv.pts.adrblk = resbic.data.data.ennamadr
									}
								}
							}
					}
		   	}
				let extkey;
				if(this.model.nidgrp.rec.hndtyp !='OT'){
					extkey = this.model.nidgrp.apl.pts.extkey
				}else{
					extkey = this.model.nidgrp.ben.pts.extkey
				}
				let data = {
					extkey: extkey,
					deptNo: JSON.parse(sessionStorage.getItem("currentOrg")).departmentNumber,
					gartyp: this.model.nidgrp.rec.gartyp
				}
				let res = await Api.post('/business/nitopnRule/getStaPtsptaInfo', data);
				if (res.respCode === SUCCESS) {
					if(res.data && res.data.data){
						if(this.model.nidgrp.rec.hndtyp !='OT'){
							this.model.nidgrp.apl.name = res.data.data.nam1
							this.model.nidgrp.apl.nam = res.data.data.nam1
							this.model.nidgrp.apl.pts.nam = res.data.data.nam1
							this.model.nidgrp.apl.ptyinr = res.data.data.ptyinr
							this.model.nidgrp.apl.ptainr = res.data.data.ptainr
							this.model.nidgrp.apl.extkey =res.data.data.objkey
							this.model.nidgrp.apl.rol = 'APL'
							this.model.nidgrp.apl.pts.extkey = res.data.data.objkey
							this.model.nidgrp.apl.pts.rol = 'APL'
							this.model.nidgrp.apl.pts.ptainr = res.data.data.ptainr
							this.model.nidgrp.apl.pts.ptyinr = res.data.data.ptyinr
							this.model.nidgrp.apl.pts.ptynam1 = res.data.data.ptynam1
							this.model.nidgrp.apl.pts.cnnam = res.data.data.cnnam
							this.model.nidgrp.apl.pts.cnadr = res.data.data.cnadr
							this.model.nidgrp.apl.pts.ennam = res.data.data.ennam
							this.model.nidgrp.apl.pts.enadr = res.data.data.enadr
						}else{
							this.model.nidgrp.ben.name = res.data.data.nam1
							this.model.nidgrp.ben.nam = res.data.data.nam1
							this.model.nidgrp.ben.ptyinr = res.data.data.ptyinr
							this.model.nidgrp.ben.ptainr = res.data.data.ptainr
							this.model.nidgrp.ben.extkey = res.data.data.objkey
							this.model.nidgrp.ben.rol = 'BEN'
							this.model.nidgrp.ben.pts.extkey = res.data.data.objkey
							this.model.nidgrp.ben.pts.rol = 'BEN'
							this.model.nidgrp.ben.pts.ptainr = res.data.data.ptainr
							this.model.nidgrp.ben.pts.ptyinr = res.data.data.ptyinr
							this.model.nidgrp.ben.pts.nam = res.data.data.nam1
							this.model.nidgrp.ben.pts.ptynam1 = res.data.data.ptynam1
							this.model.nidgrp.ben.pts.cnnam = res.data.data.cnnam
							this.model.nidgrp.ben.pts.cnadr = res.data.data.cnadr
							this.model.nidgrp.ben.pts.ennam = res.data.data.ennam
							this.model.nidgrp.ben.pts.enadr = res.data.data.enadr
						}
					}
					
				}
			}
		},
		handleChangeFingua(e) {
			this.model.nidgrp.cbs.opn1.cur = this.model.nidgrp.cbs.max.cur
			if(e === undefined){
				return
			}
			if (this.model.nidgrp.cbs.max.cur == "CNY") {
				if (this.model.nidgrp.rec.fingua == "Y") {
					this.model.nidgrp.rec.cmtflg = "X"
				} else {
					this.model.nidgrp.rec.cmtflg = ""
				}
				this.defaultVouflgN1000(true);
			}
			this.calcName()
		},
		calcName() {
			if(this.model.nidgrp.cbs.max.amt==''){
				this.model.nidgrp.cbs.max.amt=0
			}
			this.model.nidgrp.cbs.opn1.amt = this.model.nidgrp.cbs.max.amt
			let model = this.model;
			this.model.nidgrp.rec.nam = model.nidgrp.cbs.max.cur + " " +
				model.nidgrp.cbs.max.amt + " " +
				(model.nidgrp.rec.stacty || "") + "." +
				model.nidgrp.apl.pts.nam
		},
		changeValues() {
			let isHasModify = this.model.nidgrp.rec.modifySet;
			if ((!isHasModify || (isHasModify && !isHasModify.includes('grtjuscod'))) && this.model.nidgrp.rec.grtjuscod == '' && this.model.warcreditcode != '' && this.model.nidgrp.rec.othersno == 'E0000003') {
				this.model.nidgrp.rec.grtjuscod = this.model.warcreditcode;
			}
		},
		// 数据采集标志--"cfagit.cfaflg"
		onCfaflg() {
			switch (this.model.cfagit.cfaflg) {
				case "1":
					this.model.cfagit.basflg = 'X';
					this.model.cfagit.dclflg = 'X';
					if (!this.model.cfagit.ownextkey) {
						this.ownextkey = this.codes.ownextkey1;
						this.model.cfagit.ownextkey = this.codes.ownextkey1[0].value;
					}
					break;
				case "2":
					this.model.cfagit.basflg = 'X';
					this.model.cfagit.dclflg = '';
					break;
				case "3":
					this.model.cfagit.basflg = '';
					this.model.cfagit.dclflg = 'X';
					break;
				case "5":
					this.model.cfagit.vrfflg = 'X';
					this.model.cfagit.dclflg = 'X';
					break;
				default:
					this.model.cfagit.basflg = '';
					this.model.cfagit.vrfflg = '';
					this.model.cfagit.dclflg = '';
			}
		},
		// 无限额保函--nidgrp.rec.expflg 或者 nidgrp.rec.hndtyp
		changeExpflgOrHndtyp(e) {
			if(e === undefined){
				return
			}
			if (this.model.nidgrp.rec.expflg == "X" && this.model.nidgrp.rec.hndtyp == "OC") {
				this.model.nidgrp.rec.liaflg = "X";
			}

			if (this.model.nidgrp.rec.hndtyp == 'OT') {
				this.model.nidgrp.rec.fingua = "N"
				// 修改校验规则nidgrp.rec.cxmflg
			} else {
				this.model.nidgrp.rec.fingua = ""
				// 修改校验规则nidgrp.rec.cxmflg
			}

			if (this.model.nidgrp.rec.hndtyp != 'OT' || this.model.nidgrp.rec.gartyp == 'F') {
				this.model.nidgrp.rec.iscrotra = ''
			}
		},
		clearExpdatValues(e){
			let businessType = this.$route.query.businessType;
			if(!businessType){
				if (this.model.nidgrp.rec.expflg == 'X') {
					this.model.addbcb.bccls1 = 'Y'
				}
				if (this.model.nidgrp.rec.expflg == '') {
					this.model.addbcb.bccls1 = 'N'
				}
			}
			if(e == undefined){
				return
			}
			if(this.model.nidgrp.rec.expflg == 'X'){
				this.model.nidgrp.rec.expdat=""
				this.model.nidgrp.rec.liaflg = "X"
        this.model.nidgrp.rec.liadat = ""
			}
			this.$nextTick(() => {
				this.root.$refs['modelForm'].validateField(['nidgrp.rec.expdat']);
			})
		},
		//获取当前用户机构是否自贸区
		getZmqflg(){
			let _this = this
			if (_this.model.nidgrp.rec.oppbnk !== "")//如果对手行有信息就设置X
				_this.model.zmqflg = "X";
			else
				_this.model.zmqflg = JSON.parse(window.sessionStorage.accbch).zmqflg;
			//赋值opbnk
			if(this.model.zmqflg === "X" && this.model.nidgrp.adv.pts.extkey !== "")
				this.model.nidgrp.rec.oppbnk = this.model.nidgrp.adv.pts.extkey.slice(0, 11);
		},
		compareData(e){
			this.model.addbcb.expdat = this.model.nidgrp.rec.expdat
			if(e){
				if (moment(this.model.nidgrp.rec.expdat).diff(moment(this.model.nidgrp.rec.opndat), 'hours') < 0) {
					this.$nextTick(() => {
						this.root.$refs['modelForm'].validateField(['nidgrp.rec.expdat']);
					})
				}
				if (moment(this.model.nidgrp.rec.expdat).diff(moment(this.model.nidgrp.rec.liadat), 'hours') > 0) {
					this.$nextTick(() => {
						this.root.$refs['modelForm'].validateField(['nidgrp.rec.liadat']);
					})
				}
			}
		},
		 setOtherData(e){
			 if(e == undefined && !this.model.nidgrp.rec.inudat){
				this.model.nidgrp.rec.inudat = moment(new Date()).format('YYYY-MM-DD');
			 }
			 this.model.nidgrp.rec.orddat = moment(this.model.nidgrp.rec.opndat).format('YYYY-MM-DD');
			 if(e){
			 this.$nextTick(() => {
				this.root.$refs['modelForm'].validateField(['nidgrp.rec.inudat']);
			}) 
		}
		 },
		defaultVouflgN1000(e) {
			if(e === undefined){
				return
			}
			//--暂时只有保函开立交易用--
			//2017-4人行 要求2122对保函开立交易开放外币申报
			if (this.model.nidgrp.cbs.max.cur == "CNY") {
				if (this.model.nidgrp.rec.cmtflg != "") {
					this.model.cnybop.vouflg = "1"
				} else {
					this.model.cnybop.vouflg = "2"
				}
			}
			else {
				if (this.model.nidgrp.rec.fingua == "Y") {
					this.model.cnybop.vouflg = "1"
				} else {
					this.model.cnybop.vouflg = "2"
				}
			}
		},
		clearData(e) {
			if(e === undefined){
				return
			}
			this.model.nidgrp.rec.bilvvv = '';
			this.model.nidgrp.rec.cunqii = '';
			this.model.nidgrp.rec.idcode = '';
			this.model.nidgrp.rec.bdbrmc = '';
			this.model.nidgrp.rec.bdbrdh = '';
			this.model.nidgrp.rec.bdbrdz = '';
			this.model.nidgrp.rec.bngcod = '';
			this.changeApl(e);
			this.changeBdb(e);
		},

		clearLiadatData(e) {
			if (e === undefined) {
				return
			}
			if (this.model.nidgrp.rec.liaflg == "X") {
				this.model.nidgrp.rec.liadat = ''
			}
			this.$nextTick(() => {
				this.root.$refs['modelForm'].validateField(['nidgrp.rec.liadat']);
			}) 
		},
		async getBilvvvData(e) {
			if(e === undefined){
				return
			}
			if(this.model.nidgrp.apl.pts.extkey!='' || this.model.nidgrp.bdb.pts.extkey!=''){
				// 查询上浮比率的接口--nidgrp.rec.bilvvv
			let data = {
				fenlishi: this.model.nidgrp.rec.fenlishi,
				segtyp: this.model.nidgrp.rec.segtyp,
        aplinr: this.model.nidgrp.apl.pts.ptyinr,
        bdbinr: this.model.nidgrp.bdb.pts.ptyinr
			}
			let res = await Api.post('/business/hitopnRule/getBilvvvData', data);
			if (res.respCode === SUCCESS) {
				this.model.nidgrp.rec.bilvvv = res.data.bilvvv;
				this.model.nidgrp.rec.cunqii = res.data.cunqii;
			}

			// 查询统一社会信用代码和被担保人名称的接口--nidgrp.rec.idcode
			let fromflg;
			if(!this.model.nidgrp.rec.fromflg){
				fromflg='';
			}
			let agentcorpname;
			if(!this.model.nidgrp.rec.agentcorpname){
				agentcorpname='';
			}
			let datas = {
				fenlishi: this.model.nidgrp.rec.fenlishi,
				fromflg,
				warran: this.model.nidgrp.rec.aplnam,
				agentcorpname,
        aplinr: this.model.nidgrp.apl.pts.ptyinr,
        bdbinr: this.model.nidgrp.bdb.pts.ptyinr
			}
			const loading = this.loading();
			let resc = await Api.post('/business/hitopnRule/getIdcodeAndBdbRmcAndSqrnam', datas);
			loading.close();
			if (resc.respCode === SUCCESS) {
				if(resc.data.idcode !=undefined && resc.data.idcode!=''){
					this.model.nidgrp.rec.idcode = resc.data.idcode;
					this.model.nidgrp.rec.sqqydm = resc.data.idcode;
				}
				if(resc.data.nam1 !=undefined && resc.data.nam1!=''){
					this.model.nidgrp.rec.bdbrmc = resc.data.nam1;
					this.model.nidgrp.rec.sqrnam = resc.data.nam1;
				}
				// if(resc.data.bngcod !=undefined && resc.data.bngcod!=''){
				// 	this.model.nidgrp.rec.sqqyhg = resc.data.bngcod;
				// }
			}
			 // 查询地址和电话
			 let aplptainr;
			 let bdbptainr;
			 let result;
			 if(this.model.nidgrp.rec.fenlishi!=''){
				aplptainr='',
				bdbptainr=this.model.nidgrp.bdb.pts.ptainr
			 }else{
				aplptainr=this.model.nidgrp.apl.pts.ptainr,
				bdbptainr=''
			 }
				 
			let dataes = {
				aplptainr,
				bdbptainr
			}
			let reses = await Api.post('/business/hitopnRule/getTeleAndAdressData', dataes);
			if (reses.respCode === SUCCESS) {
				result=reses.data
			}
			if(this.model.nidgrp.rec.fenlishi!=''){
				// 被担保人联系电话 nidgrp.rec.bdbrdh
				if(result.tel1 !=undefined && result.tel1!=''){
					this.model.nidgrp.rec.bdbrdh=result.tel1;
				}
				// 被担保人地址 nidgrp.rec.bdbrdz
				if(this.model.nidgrp.rec.fromflg=='Y' && this.model.nidgrp.warranteedr){
            // GIDGRP\WARRANTEEDR
				}else{
					this.model.nidgrp.rec.bdbrdz=result.adr1+result.adr2+result.adr3;
				}
			}else{
				if(result.tel1 !=undefined && result.tel1!=''){
					this.model.nidgrp.rec.bdbrdh=result.tel1;
				}
				this.model.nidgrp.rec.bdbrdz=result.adr1+result.adr2+result.adr3;
			}

			// 申请人地址 nidgrp.rec.sqradr
			let isHasModify = this.model.nidgrp.rec.modifySet;
			if(!isHasModify || (isHasModify && !isHasModify.includes('sqradr'))){
				this.model.nidgrp.rec.sqradr=result.adr1+result.adr2+result.adr3;
			}

			// 申请人联系电话 nidgrp.rec.sqrtel
			if(!isHasModify || (isHasModify && !isHasModify.includes('nidgrp.rec.sqrtel'))){
				if(result.tel1 !=undefined && result.tel1!=''){
					this.model.nidgrp.rec.sqrtel=result.tel1;
				}
			}
		}
	},

	async changecunqiiData(e){
		if(e === undefined){
			return
		}
		this.$set(this.codes, 'beforeCunqii', e);
	},
		async changeBdb(e){
			if(e === undefined){
				return
			}
			if(this.model.nidgrp.bdb.pts.extkey!=''){
				let data = {
					ptyinr: this.model.nidgrp.bdb.pts.ptyinr,
					ptainr: this.model.nidgrp.bdb.pts.ptainr,
				}
				const loading = this.loading();
				let res = await Api.post('/business/hitopnRule/getPtyPtaInfo', data);
				loading.close();
				if(res.respCode === SUCCESS){
					let pty = res.data.pty;
					let pta = res.data.pta;
					let beforeRole;
					if(pty){
            // 当事人有bdb,优先取被担保人信息,旧版本是分离式时才取
						// if(this.model.nidgrp.rec.fenlishi!=''){
							//查询上浮比率的接口--nidgrp.rec.bilvvv
							this.model.nidgrp.rec.bilvvv = pty.bilvvv;
							beforeRole = pty.ptytyp;
							if(this.codes.beforeRole !=undefined && this.codes.beforeRole =='F' && pty.ptytyp == 'F'){
								if(this.codes.beforeCunqii !=undefined && this.codes.beforeCunqii){
									this.model.nidgrp.rec.cunqii = this.codes.beforeCunqii
							   }
							}else{
								this.model.nidgrp.rec.cunqii = pty.cunqii;
						  }
							// 查询统一社会信用代码和被担保人名称的接口--nidgrp.rec.idcode
							if(pty.idcode !=undefined && pty.idcode!=''){
								this.model.nidgrp.rec.idcode = pty.idcode;//idcode统一社会信用代码
							}
							if(this.model.nidgrp.bdb && this.model.nidgrp.bdb.pts && this.model.nidgrp.bdb.pts.cnnam){
								this.model.nidgrp.rec.bdbrmc = this.model.nidgrp.bdb.pts.cnnam;
							}
							if(pty.bngcod !=undefined && pty.bngcod!=''){
								this.model.nidgrp.rec.bngcod = pty.bngcod;
							}
							this.$set(this.codes, 'beforeRole', beforeRole);
						// }
					}
					if(pta){
						if(this.model.nidgrp.rec.fenlishi!=''){
							// 查询地址和电话
							// 被担保人联系电话 nidgrp.rec.bdbrdh
							if(pta.tel1 !=undefined && pta.tel1!=''){
								this.model.nidgrp.rec.bdbrdh=pta.tel1;
							}
							// 被担保人地址 nidgrp.rec.bdbrdz
							if(this.model.nidgrp.rec.fromflg=='Y' && this.model.nidgrp.warranteedr){
								// GIDGRP\WARRANTEEDR
							}else{
								if(this.model.nidgrp.bdb && this.model.nidgrp.bdb.pts && this.model.nidgrp.bdb.pts.adrblk){
								this.model.nidgrp.rec.bdbrdz=this.model.nidgrp.bdb.pts.cnadr;
								}
							}
						}
					}
				}

			}
		},
		async getExcepCustomer(e) {
			if(e === undefined){
				return
			}
				let datas = {
					transName: 'HITOPN',
					hndtyp: this.model.nidgrp.rec.hndtyp,
					apl: this.model.nidgrp.apl.pts.ptainr,
					ben: this.model.nidgrp.ben.pts.ptainr
				}
				const loading = this.loading();
				let resc = await Api.post('/business/nitopnRule/getExcepCustomer', datas);
				loading.close();
				if (resc.respCode === SUCCESS) {
					this.$set(this.codes, 'excepData', resc.data);
				}
		},
		async changeApl(e){
			if(e === undefined){
				return
			}
      
			if(e && (e.rowData && e.rowData.ptaobjkey !=this.codes.judgementType)&& this.model.nidgrp.rec.hndtyp && (this.model.nidgrp.rec.hndtyp == 'OL')){
				this.model.nidgrp.rec.ownref = ""
			}
			if(e.rowData){
        this.$set(this.codes, 'judgementType', e.rowData.ptaobjkey);
      }
			this.getExcepCustomer(e)
			if(this.model.nidgrp.apl.pts.extkey!=''){
				let data = {
					ptyinr: this.model.nidgrp.apl.pts.ptyinr,
					ptainr: this.model.nidgrp.apl.pts.ptainr,
				}
				const loading = this.loading();
				let res = await Api.post('/business/hitopnRule/getPtyPtaInfo', data);
				loading.close();
				if(res.respCode === SUCCESS){
					let pty = res.data.pty;
					let pta = res.data.pta;
					if(pty){
						if(this.model.nidgrp.rec.fenlishi==''&& !this.model.nidgrp.bdb.pts.cnnam){
							//查询上浮比率的接口--nidgrp.rec.bilvvv
							this.model.nidgrp.rec.bilvvv = pty.bilvvv;
							this.model.nidgrp.rec.cunqii = pty.cunqii;
							// 查询统一社会信用代码和被担保人名称的接口--nidgrp.rec.idcode
							if(pty.idcode !=undefined && pty.idcode!=''){
								this.model.nidgrp.rec.idcode = pty.idcode;//idcode统一社会信用代码
							}
							if(pty.nam1 !=undefined && pty.nam1!=''){
								this.model.nidgrp.rec.bdbrmc = pty.nam1;
							}
							if(pty.bngcod !=undefined && pty.bngcod!=''){
								this.model.nidgrp.rec.bngcod = pty.bngcod;
							}
						}
						// 取云平台中传来的申请人统一社会信用代码
						if(this.model.nidgrp.rec.fromflg == 'Y' && this.model.swiadd.orimsgtyp){
							  this.model.nidgrp.rec.sqqydm = this.model.swiadd.orimsgtyp;
						}else{
						this.model.nidgrp.rec.sqqydm = pty.idcode;//sqqydm申请人企业代码
					  }
						//申请人名称
						if(pty.nam1 !=undefined && pty.nam1!=''){
							this.model.nidgrp.rec.sqrnam = pty.nam1;
						}
						if(this.model.nidgrp.rec.hndtyp == 'OT'){
							this.model.nidgrp.rec.sqrnam = this.model.nidgrp.apl.pts.cnnam
						}
						//申请人企业海关编码
						// if(pty.bngcod !=undefined && pty.bngcod!=''){
						// 	this.model.nidgrp.rec.sqqyhg = pty.bngcod;
						// }
					}
					if(pta){
						if(this.model.nidgrp.rec.fenlishi==''){
							// 查询地址和电话
							// 被担保人联系电话 nidgrp.rec.bdbrdh
							if(pta.tel1 !=undefined && pta.tel1!=''){
								this.model.nidgrp.rec.bdbrdh=pta.tel1;
							}
							// 被担保人地址 nidgrp.rec.bdbrdz
							if(this.model.nidgrp.rec.fromflg=='Y' && this.model.nidgrp.warranteedr){
								// GIDGRP\WARRANTEEDR
							}else{
								this.model.nidgrp.rec.bdbrdz=pta.adr1+pta.adr2+pta.adr3;
							}
						}
						
						// 申请人地址 nidgrp.rec.sqradr
						let isHasModify = this.model.nidgrp.rec.modifySet;
						if(!isHasModify || (isHasModify && !isHasModify.includes('sqradr'))){
							this.model.nidgrp.rec.sqradr=pta.adr1+pta.adr2+pta.adr3;
						}

						// 申请人联系电话 nidgrp.rec.sqrtel
						if(!isHasModify || (isHasModify && !isHasModify.includes('sqrtel'))){
							if(pta.tel1 !=undefined && pta.tel1!=''){
								this.model.nidgrp.rec.sqrtel=pta.tel1;
							}
						}
					}
				}

			}
		},
		clearDeleteData(e){
			if(e === undefined){
				return
			}
			if(this.model.nidgrp.apl.pts.extkey == ""){
				this.model.nidgrp.apl.pts.nam = ""
				this.model.nidgrp.apl.pts.adrblk = ""
				this.model.nidgrp.rec.ownref = ""
				if(this.model.nidgrp.bdb.pts.cnnam == ""){//根据业务建议修改为取bdb
					this.model.nidgrp.rec.bilvvv = '';
					this.model.nidgrp.rec.cunqii = '';
					this.model.nidgrp.rec.idcode = '';
					this.model.nidgrp.rec.bdbrmc = '';
					this.model.nidgrp.rec.bdbrdh = '';
					this.model.nidgrp.rec.bdbrdz = '';
					this.model.nidgrp.rec.bngcod = '';
				}
				this.model.nidgrp.rec.sqrnam = '';
				//this.model.nidgrp.rec.sqqyhg = '';
				this.model.nidgrp.rec.sqradr = '';
				this.model.nidgrp.rec.sqrtel = '';
				this.model.nidgrp.rec.sqqydm = '';
			}
			if(this.model.nidgrp.bdb.pts.extkey == ""){
				this.model.nidgrp.bdb.pts.nam = ""
        this.model.nidgrp.bdb.pts.adrblk = ""
        this.model.nidgrp.rec.bilvvv = '';
				this.model.nidgrp.rec.cunqii = '';
				this.model.nidgrp.rec.idcode = '';
				this.model.nidgrp.rec.bdbrmc = '';
				this.model.nidgrp.rec.bdbrdh = '';
				this.model.nidgrp.rec.bdbrdz = '';
        this.model.nidgrp.rec.bngcod = '';
        //被担保清空,取申请人的
        if(this.model.nidgrp.rec.fenlishi ==''&&this.model.nidgrp.apl.pts.extkey!=''){
          this.changeApl(e);
        }
			}
			if(this.model.nidgrp.iss.pts.extkey == ""){
				this.model.nidgrp.iss.pts.nam = ""
				this.model.nidgrp.iss.pts.adrblk = ""
			}
			if(this.model.nidgrp.adv.pts.extkey == ""){
				this.model.nidgrp.adv.pts.nam = ""
				this.model.nidgrp.adv.pts.adrblk = ""
			}
			if(this.model.nidgrp.ctr.pts.extkey == ""){
				this.model.nidgrp.ctr.pts.nam = ""
				this.model.nidgrp.ctr.pts.adrblk = ""
			}
		},

		// 保函种类--nidgrp.rec.gartyp
		async changeGartyp(e) {
			if(e && this.model.nidgrp.blk.modifySet){
        this.model.nidgrp.blk.modifySet = this.model.nidgrp.blk.modifySet.filter(key=>key!='gidtxt')
      }
      if(!e && !this.model.nidgrp.rec.gtxinr && this.model.nidgrp.blk.modifySet && this.model.nidgrp.blk.modifySet.includes('gidtxt')){
        //初始化时,如保函文本是修改过的,且并没有报函文本模板inr,则不要再变化了 
        return
			}
			let m24infcpy;
				let m22amecnt;
				let msgtyp;
				let othersno;
				if(this.model.swiadd && this.model.swiadd.m24infcpy){
					m24infcpy = this.model.swiadd.m24infcpy
				}else{
					m24infcpy =''	
				}
				if(this.model.swiadd && this.model.swiadd.m22amecnt){
					m22amecnt = this.model.swiadd.m22amecnt
				}else{
					m22amecnt =''
				}
				if(this.model.nidgrp.rec && this.model.nidgrp.rec.othersno){
					othersno = this.model.nidgrp.rec.othersno
				}else{
					othersno =''
				}
				if(this.$route.query.msgtyp){
					msgtyp = this.$route.query.msgtyp
				}else{
					msgtyp = ''
				}
			let data = {
				gartyp: this.model.nidgrp.rec.gartyp,
				hndtyp: this.model.nidgrp.rec.hndtyp,
				gtxinr: this.model.nidgrp.rec.gtxinr,
				giduil: this.model.nidgrp.rec.giduil,
				segtyp: this.model.nidgrp.rec.segtyp,
				objextkey: JSON.parse(sessionStorage.getItem("currentOrg")).departmentNumber,
				trntyp: 'HGBH',
				fromflg: this.model.nidgrp.rec.fromflg,
				m24infcpy: m24infcpy,
				m22amecnt: m22amecnt,
				objinr: this.model.trnmod.swiadd.objinr || "",
				msgtyp: msgtyp,
				gidtxt: this.model.nidgrp.blk.gidtxt,
				othersno: othersno
			}
			const loading = this.loading();
			let res = await Api.post('/business/gitopn/defaultGidgrpRecGtxinrN1000FromGtx', data);
			loading.close();
			if (res.respCode === SUCCESS) {
				if(res.data && res.data.length > 0) {
					if (!this.isInDisplay) {
            this.model.nidgrp.rec.gtxinr = res.data[0].value;
            if(e){
              //如果是事件则重置,否则不做更新,保留原样
                this.model.nitp.lettername = res.data[0].label;
                this.model.nitp.lettername.modifySet = this.model.nitp.lettername.modifySet.filter(key=>key!='lettername')
            }
						if (e !== undefined || !this.model.nidgrp.blk.gtxgidtxt) {
							this.model.nidgrp.blk.gtxgidtxt = res.data[0].atxtxt
							this.model.nidgrp.blk.gidtxt = res.data[0].atxtxt
						}
						// 备份字段
						this.$set(this.codes, 'gtxgidtxtMark', res.data[0].atxtxt)
						this.getConfigData(this.model.nidgrp.rec.gtxinr)
					}
					this.$set(this.codes, 'atxinrList', res.data);
				}
			
			}
		},
		// 获取文本语言
		async getGidUil() {
			let data = {
				dbcode: 'uiltxt',
				valueList: 'CN,EN'
			}
			const loading = this.loading();
			let res = await Api.post('/business/nitopnRule/getCodeTableExplame',data);
			loading.close();
			if (res.respCode === SUCCESS) {
				this.$set(this.codes, 'giduilList', res.data);
			}
		},

		// 获取币种
		async getCurtxtFromStb() {
			let data = {
				dbcode: 'curtxt',
				uil: 'EN',
				transName: 'NITOPN'
			}
			const loading = this.loading();
			let res = await Api.post('/business/nitopnRule/getCurTxtFromStb',data);
			loading.close();
			if (res.respCode === SUCCESS) {
				this.$set(this.codes, 'curtxtList', res.data);
			}
		},

		async changeGiduil(e){
			if(e === undefined){
				return
			}
			this.model.nidgrp.rec.gtxinr='';
			if (this.model.nidgrp.rec.gartyp == "1") {
				this.model.nidgrp.rec.gtxinr = "<NILTXT>";
			} else {
				this.model.nidgrp.rec.gtxinr = "";
			}
			// 保函文本语言发生修改,调用事件
			if(!this.model.nidgrp.rec.giduil1){
				this.$confirm('是否确定要更换保函语种?', '提示', {
					confirmButtonText: '确定',
					cancelButtonText: '取消',
					type: 'warning',
				}).then(async () => {
					let m24infcpy;
					let m22amecnt;
					let msgtyp;
					let othersno;
					if(this.model.swiadd && this.model.swiadd.m24infcpy){
						m24infcpy = this.model.swiadd.m24infcpy
					}else{
						m24infcpy =''	
					}
					if(this.model.swiadd && this.model.swiadd.m22amecnt){
						m22amecnt = this.model.swiadd.m22amecnt
					}else{
						m22amecnt =''
					}
					if(this.model.nidgrp.rec && this.model.nidgrp.rec.othersno){
						othersno = this.model.nidgrp.rec.othersno
					}else{
						othersno =''
					}
					if(this.$route.query.msgtyp){
						msgtyp = this.$route.query.msgtyp
					}else{
						msgtyp = ''
					}
					let data = {
						gartyp: this.model.nidgrp.rec.gartyp,
						hndtyp: this.model.nidgrp.rec.hndtyp,
						gtxinr: this.model.nidgrp.rec.gtxinr,
						giduil: this.model.nidgrp.rec.giduil,
						segtyp: this.model.nidgrp.rec.segtyp,
						objextkey: JSON.parse(sessionStorage.getItem("currentOrg")).departmentNumber,
						trntyp: 'HGBH',
						fromflg: this.model.nidgrp.rec.fromflg,
						m24infcpy: m24infcpy,
					  m22amecnt: m22amecnt,
						objinr: this.model.trnmod.swiadd.objinr || "",
						msgtyp: msgtyp,
						gidtxt: this.model.nidgrp.blk.gidtxt,
						othersno: othersno
					}
					const loading = this.loading();
					let res = await Api.post('/business/gitopn/defaultGidgrpRecGtxinrN1000FromGtx', data);
					loading.close();
					if (res.respCode === SUCCESS) {
						this.$set(this.codes, 'atxinrList', res.data);
					}
					// 申请人
          this.model.nidgrp.apl.pts.ref = ""
					this.model.nidgrp.apl.pts.extkey = ""
					this.model.nidgrp.apl.pts.nam = ""
          this.model.nidgrp.apl.pts.adrblk = ""
          // 受益人
          this.model.nidgrp.ben.pts.ref = ""
					this.model.nidgrp.ben.pts.extkey = ""
					this.model.nidgrp.ben.pts.nam = ""
          this.model.nidgrp.ben.pts.adrblk = ""
          // 被保证人
          this.model.nidgrp.bdb.pts.ref = ""
					this.model.nidgrp.bdb.pts.extkey = ""
					this.model.nidgrp.bdb.pts.nam = ""
          this.model.nidgrp.bdb.pts.adrblk = ""
				})
			}
		},
		changeAtxinr(e) {
			if(e === undefined){
				return
			}
			this.model.nidgrp.blk.gtxgidtxt = ""
      this.model.nidgrp.blk.gidtxt = ""
      if(this.model.nidgrp.blk.modifySet){
        this.model.nidgrp.blk.modifySet = this.model.nidgrp.blk.modifySet.filter(key=>key!='gidtxt')
      }

			for (let item of this.codes.atxinrList) {
				if (e === item.value) {
					this.model.nidgrp.blk.gtxgidtxt = item.atxtxt
					this.model.nidgrp.blk.gidtxt = item.atxtxt
					// 备份字段
					this.$set(this.codes, 'gtxgidtxtMark', item.atxtxt)
				}
			}
			this.getConfigData(e)
		},
		async getConfigData(gtxinr) {
			if (gtxinr === undefined) {
				return;
			}
      let params = {
        objinr: gtxinr,
        objtyp: 'gtx'
      };
      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 (this.model.textTempData && !this.model.textTempData[`#${item.cod}`]) {
							this.$set(this.model.textTempData, `#${item.cod}`, '')
						}
					}
				})
				this.$set(this.codes, 'frameList', list)
      } else {
        this.$notify.error({ title: "错误", message: "服务请求失败!" });
      }
      loading.close();
		},
	/*	// 获取记账机构下拉列表
		async queryOrgList() {
			const loading = this.loading();
			let res = await Api.post('/business/userinfo/user/getAccBchList');
			loading.close();
			if (res.respCode === SUCCESS) {
				this.markOrgList = res.data;
				let isHasModify = this.model.nidgrp.rec.modifySet;
				if(this.markOrgList.length > 0){
					this.model.nidgrp.rec.bchkeyinr = this.markOrgList[0].inr;
					if(!isHasModify || (isHasModify && !isHasModify.includes('dbyhmc'))){
						this.model.nidgrp.rec.dbyhmc=this.markOrgList[0].bchname;
					}
					if(!isHasModify || (isHasModify && !isHasModify.includes('dbyhdz'))){
						this.model.nidgrp.rec.dbyhdz=this.markOrgList[0].adr;
          }
					if(!isHasModify || (isHasModify && !isHasModify.includes('dbyhdh'))){
						this.model.nidgrp.rec.dbyhdh=this.markOrgList[0].tel;
					}
				}
			}
		},*/
		// 获取客户经理信息
		async getResponsibleUser() {
			const loading = this.loading();
			let res = await Api.post('/business/nitopnRule/getResponseiblePeople');
			loading.close();
			if (res.respCode === SUCCESS) {
				if(this.model.nitp.usr.extkey == undefined || this.model.nitp.usr.extkey == ''){
				this.model.nitp.usr.extkey = res.data;
				}
			}
		},
		// 获取上收标识
		async getSdhflg() {
			let data = {
				trninr: this.$route.query.businessInr,
				type: this.$route.query.businessType
			}
			const loading = this.loading();
			let res = await Api.post('/business/nitopnRule/getSndflgData',data);
			loading.close();
			if (res.respCode === SUCCESS) {
				this.$set(this.codes, 'sndflgJudgement', res.data);
			}
		},

		// 获取开立方式
async getHndtypData() {
	let data = {
		dbcode: 'hndtyp',
		transName: 'HITOPN'
	}
	const loading = this.loading();
	let res = await Api.post('/business/hitopnRule/getHndtypData',data);
	loading.close();
	if (res.respCode === SUCCESS) {
		this.$set(this.codes, 'hndtypList', res.data);
	}
},

		// 获取受益人海关数据信息
		async getHaiGuanData() {
			const loading = this.loading();
			let res = await Api.post('/business/hitopnRule/getHaiGuanData');
			loading.close();
			if (res.respCode === SUCCESS) {
				let transferData = res.data.map(item => ({
          ...item,
					extkey: item.extkey,
					disabled: item.extkey === this.model.nidgrp.ben.pts.extkey
				}));

				this.$set(this.codes, 'transferData', transferData)
				this.$set(this.codes, 'markList', transferData)
			}
    },
    //开立方式
    changeHndtyp(e){
      if(e === undefined){
				return
			}
			let beforeData
			if((e == 'OT' && this.codes.beforeHndtyp !=undefined && (this.codes.beforeHndtyp !='OT'))
			|| (e != 'OT' && this.codes.beforeHndtyp !=undefined && (this.codes.beforeHndtyp =='OT'))){
				beforeData = this.codes.beforeHndtyp
				this.$confirm('是否切换开立方式?', '提示', {
					confirmButtonText: '确定',
					cancelButtonText: '取消',
					type: 'warning',
				}).then(() => {
					this.model.nidgrp.rec.ownref='';
					this.model.nidgrp.rec.fenlishi='';
					this.model.nidgrp.apl.pts.ref = ""
					this.model.nidgrp.apl.pts.extkey = ""
					this.model.nidgrp.apl.pts.nam = ""
					this.model.nidgrp.apl.pts.ptainr = ""
					this.model.nidgrp.apl.pts.adrblk = ""
					this.model.nidgrp.apl.pts.cnadr = ""
					this.model.nidgrp.apl.pts.cnnam = ""
				if(this.model.nidgrp.rec.hndtyp =='OT'){
					// 直开切转开
					this.model.nidgrp.bdb.pts.ref = ""
					this.model.nidgrp.bdb.pts.extkey = ""
					this.model.nidgrp.bdb.pts.nam = ""
					this.model.nidgrp.bdb.pts.ptainr = ""
					this.model.nidgrp.bdb.pts.adrblk = ""
					this.model.nidgrp.bdb.pts.cnadr = ""
					this.model.nidgrp.bdb.pts.cnnam = ""
				}else{
					// 转开切直开
					this.model.nidgrp.iss.pts.ref = ""
					this.model.nidgrp.iss.pts.extkey = ""
					this.model.nidgrp.iss.pts.nam = ""
					this.model.nidgrp.iss.pts.ptainr = ""
					this.model.nidgrp.iss.pts.adrblk = ""
					this.model.nidgrp.iss.pts.cnadr = ""
					this.model.nidgrp.iss.pts.cnnam = ""
					this.model.nidgrp.rec.iscrotra=''
				}
				}).catch(() => {
					this.model.nidgrp.rec.hndtyp = beforeData
					this.$set(this.codes, 'beforeHndtyp', beforeData);
				})
			}
			this.$set(this.codes, 'beforeHndtyp', e);
    },
    //暂存开立日期更新
    // setSptOpnDate(){
    //   if(!this.$route.query.type && this.$route.query.businessType==='SPT'){
    //     this.model.nidgrp.rec.opndat = moment(new Date()).format('YYYY-MM-DD');
    //   }
    // },
	}
}
//你可以添加自动default处理