From e9283ffe6822b12ec5dd2ccf4dc13a369b227a61 Mon Sep 17 00:00:00 2001
From: zhou zhou <3272660260@qq.com>
Date: 星期一, 30 三月 2026 08:32:06 +0800
Subject: [PATCH] chore: sync rsf-design from isolated worktree
---
rsf-design/src/directives/core/roles.js | 21 ++++++++++++++++++++-
1 files changed, 20 insertions(+), 1 deletions(-)
diff --git a/rsf-design/src/directives/core/roles.js b/rsf-design/src/directives/core/roles.js
index 2fb4155..bf0c186 100644
--- a/rsf-design/src/directives/core/roles.js
+++ b/rsf-design/src/directives/core/roles.js
@@ -1,7 +1,26 @@
import { useUserStore } from '@/store/modules/user'
+
+function extractRoleCodes(roles) {
+ if (!Array.isArray(roles)) {
+ return []
+ }
+
+ return roles
+ .map((item) => {
+ if (typeof item === 'string') {
+ return item
+ }
+ if (item && typeof item === 'object') {
+ return item.code || item.name || ''
+ }
+ return ''
+ })
+ .filter(Boolean)
+}
+
function checkRolePermission(el, binding) {
const userStore = useUserStore()
- const userRoles = userStore.getUserInfo.roles
+ const userRoles = extractRoleCodes(userStore.getUserInfo.roles)
if (!userRoles?.length) {
removeElement(el)
return
--
Gitblit v1.9.1