Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
confucius
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
罗超
confucius
Commits
787cc9ef
Commit
787cc9ef
authored
Nov 24, 2020
by
黄奎
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
页面修改
parent
572637df
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
69 additions
and
274 deletions
+69
-274
menufunction-form.vue
src/components/system/menufunction-form.vue
+3
-3
role-form.vue
src/components/system/role-form.vue
+66
-6
role.vue
src/pages/system/role.vue
+0
-9
setroleauth.vue
src/pages/system/setroleauth.vue
+0
-251
routes.js
src/router/routes.js
+0
-5
No files found.
src/components/system/menufunction-form.vue
View file @
787cc9ef
...
...
@@ -46,7 +46,7 @@
persistent
:
true
,
objOption
:
{
Id
:
0
,
//主键编号
MenuId
:
0
,
//菜单编号
Menu
_
Id
:
0
,
//菜单编号
FunctionName
:
""
,
//权限名称
FunctionCode
:
""
,
//权限编号
Remarks
:
""
,
//权限备注
...
...
@@ -67,7 +67,7 @@
Id
:
this
.
saveObj
.
Id
}).
then
(
res
=>
{
this
.
objOption
.
Id
=
res
.
Data
.
Id
;
this
.
objOption
.
Menu
Id
=
res
.
Data
.
Menu
Id
;
this
.
objOption
.
Menu
_Id
=
res
.
Data
.
Menu_
Id
;
this
.
objOption
.
FunctionName
=
res
.
Data
.
FunctionName
;
this
.
objOption
.
FunctionCode
=
res
.
Data
.
FunctionCode
;
this
.
objOption
.
Remarks
=
res
.
Data
.
Remarks
;
...
...
@@ -77,7 +77,7 @@
}
else
{
this
.
optionTitle
=
"新增菜单功能权限"
this
.
objOption
.
Id
=
0
;
this
.
objOption
.
MenuId
=
0
;
this
.
objOption
.
Menu
_
Id
=
0
;
this
.
objOption
.
FunctionName
=
""
;
this
.
objOption
.
FunctionCode
=
""
;
this
.
objOption
.
Remarks
=
""
;
...
...
src/components/system/role-form.vue
View file @
787cc9ef
...
...
@@ -16,6 +16,33 @@
title=
"注意:关闭后,角色将无法正常使用."
/>
</div>
</div>
<div
class=
"text-caption q-mb-lg q-px-md text-grey-6"
>
权限设置
</div>
<q-card>
<template
v-for=
"(item,index) in AuthMenuList"
>
<q-checkbox
v-model=
"item.IsChecked"
:false-value=
"item.IsChecked"
:label=
"item.MenuName"
@
input=
"menuChange(item)"
/>
</
template
>
<div
class=
"row wrap"
>
<
template
v-if=
"SubMenuList&&SubMenuList.length>0"
v-for=
"(subItem,subIndex) in SubMenuList"
>
<q-card
class=
"my-card"
flat
style=
"width:200px;border:1px solid red;float:left;"
>
<q-card-section>
<div
class=
"text-h6"
>
<q-checkbox
v-model=
"subItem.IsChecked"
:false-value=
"subItem.IsChecked"
:label=
"subItem.MenuName"
/>
</div>
<template
v-if=
"subItem.SubList&&subItem.SubList.length>0"
v-for=
"(chiildItem,index) in subItem.SubList"
>
<span
style=
"display:inline-block"
>
<q-checkbox
v-model=
"chiildItem.IsChecked"
:false-value=
"chiildItem.IsChecked"
:label=
"chiildItem.MenuName"
/>
</span>
</
template
>
</q-card-section>
</q-card>
</template>
</div>
</q-card>
</q-card-section>
<q-separator
/>
<q-card-actions
align=
"right"
class=
"bg-white"
>
...
...
@@ -31,6 +58,7 @@
import
{
queryRoleInfo
,
saveRoleInfo
,
GetRolePermission
}
from
'../../api/system/index'
import
selectTree
from
'../common/select-tree'
export
default
{
...
...
@@ -54,17 +82,37 @@
},
returnString
:
[],
optionTitle
:
""
,
//菜单列表
TreeMenuList
:
[],
saveLoading
:
false
,
//选中的节点
checkMenuArray
:
[],
AuthMenuList
:
[],
//权限列表
SubMenuList
:
[],
//下级菜单权限
group
:
[],
}
},
computed
:
{
},
mounted
()
{
this
.
initObj
()
this
.
initObj
();
this
.
queryRolePermission
();
},
methods
:
{
//菜单切换
menuChange
(
item
)
{
this
.
SubMenuList
=
[];
this
.
SubMenuList
=
item
.
SubList
;
},
//获取权限
queryRolePermission
()
{
var
qMsg
=
{
Role_Id
:
this
.
objOption
.
RoleId
};
GetRolePermission
(
qMsg
).
then
(
res
=>
{
console
.
log
(
"res"
,
res
.
Data
)
if
(
res
.
Code
==
1
)
{
this
.
AuthMenuList
=
res
.
Data
;
}
}).
catch
(()
=>
{})
},
//初始化表单
initObj
()
{
this
.
returnString
=
[];
...
...
@@ -94,7 +142,19 @@
},
//保存菜单
saveRole
()
{
this
.
saveLoading
=
true
this
.
saveLoading
=
true
;
var
tempArray
=
[];
if
(
this
.
AuthMenuList
&&
this
.
AuthMenuList
.
length
>
0
)
{
this
.
AuthMenuList
.
forEach
(
item
=>
{
if
(
item
.
IsChecked
)
{
tempArray
.
push
({
});
}
})
}
console
.
log
()
saveRoleInfo
(
this
.
objOption
).
then
(
res
=>
{
this
.
saveLoading
=
false
this
.
$q
.
notify
({
...
...
src/pages/system/role.vue
View file @
787cc9ef
...
...
@@ -34,9 +34,6 @@
<q-td
:props=
"props"
>
<q-btn
flat
size=
"xs"
icon=
"edit"
color=
"accent"
style=
"font-weight:400"
label=
"编辑"
@
click=
"EditRole(props.row)"
/>
<q-btn
flat
size=
"xs"
icon=
"edit"
color=
"accent"
style=
"font-weight:400"
label=
"设置权限"
@
click=
"gotoSub(props.row)"
/>
</q-td>
</
template
>
</q-table>
...
...
@@ -137,12 +134,6 @@
this
.
getRolelist
()
},
methods
:
{
gotoSub
(
obj
)
{
var
tempStr
=
'/system/setroleauth?roleId='
+
obj
.
RoleId
;
this
.
$router
.
push
({
path
:
tempStr
});
},
//重新查询
resetSearch
()
{
this
.
msg
.
pageIndex
=
1
;
...
...
src/pages/system/setroleauth.vue
deleted
100644 → 0
View file @
572637df
<
style
scoped
>
.commonTable
{
width
:
100%
;
border-collapse
:
collapse
;
}
.commonTable
tr
th
{
background
:
#E6E6E6
;
height
:
40px
;
font-size
:
14px
;
color
:
#333
;
border
:
1px
solid
#E6E6E6
}
.commonTable
tr
{
background
:
#fff
;
text-align
:
center
;
height
:
40px
;
}
.commonTable
tr
:nth-child
(
2n
+
1
)
{
background
:
#fafafa
;
}
.commonTable
tr
td
{
font-size
:
12px
;
border
:
1px
solid
#E5E5E5
;
}
</
style
>
<
template
>
<div
class=
"page-body"
>
<div
class=
"page-search row items-center"
>
<div
class=
"col row wrap q-mr-lg q-col-gutter-md"
>
</div>
<div
class=
"page-option"
>
<q-btn
color=
"accent"
class=
"q-mr-md"
icon=
"add"
label=
"保存权限"
@
click=
"saveRolePermission"
/>
</div>
</div>
<div
class=
"page-content"
>
<span>
菜单权限
</span>
<table
class=
"commonTable"
border=
"0"
cellspacing=
"0"
cellpadding=
"0"
v-loading=
"loading"
>
<tr>
<th
style=
"width:200px;"
>
一级菜单
</th>
<th
style=
"width:200px;"
>
二级菜单
</th>
<th>
三级菜单
</th>
</tr>
<template
v-for=
"(item,index) in MenuList"
>
<template
v-for=
"(subItem,subIndex) in item.SubList"
>
<tr
:key=
"index+'1'+subIndex"
>
<td
v-if=
"subIndex==0"
:rowspan=
"item.SubList.length"
>
<el-checkbox
v-model=
"item.IsChecked"
:key=
"index"
@
change=
"ChangeItem(item)"
>
{{
item
.
MenuName
}}
</el-checkbox>
</td>
<td
style=
"text-align:left;padding-left:5px;"
>
<el-checkbox
v-model=
"subItem.IsChecked"
:key=
"subIndex"
@
change=
"ChangeItem(subItem);SetParent(subItem,0)"
>
{{
subItem
.
MenuName
}}
</el-checkbox>
</td>
<td
style=
"text-align:left;padding-left:5px;"
>
<template
v-for=
"(childItem,childIndex) in subItem.SubList"
>
<el-checkbox
v-model=
"childItem.IsChecked"
:key=
"childIndex"
@
change=
"SetParent(childItem,subItem.ParentId)"
>
{{
childItem
.
MenuName
}}
</el-checkbox>
</
template
>
</td>
</tr>
</template>
</template>
</table>
<span>
功能权限
</span>
<table
class=
"commonTable"
border=
"0"
cellspacing=
"0"
cellpadding=
"0"
v-loading=
"loading"
>
<tr>
<th
style=
"width:200px;"
>
一级分类
</th>
<th>
功能名称
</th>
</tr>
<
template
v-for=
"(item,index) in ActionList"
>
<template
v-for=
"(subItem,subIndex) in item.SubList"
>
<tr
:key=
"index+'1'+subIndex"
>
<td
v-if=
"subIndex==0"
:rowspan=
"item.SubList.length"
>
<el-checkbox
v-model=
"item.IsChecked"
:key=
"index"
@
change=
"ChangeItem(item)"
>
{{
item
.
CategoryName
}}
</el-checkbox>
</td>
<td
style=
"text-align:left;padding-left:5px;"
>
<el-checkbox
v-model=
"subItem.IsChecked"
:key=
"subIndex"
@
change=
"ChangeItem(subItem);SetParent(subItem,0)"
>
{{
subItem
.
ActionName
}}
</el-checkbox>
</td>
</tr>
</
template
>
</template>
</table>
</div>
</div>
</template>
<
script
>
import
{
GetRolePermission
,
SetRolePermission
}
from
'../../api/system/index'
export
default
{
meta
:
{
title
:
"设置角色权限"
},
components
:
{
},
data
()
{
return
{
currentUrl
:
""
,
loading
:
false
,
roleId
:
0
,
//角色编号
MenuList
:
[],
//菜单权限
ActionList
:
[],
//功能权限
}
},
mounted
()
{
this
.
currentUrl
=
this
.
$route
.
path
if
(
this
.
$route
.
query
.
roleId
)
{
this
.
roleId
=
this
.
$route
.
query
.
roleId
}
this
.
queryRolePermission
();
},
methods
:
{
//设置选中
ChangeItem
(
item
)
{
if
(
item
.
SubList
&&
item
.
SubList
.
length
>
0
)
{
item
.
SubList
.
forEach
(
subItem
=>
{
subItem
.
IsChecked
=
item
.
IsChecked
;
if
(
subItem
.
SubList
&&
subItem
.
SubList
.
length
>
0
)
{
subItem
.
SubList
.
forEach
(
childItem
=>
{
childItem
.
IsChecked
=
item
.
IsChecked
;
})
}
})
}
},
//设置父项选中
SetParent
(
pItem
,
pValue
)
{
this
.
MenuList
.
forEach
(
item
=>
{
if
(
item
.
MenuId
==
pItem
.
ParentId
&&
pItem
.
IsChecked
)
{
item
.
IsChecked
=
pItem
.
IsChecked
}
if
(
pValue
>
0
&&
item
.
MenuId
==
pValue
&&
pItem
.
IsChecked
)
{
item
.
IsChecked
=
pItem
.
IsChecked
}
if
(
item
.
SubList
&&
item
.
SubList
.
length
>
0
)
{
item
.
SubList
.
forEach
(
subItem
=>
{
if
(
subItem
.
MenuId
==
pItem
.
ParentId
&&
pItem
.
IsChecked
)
{
subItem
.
IsChecked
=
pItem
.
IsChecked
}
if
(
subItem
.
SubList
&&
subItem
.
SubList
.
length
>
0
)
{
subItem
.
SubList
.
forEach
(
childItem
=>
{
if
(
childItem
.
MenuId
==
pItem
.
ParentId
&&
pItem
.
IsChecked
)
{
childItem
.
IsChecked
=
pItem
.
IsChecked
}
});
}
})
}
})
},
//获取权限
queryRolePermission
()
{
var
qMsg
=
{
Role_Id
:
this
.
roleId
};
GetRolePermission
(
qMsg
).
then
(
res
=>
{
if
(
res
.
Code
==
1
)
{
this
.
MenuList
=
res
.
Data
.
menuList
;
this
.
ActionList
=
res
.
Data
.
functionList
;
}
}).
catch
(()
=>
{
})
},
//保存角色权限
saveRolePermission
()
{
var
tempMenu
=
[];
var
tempAction
=
[];
if
(
this
.
MenuList
&&
this
.
MenuList
.
length
>
0
)
{
this
.
MenuList
.
forEach
(
item
=>
{
if
(
item
.
IsChecked
)
{
tempMenu
.
push
({
ID
:
0
,
Role_Id
:
this
.
roleId
,
Menu_Id
:
item
.
MenuId
});
}
if
(
item
.
SubList
&&
item
.
SubList
.
length
>
0
)
{
item
.
SubList
.
forEach
(
subItem
=>
{
if
(
subItem
.
IsChecked
)
{
tempMenu
.
push
({
ID
:
0
,
Role_Id
:
this
.
roleId
,
Menu_Id
:
subItem
.
MenuId
});
}
if
(
subItem
.
SubList
&&
subItem
.
SubList
.
length
>
0
)
{
subItem
.
SubList
.
forEach
(
childItem
=>
{
if
(
childItem
.
IsChecked
)
{
tempMenu
.
push
({
ID
:
0
,
Role_Id
:
this
.
roleId
,
Menu_Id
:
subItem
.
MenuId
});
}
});
}
})
}
})
}
if
(
this
.
ActionList
&&
this
.
ActionList
.
length
>
0
)
{
this
.
ActionList
.
forEach
(
item
=>
{
if
(
item
.
SubList
&&
item
.
SubList
.
length
>
0
)
{
item
.
SubList
.
forEach
(
subItem
=>
{
if
(
subItem
.
IsChecked
)
{
tempAction
.
push
({
ID
:
0
,
Role_Id
:
this
.
roleId
,
Action_Id
:
item
.
Action_Id
,
ActionName
:
item
.
ActionName
});
}
})
}
})
}
var
data
=
{
roleMenu
:
tempMenu
,
roleFunction
:
tempAction
};
console
.
log
(
"data"
,
data
);
SetRolePermission
(
data
).
then
(
res
=>
{
if
(
res
.
Code
==
1
)
{
this
this
.
queryRolePermission
();
}
});
}
}
}
</
script
>
<
style
lang=
"sass"
>
@import
url('~assets/css/table.sass');
</
style
>
src/router/routes.js
View file @
787cc9ef
...
...
@@ -77,11 +77,6 @@ const routes = [{
component
:
()
=>
import
(
"pages/system/role.vue"
)
},
{
path
:
"/system/setroleauth"
,
//设置角色权限
component
:
()
=>
import
(
"pages/system/setroleauth.vue"
)
},
{
path
:
"/course/catagory"
,
//课程分类
component
:
()
=>
...
...
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