From b9e52200692bf1b160ba02ffa33cf5302f2ada05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90Li?= <15040126243@163.com> Date: Thu, 26 Mar 2026 18:06:00 +0800 Subject: [PATCH] =?UTF-8?q?update=20=E4=BC=98=E5=8C=96=20=E9=80=9A?= =?UTF-8?q?=E7=9F=A5=E5=85=AC=E5=91=8A=E9=A1=B5=E9=9D=A2=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E6=9F=A5=E7=9C=8B=E8=AF=A6=E6=83=85=E5=8A=9F=E8=83=BD=20?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E9=A2=84=E8=A7=88=E5=B7=B2=E7=BB=8F=E7=BC=96?= =?UTF-8?q?=E8=BE=91=E5=A5=BD=E7=9A=84=E5=AF=8C=E6=96=87=E6=9C=AC=E5=86=85?= =?UTF-8?q?=E5=AE=B9=20update=20=E4=BC=98=E5=8C=96=20=E6=B6=88=E6=81=AF?= =?UTF-8?q?=E7=9B=92=E5=AD=90=E7=9B=B8=E5=85=B3=E6=B6=88=E6=81=AF=E5=8F=AF?= =?UTF-8?q?=E7=9B=B4=E6=8E=A5=E8=B7=B3=E8=BD=AC=E5=88=B0=E8=AF=A6=E6=83=85?= =?UTF-8?q?=E9=A1=B5=E5=B1=95=E7=A4=BA=E5=AF=8C=E6=96=87=E6=9C=AC=E5=86=85?= =?UTF-8?q?=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/layout/components/notice/index.vue | 5 +- src/store/modules/notice.ts | 1 - src/utils/push-message.ts | 3 - src/utils/push.ts | 1 - src/views/system/notice/index.vue | 122 +++++++++++++++++++++++++ 5 files changed, 123 insertions(+), 9 deletions(-) diff --git a/src/layout/components/notice/index.vue b/src/layout/components/notice/index.vue index 0361808..10de4e0 100644 --- a/src/layout/components/notice/index.vue +++ b/src/layout/components/notice/index.vue @@ -70,10 +70,7 @@ const onNewsClick = async (item: any) => { currentNewsList.value[item].read = true; const current = currentNewsList.value[item]; if (current?.path) { - await router.push({ - path: current.path, - query: current.query || undefined - }); + await router.push(current.path); } }; diff --git a/src/store/modules/notice.ts b/src/store/modules/notice.ts index eda6473..ed149a0 100644 --- a/src/store/modules/notice.ts +++ b/src/store/modules/notice.ts @@ -11,7 +11,6 @@ export interface NoticeItem { content?: string; data?: Record | null; path?: string; - query?: Record | null; time: string; } diff --git a/src/utils/push-message.ts b/src/utils/push-message.ts index 81fe6b0..bb5552c 100644 --- a/src/utils/push-message.ts +++ b/src/utils/push-message.ts @@ -25,7 +25,6 @@ export interface PushMessagePayload { message?: string; data?: Record | null; path?: string; - query?: Record | null; timestamp?: number; } @@ -40,7 +39,6 @@ export const parsePushMessage = (raw: string): PushMessagePayload => { message: payload.message ?? '', data: payload.data ?? null, path: payload.path, - query: payload.query ?? null, timestamp: payload.timestamp ?? Date.now() }; } catch { @@ -50,7 +48,6 @@ export const parsePushMessage = (raw: string): PushMessagePayload => { message: raw, data: null, path: undefined, - query: null, timestamp: Date.now() }; } diff --git a/src/utils/push.ts b/src/utils/push.ts index f7f81fb..508040b 100644 --- a/src/utils/push.ts +++ b/src/utils/push.ts @@ -20,7 +20,6 @@ const appendNotice = (raw: string) => { content: payload.data?.noticeContent, data: payload.data, path: payload.path, - query: payload.query, read: false, time: new Date(payload.timestamp ?? Date.now()).toLocaleString() }); diff --git a/src/views/system/notice/index.vue b/src/views/system/notice/index.vue index fdd7fdc..e1cdbc5 100644 --- a/src/views/system/notice/index.vue +++ b/src/views/system/notice/index.vue @@ -73,6 +73,9 @@ + + +
+
+
{{ detailForm.noticeTitle || '-' }}
+
+
+ 类型: + +
+
+ 状态: + +
+
+ 创建者: + {{ detailForm.createByName || '-' }} +
+
+ 创建时间: + {{ proxy.parseTime(detailForm.createTime, '{y}-{m}-{d} {h}:{i}:{s}') || '-' }} +
+
+
+ +
+
+
@@ -131,6 +162,8 @@ import { NoticeForm, NoticeQuery, NoticeVO } from '@/api/system/notice/types'; const { proxy } = getCurrentInstance() as ComponentInternalInstance; const { sys_notice_status, sys_notice_type } = toRefs(proxy?.useDict('sys_notice_status', 'sys_notice_type')); +const route = useRoute(); +const router = useRouter(); const noticeList = ref([]); const loading = ref(true); @@ -147,6 +180,10 @@ const dialog = reactive({ visible: false, title: '' }); +const detailDialog = reactive({ + visible: false +}); +const routeDetailSyncing = ref(false); const initFormData: NoticeForm = { noticeId: undefined, @@ -157,6 +194,7 @@ const initFormData: NoticeForm = { remark: '', createByName: '' }; +const detailForm = ref({} as NoticeVO); const data = reactive>({ form: { ...initFormData }, queryParams: { @@ -227,6 +265,31 @@ const handleUpdate = async (row?: NoticeVO) => { dialog.visible = true; dialog.title = '修改公告'; }; +/** 详情按钮操作 */ +const handleDetail = async (row: NoticeVO) => { + await openDetail(row.noticeId); +}; +/** 打开详情 */ +const openDetail = async (noticeId: string | number) => { + const { data } = await getNotice(noticeId); + detailForm.value = data; + detailDialog.visible = true; +}; +/** 详情弹窗关闭后移除路由参数 */ +const handleDetailDialogClosed = async () => { + if (!route.query.noticeId) { + return; + } + routeDetailSyncing.value = true; + await router.replace({ + path: route.path, + query: { + ...route.query, + noticeId: undefined + } + }); + routeDetailSyncing.value = false; +}; /** 提交按钮 */ const submitForm = () => { noticeFormRef.value?.validate(async (valid: boolean) => { @@ -250,10 +313,69 @@ const handleDelete = async (row?: NoticeVO) => { onMounted(() => { getList(); }); + +watch( + () => route.query.noticeId, + async (noticeId) => { + if (routeDetailSyncing.value || !noticeId) { + return; + } + await openDetail(String(noticeId)); + }, + { immediate: true } +);