diff --git a/src/views/business/loading-manage.vue b/src/views/business/loading-manage.vue index a8c0eca..112a057 100644 --- a/src/views/business/loading-manage.vue +++ b/src/views/business/loading-manage.vue @@ -1276,11 +1276,11 @@ export default { findWaybillId(row, waybillNo) { const rows = this.splitText(row.loadingSubNos); const index = rows.findIndex(item => item === waybillNo); - const linkedRows = this.parseJsonArray(row.waybillList || row.waybillRows || row.waybills); + const linkedRows = parseJsonArray(row.waybillList || row.waybillRows || row.waybills); if (linkedRows[index]?.id || linkedRows[index]?.waybillId) { return linkedRows[index].id || linkedRows[index].waybillId; } - const ids = this.parseJsonArray(row.waybillIdsJson); + const ids = parseJsonArray(row.waybillIdsJson); return ids[index] || ''; }, async openWaybillDetail(row = {}) { diff --git a/src/views/vehicle/customer-archive.vue b/src/views/vehicle/customer-archive.vue index 42531ce..1ac93f7 100644 --- a/src/views/vehicle/customer-archive.vue +++ b/src/views/vehicle/customer-archive.vue @@ -678,6 +678,11 @@ + + + 详情 + + + + + 变更日期:{{ changeRecordDetail.changeTime || '-' }} + 变更账号:{{ changeRecordDetail.changeUserName || '-' }} + + + + + + + + + 关闭 + + + {{ readonly ? '关闭' : '取消' }} 保存 @@ -1351,6 +1390,9 @@ export default { total: 0, records: [], }, + changeRecordDetailVisible: false, + changeRecordDetail: null, + changeRecordDetailRows: [], contactIndex: -1, contactForm: this.emptyContact(), contactMapBox: false, @@ -1916,6 +1958,9 @@ export default { registeredRegionName: '注册地址', registeredDetailAddress: '详细地址', invoiceType: '发票类型', + qualificationAttachments: '客商材料', + customerAttachments: '客商材料', + 客商材料: '客商材料', }; if (fieldLabelMap[field]) return fieldLabelMap[field]; const column = (this.option.column || []).find(item => item.prop === field); @@ -1996,6 +2041,68 @@ export default { }) .join(';'); }, + normalizeScoreChangeEntries(value) { + const normalized = this.normalizeChangeFieldValue(value); + if (Array.isArray(normalized)) return normalized; + return normalized && typeof normalized === 'object' ? [normalized] : []; + }, + formatScoreChangeDiff(beforeValue, afterValue) { + const beforeEntries = this.normalizeScoreChangeEntries(beforeValue); + const afterEntries = this.normalizeScoreChangeEntries(afterValue); + const size = Math.max(beforeEntries.length, afterEntries.length); + const fields = [ + ['scoreDate', '评分日期'], + ['selfScore', '自评得分'], + ['reviewScore', '复评得分'], + ['finalScore', '最终得分'], + ['creditLevel', '信用等级'], + ['details', '评分明细'], + ]; + const formatValue = (field, value) => { + if (field === 'details') { + return this.formatScoreChangeValue([{ details: value }]).replace(/^第\d+条评分$/, '空'); + } + if (value === undefined || value === null || value === '' || value === '-1') return '空'; + return field.endsWith('Score') ? `${this.formatScoreValue(value)}分` : String(value); + }; + const before = []; + const after = []; + for (let index = 0; index < size; index += 1) { + const left = beforeEntries[index] || {}; + const right = afterEntries[index] || {}; + fields.forEach(([field, label]) => { + const leftValue = left[field]; + const rightValue = right[field]; + if (JSON.stringify(leftValue) === JSON.stringify(rightValue)) return; + const prefix = size > 1 ? `第${index + 1}条-${label}` : label; + before.push(`${prefix}:${formatValue(field, leftValue)}`); + after.push(`${prefix}:${formatValue(field, rightValue)}`); + }); + } + return { before: before.join(';') || '空', after: after.join(';') || '空' }; + }, + formatAttachmentChangeValue(value) { + const attachments = Array.isArray(value) + ? value + : value && typeof value === 'object' + ? [value] + : this.parseAttachments(value); + const names = attachments + .map(item => { + const fileName = + typeof item === 'string' + ? item + : item?.originalName || item?.name || item?.fileName || item?.url || item?.link || ''; + const name = String(fileName).trim().split('?')[0].split('/').pop(); + try { + return decodeURIComponent(name); + } catch (error) { + return name; + } + }) + .filter(Boolean); + return names.length ? names.join('、') : '空'; + }, formatChangeFieldValue(field, value) { value = this.normalizeChangeFieldValue(value); if (value === undefined || value === null || value === '' || value === '-1') return '空'; @@ -2006,7 +2113,11 @@ export default { 审核状态: 'approvalStatus', 状态: 'status', 客户类型: 'customerType', + 客商材料: 'qualificationAttachments', }[field] || field; + if (['qualificationAttachments', 'customerAttachments'].includes(normalizedField)) { + return this.formatAttachmentChangeValue(value); + } if (normalizedField === '评分信息' || normalizedField === 'scores') { return this.formatScoreChangeValue(value) || '空'; } @@ -2036,6 +2147,39 @@ export default { if (typeof value === 'object') return JSON.stringify(value); return String(value); }, + buildChangeRecordDetailRows(row = {}) { + const beforeData = this.parseChangeData(row.beforeData); + const afterData = this.parseChangeData(row.afterData); + const fields = [...new Set([...Object.keys(beforeData), ...Object.keys(afterData)])]; + const rows = fields + .filter( + field => + field !== '变更内容' && + !(this.isEmptyChangeValue(beforeData[field]) && this.isEmptyChangeValue(afterData[field])) + ) + .map(field => ({ + field: this.getChangeFieldLabel(field), + ...(this.isScoreChangeField(field) + ? this.formatScoreChangeDiff(beforeData[field], afterData[field]) + : { + before: this.formatChangeFieldValue(field, beforeData[field]), + after: this.formatChangeFieldValue(field, afterData[field]), + }), + })); + const content = String(row.changeContent || '').trim(); + if (content) { + rows.unshift({ field: '变更内容', before: '空', after: content }); + } + return rows; + }, + isScoreChangeField(field) { + return ['评分信息', 'scores'].includes(field); + }, + openChangeRecordDetail(row) { + this.changeRecordDetail = row; + this.changeRecordDetailRows = this.buildChangeRecordDetailRows(row); + this.changeRecordDetailVisible = true; + }, formatChangeContent(row) { const beforeData = this.parseChangeData(row.beforeData); const afterData = this.parseChangeData(row.afterData); @@ -2047,8 +2191,11 @@ export default { !(this.isEmptyChangeValue(beforeData[field]) && this.isEmptyChangeValue(afterData[field])) ) .map(field => { - const before = this.formatChangeFieldValue(field, beforeData[field]); - const after = this.formatChangeFieldValue(field, afterData[field]); + const scoreDiff = this.isScoreChangeField(field) + ? this.formatScoreChangeDiff(beforeData[field], afterData[field]) + : null; + const before = scoreDiff?.before || this.formatChangeFieldValue(field, beforeData[field]); + const after = scoreDiff?.after || this.formatChangeFieldValue(field, afterData[field]); return `${this.getChangeFieldLabel(field)}:变更前:${before} → 变更后:${after}`; }); const content = String(row.changeContent || '').trim(); @@ -3168,6 +3315,9 @@ export default { }, resetArchive() { this.readonly = false; + this.changeRecordDetailVisible = false; + this.changeRecordDetail = null; + this.changeRecordDetailRows = []; this.archiveForm = this.emptyArchive(); this.originalAccessType = ''; this.qualificationFiles = []; @@ -4284,6 +4434,27 @@ export default { word-break: break-word; } +:deep(.change-record-detail-dialog .el-dialog__body) { + max-height: 65vh; + overflow: auto; +} + +:deep(.change-record-detail-dialog .change-record-detail-value .cell) { + white-space: pre-wrap; + word-break: break-word; + overflow: visible; + text-overflow: clip; + line-height: 1.6; +} + +.change-record-detail-meta { + display: flex; + gap: 32px; + margin-bottom: 16px; + color: #606266; + font-size: 14px; +} + :deep(.archive-dialog .el-dialog__body) { max-height: 72vh; overflow: auto;