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
77879666
Commit
77879666
authored
Nov 18, 2020
by
Mac
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
http://gitlab.oytour.com/luochao/confucius
parents
f65503ff
100391c8
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
320 additions
and
58 deletions
+320
-58
index.js
src/api/system/index.js
+23
-0
role-form.vue
src/components/system/role-form.vue
+0
-26
manager.vue
src/pages/school/manager.vue
+10
-10
role.vue
src/pages/system/role.vue
+9
-0
setroleauth.vue
src/pages/system/setroleauth.vue
+251
-0
routes.js
src/router/routes.js
+27
-22
No files found.
src/api/system/index.js
View file @
77879666
...
...
@@ -184,3 +184,26 @@ export function setRoleStatus(data) {
data
})
}
/**
* 获取角色菜单和功能权限
* @param {JSON对象} data
*/
export
function
GetRolePermission
(
data
)
{
return
request
({
url
:
'/Public/GetRolePermission'
,
method
:
'post'
,
data
})
}
/**
* 保存角色权限
*/
export
function
SetRolePermission
(
data
)
{
return
request
({
url
:
'/Public/SetRolePermission'
,
method
:
'post'
,
data
})
}
src/components/system/role-form.vue
View file @
77879666
...
...
@@ -16,12 +16,6 @@
title=
"注意:关闭后,角色将无法正常使用."
/>
</div>
</div>
<div
class=
"text-caption q-mb-lg q-px-md text-grey-6"
>
权限设置
</div>
<div
class=
"row wrap"
>
<selectTree
v-if=
"TreeMenuList&&TreeMenuList.length>0"
:treeData=
'TreeMenuList'
:defaultArray=
"returnString"
nodeKey=
"MenuId"
:multiple=
"true"
labelKey=
"MenuName"
childrenKey=
"SubList"
tipText=
"选择菜单"
@
getChild=
"getChild"
classStr=
"col-6 q-pr-lg q-pb-lg"
></selectTree>
</div>
</q-card-section>
<q-separator
/>
<q-card-actions
align=
"right"
class=
"bg-white"
>
...
...
@@ -35,7 +29,6 @@
<
script
>
import
{
queryTreeMenu
,
queryRoleInfo
,
saveRoleInfo
,
}
from
'../../api/system/index'
...
...
@@ -57,7 +50,6 @@
RoleId
:
0
,
//角色编号
RoleName
:
""
,
//角色名称
RoleIntro
:
""
,
//角色介绍
RoleAuth
:
""
,
//角色权限
Status
:
0
,
//状态(0-正常,1-禁用)},
},
returnString
:
[],
...
...
@@ -70,25 +62,9 @@
}
},
mounted
()
{
this
.
queryMenuList
();
this
.
initObj
()
},
methods
:
{
getChild
(
menuArray
)
{
var
tempStr
=
""
;
if
(
menuArray
&&
menuArray
!=
''
)
{
tempStr
=
menuArray
;
}
this
.
objOption
.
RoleAuth
=
tempStr
;
},
//获取菜单列表
queryMenuList
()
{
this
.
TreeMenuList
=
[];
var
qMsg
=
{}
queryTreeMenu
(
qMsg
).
then
(
res
=>
{
this
.
TreeMenuList
=
res
.
Data
;
})
},
//初始化表单
initObj
()
{
this
.
returnString
=
[];
...
...
@@ -99,7 +75,6 @@
this
.
objOption
.
RoleId
=
res
.
Data
.
RoleId
;
this
.
objOption
.
RoleName
=
res
.
Data
.
RoleName
;
this
.
objOption
.
RoleIntro
=
res
.
Data
.
RoleIntro
;
this
.
objOption
.
RoleAuth
=
res
.
Data
.
RoleAuth
;
this
.
objOption
.
Status
=
res
.
Data
.
Status
;
this
.
returnString
=
res
.
Data
.
CheckMenuList
;
})
...
...
@@ -109,7 +84,6 @@
this
.
objOption
.
RoleId
=
0
;
this
.
objOption
.
RoleName
=
""
;
this
.
objOption
.
RoleIntro
=
""
;
this
.
objOption
.
RoleAuth
=
""
;
this
.
objOption
.
Status
=
0
;
}
},
...
...
src/pages/school/manager.vue
View file @
77879666
...
...
@@ -87,7 +87,7 @@
<q-input
filled
stack-label
maxlength=
"20"
:dense=
"false"
v-model=
"objOption.Remark"
class=
"col-6 q-pb-lg q-pr-lg"
label=
"校区备注"
/>
<selectTree
v-if=
"DeptList&&DeptList.length>0"
:treeData=
'DeptList'
:defaultArray=
"returnString"
nodeKey=
"DeptId"
:multiple=
"false"
labelKey=
"DeptName"
childrenKey=
"ChildList"
tipText=
"
所属
部门"
nodeKey=
"DeptId"
:multiple=
"false"
labelKey=
"DeptName"
childrenKey=
"ChildList"
tipText=
"
上级
部门"
@
getChild=
"getChild"
classStr=
"col-6 q-pr-lg q-pb-lg"
></selectTree>
<div
class=
"col-6"
>
<q-toggle
size=
"md"
label=
"校区状态"
color=
"primary"
:false-value=
"1"
:true-value=
"0"
...
...
@@ -254,14 +254,14 @@
},
methods
:
{
filterFn
(
val
,
update
)
{
if
(
val
&&
val
!=
''
)
{
update
(()
=>
{
if
(
val
===
''
)
{
this
.
EmployeeList
=
JSON
.
parse
(
JSON
.
stringify
(
this
.
AllemployeeList
))
}
else
{
const
needle
=
val
.
toLowerCase
()
this
.
EmployeeList
=
this
.
AllemployeeList
.
filter
(
v
=>
v
.
EmployeeName
.
toLowerCase
().
indexOf
(
needle
)
>
-
1
)
})
}
else
{
this
.
EmployeeList
=
JSON
.
parse
(
JSON
.
stringify
(
this
.
AllemployeeList
));
}
})
},
//获取员工列表
getEmployee
()
{
...
...
@@ -271,9 +271,9 @@
queryEmployee
(
qMsg
).
then
(
res
=>
{
if
(
res
.
Code
==
1
)
{
var
jsonData
=
res
.
Data
;
if
(
jsonData
&&
jsonData
>
0
)
{
this
.
AllemployeeList
=
J
OS
N
.
parse
(
JSON
.
stringify
(
jsonData
));
this
.
EmployeeList
=
J
OS
N
.
parse
(
JSON
.
stringify
(
jsonData
));;
if
(
jsonData
&&
jsonData
.
length
>
0
)
{
this
.
AllemployeeList
=
J
SO
N
.
parse
(
JSON
.
stringify
(
jsonData
));
this
.
EmployeeList
=
J
SO
N
.
parse
(
JSON
.
stringify
(
jsonData
));;
}
}
})
...
...
src/pages/system/role.vue
View file @
77879666
...
...
@@ -34,6 +34,9 @@
<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>
...
...
@@ -134,6 +137,12 @@
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
0 → 100644
View file @
77879666
<
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 @
77879666
...
...
@@ -72,6 +72,11 @@ const routes = [{
component
:
()
=>
import
(
"pages/system/role.vue"
)
},
{
path
:
"/system/setroleauth"
,
//设置角色权限
component
:
()
=>
import
(
"pages/system/setroleauth.vue"
)
},
{
path
:
"/course/catagory"
,
//课程分类
component
:
()
=>
...
...
@@ -168,15 +173,15 @@ const routes = [{
import
(
"pages/financial/sellCommissionRules.vue"
)
},
{
path
:
"/financial/FProcessManagement"
,
//流程管理、
component
:
()
=>
import
(
"pages/financial/FProcessManagement.vue"
)
},
{
path
:
"/financial/addFinancialProcess"
,
//新增修改等级
component
:
()
=>
import
(
"pages/financial/addFinancialProcess.vue"
)
},
path
:
"/financial/FProcessManagement"
,
//流程管理、
component
:
()
=>
import
(
"pages/financial/FProcessManagement.vue"
)
},
{
path
:
"/financial/addFinancialProcess"
,
//新增修改等级
component
:
()
=>
import
(
"pages/financial/addFinancialProcess.vue"
)
},
{
path
:
"/financial/accountingWork"
,
//会计窗口
component
:
()
=>
...
...
@@ -216,7 +221,7 @@ const routes = [{
path
:
"/financial/accDetail/CashReport"
,
//现金日报表
component
:
()
=>
import
(
"pages/financial/accDetail/CashReport.vue"
)
},{
},
{
path
:
"/financial/accDetail/CashReport"
,
//现金日报表
component
:
()
=>
import
(
"pages/financial/accDetail/CashReport.vue"
)
...
...
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