Skip to content
项目
群组
代码片段
帮助
正在加载...
登录/注册
切换导航
广
广东建设用地-前端
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
广东建设用地
广东建设用地-前端
Commits
be7f7589
提交
be7f7589
authored
4月 30, 2026
作者:
jinrongbin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
添加、编辑用户时,用户等级不能高于当前操作的管理员等级
上级
4c302947
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
25 行增加
和
1 行删除
+25
-1
UserDrawer.vue
src/views/system/user/UserDrawer.vue
+25
-1
没有找到文件。
src/views/system/user/UserDrawer.vue
浏览文件 @
be7f7589
...
@@ -33,6 +33,8 @@
...
@@ -33,6 +33,8 @@
import
{
useDrawerAdaptiveWidth
}
from
'/@/hooks/jeecg/useAdaptiveWidth'
;
import
{
useDrawerAdaptiveWidth
}
from
'/@/hooks/jeecg/useAdaptiveWidth'
;
import
{
getTenantId
}
from
'/@/utils/auth'
;
import
{
getTenantId
}
from
'/@/utils/auth'
;
import
{
getTown
,
cityTree
}
from
'@/api/common/api'
;
import
{
getTown
,
cityTree
}
from
'@/api/common/api'
;
import
{
useUserStore
}
from
'/@/store/modules/user'
;
import
{
useMessage
}
from
'/@/hooks/web/useMessage'
;
// 声明Emits
// 声明Emits
const
emit
=
defineEmits
([
'success'
,
'register'
]);
const
emit
=
defineEmits
([
'success'
,
'register'
]);
...
@@ -54,6 +56,8 @@
...
@@ -54,6 +56,8 @@
showFooter
.
value
=
data
?.
showFooter
??
true
;
showFooter
.
value
=
data
?.
showFooter
??
true
;
setDrawerProps
({
confirmLoading
:
false
,
showFooter
:
showFooter
.
value
});
setDrawerProps
({
confirmLoading
:
false
,
showFooter
:
showFooter
.
value
});
isUpdate
.
value
=
!!
data
?.
isUpdate
;
isUpdate
.
value
=
!!
data
?.
isUpdate
;
// 新增/编辑统一过滤可选级别,不能超过当前登录用户
Options
.
value
=
getAvailableUserLevelOptions
();
if
(
unref
(
isUpdate
))
{
if
(
unref
(
isUpdate
))
{
rowId
.
value
=
data
.
record
.
id
;
rowId
.
value
=
data
.
record
.
id
;
//租户信息定义成数组
//租户信息定义成数组
...
@@ -160,8 +164,22 @@
...
@@ -160,8 +164,22 @@
//获取标题
//获取标题
const
getTitle
=
computed
(()
=>
(
!
unref
(
isUpdate
)
?
'新增用户'
:
'编辑用户'
));
const
getTitle
=
computed
(()
=>
(
!
unref
(
isUpdate
)
?
'新增用户'
:
'编辑用户'
));
const
{
adaptiveWidth
}
=
useDrawerAdaptiveWidth
();
const
{
adaptiveWidth
}
=
useDrawerAdaptiveWidth
();
const
Options
=
getUserLevel
().
data
;
const
Options
=
ref
<
any
[]
>
([])
;
const
Codeoptions
=
ref
<
any
>
([]);
const
Codeoptions
=
ref
<
any
>
([]);
const
userStore
=
useUserStore
();
const
{
createMessage
}
=
useMessage
();
function
getAvailableUserLevelOptions
()
{
const
allLevels
=
getUserLevel
().
data
.
value
||
[];
const
currentLevel
=
(
userStore
.
getUserInfo
as
any
)?.
userIdentity
;
// 超级管理员不限制
if
(
currentLevel
===
0
||
currentLevel
===
'0'
)
{
return
allLevels
;
}
// 数值越小权限越高,当前用户只能选择自己及以下级别
return
allLevels
.
filter
((
item
)
=>
Number
(
item
.
value
)
>=
Number
(
currentLevel
));
}
async
function
changLevel
(
v
,
model
,
type
)
{
async
function
changLevel
(
v
,
model
,
type
)
{
if
(
type
!=
'edit'
)
model
.
codeRegion
=
''
;
if
(
type
!=
'edit'
)
model
.
codeRegion
=
''
;
if
(
v
==
'1'
)
{
if
(
v
==
'1'
)
{
...
@@ -186,6 +204,12 @@
...
@@ -186,6 +204,12 @@
try
{
try
{
let
values
=
await
validate
();
let
values
=
await
validate
();
setDrawerProps
({
confirmLoading
:
true
});
setDrawerProps
({
confirmLoading
:
true
});
const
currentLevel
=
Number
((
userStore
.
getUserInfo
as
any
)?.
userIdentity
);
const
selectedLevel
=
Number
(
values
.
userIdentity
);
if
(
!
Number
.
isNaN
(
currentLevel
)
&&
currentLevel
!==
0
&&
selectedLevel
<
currentLevel
)
{
createMessage
.
warning
(
'用户等级不能超过当前登录用户等级'
);
return
;
}
values
.
userIdentity
===
1
&&
(
values
.
departIds
=
''
);
values
.
userIdentity
===
1
&&
(
values
.
departIds
=
''
);
let
isUpdateVal
=
unref
(
isUpdate
);
let
isUpdateVal
=
unref
(
isUpdate
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论