+
+ 角色为全库共用,不按租户隔离;各租户用户可在「用户管理」中绑定同一角色,菜单权限以角色配置为准。
+
@@ -73,6 +76,23 @@ export default {
this.init()
},
methods: {
+ parseRoleMenuIds(menus) {
+ if (menus == null || menus === '') {
+ return []
+ }
+ if (Array.isArray(menus)) {
+ return menus.map((id) => Number(id)).filter((id) => !Number.isNaN(id))
+ }
+ if (typeof menus === 'string') {
+ try {
+ const parsed = JSON.parse(menus)
+ return this.parseRoleMenuIds(parsed)
+ } catch {
+ return []
+ }
+ }
+ return []
+ },
async init() {
let res = await roleServer.list()
this.gridOption.data = res.data
@@ -120,12 +140,8 @@ export default {
let res = await menuServer.list()
let tree = uiTool.transformTree(res.data)
- if (row.menus) {
- this.expandTreeAll = JSON.parse(row.menus)
- this.treeData = this.mapTree(tree)
- } else {
- this.treeData = this.mapTree(tree)
- }
+ this.expandTreeAll = this.parseRoleMenuIds(row.menus)
+ this.treeData = this.mapTree(tree)
this.isShowPermission = true
},
@@ -136,7 +152,7 @@ export default {
p.children = this.mapTree(p.children)
}
- let row = this.expandTreeAll.find((p2) => p2 === p.id)
+ let row = this.expandTreeAll.find((p2) => Number(p2) === Number(p.id))
if (row) {
p.checked = true
}
diff --git a/src/views/system/sys_tenant.vue b/src/views/system/sys_tenant.vue
new file mode 100644
index 0000000..ca9ea2d
--- /dev/null
+++ b/src/views/system/sys_tenant.vue
@@ -0,0 +1,127 @@
+
+
+
+ 仅平台租户(is_platform=1)可维护租户列表;普通租户登录后本页仅能看到自身租户信息。
+ 需在数据库执行迁移脚本创建 sys_tenant 表及默认数据。
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/views/system/sys_user.vue b/src/views/system/sys_user.vue
index 403b361..efa71db 100644
--- a/src/views/system/sys_user.vue
+++ b/src/views/system/sys_user.vue
@@ -1,5 +1,10 @@
+
+ 当前租户:{{ currentTenant.name }}({{ currentTenant.code }})。用户按租户隔离;
+ 角色全库共用,下拉中的角色对所有租户一致。
+ 平台租户可为他人指定「目标租户」。
+
@@ -16,9 +21,10 @@