import Api from '~/service/Api';
export default {
	methods: {

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

		// 获取客户经理信息
		async getResponsibleUser() {
			const loading = this.loading();
			let res = await Api.post('/business/nitopnRule/getResponseiblePeople');
			loading.close();
			if (res.respCode === SUCCESS) {
				this.model.nitp.usr.extkey = res.data;
			}
		},
		// 需用户确认有条件显示
		async judgementNeedCustomerButtonShow() {
			let trninr;
			if(this.$route.query.businessInr){
				trninr = this.$route.query.businessInr
			}else{
				trninr = ''
			}
			let type;
			if(this.$route.query.businessType){
				type = this.$route.query.businessType
			}else{
				type = ''
			}
			let data = {
				extkey: this.$store.state.UserContext.currentOrg.departmentNumber,
				trninr: trninr,
				type: type
			}
			const loading = this.loading();
			let res = await Api.post('/business/nitopnRule/judgementNeedCustomerButtonShow', data);
			loading.close();
			if (res.respCode === SUCCESS) {
				this.$set(this.codes, 'buttonShow', res.data);
			}
		},
		//保函文本格式
		async onGtxinr() {
			if (!this.model.nidgrp.rec.gtxinr) {
				if (this.model.nidgrp.rec.gartyp == "1") {
					this.model.nidgrp.rec.gtxinr = "<NILTXT>";
				} else {
					this.model.nidgrp.rec.gtxinr = "";
				}
			}
			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: this.$store.state.UserContext.currentOrg.departmentNumber,
				trntyp: 'GNBH',
				fromflg: '',
				objinr: this.model.trnmod.swiadd.objinr || "",
				msgtyp: ""
			}
			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) {
					this.$set(this.codes, 'atxinrList', res.data)
				}
			}
		},
	},
}