diff --git a/admin-frontend-vue/src/api/notifications.ts b/admin-frontend-vue/src/api/notifications.ts index fe00b1d0d..6b52333ba 100644 --- a/admin-frontend-vue/src/api/notifications.ts +++ b/admin-frontend-vue/src/api/notifications.ts @@ -1,11 +1,25 @@ import { http } from './http' import { unwrap } from './envelope' +/** 业务严重度:紧急 / 高危 / 中危 / 低危(后端按 scene + level 推导)。 */ +export type AdminNotificationSeverity = 'urgent' | 'high' | 'medium' | 'low' + +export type AdminNotificationSortMode = 'severity' | 'time' + +export const ADMIN_NOTIFICATION_SEVERITY_LABELS: Readonly> = { + urgent: '紧急', + high: '高危', + medium: '中危', + low: '低危', +} + /** 单条通知(后台铃铛)。 */ export interface AdminNotificationItem { id: number scene: string level: string + /** 业务严重度;旧后端不返回时前端按 level 兜底。 */ + severity?: string title: string content: string read: boolean @@ -38,6 +52,8 @@ export interface AdminNotificationGroup { rowCount: number unreadCount: number level: string + /** 组内最高严重度。 */ + severity?: string title: string content: string createdAt: string | null @@ -69,6 +85,8 @@ export interface AdminNotificationListParams { keyword?: string startDate?: string endDate?: string + /** 排序:severity(默认)或 time;默认值不下发。 */ + sort?: AdminNotificationSortMode /** 展开聚合组:三个条件取自该组自己返回的值,原样回传。 */ scene?: string day?: string @@ -90,6 +108,7 @@ export async function fetchNotificationGroups( keyword: keyword || undefined, startDate: params.startDate || undefined, endDate: params.endDate || undefined, + sort: params.sort === 'time' ? 'time' : undefined, }, }) return unwrap(data) @@ -107,6 +126,7 @@ export async function fetchNotificationList( keyword: keyword || undefined, startDate: params.startDate || undefined, endDate: params.endDate || undefined, + sort: params.sort === 'time' ? 'time' : undefined, scene: params.scene || undefined, day: params.day || undefined, subjectUserId: params.subjectUserId ?? undefined, diff --git a/admin-frontend-vue/src/components/NotificationBell.vue b/admin-frontend-vue/src/components/NotificationBell.vue index 81ff636da..b9f9ac1e9 100644 --- a/admin-frontend-vue/src/components/NotificationBell.vue +++ b/admin-frontend-vue/src/components/NotificationBell.vue @@ -75,6 +75,25 @@ 重置 +
+ 排序 + + +
正在加载...
@@ -82,13 +101,17 @@
{{ hasFilter ? '没有符合条件的通知' : '暂无通知' }}