From c3f054ca195b14661df3450fd2f0cc3d23246488 Mon Sep 17 00:00:00 2001 From: wangyan Date: Tue, 10 Feb 2026 14:20:54 +0800 Subject: [PATCH] =?UTF-8?q?feat(notice):=20=E5=AE=9E=E7=8E=B0=E5=85=AC?= =?UTF-8?q?=E5=91=8A=E6=A8=A1=E5=9D=97=E7=9A=84=E5=8F=AA=E8=AF=BB=E6=9F=A5?= =?UTF-8?q?=E7=9C=8B=E6=A8=A1=E5=BC=8F=E5=92=8C=E6=95=B0=E6=8D=AE=E6=A0=BC?= =?UTF-8?q?=E5=BC=8F=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 添加只读模式判断功能,支持通过readonly参数控制页面编辑状态 - 优化公告数据的序列化处理,实现发布范围和分子公司字段的数组与字符串转换 - 更新公告API接口,将noticeReadStatus方法从GET改为POST请求 - 修改公告列表页面的字段映射,统一使用departmentName替代deptName字段 - 优化公告列表的发布范围显示逻辑,修复渲染异常问题 - 添加公告查看按钮,支持以只读模式查看公告详情 - 在编辑器组件中添加禁用状态控制,确保只读模式下无法编辑内容 - 调整公告统计数据显示,使用alreadyReadCount和shouldReadCount字段替换原有计数方式 --- src/api/Notice/index.js | 10 ++++-- src/pages/Container/Notice/Add/index.js | 45 +++++++++++++++++++----- src/pages/Container/Notice/List/index.js | 23 +++++++----- 3 files changed, 59 insertions(+), 19 deletions(-) diff --git a/src/api/Notice/index.js b/src/api/Notice/index.js index e3c201b..81a8626 100644 --- a/src/api/Notice/index.js +++ b/src/api/Notice/index.js @@ -20,5 +20,11 @@ export const noticeBatchDelete = declareRequest( "noticeLoading", "Delete > @/appmenu/notice/ids/{ids}", ); -export const noticeInfo = declareRequest("noticeLoading", "Get > /appmenu/notice/{id}"); -export const noticeReadStatus = declareRequest("noticeLoading", "Get > /appmenu/notice/readStatus/{noticeId}"); +export const noticeInfo = declareRequest( + "noticeLoading", + "Get > /appmenu/notice/{id}", +); +export const noticeReadStatus = declareRequest( + "noticeLoading", + "Post > @/appmenu/notice/noticeReadStatus", +); diff --git a/src/pages/Container/Notice/Add/index.js b/src/pages/Container/Notice/Add/index.js index 4a42ec5..092507a 100644 --- a/src/pages/Container/Notice/Add/index.js +++ b/src/pages/Container/Notice/Add/index.js @@ -15,6 +15,9 @@ function Add(props) { const contentValue = Form.useWatch("content", form); const publishScope = Form.useWatch("publishScope", form); + // 判断是否为只读模式 + const isReadOnly = queryParams["readonly"] === "true"; + // 当取消勾选分子公司时,清空发布部门ID useEffect(() => { if (publishScope && !publishScope.includes("2")) { @@ -26,15 +29,26 @@ function Add(props) { if (queryParams["id"]) { props["noticeInfo"]({ id: queryParams["id"] }).then((res) => { if (res.data) { - form.setFieldsValue(res.data); + // 处理编辑时的数据格式 + const formData = { ...res.data }; + // 将逗号分隔的字符串转换为数组 + if (formData.publishScope && typeof formData.publishScope === "string") { + formData.publishScope = formData.publishScope.split(","); + } + if (formData.publishCorpinfoIds && typeof formData.publishCorpinfoIds === "string") { + formData.publishCorpinfoIds = formData.publishCorpinfoIds.split(","); + } + form.setFieldsValue(formData); } }); } }, []); useEffect(() => { - props["corpInfoListAll"]({ inType: "0,1,2,6", eqUseFlag: 1 }).then((res) => { + console.log(props); + props["corpInfoListAll"]({ inType: "0,1,6", eqUseFlag: 1 }).then((res) => { if (res.data) { + console.log(res.data); res.data.forEach((item) => { item.bianma = item.id; item.name = item.corpName; @@ -52,6 +66,15 @@ function Add(props) { return; // 阻止后续逻辑 } const values = await form.validateFields(); + + // 将通知范围数组转换为字符串 + if (values.publishScope && Array.isArray(values.publishScope)) { + values.publishScope = values.publishScope.join(","); + } + // 将分子公司数组转换为字符串 + if (values.publishCorpinfoIds && Array.isArray(values.publishCorpinfoIds)) { + values.publishCorpinfoIds = values.publishCorpinfoIds.join(","); + } if (queryParams["id"]) { values.id = queryParams["id"]; props["noticeEdit"](values).then((res) => { @@ -73,8 +96,8 @@ function Add(props) { return ( {_hasPermission("notice-edit") && (