Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
glsx-web
/
authority
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Settings
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 8680beae
authored
Sep 14, 2018
by
cwq0219
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
role接口
1 parent
4f5c5db0
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
50 additions
and
26 deletions
src/common/roleConst.js
src/components/RoleCreate/src/main.vue
src/config/common.conf.js
src/views/customer/role/index.vue
src/common/roleConst.js
View file @
8680bea
const
roleCreateStructure
=
{
//
id: Number,
id
:
Number
,
roleName
:
''
,
description
:
''
,
departName
:
''
,
...
...
src/components/RoleCreate/src/main.vue
View file @
8680bea
...
...
@@ -28,7 +28,7 @@
<
script
>
import
{
roleCreateStructure
}
from
'@/common/commonConst'
import
{
saveRoleList
}
from
'@/api/api'
import
{
saveRoleList
,
updateRole
}
from
'@/api/api'
export
default
{
name
:
'RoleCreate'
,
props
:
{
...
...
@@ -64,28 +64,39 @@ export default {
}
},
methods
:
{
// isRoleNameExit
addRole
(
editData
)
{
saveRoleList
.
req
(
editData
).
then
((
data
)
=>
{
getParams
()
{
return
this
.
$deep_clone
(
this
.
createRuleForm
)
},
// 接口
addRole
()
{
saveRoleList
.
req
(
this
.
getParams
()).
then
((
data
)
=>
{
console
.
log
(
data
)
}).
catch
(
err
=>
{
console
.
log
(
err
)
})
},
updateRoleInfo
()
{
updateRole
.
req
(
this
.
getParams
()).
then
((
data
)
=>
{
console
.
log
(
data
)
}).
catch
(
err
=>
{
console
.
log
(
err
)
})
},
// 接口
handleCreateSubmit
(
formName
)
{
const
editData
=
this
.
$deep_clone
(
this
.
createRuleForm
)
const
editData
=
this
.
getParams
(
)
// eidt:true;create:false
// const flagEOrC = role
.id === Number
// flagEOrC &&
// const editData = { roleName: 'fhkdsajfakjfa' }
this
.
addRole
(
editData
)
//
this.$refs[formName].validate((valid) => {
//
if (valid) {
//
this.$emit('createClose', flagEOrC, editData)
//
} else {
//
return false
//
}
//
})
const
flagEOrC
=
editData
.
id
===
Number
console
.
log
(
flagEOrC
)
flagEOrC
&&
this
.
addRole
()
!
flagEOrC
&&
this
.
updateRoleInfo
(
)
this
.
$refs
[
formName
].
validate
((
valid
)
=>
{
if
(
valid
)
{
this
.
$emit
(
'createClose'
,
flagEOrC
,
editData
)
}
else
{
return
false
}
})
},
handleCreateCancel
()
{
this
.
$emit
(
'createClose'
)
...
...
src/config/common.conf.js
View file @
8680bea
...
...
@@ -2,7 +2,7 @@ export default {
axios
:
{
// baseURL: 'http://cas.dev.glsx.net/admin-operating-auth/',
baseURL
:
'http://192.168.3.171:7300/mock/5b91805391b67469b43e2921/subsystem/'
,
whiteList
:
[
'role/deleteRoleById'
,
'role/deleteUserRoleById'
,
'role/getRoleDetail'
,
'role/getRoleDetail'
,
'role/getRoleList'
,
'role/isRoleNameExit'
,
'role/saveRoleList'
,
'role/selectMenuTreeRoleId'
,
'role/selectUserRoleByRoleId'
,
'role/updateRole'
,
'user/batcheDel'
,
'user/findAll'
,
'user/get'
,
'user/getWithRoles'
,
'user/operatUser'
,
'user/updateUser'
],
whiteList
:
[
'role/deleteRoleById'
,
'role/deleteUserRoleById'
,
'role/getRoleDetail'
,
'role/getRoleDetail'
,
'role/getRoleList'
,
'role/isRoleNameExit'
,
'role/saveRoleList'
,
'role/selectMenuTreeRoleId'
,
'role/selectUserRoleByRoleId'
,
'role/updateRole'
,
'user/batcheDel'
,
'user/findAll'
,
'user/get'
,
'user/getWithRoles'
,
'user/operatUser'
,
'user/updateUser'
,
'department/del'
,
'department/findTree'
,
'department/getPName'
,
'department/getTreeNode'
,
'department/updateDepartment'
,
'menu/add'
,
'menu/del'
,
'menu/edit'
,
'menu/findById'
,
'menu/findTree'
,
'menu/getByUserId'
,
'menu/getPName'
],
timeout
:
15000
,
result
:
{
data_key
:
'data'
,
// 返回值数据实体存放对象
...
...
src/views/customer/role/index.vue
View file @
8680bea
...
...
@@ -25,7 +25,7 @@
<
script
>
import
{
RoleCreate
,
RoleDetail
,
UserDetail
}
from
'@/components/index'
// 接口
import
{
getRoleList
}
from
'@/api/api'
import
{
getRoleList
,
selectUserRoleByRoleId
}
from
'@/api/api'
import
{
roleCreateStructure
,
userRoleDetailColumn
,
userRoleDetailConsole
}
from
'@/common/commonConst'
export
default
{
name
:
'role'
,
...
...
@@ -37,12 +37,14 @@ export default {
data
()
{
return
{
roleName
:
''
,
roleid
:
Number
,
createVisible
:
false
,
detailVisible
:
false
,
userDetailVisible
:
false
,
roleParam
:
roleCreateStructure
,
columnParam
:
[],
consoleParam
:
[],
dataParam
:
[],
createOrEditTitle
:
'新增角色'
,
userDetailTitle
:
'用户列表'
,
// 分页所需参数-start
...
...
@@ -104,6 +106,7 @@ export default {
},
mounted
()
{
this
.
getList
()
// this.selectUser()
},
// search--------------------
// watch: {
...
...
@@ -138,18 +141,27 @@ export default {
// 获取页面参数
getParams
()
{
return
{
// pageSize: this.pageSize,
// pageNum: this.pageNum,
roleName
:
this
.
roleName
pageSize
:
this
.
pageSize
,
pageNum
:
this
.
pageNum
,
roleName
:
this
.
roleName
,
roleId
:
1006
}
},
// 接口请求-start---------------------------------------
// 获取展示数据,请求表格数据
getList
()
{
// 接口
const
params
=
this
.
getParams
()
getRoleList
.
req
(
params
).
then
(
res
=>
{
console
.
log
(
res
)
this
.
total
=
res
.
total
this
.
roleData
.
data
=
res
.
list
}).
catch
(
err
=>
{
console
.
log
(
err
)
})
},
// 获取角色的相关用户详细信息
selectUser
()
{
const
params
=
this
.
getParams
()
selectUserRoleByRoleId
.
req
(
params
).
then
(
res
=>
{
this
.
total
=
res
.
total
this
.
roleData
.
data
=
res
.
list
}).
catch
(
err
=>
{
...
...
@@ -200,6 +212,7 @@ export default {
handleGetUserDetail
()
{
this
.
columnParam
=
userRoleDetailColumn
this
.
consoleParam
=
userRoleDetailConsole
this
.
dataParam
=
this
.
userDetailDialogVisible
()
},
handleUserDetailClose
()
{
...
...
@@ -216,8 +229,8 @@ export default {
this
.
roleParam
=
roleCreateStructure
!
data
&&
this
.
message
(
'取消创建角色'
)
// 将数据提交给后台,根据返回结果做判断
data
&&
!
flagEOrC
&&
this
.
aaaddRole
(
data
)
data
&&
flagEOrC
&&
this
.
message
(
'已经成功修改数据!'
,
'success'
)
//
data && !flagEOrC && this.aaaddRole(data)
//
data && flagEOrC && this.message('已经成功修改数据!', 'success')
}
}
}
...
...
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