diff --git a/apps/daxpay-admin/src/layouts/basic.vue b/apps/daxpay-admin/src/layouts/basic.vue index a0c9dbe27..be54d8bbb 100644 --- a/apps/daxpay-admin/src/layouts/basic.vue +++ b/apps/daxpay-admin/src/layouts/basic.vue @@ -1,32 +1,45 @@ + + diff --git a/apps/daxpay-admin/src/views/system/notify/notice/NoticeEdit.vue b/apps/daxpay-admin/src/views/system/notify/notice/NoticeEdit.vue index 99db2a3f1..a505c235c 100644 --- a/apps/daxpay-admin/src/views/system/notify/notice/NoticeEdit.vue +++ b/apps/daxpay-admin/src/views/system/notify/notice/NoticeEdit.vue @@ -15,29 +15,23 @@ const emits = defineEmits(['ok']); - const { message } = useMessage(); + const { confirm, message } = useMessage(); - const { - initFormEditType, - handleCancel, - labelCol, - wrapperCol, - visible, - title, - confirmLoading, - showable, - editable, - formEditType, - } = useFormEdit(); + const { initFormEditType, handleCancel, visible, title, confirmLoading, showable, editable, formEditType } = + useFormEdit(); const formRef = ref(); // 公告表单(时间用 dayjs 对象, 提交时转 ISO 字符串) const form = ref>({ severity: 'normal', isTop: false }); + // 正文初始内容(用于关闭时检测是否有未保存修改) + const loadedContent = ref(''); // 表单校验规则 const rules = { title: [{ required: true, message: $t('system.notify.inputTitle') }], content: [{ required: true, message: $t('system.notify.inputContent') }], + severity: [{ required: true, message: $t('system.notify.severityRequired') }], + isTop: [{ required: true, message: $t('system.notify.isTopRequired') }], }; // 重要程度选项 @@ -68,6 +62,8 @@ effectiveTime: data.effectiveTime ? dayjs(data.effectiveTime) : undefined, expireTime: data.expireTime ? dayjs(data.expireTime) : undefined, }; + // 记录正文初始值, 用于关闭时检测变动 + loadedContent.value = data.content ?? ''; confirmLoading.value = false; }); } else { @@ -82,9 +78,26 @@ nextTick(() => { formRef.value?.resetFields(); form.value = { severity: 'normal', isTop: false }; + loadedContent.value = ''; }); } + /** + * 关闭抽屉(正文有未保存修改时二次确认) + */ + function closeWithConfirm() { + const content = form.value.content ?? ''; + if (content && content !== loadedContent.value) { + confirm({ + title: $t('common.warning'), + content: $t('system.notify.confirmCloseContent'), + onOk: () => handleCancel(), + }); + } else { + handleCancel(); + } + } + /** * 提交 */ @@ -116,76 +129,119 @@ + + diff --git a/apps/daxpay-admin/src/views/system/notify/notice/NoticeList.vue b/apps/daxpay-admin/src/views/system/notify/notice/NoticeList.vue index 426abd674..268a4df80 100644 --- a/apps/daxpay-admin/src/views/system/notify/notice/NoticeList.vue +++ b/apps/daxpay-admin/src/views/system/notify/notice/NoticeList.vue @@ -226,6 +226,9 @@
-
+
{{ $t('ui.widgets.notifications') }}
@@ -175,17 +165,7 @@ function navigateTo(
-
- - {{ $t('ui.widgets.clearNotifications') }} - +
{{ $t('ui.widgets.viewAll') }} diff --git a/packages/effects/layouts/src/widgets/notification/types.ts b/packages/effects/layouts/src/widgets/notification/types.ts index 4b684f280..d868a8d77 100644 --- a/packages/effects/layouts/src/widgets/notification/types.ts +++ b/packages/effects/layouts/src/widgets/notification/types.ts @@ -1,6 +1,18 @@ interface NotificationItem { id: number | string; - avatar: string; + avatar?: string; + /** + * 通知类型(notice 公告 / message 个人消息), 用于切换图标 + */ + type?: string; + /** + * 未读数, 用于铃铛图标角标显示 + */ + count?: number; + /** + * 重要程度(important 重要), 用于标题红色标注 + */ + severity?: string; date: string; isRead?: boolean; message: string;