信用评分策略(个人)

V0.1
yujialong 1 year ago
parent 34be320ee1
commit 49341ce8ea
  1. 6
      src/api/model.ts
  2. 2
      src/components/Panel/index.vue
  3. 2
      src/layout/components/AppSidebar/Menu.vue
  4. 107
      src/views/product/strategy/CardList.vue
  5. 311
      src/views/product/strategy/Credit.vue

@ -34,3 +34,9 @@ export const accessStrategyNegativeIndustryStrategyFind = async (checkpointId: n
(await axios.post(`/product/accessStrategyNegativeIndustryStrategy/details?checkpointId=${checkpointId}&projectId=${projectId}`)).data;
export const accessStrategyNegativeIndustryStrategySave = async (data: Record<string, any>): Promise<any> =>
(await axios.post(`/product/accessStrategyNegativeIndustryStrategy/saveOrUpdate`, data)).data;
export const delCredit = async (id: number): Promise<any> => (await axios.post(`/product/creditScoringStrategy/delete?strategyId=${id}`)).data;
export const findCredit = async (id: number): Promise<any> => (await axios.post(`/product/creditScoringStrategy/details?strategyId=${id}`)).data;
export const listCredit = async (data: Record<string, any>): Promise<any> =>
(await axios.post(`/product/creditScoringStrategy/list?checkpointId=${data.checkpointId}&projectId=${data.projectId}&pageNum=${data.pageNum}&pageSize=${data.pageSize}`)).data;
export const saveCredit = async (data: Record<string, any>): Promise<any> => (await axios.post(`/product/creditScoringStrategy/saveOrUpdate`, data)).data;

@ -271,7 +271,7 @@ if (param.token) {
Cookies.set('sand-resultsDetails', param.resultsDetails ?? '');
Cookies.set('sand-resultAnnouncementTime', param.resultAnnouncementTime ?? '');
Cookies.remove('sand-submit');
router.replace('/');
router.replace(route.path);
} else {
param.systemId = Cookies.get('sand-systemId');
param.projectId = Cookies.get('sand-projectId');

@ -26,7 +26,7 @@
<!-- 风控经理 -->
<template v-else-if="role == 42">
<li :class="{ active: active == 1 }"
@click="toPage('/product?type=&i=1&role=42')">
@click="toPage('/product/bank?type=&i=1&role=42')">
<img class="icon"
src="@/assets/images/icon1.png"
alt="" />

@ -29,7 +29,42 @@
</div>
</el-tab-pane>
<el-tab-pane label="信用评分策略"
name="tab2"> </el-tab-pane>
name="tab2">
<div class="flex">
<div class="left w-[241px] min-w-[241px] pr-5 py-4">
<div class="flex justify-center items-center py-2 mb-3 text-sm text-[#006BFF] bg-[rgba(0,107,255,0.1)] border border-solid border-[#006BFF] rounded-[10px] cursor-pointer"
@click="toAdd">
<el-icon class="mr-1"
:size="16"
color="#006BFF">
<Plus />
</el-icon>
新增评分卡
</div>
<ul class="products">
<li v-for="(item, i) in list1"
:key="i"
:class="{ active: item.id === id }"
@click="switchProductCredit(item.id)">
<el-popconfirm title="您确定删除吗?"
@confirm="handleDelete(item.id)">
<template #reference>
<img src="@/assets/images/trash.png"
alt=""
class="del" />
</template>
</el-popconfirm>
<h6>{{ item.scoreCardName }}</h6>
<p class="type">{{ item.scoringObject ? '企业' : '个人' }}</p>
<p class="des">{{ item.description }}</p>
</li>
</ul>
</div>
<div class="right flex-1 px-5 pt-2">
<Credit @getList="getList" />
</div>
</div>
</el-tab-pane>
<el-tab-pane label="风险度策略"
name="tab3"> </el-tab-pane>
</el-tabs>
@ -37,10 +72,13 @@
</template>
<script setup lang="ts">
import { computed, onMounted, ref, watch, defineAsyncComponent } from 'vue';
import { computed, onMounted, ref } from 'vue';
import type { TabsPaneContext } from 'element-plus';
import { getProcessInformationBasedOnRoles } from '@/api/judgment';
import { delCredit, listCredit } from '@/api/model';
import { useRouter, useRoute } from 'vue-router';
import { ElMessage } from 'element-plus';
import Cookies from 'js-cookie';
import Com1 from './150.vue';
import Com2 from './151.vue';
import Com3 from './152.vue';
@ -48,44 +86,62 @@ import Com4 from './153.vue';
import Com5 from './154.vue';
import Com6 from './155.vue';
import Com7 from './156.vue';
import Credit from './Credit.vue';
const router = useRouter();
const route = useRoute();
const curTab = ref<string>('tab1');
const list = ref<Array<any>>([]);
const projectId = +Cookies.get('sand-projectId');
const levelId = +Cookies.get('sand-level');
const curTab = ref<string>('tab2');
const list = ref<Array<Record<string, any>>>([]);
const list1 = ref<Array<Record<string, any>>>([]);
const id = computed(() => +route.query.id);
const creditId = computed(() => +route.query.creditId);
//
const switchProduct = (id: number) => {
router.push(`/product/strategy?type=${route.query.type}&i=${route.query.i}&role=${route.query.role}&id=${id}`);
};
//
const switchProductCredit = (id: number) => {
router.push(`/product/strategy?type=${route.query.type}&i=${route.query.i}&role=${route.query.role}&creditId=${id}`);
};
//
const getList = async () => {
const getList = async (refresh?: number) => {
if (curTab.value === 'tab1') {
const { process } = await getProcessInformationBasedOnRoles(67);
id.value ||
router.push({
path: `/product/strategy`,
query: {
...route.query,
id: process[0].recordChildren[0].id,
},
});
// eslint-disable-next-line no-unused-expressions
!id.value && switchProduct(process[0].recordChildren[0].id);
list.value = process;
} else {
const res = await listCredit({
checkpointId: levelId,
projectId,
pageNum: 1,
pageSize: 50,
});
// eslint-disable-next-line no-unused-expressions
((!route.query.add && !creditId.value && res.data.length) || refresh) && switchProductCredit(res.data[0].id);
list1.value = res.data;
}
};
onMounted(() => {
getList();
});
//
const switchProduct = (id: number) => {
router.push({
path: `/product/strategy`,
query: {
...route.query,
id,
},
});
const handleDelete = async (id: number) => {
await delCredit(id);
getList(1);
ElMessage.success('删除成功!');
};
//
const toAdd = () => {
router.push(`/product/strategy?type=${route.query.type}&i=${route.query.i}&role=${route.query.role}&add=1`);
};
// tab
const tabChange = (tab: TabsPaneContext, event: Event) => {
console.log(tab, event);
getList();
};
</script>
@ -108,7 +164,10 @@ const tabChange = (tab: TabsPaneContext, event: Event) => {
@apply text-[#14436b];
}
.type {
@apply mt-3 text-sm text-[#8798a9];
@apply my-3 text-sm text-[#333];
}
.des {
@apply text-sm text-[#8798a9];
}
}
</style>

@ -0,0 +1,311 @@
<template>
<div id="wrap">
<div class="flex items-center">
<span class="mr-2 text-sm font-semibold text-[#333] whitespace-nowrap">评级卡名称</span>
<el-input class="w-[220px]"
maxlength="20"
v-model="form.scoreCardName"></el-input>
<span class="ml-10 mr-2 text-sm font-semibold text-[#333] whitespace-nowrap">评分对象</span>
<div class="w-[220px] ">
<el-select v-model="form.scoringObject">
<el-option v-for="item in scoringObjects"
:key="item"
:label="item.name"
:value="item.id" />
</el-select>
</div>
</div>
<h6 class="mt-5 mb-3 text-sm text-[#006BFF] font-semibold">评分表</h6>
<el-table class="c-table"
:data="list"
:span-method="span"
border>
<el-table-column prop="name"
label="选用"
min-width="150"
align="center">
<template #default="{ row }">
<el-checkbox v-model="row.isChoose"></el-checkbox>
</template>
</el-table-column>
<el-table-column prop="name"
label="维度"
min-width="150"
align="center"></el-table-column>
<el-table-column prop="sub"
label="指标"
min-width="150"
align="center"></el-table-column>
<el-table-column label="分值"
min-width="150"
align="center">
<template #default="{ row }">
<el-select v-model="row.score">
<el-option v-for="item in row?.itemList"
:key="item"
:value="item.options" />
</el-select>
</template>
</el-table-column>
</el-table>
<p class="mt-4 mb-2 text-sm font-semibold text-[#333] whitespace-nowrap">描述</p>
<el-input placeholder="请输入"
maxlength="100"
type="textarea"
v-model="form.description"></el-input>
<div class="flex justify-center">
<div class="submit"
@click="submit">完成配置</div>
</div>
</div>
</template>
<script setup lang="ts">
import { ref, reactive, computed, watch } from 'vue';
import { ElLoading, ElMessage } from 'element-plus';
import { saveCredit, findCredit } from '@/api/model';
import { getProcessInformationBasedOnRoles, addOperation } from '@/api/judgment';
import { useRouter, useRoute } from 'vue-router';
import type { TableColumnCtx } from 'element-plus';
import { handleId } from '@/utils/common';
// import Info from './Info.vue';
import Cookies from 'js-cookie';
const emit = defineEmits(['getList']);
const router = useRouter();
const route = useRoute();
const id = computed(() => +route.query.creditId);
const projectId = +Cookies.get('sand-projectId');
const levelId = +Cookies.get('sand-level');
let loading: boolean = true;
const list = ref<Record<string, any>[]>([]);
const detail = ref<Record<string, any>>({});
const scoringObjects = ref<Array<any>>([
{
id: 0,
name: '个人',
},
{
id: 1,
name: '企业',
},
]);
const form = reactive<RuleForm>({
checkpointId: levelId,
projectId,
description: '',
scoreCardName: '',
scoringObject: 0,
id: computed(() => route.query.creditId || ''),
});
//
const getConfig = async () => {
const { process } = await getProcessInformationBasedOnRoles(148);
const result = [];
process[0]?.recordChildren.slice(3).forEach((e, j) => {
e?.recordChildren.forEach((n, i) => {
if (i) {
const cur = detail.value[j];
result.push({
answerId1: e.id,
answerId2: n.id,
subjectId: n.subjectId,
id: cur ? cur?.dimensionIndexList[i - 1]?.id : '',
dimensionId: cur ? cur?.dimensionId : '',
strategyId: cur ? cur?.strategyId : '',
name: e.name,
sub: n.name,
isChoose: cur ? !!cur?.isChoose : false,
score: cur ? cur?.dimensionIndexList[i - 1]?.score + '' : '0',
span: i === 1 ? 1 : 0,
parent: i === 1 ? '' : j,
itemList: n?.subject?.itemList || [],
});
}
});
});
list.value = result;
loading.close();
};
//
const getDetail = async () => {
loading = ElLoading.service();
if (id.value) {
try {
const res = await findCredit(id.value);
const info = res.scoringStrategy;
if (info) {
detail.value = info.dimensionOfTheRatingTableList;
form.checkpointId = info.checkpointId;
form.description = info.description;
form.projectId = info.projectId;
form.scoreCardName = info.scoreCardName;
form.scoringObject = info.scoringObject;
}
getConfig();
} finally {
}
} else {
getConfig();
detail.value = [];
form.checkpointId = levelId;
form.description = '';
form.projectId = projectId;
form.scoreCardName = '';
form.scoringObject = 0;
}
};
watch(
() => route.query,
() => {
getDetail();
},
{
immediate: true,
},
);
interface SpanMethodProps {
row: Record<string, any>;
column: TableColumnCtx<Record<string, any>>;
rowIndex: number;
columnIndex: number;
}
//
const span = ({ row, column, rowIndex, columnIndex }: SpanMethodProps) => {
if (!columnIndex || columnIndex === 1) {
if (!rowIndex || rowIndex === 31) {
return {
rowspan: 5,
colspan: 1,
};
} else if (rowIndex === 5 || rowIndex === 11 || rowIndex === 39 || rowIndex === 53) {
return {
rowspan: 2,
colspan: 1,
};
} else if (rowIndex === 7 || rowIndex === 13 || rowIndex === 17 || rowIndex === 27 || rowIndex === 41 || rowIndex === 45 || rowIndex === 49) {
return {
rowspan: 4,
colspan: 1,
};
} else if (rowIndex === 21 || rowIndex === 24 || rowIndex === 36) {
return {
rowspan: 3,
colspan: 1,
};
} else {
return {
rowspan: 0,
colspan: 0,
};
}
}
};
//
const submit = async () => {
if (!form.scoreCardName) return ElMessage.error('请输入评分卡名称');
loading = ElLoading.service();
const param = [];
list.value.forEach((e) => {
if (e.span) {
param.push({
dimensionId: e.dimensionId,
strategyId: e.strategyId,
recordName: e.name,
isChoose: +e.isChoose,
dimensionIndexList: [
{
id: e.id,
dimensionId: e.dimensionId,
recordName: e.sub,
score: e.score,
},
],
});
} else {
param[e.parent].dimensionIndexList.push({
id: e.id,
dimensionId: e.dimensionId,
recordName: e.sub,
score: e.score,
});
}
});
await saveCredit({
...form,
dimensionOfTheRatingTableList: param,
});
addRecord();
ElMessage.success('提交成功!');
emit('getList', 1);
id.value && getDetail();
};
//
const addRecord = async () => {
const isEnterprise = form.scoringObject;
const preIds = `1,${Cookies.get('sand-level')},42,148,${form.scoringObject ? 513 : 512}`; // 1id/512/513
const lcRule: Array<Record<string, any>> = [handleId(514, 190, form.scoreCardName, preIds + ',514', 3), handleId(515, 191, form.scoringObject ? 392 : 391, preIds + ',515', 1)];
//
if (isEnterprise) {
lcRule.push(
handleId(120, 44, data.accountMaterials, preIds + ',112,120', 1),
handleId(121, 45, 162, preIds + ',112,121', 1),
handleId(122, 46, data.loanApplicationMethod, preIds + ',113,122', 1),
handleId(123, 47, data.borrowerMaterial, preIds + ',113,123', 1),
handleId(124, 48, data.collateral, preIds + ',113,124', 1),
handleId(125, 49, data.businessMaterials, preIds + ',113,125', 1),
handleId(126, 50, data.supplementaryMaterials, preIds + ',113,126', 1),
handleId(127, 51, data.runBatchObject, preIds + ',114,127', 1),
handleId(128, 52, data.accessStrategy, preIds + ',114,128', 1),
);
data.personalCreditScoringStrategiesCheck && lcRule.push(handleId(129, 53, '240,' + data.personalCreditScoringStrategies, preIds + ',114,129', 1));
data.corporateCreditScoringStrategiesCheck && lcRule.push(handleId(129, 53, '241,' + data.corporateCreditScoringStrategies, preIds + ',114,129', 1));
lcRule.push(handleId(130, 54, data.riskDegreeStrategy, preIds + ',114,130', 1));
data.interestRatePricingModelCheck && lcRule.push(handleId(131, 55, '247,' + data.interestRatePricingModel, preIds + ',114,131', 1));
data.individualInterestRateModel && lcRule.push(handleId(131, 55, data.individualInterestRateModel, preIds + ',114,131', 1));
lcRule.push(
handleId(132, 56, data.dueDiligenceMode, preIds + ',115,132', 1),
handleId(133, 57, data.dueDiligenceContent, preIds + ',115,133', 1),
handleId(134, 58, data.reviewContent, preIds + ',116,134', 1),
handleId(135, 59, data.reviewSignature, preIds + ',116,135', 1),
handleId(136, 60, data.reviewApproveContent, preIds + ',117,136', 1),
handleId(137, 61, data.approvalSignature, preIds + ',117,137', 1),
handleId(138, 62, data.contractMaterials, preIds + ',118,138', 1),
);
data.loanContract && lcRule.push(handleId(139, 63, data.loanContract, preIds + ',118,139', 1));
data.mortgageContract && lcRule.push(handleId(139, 63, data.mortgageContract, preIds + ',118,139', 1));
data.pledgeContract && lcRule.push(handleId(139, 63, data.pledgeContract, preIds + ',118,139', 1));
data.guaranteeContract && lcRule.push(handleId(139, 63, data.guaranteeContract, preIds + ',118,139', 1));
lcRule.push(handleId(140, 64, data.selectionStrategy, preIds + ',119,140', 1));
} else {
form.description && lcRule.push(handleId(516, 192, '94,' + form.description, preIds + ',516', 3));
list.value.forEach((e) => {
if (e.span) {
// e.isChoose && lcRule.push(handleId(e.answerId2, '', '', preIds + ',' + e.answerId1 + ',' + e.answerId2, ''))
e.isChoose && lcRule.push(handleId(518, '', '', preIds + ',' + e.answerId1 + ',518', ''));
} else {
lcRule.push(handleId(e.answerId2, e.subjectId, e?.itemList?.find((n) => n.options == e.score)?.itemId || '', preIds + ',' + e.answerId1 + ',' + e.answerId2, 1));
}
});
}
await addOperation({
checkpointId: levelId,
parentId: preIds,
lcJudgmentRuleReq: lcRule,
projectId,
});
};
</script>
<style lang="scss" scoped>
@import url(../../../styles/form.scss);
</style>
Loading…
Cancel
Save