feat: 新增可配置通知中心,支持扫描式/埋点式通知规则与手动群发
新增通知规则实体、扫描任务、API与管理界面,重构站内通知支持用户/电工双类型,移除硬编码的证照到期提醒,新增工单派单、电工审核结果等通知触发场景,调整菜单与数据库结构适配新通知体系。
This commit is contained in:
1 parent
91aa3c06f0
commit
6cf6a3d5b9
36 files changed
+3309
-246
No files matched your search
@@ -373,18 +373,47 @@ function openNoticeDrawer() {
|
||||
async function handleNoticeClick(item: NoticeInfo) {
|
||||
if (item.isRead === 0) {
|
||||
try {
|
||||
await noticeApi.markRead(item.id)
|
||||
item.isRead = 1
|
||||
fetchUnreadCount()
|
||||
await noticeApi.markRead(item.id);
|
||||
item.isRead = 1;
|
||||
fetchUnreadCount();
|
||||
} catch (error) {
|
||||
// 标记失败不阻断后续跳转
|
||||
}
|
||||
}
|
||||
// 电工资质到期提醒 → 跳转电工登记管理
|
||||
if (item.bizType === 'worker_cert') {
|
||||
noticeVisible.value = false
|
||||
router.push('/dispatch/worker')
|
||||
const target = resolveNoticeRoute(item);
|
||||
if (target) {
|
||||
noticeVisible.value = false;
|
||||
router.push(target);
|
||||
}
|
||||
// 无映射关系时仅标记已读,不做跳转
|
||||
}
|
||||
|
||||
// 通知类型 / 业务类型 → 目标路由映射(无匹配返回 null)
|
||||
const NOTICE_TYPE_ROUTE: Record<string, string> = {
|
||||
// 电工资质证照到期提醒
|
||||
cert_expire: '/dispatch/worker',
|
||||
// 电工入驻审核结果通知
|
||||
worker_audit_result: '/dispatch/worker',
|
||||
// 兼容旧数据
|
||||
worker_cert: '/dispatch/worker',
|
||||
};
|
||||
|
||||
// 派单通知按工单业务类型跳转对应派单页
|
||||
const NOTICE_BIZ_ROUTE: Record<string, string> = {
|
||||
repair_dispatch: '/dispatch/repair',
|
||||
maintenance_order: '/dispatch/maintenance',
|
||||
install_order: '/project/install',
|
||||
survey_order: '/project/survey',
|
||||
};
|
||||
|
||||
function resolveNoticeRoute(item: NoticeInfo): string | null {
|
||||
const byType = NOTICE_TYPE_ROUTE[item.noticeType];
|
||||
if (byType) return byType;
|
||||
if (item.noticeType === 'dispatch_assign' && item.bizType) {
|
||||
return NOTICE_BIZ_ROUTE[item.bizType] || null;
|
||||
}
|
||||
// 业务类型兜底
|
||||
return item.bizType ? NOTICE_BIZ_ROUTE[item.bizType] || NOTICE_TYPE_ROUTE[item.bizType] || null : null;
|
||||
}
|
||||
|
||||
async function handleReadAll() {
|
||||
|
||||
Reference in new issue
Block a user