Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phsl
/
admin
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
3c6554c0
authored
Mar 04, 2023
by
gexinzhineng/gxzn27
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
租户和角色管理的菜单权限不能滚动
parent
cea7b41a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
76 additions
and
45 deletions
+76
-45
src/views/system/role/index.vue
+55
-43
src/views/system/tenantPackage/index.vue
+21
-2
No files found.
src/views/system/role/index.vue
View file @
3c6554c0
...
@@ -99,37 +99,41 @@
...
@@ -99,37 +99,41 @@
</el-select>
</el-select>
</el-form-item>
</el-form-item>
<!-- 分配角色的菜单权限对话框 -->
<!-- 分配角色的菜单权限对话框 -->
<el-form-item
<el-row>
label=
"权限范围"
<el-col
:span=
"24"
>
v-if=
"
<el-form-item
actionScopeType === 'menu' || dataScopeForm.dataScope === SystemDataScopeEnum.DEPT_CUSTOM
label=
"权限范围"
"
v-if=
"
>
actionScopeType === 'menu' ||
<el-card
shadow=
"never"
>
dataScopeForm.dataScope === SystemDataScopeEnum.DEPT_CUSTOM
<
template
#
header
>
"
父子联动(选中父节点,自动选择子节点):
style=
"display: flex"
<el-switch
v-model=
"checkStrictly"
inline-prompt
active-text=
"是"
inactive-text=
"否"
/>
>
全选/全不选:
<el-card
class=
"card"
shadow=
"never"
>
<el-switch
<
template
#
header
>
v-model=
"treeNodeAll"
<!--父子联动(选中父节点,自动选择子节点):-->
inline-prompt
<!--
<el-switch
v-model=
"checkStrictly"
inline-prompt
active-text=
"是"
inactive-text=
"否"
/>
-->
active-text=
"是"
<!--全选/全不选:-->
inactive-text=
"否"
<!--
<el-switch-->
@
change=
"handleCheckedTreeNodeAll()"
<!-- v-model="treeNodeAll"-->
/>
<!-- inline-prompt-->
</
template
>
<!-- active-text="是"-->
<el-tree
<!-- inactive-text="否"-->
ref=
"treeRef"
<!-- @change="handleCheckedTreeNodeAll()"-->
node-key=
"id"
<!--/>-->
show-checkbox
</
template
>
:default-checked-keys=
"defaultCheckedKeys"
<el-tree
:check-strictly=
"!checkStrictly"
ref=
"treeRef"
:props=
"defaultProps"
node-key=
"id"
:data=
"treeOptions"
show-checkbox
empty-text=
"加载中,请稍后"
:check-strictly=
"!checkStrictly"
/>
:props=
"defaultProps"
</el-card>
:data=
"treeOptions"
</el-form-item>
empty-text=
"加载中,请稍后"
/>
</el-card>
</el-form-item>
</el-col
></el-row>
</el-form>
</el-form>
<!-- 操作按钮 -->
<!-- 操作按钮 -->
<
template
#
footer
>
<
template
#
footer
>
...
@@ -245,26 +249,28 @@ const dialogScopeVisible = ref(false)
...
@@ -245,26 +249,28 @@ const dialogScopeVisible = ref(false)
const
dialogScopeTitle
=
ref
(
'数据权限'
)
const
dialogScopeTitle
=
ref
(
'数据权限'
)
const
actionScopeType
=
ref
(
''
)
const
actionScopeType
=
ref
(
''
)
const
dataScopeDictDatas
=
ref
()
const
dataScopeDictDatas
=
ref
()
const
defaultCheckedKeys
=
ref
()
// 选项
// 选项
const
checkStrictly
=
ref
(
tru
e
)
const
checkStrictly
=
ref
(
fals
e
)
const
treeNodeAll
=
ref
(
false
)
//
const treeNodeAll = ref(false)
// 全选/全不选
// 全选/全不选
const
handleCheckedTreeNodeAll
=
()
=>
{
//
const handleCheckedTreeNodeAll = () => {
treeRef
.
value
!
.
setCheckedNodes
(
treeNodeAll
.
value
?
treeOptions
.
value
:
[])
//
treeRef.value!.setCheckedNodes(treeNodeAll.value ? treeOptions.value : [])
}
//
}
// 权限操作
// 权限操作
const
handleScope
=
async
(
type
:
string
,
row
:
RoleApi
.
RoleVO
)
=>
{
const
handleScope
=
async
(
type
:
string
,
row
:
RoleApi
.
RoleVO
)
=>
{
dataScopeForm
.
id
=
row
.
id
dataScopeForm
.
id
=
row
.
id
dataScopeForm
.
name
=
row
.
name
dataScopeForm
.
name
=
row
.
name
dataScopeForm
.
code
=
row
.
code
dataScopeForm
.
code
=
row
.
code
actionScopeType
.
value
=
type
dialogScopeVisible
.
value
=
true
if
(
type
===
'menu'
)
{
if
(
type
===
'menu'
)
{
const
menuRes
=
await
listSimpleMenusApi
()
const
menuRes
=
await
listSimpleMenusApi
()
treeOptions
.
value
=
handleTree
(
menuRes
)
treeOptions
.
value
=
handleTree
(
menuRes
)
const
role
=
await
PermissionApi
.
listRoleMenusApi
(
row
.
id
)
const
role
=
await
PermissionApi
.
listRoleMenusApi
(
row
.
id
)
if
(
role
)
{
if
(
role
)
{
// treeRef.value!.setCheckedKeys(role as unknown as Array
<
number
>
)
role
?.
forEach
((
item
:
any
)
=>
{
defaultCheckedKeys
.
value
=
role
unref
(
treeRef
)?.
setChecked
(
item
,
true
,
false
)
})
}
}
}
else
if
(
type
===
'data'
)
{
}
else
if
(
type
===
'data'
)
{
const
deptRes
=
await
listSimpleDeptApi
()
const
deptRes
=
await
listSimpleDeptApi
()
...
@@ -272,12 +278,11 @@ const handleScope = async (type: string, row: RoleApi.RoleVO) => {
...
@@ -272,12 +278,11 @@ const handleScope = async (type: string, row: RoleApi.RoleVO) => {
const
role
=
await
RoleApi
.
getRoleApi
(
row
.
id
)
const
role
=
await
RoleApi
.
getRoleApi
(
row
.
id
)
dataScopeForm
.
dataScope
=
role
.
dataScope
dataScopeForm
.
dataScope
=
role
.
dataScope
if
(
role
.
dataScopeDeptIds
)
{
if
(
role
.
dataScopeDeptIds
)
{
// treeRef.value!.setCheckedKeys(role.dataScopeDeptIds as unknown as Array
<
number
>
,
false
)
role
.
dataScopeDeptIds
?.
forEach
((
item
:
any
)
=>
{
defaultCheckedKeys
.
value
=
role
.
dataScopeDeptIds
unref
(
treeRef
)?.
setChecked
(
item
,
true
,
false
)
})
}
}
}
}
actionScopeType
.
value
=
type
dialogScopeVisible
.
value
=
true
}
}
// 保存权限
// 保存权限
const
submitScope
=
async
()
=>
{
const
submitScope
=
async
()
=>
{
...
@@ -312,3 +317,10 @@ onMounted(() => {
...
@@ -312,3 +317,10 @@ onMounted(() => {
init
()
init
()
})
})
</
script
>
</
script
>
<
style
scoped
>
.card
{
width
:
100%
;
max-height
:
400px
;
overflow-y
:
scroll
;
}
</
style
>
src/views/system/tenantPackage/index.vue
View file @
3c6554c0
...
@@ -25,7 +25,7 @@
...
@@ -25,7 +25,7 @@
ref=
"formRef"
ref=
"formRef"
>
>
<
template
#
menuIds
>
<
template
#
menuIds
>
<el-card
class=
"w-120"
>
<el-card>
<template
#
header
>
<template
#
header
>
<div
class=
"card-header"
>
<div
class=
"card-header"
>
全选/全不选:
全选/全不选:
...
@@ -91,6 +91,16 @@ const dialogTitle = ref('edit') // 弹出层标题
...
@@ -91,6 +91,16 @@ const dialogTitle = ref('edit') // 弹出层标题
const
handleCheckedTreeNodeAll
=
()
=>
{
const
handleCheckedTreeNodeAll
=
()
=>
{
treeRef
.
value
!
.
setCheckedNodes
(
treeNodeAll
.
value
?
menuOptions
.
value
:
[])
treeRef
.
value
!
.
setCheckedNodes
(
treeNodeAll
.
value
?
menuOptions
.
value
:
[])
}
}
const
validateCategory
=
(
rule
:
any
,
value
:
any
,
callback
:
any
)
=>
{
if
(
!
treeRef
.
value
!
.
getCheckedKeys
().
length
)
{
callback
(
new
Error
(
'该项为必填项'
))
}
else
{
callback
()
}
}
rules
.
menuIds
=
[{
required
:
true
,
validator
:
validateCategory
,
trigger
:
'blur'
}]
const
getTree
=
async
()
=>
{
const
getTree
=
async
()
=>
{
const
res
=
await
listSimpleMenusApi
()
const
res
=
await
listSimpleMenusApi
()
menuOptions
.
value
=
handleTree
(
res
)
menuOptions
.
value
=
handleTree
(
res
)
...
@@ -125,7 +135,9 @@ const handleUpdate = async (rowId: number) => {
...
@@ -125,7 +135,9 @@ const handleUpdate = async (rowId: number) => {
const
res
=
await
TenantPackageApi
.
getTenantPackageApi
(
rowId
)
const
res
=
await
TenantPackageApi
.
getTenantPackageApi
(
rowId
)
unref
(
formRef
)?.
setValues
(
res
)
unref
(
formRef
)?.
setValues
(
res
)
// 设置选中
// 设置选中
unref
(
treeRef
)?.
setCheckedKeys
(
res
.
menuIds
)
res
.
menuIds
?.
forEach
((
item
:
any
)
=>
{
unref
(
treeRef
)?.
setChecked
(
item
,
true
,
false
)
})
}
}
// 提交按钮
// 提交按钮
...
@@ -166,3 +178,10 @@ onMounted(async () => {
...
@@ -166,3 +178,10 @@ onMounted(async () => {
})
})
// getList()
// getList()
</
script
>
</
script
>
<
style
scoped
>
.el-card
{
width
:
100%
;
max-height
:
400px
;
overflow-y
:
scroll
;
}
</
style
>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment