feat(通知): 四级严重度与严重度/时间双排序,客户端与后台管理同步

通知表新增 severity(紧急/高危/中危/低危,V161),由 scene + level 推导且
不回改 level:老客户端配色不受影响,secret_balance 的余量偏低与欠费也能分档。
列表与聚合接口默认按严重度倒序(同档按时间倒序),sort=time 切纯时间排序;
聚合组取组内最高严重度。两端铃铛加彩色等级标签与排序切换,展开明细沿用
同一排序,严重度排序下隐藏会跨天误导的日期头。
This commit is contained in:
2026-10-21 13:33:07 +08:00
parent f6aa04d0f2
commit 86d78160fd
23 changed files with 804 additions and 40 deletions
@@ -124,6 +124,25 @@
{{ option.label }}
</button>
</div>
<div class="bell-sort-chips" role="group" aria-label="通知排序">
<span class="bell-sort-label">排序</span>
<button
type="button"
class="bell-chip"
:class="{ 'is-active': sortMode === 'severity' }"
@click="setSortMode('severity')"
>
严重度
</button>
<button
type="button"
class="bell-chip"
:class="{ 'is-active': sortMode === 'time' }"
@click="setSortMode('time')"
>
时间
</button>
</div>
<div class="bell-search-days">
<el-date-picker
:model-value="dateRange"
@@ -179,7 +198,8 @@
<ul v-else class="bell-list">
<template v-for="(group, index) in groups" :key="notificationGroupKey(group)">
<li v-if="startsNewDay(index)" class="bell-day-head">{{ formatDayLabel(group.day) }}</li>
<!-- 严重度排序会跨天交错,日期头只在时间排序下有意义 -->
<li v-if="sortMode === 'time' && startsNewDay(index)" class="bell-day-head">{{ formatDayLabel(group.day) }}</li>
<li
class="bell-item bell-group"
:class="[`bell-item--${itemLevel(group)}`, { 'bell-group--open': isExpanded(group) }]"
@@ -188,6 +208,9 @@
<NotificationLevelIcon :level="itemLevel(group)" />
<div class="bell-item-main">
<div class="bell-item-head">
<span class="bell-severity-tag" :class="`bell-severity-tag--${itemSeverity(group)}`">
{{ severityLabel(group) }}
</span>
<span class="bell-item-title" :title="group.title">{{ group.title }}</span>
<span
class="bell-item-dot"
@@ -217,6 +240,9 @@
<NotificationLevelIcon :level="itemLevel(item)" />
<div class="bell-item-main">
<div class="bell-item-head">
<span class="bell-severity-tag" :class="`bell-severity-tag--${itemSeverity(item)}`">
{{ severityLabel(item) }}
</span>
<span class="bell-item-title" :title="item.title">{{ item.title }}</span>
<span class="bell-item-dot" :class="{ 'bell-item-dot--on': !item.read }" aria-hidden="true"></span>
<span class="bell-item-time">{{ formatTime(item.createdAt) }}</span>
@@ -275,6 +301,8 @@ import { NOTIFICATION_CATEGORY_OPTIONS } from '@/shared/api/types/modules/notifi
import {
PANEL_PAGE_SIZES as PAGE_SIZES,
itemLevel,
itemSeverity,
severityLabel,
startsNewDay as groupStartsNewDay,
useNotificationBellPanel,
} from '@/shared/composables/useNotificationBellPanel'
@@ -329,6 +357,8 @@ const {
resetFilters,
rowCount,
selectCategory,
setSortMode,
sortMode,
toggleGroup,
total,
totalPages,
@@ -718,6 +748,18 @@ onUnmounted(() => {
font-weight: 500;
}
.bell-sort-chips {
display: flex;
align-items: center;
gap: 6px;
}
.bell-sort-label {
margin-right: 2px;
color: var(--bell-text-mute);
font-size: 11px;
}
.bell-search-days {
display: flex;
align-items: center;
@@ -933,6 +975,56 @@ onUnmounted(() => {
white-space: nowrap;
}
.bell-severity-tag {
flex: 0 0 auto;
padding: 1px 6px;
border: 1px solid currentColor;
border-radius: 999px;
font-size: 10.5px;
font-weight: 600;
line-height: 1.5;
}
.bell-severity-tag--urgent {
background: rgba(255, 123, 123, 0.12);
color: #ff7b7b;
}
.bell-severity-tag--high {
background: rgba(240, 187, 97, 0.12);
color: #f0bb61;
}
.bell-severity-tag--medium {
background: rgba(110, 168, 255, 0.12);
color: #6ea8ff;
}
.bell-severity-tag--low {
background: rgba(147, 161, 179, 0.12);
color: #93a1b3;
}
.bell-panel--light .bell-severity-tag--urgent {
background: #fdecec;
color: #c92a2a;
}
.bell-panel--light .bell-severity-tag--high {
background: #fdf3e2;
color: #b26a12;
}
.bell-panel--light .bell-severity-tag--medium {
background: #eaf2fb;
color: #2f6fb3;
}
.bell-panel--light .bell-severity-tag--low {
background: #f1f4f7;
color: #6b7c8e;
}
.bell-item--unread .bell-item-title {
color: var(--bell-text);
font-weight: 700;