diff --git a/src/layout/components/NavBar/components/Notification.vue b/src/components/NoticeDropdown/index.vue similarity index 52% rename from src/layout/components/NavBar/components/Notification.vue rename to src/components/NoticeDropdown/index.vue index 70bc8308..4010f261 100644 --- a/src/layout/components/NavBar/components/Notification.vue +++ b/src/components/NoticeDropdown/index.vue @@ -1,7 +1,7 @@ @@ -85,11 +107,9 @@ defineOptions({ inheritAttrs: false, }); -import NoticeAPI, { NoticePageVO, NoticePageQuery } from "@/api/system/notice"; +import NoticeAPI, { NoticePageVO, NoticePageQuery, NoticeDetailVO } from "@/api/system/notice"; const queryFormRef = ref(); -const noticeDetailRef = ref(); - const pageData = ref([]); const loading = ref(false); @@ -100,7 +120,10 @@ const queryParams = reactive({ pageSize: 10, }); -/** 查询通知公告 */ +const noticeDialogVisible = ref(false); +const noticeDetail = ref(null); + +// 查询通知公告 function handleQuery() { loading.value = true; NoticeAPI.getMyNoticePage(queryParams) @@ -113,18 +136,61 @@ function handleQuery() { }); } -/** 重置通知公告查询 */ +// 重置通知公告查询 function handleResetQuery() { queryFormRef.value!.resetFields(); queryParams.pageNum = 1; handleQuery(); } -function viewNoticeDetail(id: string) { - noticeDetailRef.value.openNotice(id); +// 阅读通知公告 +function handleReadNotice(id: string) { + NoticeAPI.getDetail(id).then((data) => { + noticeDialogVisible.value = true; + noticeDetail.value = data; + }); } onMounted(() => { handleQuery(); }); + + diff --git a/src/views/system/notice/components/NoticeDetail.vue b/src/views/system/notice/components/NoticeDetail.vue deleted file mode 100644 index d573c3e9..00000000 --- a/src/views/system/notice/components/NoticeDetail.vue +++ /dev/null @@ -1,90 +0,0 @@ - - - - - diff --git a/src/views/system/notice/index.vue b/src/views/system/notice/index.vue index b6980f00..bc19cf14 100644 --- a/src/views/system/notice/index.vue +++ b/src/views/system/notice/index.vue @@ -103,12 +103,7 @@ @@ -220,12 +254,16 @@ defineOptions({ inheritAttrs: false, }); -import NoticeAPI, { NoticePageVO, NoticeForm, NoticePageQuery } from "@/api/system/notice"; +import NoticeAPI, { + NoticePageVO, + NoticeForm, + NoticePageQuery, + NoticeDetailVO, +} from "@/api/system/notice"; import UserAPI from "@/api/system/user"; const queryFormRef = ref(); const dataFormRef = ref(); -const noticeDetailRef = ref(); const loading = ref(false); const selectIds = ref([]); @@ -272,6 +310,11 @@ const rules = reactive({ type: [{ required: true, message: "请选择通知类型", trigger: "change" }], }); +const detailDialog = reactive({ + visible: false, +}); +const currentNotice = ref({}); + // 查询通知公告 function handleQuery() { loading.value = true; @@ -400,10 +443,15 @@ function handleDelete(id?: number) { ); } -// 打开通知公告详情弹窗 -function handleOpenNoticeDetailDialog(id: number) { - noticeDetailRef.value.openNotice(id); -} +const closeDetailDialog = () => { + detailDialog.visible = false; +}; + +const openDetailDialog = async (id: string) => { + const noticeDetail = await NoticeAPI.getDetail(id); + currentNotice.value = noticeDetail; + detailDialog.visible = true; +}; onMounted(() => { handleQuery();