feat: 客商列表风险列改读落库字段并支持字典筛选与后台明细悬浮展示

This commit is contained in:
刘泉佳
2026-10-30 11:33:38 +08:00
parent 4b060fc045
commit 3397bd6a7b
+34 -30
View File
@@ -49,24 +49,24 @@
</template> </template>
<template #customerRisk="{ row }"> <template #customerRisk="{ row }">
<el-tooltip <el-tooltip
v-if="customerRiskMap[row.customerCode] && customerRiskMap[row.customerCode].risky" v-if="customerRowRisky(row)"
placement="top" placement="top"
effect="dark" effect="dark"
popper-class="customer-risk-popper" popper-class="customer-risk-popper"
> >
<template #content> <template #content>
<div>{{ customerRiskMap[row.customerCode].riskTip || '该客商为高风险/黑名单客商' }}</div> <div>{{ row.hcsRiskDetail || '该客商为高风险/黑名单客商' }}</div>
</template> </template>
<el-tag type="danger" class="status-text"> <el-tag type="danger" class="status-text">
{{ customerRiskLabel(customerRiskMap[row.customerCode]) }} {{ customerRowRiskName(row) }}
</el-tag> </el-tag>
</el-tooltip> </el-tooltip>
<el-tag <el-tag
v-else-if="customerRiskMap[row.customerCode]" v-else-if="customerRowRiskName(row)"
:type="customerRiskMap[row.customerCode].fdRiskLevel === '1' ? 'warning' : 'success'" :type="row.hcsRiskLevel === '1' ? 'warning' : 'success'"
class="status-text" class="status-text"
> >
{{ customerRiskLabel(customerRiskMap[row.customerCode]) }} {{ customerRowRiskName(row) }}
</el-tag> </el-tag>
<span v-else>-</span> <span v-else>-</span>
</template> </template>
@@ -1597,7 +1597,7 @@ import {
queryKingdeeCustomer, queryKingdeeCustomer,
syncKingdee, syncKingdee,
} from '@/api/vehicle/customer-archive'; } from '@/api/vehicle/customer-archive';
import { getRiskBatch, getRiskByName } from '@/api/business/hcs'; import { getRiskByName } from '@/api/business/hcs';
import { import {
getList as getCreditScoreQuantificationList, getList as getCreditScoreQuantificationList,
getDetail as getCreditScoreQuantificationDetail, getDetail as getCreditScoreQuantificationDetail,
@@ -1699,7 +1699,6 @@ export default {
deptSearchInitialized: false, deptSearchInitialized: false,
loading: true, loading: true,
data: [], data: [],
customerRiskMap: {},
archiveNameRisky: false, archiveNameRisky: false,
archiveNameRiskTip: '', archiveNameRiskTip: '',
page: { page: {
@@ -1963,7 +1962,17 @@ export default {
label: '客商风险', label: '客商风险',
prop: 'customerRisk', prop: 'customerRisk',
slot: true, slot: true,
search: true,
searchType: 'select',
searchOrder: 4,
searchPlaceholder: '请选择',
minWidth: 100, minWidth: 100,
dicData: [
{ label: '黑名单', value: 'blacklist' },
{ label: '高风险', value: 'high' },
{ label: '中风险', value: 'middle' },
{ label: '低风险', value: 'low' },
],
}, },
{ {
label: '客户性质', label: '客户性质',
@@ -3157,6 +3166,15 @@ export default {
}); });
}, },
initBusinessDictionaries() { initBusinessDictionaries() {
// 客商风险筛选项走业务字典 customer_risk(dictKey=筛选值 blacklist/high/middle/low,dictValue=名称),字典缺失保留固定兜底项
getDictionary({ code: 'customer_risk' }).then(res => {
const options = (res.data.data || [])
.filter(item => item.dictKey !== '-1')
.map(item => ({ label: item.dictValue, value: item.dictKey }));
if (options.length) {
this.findColumn(this.option.column, 'customerRisk').dicData = options;
}
});
this.loadDictOptions('nature_of_client', 'customerNatureOptions', [], options => { this.loadDictOptions('nature_of_client', 'customerNatureOptions', [], options => {
const customerNatureColumn = this.findColumn(this.option.column, 'customerNature'); const customerNatureColumn = this.findColumn(this.option.column, 'customerNature');
customerNatureColumn.dicData = [{ label: '全部', value: '' }, ...options]; customerNatureColumn.dicData = [{ label: '全部', value: '' }, ...options];
@@ -5534,17 +5552,20 @@ export default {
const pageData = res.data.data; const pageData = res.data.data;
this.page.total = pageData.total; this.page.total = pageData.total;
this.data = pageData.records; this.data = pageData.records;
this.loadCustomerRisk(this.data);
this.selectionClear(); this.selectionClear();
}) })
.finally(() => { .finally(() => {
this.loading = false; this.loading = false;
}); });
}, },
// 客商风险标签文案:后端 riskLevelName 转义(黑名单/高风险/中风险/低风险),缺失时兜底 // 客商风险名称(C101-1 每日定时刷新落库字段):黑名单优先,等级转义,未查询返回空展示"-"
customerRiskLabel(risk) { customerRowRiskName(row) {
if (!risk) return ''; if (row.hcsBlackStatus === 'yes') return '黑名单';
return risk.riskLevelName || (risk.risky ? '风险客商' : '正常'); return { 2: '高风险', 1: '中风险', 0: '低风险' }[row.hcsRiskLevel] || '';
},
// 高风险/黑名单判定(与列表筛选口径一致,命中显示红色标签)
customerRowRisky(row) {
return row.hcsBlackStatus === 'yes' || row.hcsRiskLevel === '2';
}, },
// 客商名称风险校验(C101-1,仅展示不作为安全边界):名称失焦/回显时查询, // 客商名称风险校验(C101-1,仅展示不作为安全边界):名称失焦/回显时查询,
// risky 在名称框下展示红色提示,悬浮见风险项明细;查询失败静默不阻断填写,提交链路由后端强校验兜底 // risky 在名称框下展示红色提示,悬浮见风险项明细;查询失败静默不阻断填写,提交链路由后端强校验兜底
@@ -5563,23 +5584,6 @@ export default {
// 忽略风险查询异常,表单正常填写 // 忽略风险查询异常,表单正常填写
}); });
}, },
// 客商列表风险批量查询(C101-1,仅展示不作为安全边界):失败静默,行内显示"-",提交链路由后端强校验兜底
loadCustomerRisk(rows) {
this.customerRiskMap = {};
const customerCodes = [...new Set(rows.map(row => row.customerCode).filter(Boolean))];
if (!customerCodes.length) return;
getRiskBatch(customerCodes)
.then(res => {
const riskMap = {};
((res.data && res.data.data) || []).forEach(risk => {
if (risk && risk.customerCode) riskMap[risk.customerCode] = risk;
});
this.customerRiskMap = riskMap;
})
.catch(() => {
// 忽略风险查询异常,列表正常展示
});
},
handleExport() { handleExport() {
this.$confirm('是否导出客商档案数据?', '提示', { this.$confirm('是否导出客商档案数据?', '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',