修改客商变更记录

This commit is contained in:
2026-08-14 15:20:22 +08:00
parent 230110c486
commit e50391f4a5
+85 -2
View File
@@ -655,7 +655,7 @@
<el-image-viewer v-if="qualificationImagePreviewVisible" :url-list="qualificationImagePreviewUrls" :initial-index="qualificationImagePreviewIndex" @close="qualificationImagePreviewVisible = false" />
<section-card title="变更记录">
<el-table :data="changeRecordPage.records" border>
<el-table :data="changeRecordPage.records" border :show-overflow-tooltip="false">
<el-table-column
label="序号"
type="index"
@@ -1921,7 +1921,83 @@ export default {
const column = (this.option.column || []).find(item => item.prop === field);
return column?.label || field;
},
normalizeChangeFieldValue(value) {
if (typeof value !== 'string') return value;
const text = value.trim();
if (!text || (!text.startsWith('[') && !text.startsWith('{') && text !== 'null')) {
return value;
}
try {
return JSON.parse(text);
} catch (error) {
return value;
}
},
isEmptyChangeValue(value) {
const normalized = this.normalizeChangeFieldValue(value);
if (normalized === undefined || normalized === null || normalized === '' || normalized === '-1') {
return true;
}
if (Array.isArray(normalized)) return normalized.length === 0;
if (typeof normalized === 'object') return Object.keys(normalized).length === 0;
return false;
},
formatScoreChangeValue(value) {
const scores = Array.isArray(value) ? value : [value];
const categoryNames = { basic: '基础得分项', plus: '加分项目', minus: '减分项目' };
return scores
.filter(item => item && typeof item === 'object')
.map((score, index) => {
const summary = [
score.scoreDate && `评分日期:${score.scoreDate}`,
score.selfScore !== undefined && score.selfScore !== ''
? `自评得分:${this.formatScoreValue(score.selfScore)}`
: '',
score.reviewScore !== undefined && score.reviewScore !== ''
? `复评得分:${this.formatScoreValue(score.reviewScore)}`
: '',
score.finalScore !== undefined && score.finalScore !== ''
? `最终得分:${this.formatScoreValue(score.finalScore)}`
: '',
score.creditLevel ? `信用等级:${score.creditLevel}` : '',
].filter(Boolean);
const scoreDetails = this.normalizeChangeFieldValue(score.details);
const details = (Array.isArray(scoreDetails) ? scoreDetails : [])
.map(detail => {
const category =
detail.categoryName ||
categoryNames[this.getScoreDetailCategoryCode(detail)] ||
'';
const itemName = detail.itemName || '评分项目';
const option = detail.selectedOption || detail.scoreDescription || '';
const points = [
detail.selfScore !== undefined && detail.selfScore !== ''
? `自评${this.formatScoreValue(detail.selfScore)}分`
: '',
detail.reviewScore !== undefined && detail.reviewScore !== ''
? `复评${this.formatScoreValue(detail.reviewScore)}分`
: '',
].filter(Boolean);
if (
!points.length &&
detail.score !== undefined &&
detail.score !== '' &&
detail.score !== -1 &&
detail.score !== '-1'
) {
points.push(`得分${this.formatScoreValue(detail.score)}分`);
}
const label = `${category ? `${category}-` : ''}${itemName}`;
return `${label}${option ? `${option}` : ''}${points.length ? `${points.join('')}` : ''}`;
})
.filter(Boolean);
if (details.length) summary.push(`评分明细:${details.join('')}`);
return summary.length ? summary.join('') : `第${index + 1}条评分`;
})
.join('');
},
formatChangeFieldValue(field, value) {
value = this.normalizeChangeFieldValue(value);
if (value === undefined || value === null || value === '' || value === '-1') return '空';
const normalizedField = {
准入类型: 'accessType',
@@ -1931,6 +2007,9 @@ export default {
状态: 'status',
客户类型: 'customerType',
}[field] || field;
if (normalizedField === '评分信息' || normalizedField === 'scores') {
return this.formatScoreChangeValue(value) || '空';
}
const valueMap = {
accessType: { temporary: '临时', formal: '正式' },
approvalStatus: {
@@ -1962,7 +2041,11 @@ export default {
const afterData = this.parseChangeData(row.afterData);
const fields = [...new Set([...Object.keys(beforeData), ...Object.keys(afterData)])];
const details = fields
.filter(field => field !== '变更内容')
.filter(
field =>
field !== '变更内容' &&
!(this.isEmptyChangeValue(beforeData[field]) && this.isEmptyChangeValue(afterData[field]))
)
.map(field => {
const before = this.formatChangeFieldValue(field, beforeData[field]);
const after = this.formatChangeFieldValue(field, afterData[field]);