feat(通知): 四级严重度与严重度/时间双排序,客户端与后台管理同步
通知表新增 severity(紧急/高危/中危/低危,V161),由 scene + level 推导且 不回改 level:老客户端配色不受影响,secret_balance 的余量偏低与欠费也能分档。 列表与聚合接口默认按严重度倒序(同档按时间倒序),sort=time 切纯时间排序; 聚合组取组内最高严重度。两端铃铛加彩色等级标签与排序切换,展开明细沿用 同一排序,严重度排序下隐藏会跨天误导的日期头。
This commit is contained in:
@@ -16,8 +16,10 @@ import {
|
||||
applyMarkReadToCounts,
|
||||
detailQueryFor,
|
||||
itemLevel,
|
||||
itemSeverity,
|
||||
latestIdWorthRecording,
|
||||
normalizedDayRange,
|
||||
severityLabel,
|
||||
startsNewDay,
|
||||
} from '@/layout/notification-bell-panel'
|
||||
|
||||
@@ -116,6 +118,23 @@ describe('通知面板层纯函数', () => {
|
||||
expect(itemLevel({ level: '' })).toBe('warning')
|
||||
})
|
||||
|
||||
it('四级严重度:后端给值原样用,旧后端缺字段按 level 兜底,绝不出现空标签', () => {
|
||||
expect(itemSeverity({ severity: 'urgent', level: 'warning' })).toBe('urgent')
|
||||
expect(itemSeverity({ severity: 'high' })).toBe('high')
|
||||
expect(itemSeverity({ severity: 'medium' })).toBe('medium')
|
||||
expect(itemSeverity({ severity: 'low' })).toBe('low')
|
||||
expect(itemSeverity({ level: 'error' })).toBe('urgent')
|
||||
expect(itemSeverity({ level: 'info' })).toBe('low')
|
||||
expect(itemSeverity({ level: 'warning' })).toBe('high')
|
||||
expect(itemSeverity({ level: '' })).toBe('high')
|
||||
expect(itemSeverity({ severity: 'fatal', level: 'warning' })).toBe('high')
|
||||
|
||||
expect(severityLabel({ severity: 'urgent' })).toBe('紧急')
|
||||
expect(severityLabel({ severity: 'high' })).toBe('高危')
|
||||
expect(severityLabel({ severity: 'medium' })).toBe('中危')
|
||||
expect(severityLabel({ severity: 'low' })).toBe('低危')
|
||||
})
|
||||
|
||||
it('已提醒水位只在首页真有数据时推进,取不到 id 就什么也不写', () => {
|
||||
expect(latestIdWorthRecording([])).toBe(0)
|
||||
expect(latestIdWorthRecording([group({ latestId: 0 })])).toBe(0)
|
||||
|
||||
Reference in New Issue
Block a user