增加流量卡状态信息,对流量信息上提进行调整,取消超过500MB进行的警告整行标黄和上提功能,仅保留流量数字标黄

This commit is contained in:
DXC
2026-01-22 10:55:41 +08:00
parent cb567b2c7d
commit 195c3f8fa4
3 changed files with 100 additions and 89 deletions

View File

@ -136,6 +136,22 @@
</template>
</el-table-column>
<el-table-column label="卡状态" width="110" align="center">
<template #default="{ row }">
<div v-if="row.isBound">
<el-tag
:type="getCardStatusType(row.statusDesc)"
effect="light"
size="small"
style="font-weight: bold;"
>
{{ row.statusDesc || '未知' }}
</el-tag>
</div>
<span v-else style="color: #ccc;">--</span>
</template>
</el-table-column>
<el-table-column label="服务截止" width="140">
<template #default="{ row }">
<div v-if="row.isBound && row.stopDate">
@ -277,6 +293,15 @@ const showAddDialog = ref(false)
const isAdding = ref(false)
const newDeviceForm = reactive({ name: '', site: '' })
// === 辅助函数:根据中文状态返回 Tag 颜色 ===
const getCardStatusType = (status) => {
if (status === '在使用') return 'success' // 绿色
if (status === '停机' || status === '销户') return 'danger' // 红色
if (status === '停机保号' || status === '沉默期') return 'warning' // 黄色
if (status === '测试期') return 'info' // 灰色
return 'info' // 默认
}
// === 核心数据处理逻辑 ===
const fetchData = async () => {
loading.value = true
@ -367,7 +392,9 @@ const fetchData = async () => {
if (isNaN(trafficNum)) trafficNum = 0
}
// === 修改处:恢复流量超标警告判断,用于标黄 ===
const trafficWarning = (trafficNum >= 500 && !isWhitelist)
let expireWarning = false
if (item.stopDate && item.stopDate !== 'N/A') {
const stopD = new Date(item.stopDate.replace(/_/g, '-'))
@ -395,10 +422,10 @@ const fetchData = async () => {
} else if (diffHours > 24) {
statusLabel = '滞后'; statusColor = '#E6A23C'; statusType = 'warning';
statusReason = `滞后 ${Math.floor(diffDays)}`;
} else if (trafficWarning) {
statusLabel = '流量警告'; statusColor = '#E6A23C'; statusType = 'warning';
statusReason = `流量超标`;
sortWeight = 500;
// === 注意:这里没有把 trafficWarning 加入到 sortWeight 或 statusType 的改变逻辑中 ===
// 从而实现了“只标黄文字,不改变行状态,不置顶”
} else if (expireWarning) {
statusLabel = '即将过期'; statusColor = '#E6A23C'; statusType = 'warning';
statusReason = `即将过期`;
@ -412,7 +439,7 @@ const fetchData = async () => {
return {
...item,
latest_time: displayTime, // <--- 这里使用了我们格式化好的漂亮时间
latest_time: displayTime,
is_hidden: isHidden,
isOrphanIoT,
isBound,
@ -550,4 +577,4 @@ onBeforeUnmount(() => window.removeEventListener('resize', updateDimensions))
.search-input { width: 100%; margin-top: 5px; }
.total-usage-tag { width: 100%; justify-content: center; margin: 5px 0 0 0; }
}
</style>
</style>