feat: 完善接口19-顶部通知铃铛与站内通知中心
All checks were successful
构建并部署前端到测试环境 / build-and-deploy (push) Successful in 4m5s

This commit is contained in:
luo
2026-07-25 10:20:53 +08:00
parent eb13763020
commit 9289a6e940
37 changed files with 1264 additions and 226 deletions

View File

@@ -20,10 +20,10 @@
<div class="filters">
<ElSelect v-model="filters.category" clearable placeholder="通知分类" @change="reload">
<ElOption label="余额预警" value="balance" />
<ElOption label="临期提醒" value="expiry" />
<ElOption label="审批" value="approval" />
<ElOption label="同步/系统" value="system" />
<ElOption label="同步" value="sync" />
<ElOption label="系统" value="system" />
</ElSelect>
<ElSelect v-model="filters.type" clearable placeholder="通知类型" @change="reload">
<ElOption v-for="type in typeOptions" :key="type" :label="type" :value="type" />
@@ -32,11 +32,11 @@
<ElOption label="提示" value="info" />
<ElOption label="警告" value="warning" />
<ElOption label="严重" value="error" />
<ElOption label="成功" value="success" />
<ElOption label="严重" value="critical" />
</ElSelect>
<ElSelect v-model="filters.read_status" clearable placeholder="已读状态" @change="reload">
<ElOption label="未读" value="unread" />
<ElOption label="已读" value="read" />
<ElSelect v-model="filters.is_read" clearable placeholder="已读状态" @change="reload">
<ElOption label="未读" :value="false" />
<ElOption label="已读" :value="true" />
</ElSelect>
<ElButton @click="loadNotifications">刷新</ElButton>
</div>
@@ -59,7 +59,8 @@
</ElTag>
</template>
</ElTableColumn>
<ElTableColumn prop="content" label="通知内容" min-width="300" show-overflow-tooltip />
<ElTableColumn prop="body" label="通知内容" min-width="300" show-overflow-tooltip />
<ElTableColumn prop="read_at" label="已读时间" width="180" />
<ElTableColumn prop="created_at" label="时间" width="180" />
<ElTableColumn label="操作" width="100" fixed="right">
<template #default="scope">
@@ -118,11 +119,10 @@
category: undefined,
type: undefined,
severity: undefined,
read_status: undefined
is_read: undefined
})
const isRead = (item: NotificationItem) =>
item.read === true || item.is_read === true || item.read_status === 'read'
const isRead = (item: NotificationItem) => item.is_read
const getCategoryLabel = (category?: string | null) =>
({
@@ -137,14 +137,14 @@
'-'
const getSeverityLabel = (severity?: string | null) =>
({ info: '提示', warning: '警告', error: '严重', success: '成功' })[severity || ''] ||
({ info: '提示', warning: '警告', error: '严重', critical: '严重' })[severity || ''] ||
severity ||
'-'
const getSeverityType = (severity?: string | null) => {
if (severity === 'error') return 'danger'
if (severity === 'warning') return 'warning'
if (severity === 'success') return 'success'
if (severity === 'critical') return 'danger'
return 'info'
}
@@ -204,12 +204,12 @@
}
const targetResponse = await NotificationService.getTarget(item.id)
if (targetResponse.code !== 0 || !targetResponse.data) {
ElMessage.info(item.content || '该通知暂无可跳转目标')
ElMessage.info(item.body || '该通知暂无可跳转目标')
await loadNotifications()
return
}
if (!navigateNotificationTarget(router, targetResponse.data)) {
ElMessage.info(targetResponse.data.message || item.content || '该通知暂无可跳转目标')
ElMessage.info(item.body || '该通知暂无可跳转目标')
}
await loadNotifications()
} catch (error: any) {