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
import Api from '~/service/Api';
import Utils from "~/utils/index";
import commonFunctions from '~/mixin/commonFunctions.js';
import buildFn from '../event/buildCommons.js';
export default {
mixins: [commonFunctions,buildFn],
methods: {
// 点击获取按钮拉取当前key字段下的表单数据
queryFormData (key) {},
// 业务信息=》基本信息=》保函编号-----获取保函编号
queryOwnref () {
let params = this.model.nidgrp.rec;
params.ownref = this.model.nitp.tempOwnref;
if (this.model.nidgrp.rec.hndtyp == "OT"){
if (!this.model.nidgrp.ben.pts.ptainr || !this.model.nidgrp.rec.gartyp) {
return
}
} else {
if (!this.model.nidgrp.apl.pts.ptainr || !this.model.nidgrp.rec.hndtyp || !this.model.nidgrp.rec.gartyp) {
return
}
}
let ptainr = '';
if (this.model.nidgrp.rec.hndtyp == "OT") {
ptainr = this.model.nidgrp.ben.pts.ptainr;
} else {
ptainr = this.model.nidgrp.apl.pts.ptainr;
}
const loading = this.loading();
let trnName = this.root.trnName.toUpperCase();
Api.post(`/business/ref/nid?ptaInr=${ptainr}&trnName=${trnName}`, params).then(res => {
loading.close();
if (res.respCode == SUCCESS) {
this.model.nidgrp.rec.ownref = res.data;
this.model.nitp.tempOwnref = res.data;
} else {
this.$message.error(res.respMsg);
}
}).catch(() => {
loading.close();
});
},
clearBdbData(){
this.model.nidgrp.bdb.name = '';
this.model.nidgrp.bdb.nam = '';
this.model.nidgrp.bdb.inr = '';
this.model.nidgrp.bdb.ptyinr = '';
this.model.nidgrp.bdb.ptainr = '';
this.model.nidgrp.bdb.extkey ='';
this.model.nidgrp.bdb.rol = '';
this.model.nidgrp.bdb.pts.extkey = '';
this.model.nidgrp.bdb.pts.rol = '';
this.model.nidgrp.bdb.pts.ptainr = '';
this.model.nidgrp.bdb.pts.ptyinr = '';
this.model.nidgrp.bdb.pts.cnnam = '';
this.model.nidgrp.bdb.pts.cnadr = '';
this.model.nidgrp.bdb.pts.ennam = '';
this.model.nidgrp.bdb.pts.enadr = ''
},
changedata(){
if(this.model.nidgrp.rec.beyzd3 == 'N'){
this.model.nidgrp.rec.beyzd4 = ''
this.model.nitp.indirectswiaddc = ''
this.codes.endtxt = ''
}
if(!(this.model.nidgrp.rec.hndtyp == 'OC' && this.model.nidgrp.rec.beyzd3 == 'Y')){
return
}
const loading = this.loading();
Api.post(`/business/nitopnRule/getBeginAndEndData`).then(res => {
loading.close();
if (res.respCode === SUCCESS) {
if(res.data){
this.model.nitp.indirectswiaddc = res.data.beginGtx.gidtxt;
this.$set(this.codes, 'indirectswiaddinr', res.data.beginGtx.inr);
this.$set(this.codes, 'endtxt', res.data.endGtx.gidtxt);
this.$set(this.codes, 'endinr', res.data.endGtx.inr);
}
}
}).catch(() => {
loading.close();
});
},
// 保函模板转文本
templateToText () {
let gtxinr = this.model.nidgrp.rec.gtxinr;
let textTempData = this.model.textTempData;
this.formatTxtp(this.model.nidgrp.blk.gtxgidtxt, gtxinr, 'gtx', textTempData, 'nidgrp')
},
// 保函模板转反担保协议文本
templateToTextFdb () {
let gtxinr = this.codes.indirectswiaddinr;
console.log(this.model.nitp.indirectswiaddc);
console.log(gtxinr);
this.formatTxtp(this.model.nitp.indirectswiaddc, gtxinr, 'gtx', {}, '', 'fdb')
},
// 递转保函模板转反担保协议文本
templateToTextDz() {
let gtxinr = this.codes.endinr;
console.log(this.codes.endtxt);
console.log(gtxinr);
this.formatTxtp(this.codes.endtxt, gtxinr, 'gtx', {}, '', 'dz')
},
//设置通知行change事件
setAdvBankChange(){
//赋值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);
},
// 密文文本解析
templateToTextMiWen() {
let gtxinr = this.model.nidgrp.rec.gtxinrmw;
console.log(this.model.nidgrp.blk.gtxgidtxtmw);
console.log(gtxinr);
this.formatTxtp(this.model.nidgrp.blk.gtxgidtxtmw, gtxinr, 'gtx', {}, 'nidgrp', 'gtxinrmw')
},
changeTxt () {
if(!this.model.nidgrp.blk.modifySet || !this.model.nidgrp.blk.modifySet.includes("gidtxt")){
this.templateToText()
}
if(!this.model.nitp.modifySet || !this.model.nitp.modifySet.includes("indirectswiadd")){
this.templateToTextFdb()
}
if (!this.model.nitp.modifySet || !this.model.nitp.modifySet.includes("indirectswiadd")) {
this.templateToTextDz()
}
if (!this.model.nidgrp.blk.gidtxtmw && this.model.nidgrp.rec.othersno && (this.model.nidgrp.rec.othersno =='E0000009'
|| this.model.nidgrp.rec.othersno =='E0000016' || this.model.nidgrp.rec.othersno =='E0000017' || this.model.nidgrp.rec.othersno =='E0000020'
|| this.model.nidgrp.rec.othersno == 'E0000024')) {
this.templateToTextMiWen()
}
},
copyValueToCountrycod() {
this.ejectOitWarning('cty',this.model.nidgrp.rec.countrycod,'nidgrp.rec.countrycod');
let val = this.model.nidgrp.rec.countrycod;
if(this.model.cfagit) {
this.model.cfagit.recgrp.bas.bencountrycode = val;
if(this.model.cfagit.recgrp.bas.modifySet) {
if(!this.model.cfagit.recgrp.bas.modifySet.includes("bencountrycode")) {
this.model.cfagit.recgrp.bas.modifySet.push("bencountrycode");
}
} else {
this.model.cfagit.recgrp.bas.modifySet = ["bencountrycode"];
}
}
if(this.model.rmbbop.rmb2122) {
this.model.rmbbop.rmb2122.recgrp.ads.voucheecountrycode = val;
}
},
//申报2122报文
query2122() {
let trnName = this.root ? this.root.trnName : this.trnName;
if (this.model.rmbbop.rmb2122.rmbflg === '1') {
let rmbbop = this.buildRobbop(this.model, trnName);
Api.post('/business/rmbbopnid/rmbbop2122Cal', rmbbop).then(res => {
if (res.respCode === SUCCESS) {
this.model.rmbbop.rmb2122 = res.data.rmb2122;
this.model.rmbbop.rmb2122.recgrp.ads.opertype = '1';
}
});
}
},
queryCfap() {
let trnName = this.root ? this.root.trnName : this.trnName;
if(this.model.cfagit.cfaflg == '1') {
let cfap = this.buildCfap(this.model, trnName);
if(cfap.recgrp.dcl == null || cfap.recgrp.dcl.length == 0) {
var a = [{
exguarancode: "",
actiontype: "",
wabachandate: "",
basere: "",
remark: "",
actiondesc: "",
acp: "",
}];
cfap.recgrp.dcl = a;
}
Api.post('/business/nid/cfaMapping', cfap).then(rtnmsg => {
if (rtnmsg.respCode == SUCCESS) {
Utils.copyValueFromVoData(this.model.cfagit.recgrp,rtnmsg.data.recgrp);
if(rtnmsg.data.ownextkey != null && rtnmsg.data.ownextkey != "") {
this.model.cfagit.ownextkey = rtnmsg.data.ownextkey
}
this.model.cfagit.cfatyp = "A";
this.model.cfagit.recgrp.bas.actiontype = "A";
this.model.cfagit.recgrp.bas.acp = "X";
this.model.cfagit.recgrp.dcl[0].actiontype = "A";
this.model.cfagit.recgrp.dcl[0].acp = "X";
}
});
}
},
onCfaflg() {
switch (this.model.cfagit.cfaflg) {
case "1":
this.model.cfagit.basflg = 'X';
this.model.cfagit.dclflg = 'X';
if (!this.model.cfagit.ownextkey) {
this.model.cfagit.ownextkey = this.codes.ownExtkeyList[0].branch;
}
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 = '';
}
if (this.model.cfagit.cfaflg == "4" || this.model.cfagit.cfaflg == "") {
this.model.cfagit.ownextkey = "";
}
},
// 获取地区机构号
async getOwnExtkeyCondition1() {
const loading = this.loading();
let body = {ownExtKey: ""};
let res = await Api.post('/business/bch/getBranchListByownExtKey', body);
loading.close();
if (res.respCode === SUCCESS) {
this.ownExtkeyList = res.data;
}
},
onCfaCurDate() {
var moment = require('moment');
this.model.cfagit.recgrp.bas.contractdate = this.model.nidgrp.rec.opndat;
this.model.cfagit.recgrp.bas.maturity = this.model.nidgrp.rec.opndat;
this.model.cfagit.recgrp.bas.maturity = moment(this.model.nidgrp.rec.opndat).add(20, "years").format("YYYY-MM-DD HH:mm:ss");
this.model.cfagit.recgrp.bas.guarancurr = this.model.nidgrp.cbs.max.cur;
this.model.cfagit.recgrp.bas.guaranamount = this.model.nidgrp.cbs.max.amt;
this.model.cfagit.recgrp.dcl[0].wabachandate = this.model.cfagit.recgrp.bas.contractdate;
this.model.cfagit.recgrp.dcl[0].basere = this.model.nidgrp.cbs.max.amt;
},
onBccls1(){
if (this.model.addbcb.bccls1 == 'N') {
if(this.model.nidgrp.rec.hndtyp && this.model.nidgrp.rec.hndtyp == 'OC'){
this.model.addbcb.expdat = this.model.nidgrp.rec.liadat;
}else{
this.model.addbcb.expdat = this.model.nidgrp.rec.expdat;
}
} else if (this.model.addbcb.bccls1 == 'Y') {
if(this.model.nidgrp.rec.hndtyp && this.model.nidgrp.rec.hndtyp == 'OC'){
this.model.addbcb.preexpdat = this.model.nidgrp.rec.liadat;
}else{
this.model.addbcb.preexpdat = this.model.nidgrp.rec.expdat;
}
}
},
async agreementSigning() {
let data = {
ftynum: this.model.nitp.yptgimod.img[0].ftynum
};
let res = await Api.post('/business/nitopnRule/agreementSigning', data);
if (res.respCode == "AAAAAA") {
if(res.data&&res.data.data=="Y"){
this.model.nitp.xyflg=res.data.data;
this.$notify({
title: "成功",
message: "协议盖章成功!",
type: "success",
});
}
else{
this.$notify({
title: '失败',
message: '协议盖章调用失败,错误信息:'+res.data.respMsg,
type: 'error',
});
}
}
else{
this.$notify({
title: '失败',
message: '协议盖章调用失败!',
type: 'error',
});
}
},
async showText() {
let data = this.model.nitp.yptgimod.img;
let res = await Api.post('/business/nitopnRule/getTextResultVo', data);
if (res.respCode == "AAAAAA") {
//res.data 内容为 TextResultVo
if (res.data.data) {
let type, code = res.data;
switch (res.data.extension) {
case "pdf": {
type = "application/pdf";
this.base64ToBlob(code,type);
break;
}
case "html": {
type = "text/html";
this.base64ToBlob(code,type);
break;
}
case "doc": {
type = "application/msword";
this.base64ToBlob(code,type);
break;
}
case "docx": {
type = "application/vnd.openxmlformats-officedocument.wordprocessingml.document";
this.base64ToBlob(code,type);
break;
}
case "xls": {
type = "application/vnd.ms-excel";
this.base64ToBlob(code,type);
break;
}
case "xlsx": {
type = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
this.base64ToBlob(code,type);
break;
}
case "txt": {
type = "text/plain";
this.base64ToBlob(code,type);
break;
}
case "gif": {
type = "image/gif";
this.base64ToBlob(code,type);
break;
}
case "jpeg": {
type = "image/jpeg";
this.base64ToBlob(code,type);
break;
}
case "jpg": {
type = "image/jpeg";
this.base64ToBlob(code,type);
break;
}
case "png": {
type = "image/png";
this.base64ToBlob(code,type);
break;
}
case "bmp": {
type = "image/bmp";
this.base64ToBlob(code,type);
break;
}
case "aac": {
type = "audio/aac";
this.base64ToBlob(code,type);
break;
}
case "abw": {
type = "application/x-abiword";
this.base64ToBlob(code,type);
break;
}
case "arc": {
type = "application/x-freearc";
this.base64ToBlob(code,type);
break;
}
case "avi": {
type = "video/x-msvideo";
this.base64ToBlob(code,type);
break;
}
case "jar": {
type = "application/java-archive";
this.base64ToBlob(code,type);
break;
}
case "js": {
type = "text/javascript";
this.base64ToBlob(code,type);
break;
}
case "json": {
type = "application/json";
this.base64ToBlob(code,type);
break;
}
case "mp3": {
type = "audio/mpeg";
this.base64ToBlob(code,type);
break;
}
case "ppt": {
type = "application/vnd.ms-powerpoint";
this.base64ToBlob(code,type);
break;
}
case "pptx": {
type = "application/vnd.openxmlformats-officedocument.presentationml.presentation";
this.base64ToBlob(code,type);
break;
}
case "rar": {
type = "application/x-rar-compressed";
this.base64ToBlob(code,type);
break;
}
case "svg": {
type = "image/svg+xml";
this.base64ToBlob(code,type);
break;
}
case "tar": {
type = "application/x-tar";
this.base64ToBlob(code,type);
break;
}
case "zip": {
type = "application/zip";
this.base64ToBlob(code,type);
break;
}
case "7z": {
type = "application/x-7z-compressed";
this.base64ToBlob(code,type);
break;
}
default: {
break;
}
}
this.$notify({
title: "成功",
message: "文件下载成功!",
type: "success",
});
}
else {
this.$notify({
title: '失败',
message: '文件下载失败!',
type: 'error',
});
}
}
},
base64ToBlob(code, type) {
if(type == 'application/pdf') {
code.data = code.data.replace(/[\n\r]/g, "")
}
const raw = window.atob(code.data);
const rawLength = raw.length;
const uInt8Array = new Uint8Array(rawLength);
for (let i = 0; i < rawLength; ++i) {
uInt8Array[i] = raw.charCodeAt(i);
}
const blob = new Blob([uInt8Array], { type: type });
// const fileURL = URL.createObjectURL(blob);
// window.open(fileURL)
let fileName = code.filename;
var downloadElement = document.createElement('a');
var href = window.URL.createObjectURL(blob);
downloadElement.href = href;
downloadElement.download = fileName;
document.body.appendChild(downloadElement);
downloadElement.click();
document.body.removeChild(downloadElement);
window.URL.revokeObjectURL(href);
},
updateOwnref(){
let ownref = this.model.nidgrp.rec.ownref;
if (ownref === '') {
//编号为空,不处理,需要点击获取按钮得到业务编号
return;
}
let gartyp = this.model.nidgrp.rec.gartyp;
if (gartyp === '') {
return;
}
if (gartyp === 'V') {
let flag = ownref.substr(8, 1);
if (flag !== 'X') {
ownref = ownref.substr(0, 8) + 'X' + ownref.substr(8);
this.model.nidgrp.rec.ownref = ownref;
}
} else {
let flag = ownref.substr(8, 1);
if (flag === 'X') {
ownref = ownref.substr(0, 8) + ownref.substr(9);
this.model.nidgrp.rec.ownref = ownref;
}
}
},
checkGidtxt() {
this.$nextTick(() => {
this.root.$refs['modelForm'].validateField(['nidgrp.blk.gidtxt']);
})
},
},
};