金融产品设计及数字化营销沙盘
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

262 lines
8.8 KiB

<template>
<!-- 征信 -->
<el-table class="c-table"
:data="form"
1 year ago
:cell-style="{background:'#fff'}"
max-height="calc(100vh - 230px)"
border>
<el-table-column prop="name"
label="征信黑名单指标"
1 year ago
min-width="220"
align="center">
</el-table-column>
<el-table-column label="规则"
1 year ago
width="700"
align="center">
<template #default="{ row }">
1 year ago
<!-- 贷记卡账户状态 -->
<div v-if="row.stRecordId == 204"
class="flex items-center">
1 year ago
<span v-if="row.recordChildren"
class="whitespace-nowrap">{{ row?.recordChildren[0]?.name }}</span>
<el-input class="w-[150px] mx-2"
placeholder="请输入"
1 year ago
v-model="row.ruleOne"></el-input>
<span class="whitespace-nowrap">的信用卡</span>
</div>
<!-- 贷记卡审批通过率 -->
<div v-else-if="isRule(row.stRecordId)"
class="flex items-center">
1 year ago
<span v-if="row.recordChildren"
class="whitespace-nowrap">{{ row?.recordChildren[0]?.name }}</span>
<div class="w-[95px] ">
<el-select class="mx-2"
clearable
v-model="row.symbol">
<el-option v-for="item in symbols"
:key="item"
:label="item.name"
:value="item.name" />
</el-select>
</div>
<el-input class="w-[80px]"
placeholder="请输入"
v-model="row.num"></el-input>
1 year ago
<span v-if="row.recordChildren"
class="ml-2 whitespace-nowrap">{{ row?.recordChildren[1]?.name }}</span>
<div class="w-[95px] ">
1 year ago
<el-select class="mx-2"
clearable
1 year ago
v-model="row.symbol1">
<el-option v-for="item in symbols"
:key="item"
:label="item.name"
:value="item.name" />
</el-select>
</div>
<el-input class="w-[80px]"
placeholder="请输入"
1 year ago
v-model="row.num1"></el-input>
<span class="ml-2 whitespace-nowrap"></span>
</div>
1 year ago
<div v-else-if="row.stRecordId == 230 || row.stRecordId == 231"
class="flex">
<el-select class="w-[85px] ml-2"
clearable
1 year ago
v-model="row.ruleOne">
<el-option value="有" />
<el-option value="无" />
</el-select>
</div>
<div v-else
class="flex items-center">
1 year ago
<span v-if="row.recordChildren"
class="whitespace-nowrap">{{ row?.recordChildren[0]?.name }}</span>
<div class="w-[95px] ">
1 year ago
<el-select class="mx-2"
clearable
1 year ago
v-model="row.symbol">
<el-option v-for="item in symbols"
:key="item"
:label="item.name"
:value="item.name" />
</el-select>
1 year ago
</div>
<el-input class="w-[80px]"
placeholder="请输入"
1 year ago
v-model="row.num"></el-input>
<span class="ml-2 whitespace-nowrap">{{ row.stRecordId === 203 || row.stRecordId === 205 ? '元' : row.stRecordId === 207 || row.stRecordId === 229 ? '万元' : ' ' }}</span>
</div>
</template>
</el-table-column>
<el-table-column label="本人命中是否进黑名单"
1 year ago
min-width="160"
align="center">
<template #default="{ row }">
<el-radio-group v-model="row.hitTheBlacklist">
<el-radio v-for="(item, i) in whethers"
:key="i"
:label="item.id">{{ item.name }}</el-radio>
</el-radio-group>
</template>
</el-table-column>
<el-table-column label="配偶命中是否拒入"
min-width="160"
align="center">
<template #default="{ row }">
<el-radio-group v-model="row.mateRejectedStandardIdentity">
<el-radio v-for="(item, i) in whethers"
:key="i"
:label="item.id">{{ item.name }}</el-radio>
</el-radio-group>
</template>
</el-table-column>
</el-table>
<div class="flex justify-end">
<div class="submit"
@click="submit">确认完成配置</div>
</div>
</template>
<script setup lang="ts">
import { ref, computed, watch, onMounted } from 'vue';
import { ElMessage } from 'element-plus';
1 year ago
import { accessStrategyCreditBlacklistFind, accessStrategyCreditBlacklistSave } from '@/api/model';
import { getProcessInformationBasedOnRoles, addOperation } from '@/api/judgment';
import { useRouter, useRoute } from 'vue-router';
import { handleId, getIds, whethers } from '@/utils/common';
import Cookies from 'js-cookie';
const router = useRouter();
const route = useRoute();
1 year ago
const projectId = +Cookies.get('sand-projectId');
const levelId = +Cookies.get('sand-level');
const form = ref<Record<string, any>[]>([]);
1 year ago
const info = ref<Record<string, any>[]>([]);
const symbols: Array<Record<string, any>> = [
{
name: '>=',
},
{
name: '<',
},
{
name: '>',
},
{
name: '==',
},
{
name: '<=',
},
];
// 配置项
const getConfig = async () => {
1 year ago
const { process } = await getProcessInformationBasedOnRoles(151);
const result = [];
process.map((e) => {
1 year ago
const cur = info.value.find((n) => n.stRecordId === e.id);
1 year ago
let num = cur?.ruleOne?.match(/\d+/g);
let num1 = cur?.ruleTwo?.match(/\d+/g);
let symbol = cur?.ruleOne?.match(/[<>=]+/g);
let symbol1 = cur?.ruleTwo?.match(/[<>=]+/g);
let temp = {
...getIds(),
name: e.name,
recordChildren: e.recordChildren,
hitTheBlacklist: cur?.hitTheBlacklist,
mateRejectedStandardIdentity: cur?.mateRejectedStandardIdentity,
symbol: symbol?.length ? symbol[0] : '',
symbol1: symbol1?.length ? symbol1[0] : '',
1 year ago
num: num?.length ? num[0] : '',
num1: num1?.length ? num1[0] : '',
ruleOne: e.id === 204 || e.id === 230 || e.id === 231 ? cur?.ruleOne : '',
ruleTwo: '',
1 year ago
subjectId: e.subjectId,
stRecordId: e.id,
};
result.push(temp);
});
form.value = result;
};
// 详情
const getDetail = async () => {
1 year ago
try {
const { data } = await accessStrategyCreditBlacklistFind();
1 year ago
info.value = data;
getConfig();
} finally {
}
};
1 year ago
watch(
() => route.query,
() => {
1 year ago
route.query.id === '151' && getDetail();
},
{
immediate: true,
},
);
const isRule = (rule: number): boolean => {
1 year ago
return rule === 208 || (rule > 215 && rule < 222) || rule === 226;
};
// 提交
const submit = async () => {
let param = JSON.parse(JSON.stringify(form.value));
param.map((e, i) => {
1 year ago
if (info.value.length) e.id = info.value.find((n) => n.stRecordId === e.stRecordId)?.id;
1 year ago
if (e.stRecordId != 204 && e.stRecordId != 230 && e.stRecordId != 231) {
e.ruleOne = e.symbol + e.num;
if (isRule(e.stRecordId)) {
e.ruleTwo = e.symbol1 + e.num1;
}
}
});
const recordParam = JSON.parse(JSON.stringify(param));
param.map((e) => {
delete e.recordChildren;
});
1 year ago
await accessStrategyCreditBlacklistSave({ creditBlacklistList: param });
addRecord(recordParam);
getDetail();
ElMessage.success('提交成功!');
};
// 新增判分记录
1 year ago
const addRecord = async (data: Record<string, any>) => {
const preIds = `1,${Cookies.get('sand-level')},42,67,147,151`; // 1,关卡id,角色(这个页面是风控经理策略)
const rule = [];
1 year ago
data[1].ruleOne && rule.push(handleId(234, 81, data[1].ruleOne, preIds + ',204,234', 3));
data[27].ruleOne && rule.push(handleId(267, 114, data[27].ruleOne === '有' ? 306 : 305, preIds + ',230,267', 1));
data[28].ruleOne && rule.push(handleId(268, 115, data[28].ruleOne === '有' ? 308 : 307, preIds + ',231,268', 1));
data.map((e, i) => {
1 year ago
if (e.stRecordId != 204 && e.stRecordId != 230 && e.stRecordId != 231) {
const len = e?.recordChildren?.length - 1;
1 year ago
e?.recordChildren.map((n, j) => {
j !== len && rule.push(handleId(n.id, n.subjectId, j ? e.ruleTwo : e.ruleOne, preIds + ',' + e.stRecordId + ',' + n.id, 5));
});
}
1 year ago
// 多选框
e.mateRejectedStandardIdentity && rule.push(handleId(274, e.subjectId, e.mateRejectedStandardIdentity, preIds + ',' + e.stRecordId + ',274', 1));
});
await addOperation({
...getIds(),
parentId: preIds,
lcJudgmentRuleReq: rule,
});
};
</script>
<style lang="scss" scoped>
@import url(../../../styles/form.scss);
.c-table {
:deep(.el-input__inner) {
@apply px-2;
}
}
</style>