From 66a1637e1331fe354f0fdcd8682c2453ab6c6dde Mon Sep 17 00:00:00 2001 From: ZhangYong Date: Fri, 21 Nov 2025 17:54:07 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B6=88=E6=81=AF=E6=8E=A8=E9=80=81=E7=8A=B6?= =?UTF-8?q?=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/home.vue | 48 ++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 46 insertions(+), 2 deletions(-) diff --git a/src/views/home.vue b/src/views/home.vue index fc9ce6d..30f1612 100644 --- a/src/views/home.vue +++ b/src/views/home.vue @@ -14,7 +14,7 @@ import goTop from '@/assets/SvgIcons/go-top.svg' import {getOrderPage} from '@/utils/goToCheck.js' import {groupMessages} from "@/utils/getMessage.js" - +import {findMenuById,permissionMapping} from "@/utils/menuTreePermission.js" import {useMessageStore} from '@/store/index.js' // ------------------ ICONS ------------------ @@ -128,13 +128,57 @@ const toggleFlag = () => { const messageStore = useMessageStore() const {messages} = storeToRefs(messageStore) + +//根据用户id查询消息状态 +const selectStatusById = () => { + // 定义权限检查函数 + const hasPermission = (permission) => findMenuById(menuTree.value, permission); + + // 初始化状态数组 + const status = []; + + // ===== 收款流程状态 ===== + // 地区财务收款待审核 + if (hasPermission(permissionMapping.area_finance_collection_pending)) { + status.push(0); + } + // 地区负责人收款待审核 + else if (hasPermission(permissionMapping.area_manager_collection_pending)) { + status.push(0); + } + + + // ===== 退款流程状态 ===== + // 地区财务退款审核 + if (hasPermission(permissionMapping.audit_area_finance_refund)) { + status.push(10); + } + // 地区负责人退款审核 + else if (hasPermission(permissionMapping.audit_area_manager_refund)) { + status.push(20); + } + // 总部财务退款审核 + else if (hasPermission(permissionMapping.audit_headquarters_refund)) { + status.push(30); + } + // 执行人待处理 + else if (hasPermission(permissionMapping.view_execution_details)) { + status.push(40); + } + + // 去重并返回结果(单一角色下实际不会有重复) + return [...new Set(status)]; +}; +console.log('权限测试',selectStatusById()); + // 获取消息 const getMessage = async () => { try { + let params = selectStatusById(); const res = await API({ url: '/getMessage', method: 'POST', - data: {} + data: params }); if (res?.data) {