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) {