index.vue
18.4 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
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
<!-- 指标管理 -->
<template>
<div class="app-container">
<el-form
:model="queryParams"
ref="queryForm"
:inline="true"
v-show="showSearch"
label-width="100px"
>
<el-form-item label="决策流编号" prop="targetCode">
<el-input
v-model="queryParams.targetCode"
placeholder="请输入决策流编号"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="产品名称" prop="productName">
<el-input
v-model="queryParams.productName"
placeholder="请输入产品名称"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="决策流名称" prop="strategyName">
<el-input
v-model="queryParams.strategyName"
placeholder="请输入决策流名称"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="启用状态" prop="status">
<el-select
v-model="queryParams.status"
placeholder="请选择启用状态"
clearable
size="small"
>
<el-option
v-for="dict in dict.type.strategy_config_status"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item label="风控类型" prop="creditType">
<el-select
v-model="queryParams.creditType"
placeholder="请选择风控类型"
clearable
size="small"
>
<el-option
v-for="dict in dict.type.file_risk_type"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item label="用户类型" prop="userType">
<el-select
v-model="queryParams.userType"
placeholder="请选择用户类型"
clearable
size="small"
>
<el-option
v-for="dict in dict.type.index_mobile_type"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button
type="primary"
icon="el-icon-search"
size="mini"
@click="handleQuery"
>查询</el-button
>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
>重置</el-button
>
<el-button
icon="el-icon-circle-plus-outline"
size="mini"
@click="addDecisionFlow"
>新增</el-button
>
</el-form-item>
</el-form>
<el-table v-loading="loading" :data="postList" :border="true">
<el-table-column label="序号" type="index" width="55" align="center" />
<el-table-column
label="产品名称"
align="center"
width="200"
prop="productCode"
>
<template slot-scope="scope">
<span>{{ ProductCode(scope.row.productCode) }}</span>
</template>
</el-table-column>
<el-table-column
label="决策流编号"
align="center"
width="200"
prop="strategyNo"
/>
<el-table-column
label="决策流名称"
align="center"
width="300"
prop="strategyName"
/>
<el-table-column
label="用户类型"
align="center"
width="110"
prop="userType"
>
<template slot-scope="scope">
<dict-tag
:options="dict.type.index_mobile_type"
:value="scope.row.userType"
/>
</template>
</el-table-column>
<el-table-column
label="风控类型"
align="center"
width="110"
prop="creditType"
>
<template slot-scope="scope">
<dict-tag
:options="dict.type.file_risk_type"
:value="scope.row.creditType"
/>
</template>
</el-table-column>
<el-table-column
label="是否额度计算"
align="center"
width="150"
prop="calculationAmount"
>
<template slot-scope="scope">
{{ scope.row.calculationAmount ? "是" : "否" }}
</template>
</el-table-column>
<el-table-column
label="额度测算条件"
align="center"
width="300"
prop="amountCalculationConditions"
>
<template slot-scope="scope">
<span>{{
queryDict(
scope.row.amountCalculationConditions,
dict.type.strategy_amount_calculation_conditions
)
}}</span>
</template>
</el-table-column>
<el-table-column
label="额度测算模块"
align="center"
width="150"
prop="amountCalculationModel"
>
<template slot-scope="scope">
<span>{{ dictCode(scope.row.amountCalculationModel) }}</span>
</template>
</el-table-column>
<el-table-column
label="描述"
show-overflow-tooltip
width="100"
align="center"
prop="remarks"
/>
<el-table-column label="版本" align="center" prop="version" />
<el-table-column label="启用状态" align="center" width="100">
<template slot-scope="scope">
<el-switch
v-model="scope.row.status"
active-value="ENABLE"
inactive-value="DISABLE"
@change="handleStatusChange(scope.row)"
></el-switch>
</template>
</el-table-column>
<el-table-column
label="新建时间"
align="center"
prop="createTime"
width="180"
>
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
</el-table-column>
<el-table-column
label="更新时间"
align="center"
prop="createTime"
width="180"
>
<template slot-scope="scope">
<span>{{ parseTime(scope.row.modifyTime) }}</span>
</template>
</el-table-column>
<el-table-column
label="操作"
align="center"
width="300"
fixed="right"
class-name="small-padding fixed-width"
>
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleCopy(scope.row)"
v-hasPermi="['system:post:edit']"
>复制</el-button
>
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['system:post:edit']"
>编辑</el-button
>
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleDetail(scope.row)"
v-hasPermi="['system:post:edit']"
>查看</el-button
>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['system:post:remove']"
>删除</el-button
>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total > 0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 决策流配置管理对话框 查看 编辑 新增 -->
<el-dialog :title="title" :visible.sync="open" v-if="open" width="600px" append-to-body>
<el-form
:disabled="dialogType === 'detail'"
ref="form"
:model="form"
:rules="rules"
label-width="120px"
>
<el-form-item label="产品名称" prop="productCode">
<el-select
v-model="form.productCode"
clearable
placeholder="请选择产品名称"
size="small"
@change="productChange"
>
<el-option
v-for="dict in products"
:key="dict.id"
:label="dict.name"
:value="dict.businessCode"
/>
</el-select>
</el-form-item>
<el-form-item label="决策流名称" prop="strategyName">
<el-input
v-model="form.strategyName"
placeholder="请输入决策流名称"
/>
</el-form-item>
<template v-if="productNo == 1">
<el-form-item label="用户类型" prop="userType">
<el-select
v-model="form.userType"
clearable
placeholder="请选择用户类型"
size="small"
>
<el-option
v-for="dict in dict.type.index_mobile_type"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
</template>
<template v-if="productNo == 2">
<el-form-item label="用户类型" prop="userType">
<el-select
v-model="form.userType"
clearable
placeholder="请选择用户类型"
size="small"
>
<el-option label="个人" value="PERSON" :disabled="true" />
<el-option label="企业" value="ENTERPRISE" />
</el-select>
</el-form-item>
</template>
<el-form-item label="风控类型" prop="creditType">
<el-select
v-model="form.creditType"
clearable
placeholder="请选择风控类型"
size="small"
>
<el-option
v-for="dict in dict.type.file_risk_type"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item label="是否需额度测算" prop="calculationAmount">
<el-radio-group v-model="form.calculationAmount">
<el-radio :label="true">是</el-radio>
<el-radio :label="false">否</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="额度测算条件" prop="amountCalculationConditions">
<el-select
v-model="form.amountCalculationConditions"
clearable
placeholder="请选择额度测算条件"
size="small"
>
<el-option
v-for="dict in dict.type.strategy_amount_calculation_conditions"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item label="额度测算模块" prop="amountCalculationModel">
<el-select
v-model="form.amountCalculationModel"
clearable
placeholder="请选择额度测算模块"
size="small"
>
<el-option
v-for="dict in amountCalculationModelDict"
:key="dict.modelName"
:label="dict.modelName"
:value="dict.modelJob"
/>
</el-select>
</el-form-item>
<el-form-item label="描述" prop="remarks">
<el-input
v-model="form.remarks"
type="textarea"
placeholder="请输入描述内容"
/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm">下一步</el-button>
<el-button @click="cancel">取消</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import {
strategyConfigList,
strategyConfigFinish,
strategyConfigCopy,
strategyConfigEnable,
strategyConfigDisable,
strategyConfigNext,
strategyConfigGetOne,
strategyConfigDelete,
productDown,
getAllModel,
} from "@/api/product_decision_flow.js";
import { modelManagerPage } from "@/api/postList/list";
export default {
name: "Post",
dicts: [
"strategy_config_status",
"file_risk_type",
"strategy_amount_calculation_conditions",
"index_mobile_type",
],
data() {
return {
// 遮罩层
loading: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
postList: [],
amountCalculationModelDict: [],
productLis: [],
title: "", // 弹出层标题
open: false, // 是否显示弹出层
dialogType: "", // 弹出层类型 edit add detail
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
},
// 表单参数
form: {},
products: [],
// 表单校验
rules: {
strategyName: [
{ required: true, message: "决策流名称不能为空", trigger: "blur" },
],
productCode: [
{ required: true, message: "产品名称不能为空", trigger: "blur" },
],
creditType: [
{ required: true, message: "风控类型不能为空", trigger: "blur" },
],
calculationAmount: [
{
required: true,
message: "是否需额度测算不能为空",
trigger: "blur",
},
],
userType: [
{ required: true, message: "用户类型不能为空", trigger: "blur" },
],
},
dicList: [],
productNo: 1,
};
},
created() {
this.getList();
this.productDown();
this.getAllModel();
},
methods: {
getList() {
this.loading = true;
strategyConfigList(this.queryParams).then((response) => {
this.postList = response.rows;
this.total = response.total;
this.loading = false;
});
var li = {
pageNum: 1,
pageSize: 1000,
};
modelManagerPage(li).then((response) => {
this.dicList = response.rows;
});
},
// 新增决策流
addDecisionFlow() {
this.dialogType = "add";
this.open = true;
this.title = "新增决策流配置";
this.reset();
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
},
// 弹窗表单重置
reset() {
this.form = {
strategyName: undefined,
productCode: undefined,
creditType: undefined,
calculationAmount: undefined,
remarks: undefined,
amountCalculationConditions: undefined,
amountCalculationModel: undefined,
};
this.resetForm("form");
},
// 启用状态变更
handleStatusChange(row, d, c) {
const status = row.status;
if (status === "DISABLE") {
strategyConfigDisable({
id: row.id,
}).then((response) => {
this.$modal.msgSuccess("禁用成功");
this.getList();
});
} else if (status === "ENABLE") {
strategyConfigEnable({
id: row.id,
}).then((response) => {
this.$modal.msgSuccess("启用成功");
this.getList();
});
}
},
// 复制策略
handleCopy(row) {
strategyConfigCopy({
id: row.id,
}).then((response) => {
this.$modal.msgSuccess("复制成功");
this.getList();
});
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 查询重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
/** 修改按钮操作 */
handleUpdate(row) {
strategyConfigGetOne({
id: row.id,
}).then((res) => {
this.form = res.data;
this.open = true;
this.dialogType = "edit";
this.title = "编辑决策流配置";
if(this.form.userType == "NBD"){
this.productNo = 1
}else{
this.productNo = 2
}
});
},
handleDetail(row) {
strategyConfigGetOne({
id: row.id,
}).then((res) => {
this.form = res.data;
this.open = true;
this.dialogType = "detail";
this.title = "查看决策流配置";
});
},
productChange(val) {
if (val == "NBD") {
this.productNo = 1;
} else {
this.productNo = 2;
}
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate((valid) => {
if (valid) {
if (
this.form.calculationAmount &&
!this.form.amountCalculationConditions
) {
return this.$modal.msgWarning("请选择额度测算条件");
}
if (
this.form.calculationAmount &&
!this.form.amountCalculationModel
) {
return this.$modal.msgWarning("请选择额度测算模块");
}
strategyConfigNext(this.form).then((response) => {
this.$modal.msgSuccess("保存成功");
this.open = false;
this.getList();
this.$router.push({
path: "decision_flow_setting",
query: { flow: response.data.id },
});
});
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
if (!row.id) return;
this.$modal
.confirm("是否确认删除名称为" + row.strategyName + "的决策流?")
.then(function () {
return strategyConfigDelete({ id: row.id });
})
.then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
})
.catch(() => {});
},
productDown() {
productDown().then((res) => {
this.products = res.data || [];
this.productLis = res.data;
});
},
getAllModel() {
getAllModel().then((res) => {
this.amountCalculationModelDict = res.data || [];
});
},
ProductCode(t) {
for (var i = 0; i < this.productLis.length; i++) {
if (t == this.productLis[i].businessCode) {
return this.productLis[i].name;
}
}
},
dictCode(t) {
for (var i = 0; i < this.dicList.length; i++) {
if (t == this.dicList[i].modelJob) {
return this.dicList[i].modelName;
}
}
},
},
};
</script>