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
import Api from '~/service/Api';
import commonFunctions from "~/mixin/commonFunctions.js";
import commonDepend from "~/mixin/commonDepend.js";
import moment from 'moment'
import Utils from "~/utils"
export default {
mixins: [commonFunctions, commonDepend],
methods: {
async init(params) {
const loading = this.loading();
const rtnmsg = await Api.post(`/${this.moduleRouter()}/${this.trnName}/init`, params);
if (rtnmsg.respCode === SUCCESS) {
loading.close();
this.model = rtnmsg.data;
} else if (rtnmsg.respCode === '400001') {
loading.close();
this.$store.commit('delTagsArry', this.$route.path);
this.$router.back()
}
},
async getdbCode(codeType, uil, codeNam) {
let params = {
codeType: codeType,
uil: uil ? uil : "EN"
};
let rtnmsg = await Api.post("/manager/dic/listDicInfo", params);
if (rtnmsg.respCode === SUCCESS) {
let curList = rtnmsg.data.map(item => ({
value: item.codeValue,
label: item.codeName
}));
this.dbCodes[codeNam] = curList;
}
},
save() {
// 前端检验
this.$refs['modelForm'].clearValidate();
this.$refs['modelForm'].validate(async (validStatic) => {
if (validStatic) {
const loading = this.loading();
this.$store.commit('setLoadingSubmit', true);
Api.post(`/Financing/dbiblc/save`, this.model).then((res) => {
if (res.respCode == "AAAAAA") {
loading.close();
if (!res.fieldErrors || (res.fieldErrors && Object.keys(res.fieldErrors).length == 0)) {
this.$notify({
title: '成功',
message: '提交成功',
type: 'success',
});
this.$store.commit('delTagsArry', this.$route.path)
this.$router.back()
} else {
const tab = this.showBackendErrors(res.fieldErrors);
if (tab) {
// 判断校验失败的表单不属于当前的tab,则切换tab到对应报错的tab页面
if (tab.name !== this.tabVal) {
this.tabClick(tab, '1');
}
}
}
} else {
this.$notify.error({
title: '错误',
message: res.respMsg
});
}
loading.close();
this.$store.commit('setLoadingSubmit', false)
})
} else {
// 前端校验失败
this.$notify({
title: '失败',
message: '校验失败',
type: 'error',
});
this.showFrontendErrors()
}
})
},
// 前端校验失败时候,tab和Collapse组件效果处理
showFrontendErrors() {
this.$nextTick(() => {
let fields = this.$refs['modelForm'].fields;
let parentVC = null;
for (let i = 0; i < fields.length; i++) {
let fieldItem = fields[i];
if (fieldItem.validateState === 'error') {
parentVC = fieldItem;
break;
}
}
let firstErrorTab = null;
let collapsePanel = null;
// while循环找出哪个tab和Collapse中报出的校验失败
while (true) {
const vcName = parentVC.$options.componentName;
// 没有Tabs的表单
if (vcName === "ElForm") {
break;
}
if (vcName === "ElTabPane") {
firstErrorTab = parentVC;
break;
}
if (vcName === "ElCollapseItem") {
collapsePanel = parentVC;
}
parentVC = parentVC.$parent;
}
if (firstErrorTab && firstErrorTab.name !== this.tabVal) {
const tabs = firstErrorTab.$parent;
tabs.currentName = firstErrorTab.name;
}
if (collapsePanel && collapsePanel.collapse.activeNames.indexOf(collapsePanel.name) < 0) {
collapsePanel.collapse.activeNames.push(collapsePanel.name)
}
setTimeout(() => {
let isError = document.querySelectorAll('.is-error');
isError[0].scrollIntoView({
block: 'center',
behavior: 'smooth'
})
}, 0);
})
},
//退出
async handleExit() {
this.$confirm("确认退出?", "提示", {
confirmButtonText: "确认",
cancelButtonText: "取消",
type: "warning"
}).then(() => {
Api.post(`/Financing/dbiblc/exit`, this.model);
this.$store.commit('delTagsArry', this.$route.path)
this.$router.back()
})
},
isDisabledButton(buttonname) {
if (this.model.disableSet.includes(buttonname)) {
return true;
} else {
return false;
}
},
clickButtyp(buttyp) {
switch (buttyp) {
case "RFU":
this.rfudialog = true;
this.model.recpan.buttyp = buttyp;
break;
case "ABA":
this.abddialog = true;
this.model.recpan.buttyp = buttyp;
break;
case "MDF":
this.model.recpan.buttyp = buttyp;
break;
case "BUN":
this.handleAplBund();
break;
case "UNB":
this.handleAplUnBund();
break;
case "REG":
this.model.recpan.buttyp = buttyp;
this.loareg();
break;
case "RCV":
this.model.recpan.buttyp = buttyp;
this.model.recgrp.rec.rcvcur = this.model.recgrp.rec.finloacur;
this.model.recgrp.rec.rcvamt = this.model.recgrp.rec.finloaamt;
this.model.recgrp.rec.facrcvdat = new Date();
this.rcvreg();
break;
case "DET":
this.model.recpan.buttyp = buttyp;
this.queryDetail();
break;
}
},
//点击绑定
handleAplBund() {
const loading = this.loading();
Api.post(`/Financing/dbiblc/aplBund`, this.model).then(res => {
if (res.respCode == SUCCESS) {
loading.close();
if (res.data.chksta == "C") {
this.$confirm("关单超额,已使用,请确认是否继续?", "提示", {
confirmButtonText: "确认",
cancelButtonText: "取消",
type: "warning"
}).then(() => {
this.model.recpan.buttyp = "BUN";
this.model.recgrp = res.data.blcgrp;
this.model.disableSet = res.data.disableSet;
})
} else {
this.model.recpan.buttyp = "BUN";
this.model.recgrp = res.data.blcgrp;
this.model.disableSet = res.data.disableSet;
}
} else {
this.$notify.error({
title: '错误',
message: res.respMsg
});
}
loading.close();
});
},
blurRelref() {
this.changeRelref()
},
//关联业务编号
changeRelref() {
if (!this.model.recgrp.rec.relref) {
this.model.recgrp.rec.relref = "";
this.model.recgrp.rec.prcrepdat = "";
this.model.recgrp.rec.finloacur = "";
this.model.recgrp.rec.finloaamt = "";
this.model.recgrp.rec.loacur = "";
this.model.recgrp.rec.loaamt = "";
this.model.bpdinr = "";
return
}
if (this.model.recgrp.rec.relref) {
const loading = this.loading();
Api.post(`/Financing/dbiblc/bpdQuery`, this.model).then((res) => {
if (res.respCode == SUCCESS) {
if (res.data.warning) {
this.$notify.warning(res.data.warning);
} else {
this.model.recgrp = res.data.blcgrp;
this.model.bpdinr = res.data.bpdinr;
}
loading.close();
} else {
this.$notify.error({
title: '错误',
message: res.respMsg
});
}
loading.close();
})
}
},
//点击解绑定
handleAplUnBund() {
const loading = this.loading();
Api.post(`/Financing/dbiblc/aplUnBund`, this.model).then(res => {
if (res.respCode == SUCCESS) {
loading.close();
this.$confirm("解绑定后该笔融资可能无法再绑定,请确认是否继续解绑定?", "提示", {
confirmButtonText: "确认",
cancelButtonText: "取消",
type: "warning"
}).then(() => {
this.model.recpan.buttyp = "UNB";
this.model.recgrp = res.data.blcgrp;
this.model.disableSet = res.data.disableSet;
})
} else {
this.$notify.error({
title: '错误',
message: res.respMsg
});
}
loading.close();
});
},
//放款登记
loareg() {
const loading = this.loading('正在调用接口');
Api.post(`/Financing/dbiblc/loareg`, this.model).then(res => {
if (res.respCode == SUCCESS) {
if (res.data.result) {
this.model.recgrp.rec = res.data.fin;
this.model.recgrp.fsa = res.data.fsa;
this.$alert('接口调用成功!', '提示', {
confirmButtonText: "确认",
callback: action => {
if (action == 'confirm') {
this.queryDetail()
}
}
})
loading.close();
} else {
this.$notify.error({
title: '错误',
message: res.data.fsa.hinmsg
});
}
} else {
this.$notify.error({
title: '错误',
message: res.respMsg
});
}
loading.close();
});
},
//还款登记
rcvreg() {
const loading = this.loading();
Api.post(`/Financing/dbiblc/rcvreg`, this.model).then(res => {
if (res.respCode == SUCCESS) {
this.model.disableSet = res.data.disableSet;
loading.close();
} else {
this.$notify.error({
title: '错误',
message: res.respMsg
});
}
loading.close();
});
},
wait(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
},
//详情查询
async queryDetail() {
const loading = this.loading('正在调用详情查询接口');
await this.wait(5000);
Api.post(`/Financing/dbiblc/queryDetail`, this.model).then(res => {
if (res.respCode == SUCCESS) {
this.model.recgrp = res.data.blcgrp;
this.model.recpan = res.data.blcp;
this.visible = true;
this.model.info = res.data.detailInfo;
loading.close();
} else {
this.$notify.error({
title: '错误',
message: res.respMsg
});
}
loading.close();
});
},
//导出excel
async exportExcel() {
const loading = this.loading();
let res = await Api.post("/Financing/dbiblc/exportExcel", {
...this.model,
});
if (res.respCode === SUCCESS) {
loading.close();
let username = this.$store.state.common.username;
Utils.exportToExcel(res.data, "BGD_" + username + "_" + this.fileCounter.toString().padStart(3, '0') + ".xlsx", "报关单信息");
this.fileCounter++;
}
loading.close();
},
},
};