Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
N
nse-ui
概览
Overview
Details
Activity
Cycle Analytics
版本库
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
问题
0
Issues
0
列表
Board
标记
里程碑
合并请求
0
Merge Requests
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
Snippets
成员
Members
Collapse sidebar
Close sidebar
活动
图像
聊天
创建新问题
作业
提交
Issue Boards
Open sidebar
吴超
nse-ui
Commits
934e77d1
Commit
934e77d1
authored
Aug 21, 2025
by
周海峰
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
no message
parent
8990fa66
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
177 行增加
和
75 行删除
+177
-75
src/components/PermissionArea/index.vue
+9
-3
src/views/safetyManagement/userConfig/edit.vue
+68
-15
src/views/safetyManagement/userConfig/index.vue
+100
-57
没有找到文件。
src/components/PermissionArea/index.vue
View file @
934e77d1
<
template
>
<
template
>
<div
style=
"font-weight: bold; font-size: 16px; margin-top: 12px;margin-bottom: 12px;"
>
权限设置
</div>
<div
style=
"font-weight: bold; font-size: 16px; margin-top: 12px;margin-bottom: 12px;"
>
权限设置
</div>
<div>
<div>
<div
class=
"permission-area"
>
<div
class=
"permission-area"
:class=
"
{ 'disabled': disabled }"
>
<div
class=
"all-select"
>
<div
class=
"all-select"
>
<el-checkbox
:model-value=
"allSelected"
@
change=
"onAllChange"
>
全选
</el-checkbox>
<el-checkbox
:model-value=
"allSelected"
@
change=
"onAllChange"
:disabled=
"disabled"
>
全选
</el-checkbox>
</div>
</div>
<div
class=
"permission-list"
>
<div
class=
"permission-list"
>
<div
v-for=
"(item, index) in permissionList"
:key=
"index"
class=
"permission-item"
>
<div
v-for=
"(item, index) in permissionList"
:key=
"index"
class=
"permission-item"
>
<div
class=
"permission-header"
@
click=
"item.children && item.children.length > 0 && toggleExpand(item)"
>
<div
class=
"permission-header"
@
click=
"
!disabled &&
item.children && item.children.length > 0 && toggleExpand(item)"
>
<div
class=
"left"
>
<div
class=
"left"
>
<span
class=
"expand-icon-placeholder"
>
<span
class=
"expand-icon-placeholder"
>
<el-icon
v-if=
"item.children && item.children.length > 0"
class=
"expand-icon"
:class=
"
{ expanded: item.expanded }">
<el-icon
v-if=
"item.children && item.children.length > 0"
class=
"expand-icon"
:class=
"
{ expanded: item.expanded }">
...
@@ -17,6 +17,7 @@
...
@@ -17,6 +17,7 @@
<el-checkbox
<el-checkbox
v-model=
"item.selected"
v-model=
"item.selected"
:indeterminate=
"item.indeterminate"
:indeterminate=
"item.indeterminate"
:disabled=
"disabled"
@
change=
"val => emit('permission-change', item, val)"
@
change=
"val => emit('permission-change', item, val)"
>
>
{{
item
.
name
}}
{{
item
.
name
}}
...
@@ -31,6 +32,7 @@
...
@@ -31,6 +32,7 @@
v-for=
"child in item.children"
v-for=
"child in item.children"
:key=
"child.id"
:key=
"child.id"
v-model=
"child.selected"
v-model=
"child.selected"
:disabled=
"disabled"
@
change=
"val => emit('sub-permission-change', item, child, val)"
@
change=
"val => emit('sub-permission-change', item, child, val)"
>
>
{{
child
.
name
}}
{{
child
.
name
}}
...
@@ -60,6 +62,10 @@ const props = defineProps({
...
@@ -60,6 +62,10 @@ const props = defineProps({
allPermissionsSelected
:
{
allPermissionsSelected
:
{
type
:
Boolean
,
type
:
Boolean
,
required
:
true
required
:
true
},
disabled
:
{
type
:
Boolean
,
default
:
false
}
}
})
})
...
...
src/views/safetyManagement/userConfig/edit.vue
View file @
934e77d1
...
@@ -94,23 +94,47 @@
...
@@ -94,23 +94,47 @@
</el-form>
</el-form>
<!-- 角色选择 -->
<!-- 角色选择 -->
<RoleTransfer
<div
class=
"component-wrapper"
>
:roles=
"roles"
<RoleTransfer
:selectedRoles=
"selectedRoles"
:roles=
"roles"
:searchRole=
"searchRole"
:selectedRoles=
"selectedRoles"
@
update:roles=
"val => roles = val"
:searchRole=
"searchRole"
@
update:selectedRoles=
"val => selectedRoles = val"
@
update:roles=
"val => roles = val"
@
update:searchRole=
"val => searchRole = val"
@
update:selectedRoles=
"val => selectedRoles = val"
/>
@
update:searchRole=
"val => searchRole = val"
/>
<div
v-if=
"isAdminUser"
class=
"overlay-mask"
>
<div
class=
"mask-message"
>
<el-alert
title=
"超级管理员用户的角色不可修改"
type=
"info"
:closable=
"false"
show-icon
/>
</div>
</div>
</div>
<!-- 权限设置 -->
<!-- 权限设置 -->
<PermissionArea
<div
class=
"component-wrapper"
>
:permissionList=
"permissionList"
<PermissionArea
:allPermissionsSelected=
"allPermissionsSelected"
:permissionList=
"permissionList"
@
update:allPermissionsSelected=
"val => allPermissionsSelected = val"
:allPermissionsSelected=
"allPermissionsSelected"
@
permission-change=
"handlePermissionChange"
@
update:allPermissionsSelected=
"val => allPermissionsSelected = val"
@
sub-permission-change=
"handleSubPermissionChange"
@
permission-change=
"handlePermissionChange"
/>
@
sub-permission-change=
"handleSubPermissionChange"
/>
<div
v-if=
"isAdminUser"
class=
"overlay-mask"
>
<div
class=
"mask-message"
>
<el-alert
title=
"超级管理员用户的权限不可修改"
type=
"info"
:closable=
"false"
show-icon
/>
</div>
</div>
</div>
</div>
</div>
<template
#
footer
>
<template
#
footer
>
<div
class=
"dialog-footer"
>
<div
class=
"dialog-footer"
>
...
@@ -178,6 +202,9 @@ const allPermissionsSelected = ref(false)
...
@@ -178,6 +202,9 @@ const allPermissionsSelected = ref(false)
const
permissionList
=
ref
([])
const
permissionList
=
ref
([])
const
instance
=
getCurrentInstance
()
const
instance
=
getCurrentInstance
()
// 判断是否为超级管理员用户(roleId = 1)
const
isAdminUser
=
ref
(
false
)
// 表单校验规则
// 表单校验规则
const
validatePassword
=
(
rule
,
value
,
callback
)
=>
{
const
validatePassword
=
(
rule
,
value
,
callback
)
=>
{
if
(
value
===
''
)
{
if
(
value
===
''
)
{
...
@@ -278,6 +305,8 @@ const initEditData = async (id) => {
...
@@ -278,6 +305,8 @@ const initEditData = async (id) => {
})
})
// 用户组
// 用户组
userGroupOptions
.
value
=
(
groupRes
.
data
||
[]).
map
(
g
=>
({
value
:
g
.
id
,
label
:
g
.
groupname
}))
userGroupOptions
.
value
=
(
groupRes
.
data
||
[]).
map
(
g
=>
({
value
:
g
.
id
,
label
:
g
.
groupname
}))
// 是否是超管
isAdminUser
.
value
=
userRes
.
data
.
rolesList
.
some
(
role
=>
role
.
id
===
'1'
)
// 未选中角色
// 未选中角色
roles
.
value
=
roleRes
.
data
roles
.
value
=
roleRes
.
data
.
filter
(
r
=>
!
(
userRes
.
data
.
rolesList
.
map
(
m
=>
m
.
id
)
||
[]).
includes
(
r
.
id
))
.
filter
(
r
=>
!
(
userRes
.
data
.
rolesList
.
map
(
m
=>
m
.
id
)
||
[]).
includes
(
r
.
id
))
...
@@ -589,4 +618,28 @@ const checkAllPermissionsStatus = () => {
...
@@ -589,4 +618,28 @@ const checkAllPermissionsStatus = () => {
text-align
:
center
;
text-align
:
center
;
display
:
inline-flex
;
display
:
inline-flex
;
}
}
.component-wrapper
{
position
:
relative
;
}
.overlay-mask
{
position
:
absolute
;
top
:
0
;
left
:
0
;
right
:
0
;
bottom
:
0
;
background-color
:
rgba
(
255
,
255
,
255
,
0.7
);
display
:
flex
;
justify-content
:
center
;
align-items
:
center
;
z-index
:
10
;
}
.mask-message
{
padding
:
10px
;
border-radius
:
4px
;
width
:
80%
;
max-width
:
400px
;
}
</
style
>
</
style
>
src/views/safetyManagement/userConfig/index.vue
View file @
934e77d1
...
@@ -11,13 +11,13 @@
...
@@ -11,13 +11,13 @@
<el-form
:inline=
"true"
:model=
"searchForm"
class=
"search-form"
>
<el-form
:inline=
"true"
:model=
"searchForm"
class=
"search-form"
>
<div
class=
"left-area"
>
<div
class=
"left-area"
>
<el-form-item
label=
"姓名:"
>
<el-form-item
label=
"姓名:"
>
<el-input
v-model=
"searchForm.
name"
placeholder=
"请输入姓名"
></el-input>
<el-input
v-model=
"searchForm.
realname"
clearable
placeholder=
"请输入姓名"
></el-input>
</el-form-item>
</el-form-item>
<el-form-item
label=
"用户名:"
>
<el-form-item
label=
"用户名:"
>
<el-input
v-model=
"searchForm.username"
placeholder=
"请输入用户名"
></el-input>
<el-input
v-model=
"searchForm.username"
clearable
placeholder=
"请输入用户名"
></el-input>
</el-form-item>
</el-form-item>
<el-form-item
label=
"备注:"
>
<el-form-item
label=
"备注:"
>
<el-input
v-model=
"searchForm.remark"
placeholder=
"请输入备注"
></el-input>
<el-input
v-model=
"searchForm.remark"
clearable
placeholder=
"请输入备注"
></el-input>
</el-form-item>
</el-form-item>
<el-form-item>
<el-form-item>
<el-button
type=
"primary"
icon=
"Search"
@
click=
"handleSearch"
>
搜索
</el-button>
<el-button
type=
"primary"
icon=
"Search"
@
click=
"handleSearch"
>
搜索
</el-button>
...
@@ -32,27 +32,36 @@
...
@@ -32,27 +32,36 @@
<!-- 用户列表 -->
<!-- 用户列表 -->
<div
class=
"user-list"
>
<div
class=
"user-list"
>
<div
class=
"user-grid"
>
<div
class=
"user-grid"
>
<div
v-for=
"(user, index) in userList"
:key=
"index"
class=
"user-card"
>
<div
v-for=
"(user, index) in userList"
:key=
"index"
class=
"user-card"
:class=
"
{ 'admin-card': user.username === 'admin' }">
<div
class=
"user-info"
>
<div
class=
"card-header"
:class=
"
{ 'admin-header': user.username === 'admin' }">
<div
class=
"avatar"
>
<div
class=
"header-info"
>
<el-avatar
:size=
"50"
icon=
"User"
></el-avatar>
</div>
<div
class=
"info"
>
<div
class=
"name"
>
{{
user
.
realname
}}
</div>
<div
class=
"name"
>
{{
user
.
realname
}}
</div>
<div
class=
"username"
>
用户名:
{{
user
.
username
}}
</div>
<div
class=
"username"
>
{{
user
.
username
}}
</div>
<div
class=
"remark"
>
备注:
{{
user
.
remark
}}
</div>
</div>
<div
class=
"user-avatar"
>
<el-avatar
:size=
"50"
icon=
"User"
:src=
"user.avatar"
></el-avatar>
</div>
</div>
<div
class=
"card-content"
>
<div
class=
"info-row"
>
<div
class=
"info-label"
>
备注:
</div>
<div
class=
"info-value"
>
{{
user
.
remark
||
'无'
}}
</div>
</div>
<div
class=
"info-row"
>
<div
class=
"info-label"
>
创建时间:
</div>
<div
class=
"info-value"
>
{{
user
.
createtime
||
''
}}
</div>
</div>
</div>
<!-- 遮罩层和操作按钮 --
>
</div
>
<div
class=
"hover-mask"
>
<!-- 遮罩层和操作按钮 --
>
<div
class=
"operation-buttons
"
>
<div
class=
"hover-mask
"
>
<div
class=
"operation-btn"
@
click=
"handleDelete(user)
"
>
<div
class=
"operation-buttons
"
>
<i
class=
"el-icon-delete"
></i
>
<div
class=
"operation-btn"
@
click=
"handleDelete(user)"
>
<span>
删除
</spa
n>
<el-icon><Delete
/></el-ico
n>
<
/div
>
<
span>
删除
</span
>
<div
class=
"operation-btn"
@
click=
"handleEdit(user)"
>
</div
>
<i
class=
"el-icon-edit"
></i
>
<div
class=
"operation-btn"
@
click=
"handleEdit(user)"
>
<span>
编辑
</spa
n>
<el-icon><Edit
/></el-ico
n>
<
/div
>
<
span>
编辑
</span
>
</div>
</div>
</div>
</div>
</div>
</div>
...
@@ -87,7 +96,7 @@
...
@@ -87,7 +96,7 @@
<
script
setup
>
<
script
setup
>
import
{
ref
,
reactive
,
onMounted
,
getCurrentInstance
}
from
'vue'
import
{
ref
,
reactive
,
onMounted
,
getCurrentInstance
}
from
'vue'
import
{
ElMessageBox
}
from
'element-plus'
import
{
ElMessageBox
}
from
'element-plus'
import
{
User
}
from
'@element-plus/icons-vue'
import
{
User
,
Delete
,
Edit
}
from
'@element-plus/icons-vue'
import
UserEdit
from
'./edit.vue'
import
UserEdit
from
'./edit.vue'
import
{
query
}
from
'@/api/safetyManagement/userConfig.js'
import
{
query
}
from
'@/api/safetyManagement/userConfig.js'
...
@@ -235,36 +244,75 @@ onMounted(() => {
...
@@ -235,36 +244,75 @@ onMounted(() => {
.user-card
{
.user-card
{
background
:
#fff
;
background
:
#fff
;
border-radius
:
8px
;
border-radius
:
8px
;
box-shadow
:
0
2px
12px
0
rgba
(
0
,
0
,
0
,
0.1
);
box-shadow
:
0
2px
4px
rgba
(
0
,
0
,
0
,
0.1
);
overflow
:
hidden
;
overflow
:
hidden
;
}
.user-info
{
display
:
flex
;
align-items
:
center
;
padding
:
20px
;
position
:
relative
;
position
:
relative
;
cursor
:
pointer
;
border-left
:
4px
solid
#3498db
;
height
:
100%
;
transition
:
all
0.3s
ease
;
.avatar
{
&:hover
{
margin-right
:
15px
;
box-shadow
:
0
4px
12px
rgba
(
0
,
0
,
0
,
0.15
);
transform
:
translateY
(
-2px
);
}
}
.info
{
&
.admin-card
{
flex
:
1
;
border-left
:
4px
solid
#f39c12
;
}
.card-header
{
padding
:
15px
20px
;
display
:
flex
;
align-items
:
center
;
justify-content
:
space-between
;
background
:
linear-gradient
(
to
right
,
#3498db
,
#73b4f8
);
color
:
white
;
.name
{
&.admin-header
{
font-size
:
16px
;
background
:
linear-gradient
(
to
right
,
#f39c12
,
#f8c471
);
font-weight
:
bold
;
margin-bottom
:
8px
;
color
:
#333
;
}
}
.username
,
.remark
{
.header-info
{
color
:
#666
;
flex
:
1
;
font-size
:
14px
;
.name
{
margin-bottom
:
5px
;
font-size
:
18px
;
font-weight
:
bold
;
margin-bottom
:
5px
;
}
.username
{
font-size
:
14px
;
opacity
:
0.9
;
}
}
.user-avatar
{
margin-left
:
15px
;
}
}
.card-content
{
padding
:
15px
20px
;
.info-row
{
display
:
flex
;
margin-bottom
:
10px
;
&:last-child
{
margin-bottom
:
0
;
}
.info-label
{
color
:
#666
;
font-size
:
14px
;
width
:
80px
;
flex-shrink
:
0
;
}
.info-value
{
color
:
#333
;
font-size
:
14px
;
flex
:
1
;
}
}
}
}
}
...
@@ -278,6 +326,7 @@ onMounted(() => {
...
@@ -278,6 +326,7 @@ onMounted(() => {
display
:
none
;
display
:
none
;
justify-content
:
center
;
justify-content
:
center
;
align-items
:
center
;
align-items
:
center
;
transition
:
all
0.3s
;
.operation-buttons
{
.operation-buttons
{
display
:
flex
;
display
:
flex
;
...
@@ -289,8 +338,8 @@ onMounted(() => {
...
@@ -289,8 +338,8 @@ onMounted(() => {
align-items
:
center
;
align-items
:
center
;
color
:
white
;
color
:
white
;
cursor
:
pointer
;
cursor
:
pointer
;
i
{
.el-icon
{
font-size
:
24px
;
font-size
:
24px
;
margin-bottom
:
8px
;
margin-bottom
:
8px
;
}
}
...
@@ -301,6 +350,7 @@ onMounted(() => {
...
@@ -301,6 +350,7 @@ onMounted(() => {
&
:hover
{
&
:hover
{
color
:
#409EFF
;
color
:
#409EFF
;
transform
:
scale
(
1.1
);
}
}
}
}
}
}
...
@@ -312,13 +362,6 @@ onMounted(() => {
...
@@ -312,13 +362,6 @@ onMounted(() => {
}
}
}
}
}
}
.operation-time
{
color
:
#666
;
i
{
margin-right
:
5px
;
}
}
}
}
.pagination
{
.pagination
{
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论