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 860d671d
authored
Sep 20, 2018
by
cwq0219
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
修改
1 parent
aea095d8
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
58 additions
and
51 deletions
src/api/roleApi.js
src/common/commonConst.js
src/common/roleConst.js
src/components/RoleCreate/src/main.vue
src/components/UserDetail/src/main.vue
src/views/customer/role/index.vue
src/api/roleApi.js
View file @
860d671
...
@@ -39,7 +39,9 @@ const getRoleList = {
...
@@ -39,7 +39,9 @@ const getRoleList = {
const
saveRoleList
=
{
const
saveRoleList
=
{
p
:
[
__sSaveRoleList
],
p
:
[
__sSaveRoleList
],
// req: params => GlAxios.post(__sSaveRoleList, JSON.stringify(params), { headers: { 'Content/-Type': 'application/json;charset=UTF-8' }})
// req: params => GlAxios.get(__sSaveRoleList, params)
// req: params => GlAxios.post(__sSaveRoleList, params, { headers: { 'Content-Type': 'application/x-www-form-urlencoded' }})
// req: params => GlAxios.post(__sSaveRoleList, params, { headers: { 'Content-Type': 'application/json; charset=utf-8' }})
req
:
params
=>
GlAxios
.
post
(
__sSaveRoleList
,
params
)
req
:
params
=>
GlAxios
.
post
(
__sSaveRoleList
,
params
)
}
}
...
...
src/common/commonConst.js
View file @
860d671
import
{
roleCreateStructure
,
userRoleDetailColumn
,
userRoleDetailConsole
}
from
'./roleConst'
import
{
roleCreateStructure
,
roleDataColumn
,
userRoleDetailColumn
,
userRoleDetailConsole
}
from
'./roleConst'
import
{
userDetailColumn
}
from
'./userConst'
import
{
userDetailColumn
}
from
'./userConst'
export
{
export
{
roleCreateStructure
,
roleCreateStructure
,
roleDataColumn
,
userRoleDetailColumn
,
userRoleDetailColumn
,
userRoleDetailConsole
,
userRoleDetailConsole
,
userDetailColumn
userDetailColumn
...
...
src/common/roleConst.js
View file @
860d671
import
{
deleteUserRoleById
}
from
'@/api/api'
const
roleCreateStructure
=
{
const
roleCreateStructure
=
{
id
:
Number
,
id
:
Number
,
roleName
:
''
,
roleName
:
''
,
description
:
''
,
description
:
''
,
departName
:
''
,
departName
:
''
,
rights
:
Array
,
//
rights: Array,
state
:
1
,
state
:
1
,
createTime
:
''
createTime
:
''
}
}
const
roleDataColumn
=
[{
label
:
'序号'
,
prop
:
'id'
},
{
label
:
'角色名字'
,
prop
:
'roleName'
},
{
label
:
'所属部门'
,
prop
:
'departName'
},
{
label
:
'状态'
,
prop
:
'state'
,
formatter
:
(
cellValue
)
=>
{
return
cellValue
<
1
?
'禁止'
:
'启动'
}
},
{
label
:
'创建时间'
,
prop
:
'createTime'
}]
const
userRoleDetailColumn
=
[{
const
userRoleDetailColumn
=
[{
label
:
'序号'
,
label
:
'序号'
,
prop
:
'userId'
prop
:
'userId'
...
@@ -32,14 +54,22 @@ const userRoleDetailConsole = {
...
@@ -32,14 +54,22 @@ const userRoleDetailConsole = {
label
:
'删除'
,
label
:
'删除'
,
type
:
'text'
,
type
:
'text'
,
callback
:
(
index
,
rows
)
=>
{
callback
:
(
index
,
rows
)
=>
{
rows
.
splice
(
index
,
1
)
const
data
=
rows
[
index
]
// this.$alert(rows[index])
const
params
=
{
roleId
:
data
.
roleId
,
userId
:
data
.
userId
}
deleteUserRoleById
.
req
(
params
).
then
(
res
=>
{
// 加入提示消息!!!
rows
.
splice
(
index
,
1
)
// console.log(res)
}).
catch
(
err
=>
{
console
.
log
(
err
)
})
}
}
}]
}]
}
}
export
{
export
{
roleCreateStructure
,
roleCreateStructure
,
roleDataColumn
,
userRoleDetailColumn
,
userRoleDetailColumn
,
userRoleDetailConsole
userRoleDetailConsole
}
}
src/components/RoleCreate/src/main.vue
View file @
860d671
...
@@ -18,13 +18,13 @@
...
@@ -18,13 +18,13 @@
</gl-select>
</gl-select>
</gl-form-item>
</gl-form-item>
<gl-form-item
label=
"菜单选项:"
>
<gl-form-item
label=
"菜单选项:"
>
<tree
<
!--
<
tree
ref=
'tree'
ref=
'tree'
:show-checkbox=
"show_checkbox"
:show-checkbox=
"show_checkbox"
:defaultExpandAll=
"defaultExpandAll"
:defaultExpandAll=
"defaultExpandAll"
@
input=
"getMenuOption"
@
input=
"getMenuOption"
style=
"height:160px"
style=
"height:160px"
></tree>
></tree>
-->
</gl-form-item>
</gl-form-item>
</gl-form>
</gl-form>
<div
slot=
"footer"
class=
"dialog-footer"
>
<div
slot=
"footer"
class=
"dialog-footer"
>
...
@@ -40,7 +40,7 @@ import { saveRoleList, updateRole } from '@/api/api'
...
@@ -40,7 +40,7 @@ import { saveRoleList, updateRole } from '@/api/api'
export
default
{
export
default
{
name
:
'RoleCreate'
,
name
:
'RoleCreate'
,
props
:
{
props
:
{
createOrEditTitle
:
String
,
//
createOrEditTitle: String,
createVisible
:
Boolean
,
createVisible
:
Boolean
,
createRuleForm
:
Object
createRuleForm
:
Object
},
},
...
@@ -53,6 +53,7 @@ export default {
...
@@ -53,6 +53,7 @@ export default {
return
{
return
{
show_checkbox
:
true
,
show_checkbox
:
true
,
defaultExpandAll
:
true
,
defaultExpandAll
:
true
,
createOrEditTitle
:
String
,
createRules
:
{
createRules
:
{
roleName
:
[
roleName
:
[
{
required
:
true
,
message
:
'请输入角色名称!'
,
trigger
:
'blur'
}
{
required
:
true
,
message
:
'请输入角色名称!'
,
trigger
:
'blur'
}
...
@@ -70,7 +71,7 @@ export default {
...
@@ -70,7 +71,7 @@ export default {
methods
:
{
methods
:
{
// tree-strat
// tree-strat
getMenuOption
(
params
)
{
getMenuOption
(
params
)
{
this
.
createRuleForm
.
rights
=
params
.
treeData
.
checkedKeys
.
concat
(
params
.
treeData
.
halfCheckedKeys
)
//
this.createRuleForm.rights = params.treeData.checkedKeys.concat(params.treeData.halfCheckedKeys)
},
},
// tree-end
// tree-end
getParams
()
{
getParams
()
{
...
@@ -78,11 +79,13 @@ export default {
...
@@ -78,11 +79,13 @@ export default {
},
},
// 接口
// 接口
addRole
(
flagEOrC
,
editData
)
{
addRole
(
flagEOrC
,
editData
)
{
// editData = { roleName: editData.roleName }
editData
=
{
roleName
:
editData
.
roleName
}
const
aa
=
JSON
.
stringify
(
editData
)
const
aa
=
{
role
:
editData
}
// console.log(aa)
// const aa = JSON.stringify(editData)
// console.log(editData)
console
.
log
(
aa
)
saveRoleList
.
req
(
aa
).
then
((
data
)
=>
{
console
.
log
(
editData
)
const
cc
=
{
roleName
:
'ggg'
}
saveRoleList
.
req
(
cc
).
then
((
data
)
=>
{
console
.
log
(
data
)
console
.
log
(
data
)
this
.
$emit
(
'createClose'
,
flagEOrC
,
editData
)
this
.
$emit
(
'createClose'
,
flagEOrC
,
editData
)
}).
catch
(
err
=>
{
}).
catch
(
err
=>
{
...
...
src/components/UserDetail/src/main.vue
View file @
860d671
...
@@ -30,7 +30,7 @@ export default {
...
@@ -30,7 +30,7 @@ export default {
},
},
apiParam
(
val
)
{
apiParam
(
val
)
{
this
.
id
=
val
.
id
this
.
id
=
val
.
id
this
.
id
!==
Number
&&
this
.
callApi
()
this
.
id
&&
this
.
callApi
()
}
}
},
},
data
()
{
data
()
{
...
@@ -85,7 +85,6 @@ export default {
...
@@ -85,7 +85,6 @@ export default {
// },
// },
callApi
()
{
callApi
()
{
this
.
flagRoleOrUser
&&
this
.
selectUser
()
this
.
flagRoleOrUser
&&
this
.
selectUser
()
// !this.flagRoleOrUser && this.getUserRoles()
!
this
.
flagRoleOrUser
&&
(
this
.
tableParam
.
data
=
[
this
.
apiParam
])
!
this
.
flagRoleOrUser
&&
(
this
.
tableParam
.
data
=
[
this
.
apiParam
])
},
},
handleClose
()
{
handleClose
()
{
...
...
src/views/customer/role/index.vue
View file @
860d671
...
@@ -26,7 +26,7 @@
...
@@ -26,7 +26,7 @@
import
{
RoleCreate
,
RoleDetail
,
UserDetail
}
from
'@/components/index'
import
{
RoleCreate
,
RoleDetail
,
UserDetail
}
from
'@/components/index'
// 接口
// 接口
import
{
getRoleList
,
deleteRoleById
}
from
'@/api/api'
import
{
getRoleList
,
deleteRoleById
}
from
'@/api/api'
import
{
roleCreateStructure
,
userRoleDetailColumn
,
userRoleDetailConsole
}
from
'@/common/commonConst'
import
{
roleCreateStructure
,
roleDataColumn
,
userRoleDetailColumn
,
userRoleDetailConsole
}
from
'@/common/commonConst'
export
default
{
export
default
{
name
:
'role'
,
name
:
'role'
,
components
:
{
components
:
{
...
@@ -57,25 +57,7 @@ export default {
...
@@ -57,25 +57,7 @@ export default {
border
:
true
,
border
:
true
,
height
:
400
,
height
:
400
,
data
:
[],
data
:
[],
column
:
[{
column
:
roleDataColumn
,
label
:
'序号'
,
prop
:
'id'
},
{
label
:
'角色名字'
,
prop
:
'roleName'
},
{
label
:
'所属部门'
,
prop
:
'departName'
},
{
label
:
'状态'
,
prop
:
'state'
,
formatter
:
(
cellValue
)
=>
{
return
cellValue
<
1
?
'禁止'
:
'启动'
}
},
{
label
:
'创建时间'
,
prop
:
'createTime'
}],
console
:
{
console
:
{
label
:
'操作'
,
label
:
'操作'
,
prop
:
'roleOptions'
,
prop
:
'roleOptions'
,
...
@@ -135,7 +117,7 @@ export default {
...
@@ -135,7 +117,7 @@ export default {
cancelButtonText
:
'取消'
,
cancelButtonText
:
'取消'
,
type
:
'warning'
type
:
'warning'
}).
then
(()
=>
{
}).
then
(()
=>
{
// 删除角色,根据返回的code值来判断是否删除成功
// 删除角色,根据返回的code值来判断是否删除成功
(已有拦截器)
this
.
deleteRole
(
rows
[
index
].
id
)
this
.
deleteRole
(
rows
[
index
].
id
)
}).
catch
(()
=>
{
}).
catch
(()
=>
{
this
.
message
(
'取消删除'
)
this
.
message
(
'取消删除'
)
...
@@ -157,7 +139,6 @@ export default {
...
@@ -157,7 +139,6 @@ export default {
// console.log(res)
// console.log(res)
this
.
total
=
res
.
total
this
.
total
=
res
.
total
this
.
roleData
.
data
=
res
.
list
this
.
roleData
.
data
=
res
.
list
// console.log(this.roleData.data)
}).
catch
(
err
=>
{
}).
catch
(
err
=>
{
console
.
log
(
err
)
console
.
log
(
err
)
})
})
...
@@ -167,21 +148,11 @@ export default {
...
@@ -167,21 +148,11 @@ export default {
deleteRoleById
.
req
({
roleId
:
params
}).
then
(
res
=>
{
deleteRoleById
.
req
({
roleId
:
params
}).
then
(
res
=>
{
this
.
message
(
'删除成功'
,
'success'
)
this
.
message
(
'删除成功'
,
'success'
)
this
.
getList
()
this
.
getList
()
}).
catch
(
err
=>
{
}).
catch
(
message
=>
{
console
.
log
(
err
)
this
.
message
(
message
,
'error'
)
})
})
},
},
// 接口请求-end---------------------------------------
// 接口请求-end---------------------------------------
// 新增用户到页面
// addRole(data) {
// 后台获取----------------------
// data.id = '1038'
// data.createTime = new Date().toLocaleString().split('/').join('-')
// 后台获取----------------------
// const newData = data
// this.roleData.data.push(newData)
// this.message('创建角色成功!', 'success')
// },
createDialogVisible
()
{
createDialogVisible
()
{
this
.
createVisible
=
!
this
.
createVisible
this
.
createVisible
=
!
this
.
createVisible
},
},
...
@@ -220,12 +191,13 @@ export default {
...
@@ -220,12 +191,13 @@ export default {
},
},
handleUserDetailClose
()
{
handleUserDetailClose
()
{
this
.
userDetailDialogVisible
()
this
.
userDetailDialogVisible
()
this
.
getList
()
this
.
apiParam
=
Number
this
.
apiParam
=
Number
},
},
handleCreateOrEdit
(
title
)
{
handleCreateOrEdit
(
title
)
{
this
.
createDialogVisible
()
this
.
createOrEditTitle
=
title
this
.
createOrEditTitle
=
title
this
.
roleParam
!==
roleCreateStructure
?
this
.
roleParam
:
roleCreateStructure
this
.
roleParam
!==
roleCreateStructure
?
this
.
roleParam
:
roleCreateStructure
this
.
createDialogVisible
()
},
},
// 关闭新增用户组件
// 关闭新增用户组件
handleCreateClose
(
flagEOrC
,
data
)
{
handleCreateClose
(
flagEOrC
,
data
)
{
...
...
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