feat: 客商列表风险列改读落库字段并支持字典筛选与后台明细悬浮展示
This commit is contained in:
@@ -49,24 +49,24 @@
|
||||
</template>
|
||||
<template #customerRisk="{ row }">
|
||||
<el-tooltip
|
||||
v-if="customerRiskMap[row.customerCode] && customerRiskMap[row.customerCode].risky"
|
||||
v-if="customerRowRisky(row)"
|
||||
placement="top"
|
||||
effect="dark"
|
||||
popper-class="customer-risk-popper"
|
||||
>
|
||||
<template #content>
|
||||
<div>{{ customerRiskMap[row.customerCode].riskTip || '该客商为高风险/黑名单客商' }}</div>
|
||||
<div>{{ row.hcsRiskDetail || '该客商为高风险/黑名单客商' }}</div>
|
||||
</template>
|
||||
<el-tag type="danger" class="status-text">
|
||||
{{ customerRiskLabel(customerRiskMap[row.customerCode]) }}
|
||||
{{ customerRowRiskName(row) }}
|
||||
</el-tag>
|
||||
</el-tooltip>
|
||||
<el-tag
|
||||
v-else-if="customerRiskMap[row.customerCode]"
|
||||
:type="customerRiskMap[row.customerCode].fdRiskLevel === '1' ? 'warning' : 'success'"
|
||||
v-else-if="customerRowRiskName(row)"
|
||||
:type="row.hcsRiskLevel === '1' ? 'warning' : 'success'"
|
||||
class="status-text"
|
||||
>
|
||||
{{ customerRiskLabel(customerRiskMap[row.customerCode]) }}
|
||||
{{ customerRowRiskName(row) }}
|
||||
</el-tag>
|
||||
<span v-else>-</span>
|
||||
</template>
|
||||
@@ -1597,7 +1597,7 @@ import {
|
||||
queryKingdeeCustomer,
|
||||
syncKingdee,
|
||||
} from '@/api/vehicle/customer-archive';
|
||||
import { getRiskBatch, getRiskByName } from '@/api/business/hcs';
|
||||
import { getRiskByName } from '@/api/business/hcs';
|
||||
import {
|
||||
getList as getCreditScoreQuantificationList,
|
||||
getDetail as getCreditScoreQuantificationDetail,
|
||||
@@ -1699,7 +1699,6 @@ export default {
|
||||
deptSearchInitialized: false,
|
||||
loading: true,
|
||||
data: [],
|
||||
customerRiskMap: {},
|
||||
archiveNameRisky: false,
|
||||
archiveNameRiskTip: '',
|
||||
page: {
|
||||
@@ -1963,7 +1962,17 @@ export default {
|
||||
label: '客商风险',
|
||||
prop: 'customerRisk',
|
||||
slot: true,
|
||||
search: true,
|
||||
searchType: 'select',
|
||||
searchOrder: 4,
|
||||
searchPlaceholder: '请选择',
|
||||
minWidth: 100,
|
||||
dicData: [
|
||||
{ label: '黑名单', value: 'blacklist' },
|
||||
{ label: '高风险', value: 'high' },
|
||||
{ label: '中风险', value: 'middle' },
|
||||
{ label: '低风险', value: 'low' },
|
||||
],
|
||||
},
|
||||
{
|
||||
label: '客户性质',
|
||||
@@ -3157,6 +3166,15 @@ export default {
|
||||
});
|
||||
},
|
||||
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 => {
|
||||
const customerNatureColumn = this.findColumn(this.option.column, 'customerNature');
|
||||
customerNatureColumn.dicData = [{ label: '全部', value: '' }, ...options];
|
||||
@@ -5534,17 +5552,20 @@ export default {
|
||||
const pageData = res.data.data;
|
||||
this.page.total = pageData.total;
|
||||
this.data = pageData.records;
|
||||
this.loadCustomerRisk(this.data);
|
||||
this.selectionClear();
|
||||
})
|
||||
.finally(() => {
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
// 客商风险标签文案:后端 riskLevelName 转义(黑名单/高风险/中风险/低风险),缺失时兜底
|
||||
customerRiskLabel(risk) {
|
||||
if (!risk) return '';
|
||||
return risk.riskLevelName || (risk.risky ? '风险客商' : '正常');
|
||||
// 客商风险名称(C101-1 每日定时刷新落库字段):黑名单优先,等级转义,未查询返回空展示"-"
|
||||
customerRowRiskName(row) {
|
||||
if (row.hcsBlackStatus === 'yes') return '黑名单';
|
||||
return { 2: '高风险', 1: '中风险', 0: '低风险' }[row.hcsRiskLevel] || '';
|
||||
},
|
||||
// 高风险/黑名单判定(与列表筛选口径一致,命中显示红色标签)
|
||||
customerRowRisky(row) {
|
||||
return row.hcsBlackStatus === 'yes' || row.hcsRiskLevel === '2';
|
||||
},
|
||||
// 客商名称风险校验(C101-1,仅展示不作为安全边界):名称失焦/回显时查询,
|
||||
// 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() {
|
||||
this.$confirm('是否导出客商档案数据?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
|
||||
Reference in New Issue
Block a user