页面按钮权限

This commit is contained in:
huhao
2026-08-11 14:09:26 +08:00
parent 94ec5e65ca
commit c6836b402a
2 changed files with 5 additions and 3 deletions
+4 -2
View File
@@ -38,13 +38,15 @@ export const useMenuStore = defineStore('menu', () => {
/**
* 取岗位某功能的数据权限级别(仅按 WorkPostName)
* @returns {'view'|'edit'|null} null 表示无菜单权限
* - WorkPostName 在权限表中:按表配置
* - 不在表中:不限制(edit)
* - WorkPostName 为空:仅可查看(view)
* - 在权限表中:按表配置
* - 有岗位名但不在表中:不限制(edit)
*/
const getPostFuncLevel = (funcKey) => {
if (!funcKey) return null
const userStore = useUserStore()
const postName = String(userStore.userInfo?.WorkPostName || '').trim()
if (!postName) return 'view'
const map = postMenuPermissions[postName]
if (!map) return 'edit'
return map[funcKey] || null