del: 激活时间
All checks were successful
构建并部署前端到测试环境 / build-and-deploy (push) Successful in 4m39s

This commit is contained in:
sexygoat
2026-04-29 12:49:30 +08:00
parent 175fe55be7
commit 9b4d956032

View File

@@ -79,7 +79,7 @@
</ElTableColumn>
<ElTableColumn label="变更内容" min-width="250">
<template #default="{ row }">
<div v-if="getChangeContent(row)" class="change-content">
<div v-if="getChangeContent(row).length" class="change-content">
<span
v-for="(change, index) in getChangeContent(row)"
:key="index"
@@ -87,14 +87,7 @@
>
<span class="field-name">{{ change.fieldName }}</span>
<span class="field-value">
<template v-if="change.beforeValue !== undefined">
<span class="old-value">{{ formatValue(change.beforeValue) }}</span>
<span class="arrow"></span>
<span class="new-value">{{ formatValue(change.afterValue) }}</span>
</template>
<template v-else>
<span class="new-value">{{ formatValue(change.afterValue) }}</span>
</template>
<span class="new-value">{{ formatFieldValue(change.key, change.afterValue) }}</span>
</span>
</span>
</div>
@@ -121,17 +114,17 @@
</template>
<script setup lang="ts">
import { ref, reactive, watch } from 'vue'
import { reactive, ref, watch } from 'vue'
import {
ElCard,
ElTable,
ElTableColumn,
ElTag,
ElButton,
ElSelect,
ElCard,
ElMessage,
ElOption,
ElPagination,
ElMessage
ElSelect,
ElTable,
ElTableColumn,
ElTag
} from 'element-plus'
import { AssetService } from '@/api/modules'
import type { AssetOperationLogItem } from '@/types/api'
@@ -143,8 +136,8 @@
}
interface ChangeItem {
key: string
fieldName: string
beforeValue?: any
afterValue?: any
}
@@ -291,19 +284,50 @@
return formatValue(value)
}
const sanitizeFieldName = (fieldName: string): string => {
return fieldName.trim().replace(/[^]*/g, '').trim()
}
const shouldHideIdField = (key: string, fieldName: string): boolean => {
const normalizedKey = key.trim()
const normalizedKeyLower = normalizedKey.toLowerCase()
const normalizedFieldName = sanitizeFieldName(fieldName)
const normalizedFieldNameUpper = normalizedFieldName.toUpperCase()
const visibleIdentifierKeys = new Set(['iccid', 'msisdn', 'imei', 'imsi', 'sn'])
const visibleIdentifierNames = ['ICCID', 'MSISDN', 'IMEI', 'IMSI', 'SN']
if (
visibleIdentifierKeys.has(normalizedKeyLower) ||
visibleIdentifierNames.some((name) => normalizedFieldNameUpper.endsWith(name))
) {
return false
}
return (
normalizedKeyLower === 'id' ||
normalizedKeyLower.endsWith('_id') ||
/^[a-z][a-z0-9]*Id$/.test(normalizedKey) ||
normalizedFieldName === '绑定记录ID' ||
normalizedFieldName === 'ID' ||
normalizedFieldName.endsWith('ID')
)
}
const getChangeContent = (row: AssetOperationLogItem): ChangeItem[] => {
const after = row.operation_content_after
const before = row.operation_content_before
const desc = row.operation_fields_desc || {}
if (!after || Object.keys(after).length === 0) return []
const changes: ChangeItem[] = []
for (const key of Object.keys(after)) {
const fieldName = desc[key] || key
const fieldName = sanitizeFieldName(desc[key] || key)
if (shouldHideIdField(key, fieldName)) continue
changes.push({
key,
fieldName,
beforeValue: before?.[key],
afterValue: after[key]
})
}
@@ -368,16 +392,6 @@
}
.field-value {
.old-value {
text-decoration: line-through;
color: var(--el-text-color-secondary);
}
.arrow {
color: var(--el-text-color-light);
margin: 0 4px;
}
.new-value {
color: var(--el-color-success);
}