修复业务模块bug
This commit is contained in:
@@ -664,22 +664,19 @@
|
||||
:index="changeRecordIndex"
|
||||
/>
|
||||
<el-table-column label="变更日期" prop="changeTime" min-width="170" sortable />
|
||||
<el-table-column label="变更字段" prop="changedFields" min-width="180" />
|
||||
<el-table-column
|
||||
label="原数据"
|
||||
prop="beforeData"
|
||||
min-width="240"
|
||||
show-overflow-tooltip
|
||||
:formatter="formatChangeData"
|
||||
/>
|
||||
<el-table-column
|
||||
label="修改后数据"
|
||||
prop="afterData"
|
||||
min-width="240"
|
||||
show-overflow-tooltip
|
||||
:formatter="formatChangeData"
|
||||
/>
|
||||
<el-table-column label="变更内容" prop="changeContent" min-width="180" />
|
||||
label="变更内容"
|
||||
min-width="560"
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<el-tooltip placement="top" :show-after="200">
|
||||
<template #content>
|
||||
<div class="change-record-content-tooltip">{{ formatChangeContent(row) }}</div>
|
||||
</template>
|
||||
<span class="change-record-content-cell">{{ formatChangeContent(row) }}</span>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="变更账号" prop="changeUserName" min-width="160" />
|
||||
</el-table>
|
||||
<empty-pagination
|
||||
@@ -1882,17 +1879,98 @@ export default {
|
||||
changeRecordIndex(index) {
|
||||
return (this.changeRecordPage.currentPage - 1) * this.changeRecordPage.pageSize + index + 1;
|
||||
},
|
||||
formatChangeData(row, column, value) {
|
||||
if (!value || value === '-1') return '';
|
||||
parseChangeData(value) {
|
||||
if (!value || value === '-1') return {};
|
||||
if (typeof value === 'object') return this.replaceNegativeOneWithBlank(value);
|
||||
const text = String(value).trim();
|
||||
if (!text || text === '-1') return {};
|
||||
try {
|
||||
const data = this.replaceNegativeOneWithBlank(JSON.parse(value));
|
||||
return Object.entries(data)
|
||||
.map(([field, fieldValue]) => `${field}:${fieldValue ?? ''}`)
|
||||
.join(';');
|
||||
const parsed = JSON.parse(text);
|
||||
return parsed && typeof parsed === 'object'
|
||||
? this.replaceNegativeOneWithBlank(parsed)
|
||||
: { 变更内容: parsed };
|
||||
} catch (error) {
|
||||
return value;
|
||||
return text.split(/[;;]/).reduce((data, item) => {
|
||||
const match = item.trim().match(/^([^::]+)\s*[::]\s*(.*)$/);
|
||||
if (match) data[match[1].trim()] = match[2].trim();
|
||||
return data;
|
||||
}, {});
|
||||
}
|
||||
},
|
||||
getChangeFieldLabel(field) {
|
||||
const fieldLabelMap = {
|
||||
accessType: '准入标准',
|
||||
approvalStatus: '审核状态',
|
||||
currentNode: '当前节点',
|
||||
currentProcessor: '当前处理人',
|
||||
customerCode: '客商编号',
|
||||
shortName: '客商简称',
|
||||
fullName: '客商名称',
|
||||
customerType: '客户类型',
|
||||
customerNature: '客户性质',
|
||||
unifiedCreditCode: '统一信用代码',
|
||||
deptName: '所属组织',
|
||||
approvedTime: '审核通过时间',
|
||||
status: '状态',
|
||||
businessTermType: '营业期限类型',
|
||||
registeredRegionName: '注册地址',
|
||||
registeredDetailAddress: '详细地址',
|
||||
invoiceType: '发票类型',
|
||||
};
|
||||
if (fieldLabelMap[field]) return fieldLabelMap[field];
|
||||
const column = (this.option.column || []).find(item => item.prop === field);
|
||||
return column?.label || field;
|
||||
},
|
||||
formatChangeFieldValue(field, value) {
|
||||
if (value === undefined || value === null || value === '' || value === '-1') return '空';
|
||||
const normalizedField = {
|
||||
准入类型: 'accessType',
|
||||
准入标准: 'accessType',
|
||||
审批状态: 'approvalStatus',
|
||||
审核状态: 'approvalStatus',
|
||||
状态: 'status',
|
||||
客户类型: 'customerType',
|
||||
}[field] || field;
|
||||
const valueMap = {
|
||||
accessType: { temporary: '临时', formal: '正式' },
|
||||
approvalStatus: {
|
||||
draft: '草稿',
|
||||
reviewing: '审核中',
|
||||
approved: '审核通过',
|
||||
rejected: '审核不通过',
|
||||
},
|
||||
status: { 1: '启用', 2: '停用', 0: '停用' },
|
||||
};
|
||||
if (Array.isArray(value)) {
|
||||
return value.map(item => this.formatChangeFieldValue(normalizedField, item)).join('、');
|
||||
}
|
||||
if (valueMap[normalizedField]?.[value] !== undefined) {
|
||||
return valueMap[normalizedField][value];
|
||||
}
|
||||
if (normalizedField === 'customerType') {
|
||||
return String(value)
|
||||
.split(/[,,]/)
|
||||
.map(item => ({ customer: '客户', carrier: '承运商' }[item.trim()] || item.trim()))
|
||||
.filter(Boolean)
|
||||
.join('、');
|
||||
}
|
||||
if (typeof value === 'object') return JSON.stringify(value);
|
||||
return String(value);
|
||||
},
|
||||
formatChangeContent(row) {
|
||||
const beforeData = this.parseChangeData(row.beforeData);
|
||||
const afterData = this.parseChangeData(row.afterData);
|
||||
const fields = [...new Set([...Object.keys(beforeData), ...Object.keys(afterData)])];
|
||||
const details = fields
|
||||
.filter(field => field !== '变更内容')
|
||||
.map(field => {
|
||||
const before = this.formatChangeFieldValue(field, beforeData[field]);
|
||||
const after = this.formatChangeFieldValue(field, afterData[field]);
|
||||
return `${this.getChangeFieldLabel(field)}:变更前:${before} → 变更后:${after}`;
|
||||
});
|
||||
const content = String(row.changeContent || '').trim();
|
||||
return [content, ...details].filter(Boolean).join(';');
|
||||
},
|
||||
emptyContact() {
|
||||
return {
|
||||
contactName: '',
|
||||
@@ -4108,6 +4186,21 @@ export default {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.change-record-content-cell {
|
||||
display: block;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.change-record-content-tooltip {
|
||||
max-width: 900px;
|
||||
max-height: 320px;
|
||||
overflow: auto;
|
||||
white-space: pre-wrap;
|
||||
word-break: break-word;
|
||||
}
|
||||
|
||||
:deep(.archive-dialog .el-dialog__body) {
|
||||
max-height: 72vh;
|
||||
overflow: auto;
|
||||
|
||||
Reference in New Issue
Block a user