Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
micro-system
/
system
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit a8f6e802
authored
Oct 27, 2020
by
胡悦
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
用户、角色部分接口提交
1 parent
f70ef5b0
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
100 additions
and
82 deletions
src/components/basic-table/index.vue
src/config/config.js
src/services/role.js
src/views/role/index.vue
src/views/user/index.vue
src/components/basic-table/index.vue
View file @
a8f6e80
...
@@ -296,12 +296,10 @@ export default {
...
@@ -296,12 +296,10 @@ export default {
// 页码
// 页码
handleSizeChange
(
value
)
{
handleSizeChange
(
value
)
{
this
.
page
.
pageSize
=
value
this
.
page
.
pageSize
=
value
console
.
log
(
'handleSizeChange'
,
value
)
this
.
getListApi
?
this
.
refreshTable
(
false
)
:
this
.
$emit
(
'refreshTable'
,
this
.
page
)
this
.
getListApi
?
this
.
refreshTable
(
false
)
:
this
.
$emit
(
'refreshTable'
,
this
.
page
)
},
},
handleCurrentChange
(
value
)
{
handleCurrentChange
(
value
)
{
console
.
log
(
'handleCurrentChange'
,
value
)
this
.
page
.
pageNumber
=
value
this
.
page
.
pageNumber
=
value
this
.
getListApi
?
this
.
refreshTable
(
false
)
:
this
.
$emit
(
'refreshTable'
,
this
.
page
)
this
.
getListApi
?
this
.
refreshTable
(
false
)
:
this
.
$emit
(
'refreshTable'
,
this
.
page
)
...
...
src/config/config.js
View file @
a8f6e80
...
@@ -32,7 +32,8 @@ const ROLE_API = {
...
@@ -32,7 +32,8 @@ const ROLE_API = {
TENANT_SIMPLELIST
:
BASE_URL
+
'/usercenter/tenant/simplelist'
,
TENANT_SIMPLELIST
:
BASE_URL
+
'/usercenter/tenant/simplelist'
,
ROLE_ADD
:
BASE_URL
+
'/usercenter/role/add'
,
ROLE_ADD
:
BASE_URL
+
'/usercenter/role/add'
,
ROLE_EDIT
:
BASE_URL
+
'/usercenter/role/edit'
,
ROLE_EDIT
:
BASE_URL
+
'/usercenter/role/edit'
,
ROLE_DELETE
:
BASE_URL
+
'/usercenter/role/delete'
ROLE_DELETE
:
BASE_URL
+
'/usercenter/role/delete'
,
MENU_TREE
:
BASE_URL
+
'/usercenter/menu/checkedtree'
}
}
const
MENU_API
=
{
const
MENU_API
=
{
MENU_SEARCH
:
BASE_URL
+
'/usercenter/menu/search'
,
MENU_SEARCH
:
BASE_URL
+
'/usercenter/menu/search'
,
...
@@ -45,7 +46,7 @@ const MENU_API = {
...
@@ -45,7 +46,7 @@ const MENU_API = {
const
ORGINIZA_API
=
{
const
ORGINIZA_API
=
{
ORGINIZA_SEARCH
:
BASE_URL
+
'/usercenter/organization/rootList'
,
ORGINIZA_SEARCH
:
BASE_URL
+
'/usercenter/organization/rootList'
,
ORGINIZA_CHILDREN
:
BASE_URL
+
'/usercenter/organization/children'
,
ORGINIZA_CHILDREN
:
BASE_URL
+
'/usercenter/organization/children'
,
ORGINIZA_SIMPLElIST
:
BASE_URL
+
'/usercenter/organization/simple
L
ist'
,
ORGINIZA_SIMPLElIST
:
BASE_URL
+
'/usercenter/organization/simple
l
ist'
,
ORGINIZA_TREEORY
:
BASE_URL
+
'/usercenter/organization/orgtree'
,
ORGINIZA_TREEORY
:
BASE_URL
+
'/usercenter/organization/orgtree'
,
ORGINIZA_ADD
:
BASE_URL
+
'/usercenter/organization/add'
,
ORGINIZA_ADD
:
BASE_URL
+
'/usercenter/organization/add'
,
ORGINIZA_EDIT
:
BASE_URL
+
'/usercenter/organization/edit'
,
ORGINIZA_EDIT
:
BASE_URL
+
'/usercenter/organization/edit'
,
...
...
src/services/role.js
View file @
a8f6e80
...
@@ -36,4 +36,10 @@ function deleteRole (params) {
...
@@ -36,4 +36,10 @@ function deleteRole (params) {
return
request
(
params
,
url
)
return
request
(
params
,
url
)
}
}
export
{
getRoleList
,
roleInfo
,
getTenantList
,
addRole
,
editRole
,
deleteRole
}
// 获取菜单权限
function
getMenuTree
(
params
)
{
const
url
=
ROLE_API
.
MENU_TREE
return
request
(
params
,
url
)
}
export
{
getRoleList
,
roleInfo
,
getTenantList
,
addRole
,
editRole
,
deleteRole
,
getMenuTree
}
src/views/role/index.vue
View file @
a8f6e80
...
@@ -30,6 +30,7 @@
...
@@ -30,6 +30,7 @@
>
新增
</el-button>
>
新增
</el-button>
</div>
</div>
<basic-table
<basic-table
ref=
"roleTable"
:tableParams=
"tableParams"
:tableParams=
"tableParams"
:getListApi=
"getListApi"
:getListApi=
"getListApi"
:searchForm=
"searchForm"
:searchForm=
"searchForm"
...
@@ -65,14 +66,14 @@
...
@@ -65,14 +66,14 @@
>
>
<div
slot=
"visible-type"
>
<div
slot=
"visible-type"
>
<el-radio-group
<el-radio-group
@
change=
"radioChange(
$event
)"
@
change=
"radioChange(
roleForm.visibleType
)"
v-model=
"roleForm.visibleType"
v-model=
"roleForm.visibleType"
>
>
<el-radio
<el-radio
v-for=
"(child,childIndex) in $Constants.ROLE_VISIBLE"
v-for=
"(child,childIndex) in $Constants.ROLE_VISIBLE"
:key=
"childIndex"
:key=
"childIndex"
:label=
"childIndex"
:label=
"childIndex"
>
{{
child
}}
</el-radio>
>
{{
child
}}
{{
childIndex
}}
</el-radio>
</el-radio-group>
</el-radio-group>
<el-select
<el-select
v-if=
"roleForm.visibleType == '2'"
v-if=
"roleForm.visibleType == '2'"
...
@@ -90,7 +91,7 @@
...
@@ -90,7 +91,7 @@
</div>
</div>
<div
slot=
"menu-list"
>
<div
slot=
"menu-list"
>
<el-tree
<el-tree
:data=
"data"
:data=
"
tree
data"
show-checkbox
show-checkbox
default-expand-all
default-expand-all
node-key=
"id"
node-key=
"id"
...
@@ -109,7 +110,7 @@
...
@@ -109,7 +110,7 @@
</
template
>
</
template
>
<
script
>
<
script
>
import
{
getRoleList
,
roleInfo
,
getTenantList
,
addRole
,
editRole
,
deleteRole
}
from
'services/role'
;
import
{
getRoleList
,
roleInfo
,
getTenantList
,
addRole
,
editRole
,
deleteRole
,
getMenuTree
}
from
'services/role'
;
export
default
{
export
default
{
data
()
{
data
()
{
...
@@ -152,11 +153,6 @@ export default {
...
@@ -152,11 +153,6 @@ export default {
btnList
:
[
btnList
:
[
{
{
type
:
'primary'
,
type
:
'primary'
,
name
:
'新增'
,
pType
:
'create'
},
{
type
:
'primary'
,
name
:
'编辑'
,
name
:
'编辑'
,
pType
:
'edit'
pType
:
'edit'
},
},
...
@@ -193,46 +189,12 @@ export default {
...
@@ -193,46 +189,12 @@ export default {
permissionType
:
[{
required
:
true
,
message
:
'请选择数据权限'
}],
permissionType
:
[{
required
:
true
,
message
:
'请选择数据权限'
}],
menuIdList
:
[{
required
:
true
,
validator
:
checkMenu
,
trigger
:
'blur'
}]
menuIdList
:
[{
required
:
true
,
validator
:
checkMenu
,
trigger
:
'blur'
}]
},
},
data
:
[{
treedata
:
[],
id
:
1
,
label
:
'一级 1'
,
children
:
[{
id
:
4
,
label
:
'二级 1-1'
,
children
:
[{
id
:
9
,
label
:
'三级 1-1-1'
},
{
id
:
10
,
label
:
'三级 1-1-2'
}]
}]
},
{
id
:
2
,
label
:
'一级 2'
,
children
:
[{
id
:
5
,
label
:
'二级 2-1'
},
{
id
:
6
,
label
:
'二级 2-2'
}]
},
{
id
:
3
,
label
:
'一级 3'
,
children
:
[{
id
:
7
,
label
:
'二级 3-1'
},
{
id
:
8
,
label
:
'二级 3-2'
}]
}],
tenantList
:
[]
tenantList
:
[]
}
}
},
},
mounted
()
{
mounted
()
{
this
.
get
TenantList
()
this
.
get
MenuTree
()
},
},
methods
:
{
methods
:
{
// 重置搜索条件
// 重置搜索条件
...
@@ -274,7 +236,7 @@ export default {
...
@@ -274,7 +236,7 @@ export default {
enableStatus
:
true
,
enableStatus
:
true
,
menuIdList
:
[]
menuIdList
:
[]
}
}
this
.
setCheckedNodes
()
this
.
getTenantList
()
this
.
handleClose
()
this
.
handleClose
()
break
break
case
'edit'
:
case
'edit'
:
...
@@ -291,7 +253,7 @@ export default {
...
@@ -291,7 +253,7 @@ export default {
roleInfo
({
id
:
row
.
id
}).
then
(
res
=>
{
roleInfo
({
id
:
row
.
id
}).
then
(
res
=>
{
this
.
roleForm
=
JSON
.
parse
(
JSON
.
stringify
(
res
.
data
))
this
.
roleForm
=
JSON
.
parse
(
JSON
.
stringify
(
res
.
data
))
this
.
roleForm
.
enableStatus
=
res
.
data
.
enableStatus
==
1
?
true
:
false
this
.
roleForm
.
enableStatus
=
res
.
data
.
enableStatus
==
1
?
true
:
false
this
.
getMenuTree
({
roleId
:
row
.
id
})
this
.
handleClose
(
res
.
data
)
this
.
handleClose
(
res
.
data
)
})
})
},
},
...
@@ -305,15 +267,28 @@ export default {
...
@@ -305,15 +267,28 @@ export default {
type
:
'error'
,
type
:
'error'
,
callBack
:
()
=>
{
callBack
:
()
=>
{
deleteRole
({
id
:
id
}).
then
(
res
=>
{
deleteRole
({
id
:
id
}).
then
(
res
=>
{
this
.
$message
({
if
(
res
.
code
==
'200'
)
{
type
:
'success'
,
this
.
$message
({
message
:
'删除成功!'
type
:
'success'
,
})
message
:
'删除成功!'
})
this
.
$refs
.
roleTable
.
refreshTable
()
}
else
{
this
.
$message
(
res
.
message
)
}
})
})
}
}
}
}
this
.
$Common
.
confirmDialog
(
tipData
)
this
.
$Common
.
confirmDialog
(
tipData
)
},
},
// 获取菜单权限列表
getMenuTree
(
params
)
{
getMenuTree
(
params
).
then
(
res
=>
{
console
.
log
(
res
)
this
.
treedata
=
res
.
data
})
},
// 获取选中菜单数组
// 获取选中菜单数组
getCheckedKeys
()
{
getCheckedKeys
()
{
this
.
roleForm
.
menuIdList
=
this
.
$refs
.
tree
.
getCheckedKeys
()
this
.
roleForm
.
menuIdList
=
this
.
$refs
.
tree
.
getCheckedKeys
()
...
@@ -329,7 +304,8 @@ export default {
...
@@ -329,7 +304,8 @@ export default {
})
})
},
},
radioChange
(
e
)
{
radioChange
(
e
)
{
console
.
log
(
e
)
console
.
log
(
e
,
this
.
roleForm
)
this
.
$set
(
this
.
roleForm
,
'visibleType'
,
e
)
}
}
}
}
}
}
...
...
src/views/user/index.vue
View file @
a8f6e80
...
@@ -4,7 +4,12 @@
...
@@ -4,7 +4,12 @@
<div
class=
"user-tree-top"
>
<div
class=
"user-tree-top"
>
<span>
组织架构
</span>
<span>
组织架构
</span>
</div>
</div>
<el-input
size=
"mini"
></el-input>
<el-input
size=
"mini"
placeholder=
"按回车搜索"
v-model=
"orgName"
@
input=
"treeInput"
></el-input>
<el-tree
<el-tree
:data=
"treedata"
:data=
"treedata"
accordion
accordion
...
@@ -44,6 +49,7 @@
...
@@ -44,6 +49,7 @@
>
新增
</el-button>
>
新增
</el-button>
</div>
</div>
<basic-table
<basic-table
ref=
"userTable"
:tableParams=
"tableParams"
:tableParams=
"tableParams"
:searchForm=
"searchForm"
:searchForm=
"searchForm"
:getListApi=
"getListApi"
:getListApi=
"getListApi"
...
@@ -126,6 +132,7 @@ export default {
...
@@ -126,6 +132,7 @@ export default {
data
()
{
data
()
{
return
{
return
{
USERSTATUS
:
this
.
$Constants
.
USER_STATUS
,
USERSTATUS
:
this
.
$Constants
.
USER_STATUS
,
orgName
:
''
,
searchForm
:
{},
searchForm
:
{},
userFormList
:
[
userFormList
:
[
{
{
...
@@ -138,13 +145,14 @@ export default {
...
@@ -138,13 +145,14 @@ export default {
type
:
'select'
,
type
:
'select'
,
prop
:
'userStatus'
,
prop
:
'userStatus'
,
placeholder
:
'请选择用户状态'
,
placeholder
:
'请选择用户状态'
,
options
:
[{
options
:
value
:
'0'
,
[{
label
:
'正常'
value
:
'1'
,
},
{
label
:
'正常'
value
:
'1'
,
},
{
label
:
'停用'
value
:
'2'
,
}]
label
:
'停用'
}]
}
}
],
],
tableParams
:
{
tableParams
:
{
...
@@ -158,15 +166,16 @@ export default {
...
@@ -158,15 +166,16 @@ export default {
prop
:
'id'
prop
:
'id'
},
{
},
{
label
:
'登录名称'
,
label
:
'登录名称'
,
prop
:
'account'
prop
:
'account'
,
width
:
120
},
{
},
{
label
:
'用户名称'
,
label
:
'用户名称'
,
prop
:
'username'
,
prop
:
'username'
,
width
:
1
2
0
width
:
1
0
0
},
{
},
{
label
:
'部门'
,
label
:
'部门'
,
prop
:
'departmentName'
,
prop
:
'departmentName'
,
width
:
2
00
width
:
1
00
},
{
},
{
label
:
'手机号'
,
label
:
'手机号'
,
prop
:
'phoneNumber'
,
prop
:
'phoneNumber'
,
...
@@ -177,7 +186,8 @@ export default {
...
@@ -177,7 +186,8 @@ export default {
addHtml
:
'status'
addHtml
:
'status'
},
{
},
{
label
:
'创建时间'
,
label
:
'创建时间'
,
prop
:
'createDate'
prop
:
'createdDate'
,
width
:
150
}
}
],
],
tableOption
:
{
tableOption
:
{
...
@@ -296,7 +306,7 @@ export default {
...
@@ -296,7 +306,7 @@ export default {
}
}
]
]
}
}
]
]
,
}
}
},
},
watch
:
{
watch
:
{
...
@@ -320,10 +330,20 @@ export default {
...
@@ -320,10 +330,20 @@ export default {
if
(
valid
)
{
if
(
valid
)
{
let
params
=
JSON
.
parse
(
JSON
.
stringify
(
this
.
userForm
))
let
params
=
JSON
.
parse
(
JSON
.
stringify
(
this
.
userForm
))
params
.
enableStatus
=
this
.
userForm
.
enableStatus
?
1
:
2
params
.
enableStatus
=
this
.
userForm
.
enableStatus
?
1
:
2
delete
params
.
departmentName
delete
params
.
superiorName
let
api
=
addUser
let
api
=
addUser
if
(
params
.
id
)
api
=
editUser
if
(
params
.
id
)
api
=
editUser
api
(
params
).
then
(
res
=>
{
api
(
params
).
then
(
res
=>
{
this
.
handleClose
()
if
(
res
.
code
=
'200'
)
{
this
.
$refs
.
userTable
.
refreshTable
()
this
.
handleClose
()
this
.
$message
({
type
:
'success'
,
message
:
'操作成功!'
})
}
})
})
}
else
{
}
else
{
console
.
log
(
'error'
)
console
.
log
(
'error'
)
...
@@ -340,7 +360,8 @@ export default {
...
@@ -340,7 +360,8 @@ export default {
},
},
// 组织架构节点
// 组织架构节点
handleNodeClick
(
data
)
{
handleNodeClick
(
data
)
{
console
.
log
(
data
)
this
.
searchForm
.
departmentId
=
data
.
id
this
.
$refs
.
userTable
.
refreshTable
()
},
},
// 树节点内容区的渲染
// 树节点内容区的渲染
renderContent
(
h
,
{
node
,
data
,
store
})
{
renderContent
(
h
,
{
node
,
data
,
store
})
{
...
@@ -393,10 +414,15 @@ export default {
...
@@ -393,10 +414,15 @@ export default {
type
:
'error'
,
type
:
'error'
,
callBack
:
()
=>
{
callBack
:
()
=>
{
deleteUser
({
id
:
id
}).
then
(
res
=>
{
deleteUser
({
id
:
id
}).
then
(
res
=>
{
this
.
$message
({
if
(
res
.
code
==
'200'
)
{
type
:
'success'
,
this
.
$message
({
message
:
'删除成功!'
type
:
'success'
,
})
message
:
'删除成功!'
})
this
.
$refs
.
userTable
.
refreshTable
()
}
else
{
this
.
$message
(
res
.
message
)
}
})
})
}
}
}
}
...
@@ -404,14 +430,16 @@ export default {
...
@@ -404,14 +430,16 @@ export default {
},
},
// 部门弹窗
// 部门弹窗
selectDepart
()
{
selectDepart
()
{
this
.
filterText
=
''
this
.
filterDialogTitle
=
'选择组织'
this
.
filterDialogTitle
=
'选择组织'
this
.
getSimpleList
()
this
.
getSimpleList
()
this
.
closeFilter
()
this
.
closeFilter
()
},
},
// 上级弹窗
// 上级弹窗
selectSuperior
()
{
selectSuperior
()
{
this
.
filterText
=
''
this
.
filterDialogTitle
=
'选择直接上级'
this
.
filterDialogTitle
=
'选择直接上级'
this
.
getSuperUser
()
this
.
getSuperUser
(
{
departmentId
:
this
.
userForm
.
departmentId
}
)
this
.
closeFilter
()
this
.
closeFilter
()
},
},
...
@@ -439,20 +467,21 @@ export default {
...
@@ -439,20 +467,21 @@ export default {
getSuperUser
(
params
)
{
getSuperUser
(
params
)
{
getSuperUser
(
params
).
then
(
res
=>
{
getSuperUser
(
params
).
then
(
res
=>
{
console
.
log
(
res
)
console
.
log
(
res
)
this
.
filterTextData
=
res
.
data
.
list
this
.
filterTextData
=
res
.
data
})
})
},
},
// 获取组织树
// 获取组织树
getSimpleList
()
{
getSimpleList
()
{
get
SimpleList
().
then
(
res
=>
{
get
TreeOrg
().
then
(
res
=>
{
console
.
log
(
res
)
console
.
log
(
res
)
this
.
filterTextData
=
res
.
data
.
list
this
.
filterTextData
=
res
.
data
})
})
},
},
// 获取组织架构
// 获取组织架构
getTreeOrg
()
{
getTreeOrg
(
params
)
{
getTreeOrg
().
then
(
res
=>
{
getTreeOrg
(
params
).
then
(
res
=>
{
console
.
log
(
res
)
console
.
log
(
res
)
// this.searchForm.departmentId = res.data.id
this
.
treedata
=
res
.
data
this
.
treedata
=
res
.
data
})
})
},
},
...
@@ -463,6 +492,14 @@ export default {
...
@@ -463,6 +492,14 @@ export default {
this
.
userData
[
5
].
options
=
res
.
data
this
.
userData
[
5
].
options
=
res
.
data
console
.
log
(
this
.
roleList
)
console
.
log
(
this
.
roleList
)
})
})
},
// 组织架构搜索
treeInput
(
value
)
{
const
params
=
{
orgName
:
value
}
this
.
getTreeOrg
(
params
)
// this.$refs.userTable.refreshTable()
}
}
}
}
}
}
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment