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 aea095d8
authored
Sep 19, 2018
by
cwq0219
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
优化
1 parent
b334f618
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
34 additions
and
45 deletions
src/components/RoleCreate/src/main.vue
src/components/UserDetail/src/main.vue
src/views/customer/role/index.vue
src/views/customer/user/index.vue
src/components/RoleCreate/src/main.vue
View file @
aea095d
...
...
@@ -35,28 +35,22 @@
</
template
>
<
script
>
import
{
roleCreateStructure
}
from
'@/common/commonConst'
//
import { roleCreateStructure } from '@/common/commonConst'
import
{
saveRoleList
,
updateRole
}
from
'@/api/api'
export
default
{
name
:
'RoleCreate'
,
props
:
{
createOrEditTitle
:
String
,
createVisible
:
Boolean
,
rolePara
m
:
Object
createRuleFor
m
:
Object
},
watch
:
{
createVisible
(
val
)
{
!
val
&&
this
.
$refs
[
'createRuleForm'
].
resetFields
()
},
roleParam
(
val
)
{
if
(
val
!==
this
.
createRuleForm
)
{
this
.
createRuleForm
=
this
.
$deep_clone
(
val
)
}
}
},
data
()
{
return
{
createRuleForm
:
roleCreateStructure
,
show_checkbox
:
true
,
defaultExpandAll
:
true
,
createRules
:
{
...
...
@@ -85,10 +79,10 @@ export default {
// 接口
addRole
(
flagEOrC
,
editData
)
{
// editData = { roleName: editData.roleName }
//
const aa = JSON.stringify(editData)
const
aa
=
JSON
.
stringify
(
editData
)
// console.log(aa)
// console.log(editData)
saveRoleList
.
req
(
editDat
a
).
then
((
data
)
=>
{
saveRoleList
.
req
(
a
a
).
then
((
data
)
=>
{
console
.
log
(
data
)
this
.
$emit
(
'createClose'
,
flagEOrC
,
editData
)
}).
catch
(
err
=>
{
...
...
src/components/UserDetail/src/main.vue
View file @
aea095d
...
...
@@ -10,13 +10,13 @@
</
template
>
<
script
>
import
{
selectUserRoleByRoleId
,
getWithRoles
}
from
'@/api/api'
import
{
selectUserRoleByRoleId
}
from
'@/api/api'
export
default
{
name
:
'UserDetail'
,
props
:
{
userDetailTitle
:
String
,
userDetailVisible
:
Boolean
,
apiParam
:
[
Number
,
Function
],
apiParam
:
[
Object
,
Function
],
flagRoleOrUser
:
[
Boolean
,
Function
],
columnParam
:
Array
,
consoleParam
:
[
Array
,
Object
]
...
...
@@ -28,11 +28,8 @@ export default {
consoleParam
(
val
)
{
this
.
tableParam
.
console
=
val
},
flagRoleOrUser
(
val
)
{
this
.
flag
=
val
},
apiParam
(
val
)
{
this
.
id
=
val
this
.
id
=
val
.
id
this
.
id
!==
Number
&&
this
.
callApi
()
}
},
...
...
@@ -42,7 +39,6 @@ export default {
pageSize
:
5
,
total
:
10
,
id
:
Number
,
flag
:
Number
,
tableParam
:
{
border
:
true
,
align
:
'center'
,
...
...
@@ -60,13 +56,13 @@ export default {
roleId
:
this
.
id
}
},
getUserParams
()
{
return
{
pageSize
:
this
.
pageSize
,
pageNum
:
this
.
pageNum
,
userId
:
this
.
id
}
},
//
getUserParams() {
//
return {
//
pageSize: this.pageSize,
//
pageNum: this.pageNum,
//
userId: this.id
//
}
//
},
// 获取角色的相关用户详细信息
selectUser
()
{
const
params
=
this
.
getRoleParams
()
...
...
@@ -78,21 +74,19 @@ export default {
})
},
// 获取用户详情,包括角色
getUserRoles
()
{
const
params
=
this
.
getUserParams
()
getWithRoles
.
req
(
params
).
then
(
res
=>
{
this
.
total
=
1
this
.
tableParam
.
data
=
[
res
]
}).
catch
(
err
=>
{
console
.
log
(
err
)
})
},
objectToArray
()
{
},
// getUserRoles() {
// const params = this.getUserParams()
// getWithRoles.req(params).then(res => {
// this.total = 1
// this.tableParam.data = [res]
// }).catch(err => {
// console.log(err)
// })
// },
callApi
()
{
this
.
flag
&&
this
.
selectUser
()
!
this
.
flag
&&
this
.
getUserRoles
()
this
.
flagRoleOrUser
&&
this
.
selectUser
()
// !this.flagRoleOrUser && this.getUserRoles()
!
this
.
flagRoleOrUser
&&
(
this
.
tableParam
.
data
=
[
this
.
apiParam
])
},
handleClose
()
{
this
.
$emit
(
'userDetailClose'
)
...
...
src/views/customer/role/index.vue
View file @
aea095d
...
...
@@ -7,8 +7,8 @@
</div>
<hr>
<div
class=
"default p-t15"
>
<gl-button
class=
"control-tabledata-button"
size=
"small"
@
click=
"handleCreateOrEdit(
roleParam,
'新增角色')"
>
创建
</gl-button>
<role-create
:createVisible=
"createVisible"
:
rolePara
m=
"roleParam"
:createOrEditTitle=
"createOrEditTitle"
@
createClose=
"handleCreateClose"
></role-create>
<gl-button
class=
"control-tabledata-button"
size=
"small"
@
click=
"handleCreateOrEdit('新增角色')"
>
创建
</gl-button>
<role-create
:createVisible=
"createVisible"
:
createRuleFor
m=
"roleParam"
:createOrEditTitle=
"createOrEditTitle"
@
createClose=
"handleCreateClose"
></role-create>
<div
class=
"m-b8"
>
<transition>
<gl-table
:table=
"roleData"
></gl-table>
...
...
@@ -83,7 +83,8 @@ export default {
label
:
'编辑'
,
type
:
'text'
,
callback
:
(
index
,
rows
)
=>
{
this
.
handleCreateOrEdit
(
rows
[
index
],
'角色列表'
)
this
.
roleParam
=
this
.
$deep_clone
(
rows
[
index
])
this
.
handleCreateOrEdit
(
'角色列表'
)
}
},
{
label
:
'详细'
,
...
...
@@ -214,17 +215,17 @@ export default {
this
.
columnParam
=
userRoleDetailColumn
this
.
consoleParam
=
userRoleDetailConsole
this
.
flagRoleOrUser
=
true
this
.
apiParam
=
rows
[
index
]
.
id
this
.
apiParam
=
rows
[
index
]
this
.
userDetailDialogVisible
()
},
handleUserDetailClose
()
{
this
.
userDetailDialogVisible
()
this
.
apiParam
=
Number
},
handleCreateOrEdit
(
params
,
title
)
{
handleCreateOrEdit
(
title
)
{
this
.
createDialogVisible
()
this
.
createOrEditTitle
=
title
this
.
roleParam
=
params
this
.
roleParam
!==
roleCreateStructure
?
this
.
roleParam
:
roleCreateStructure
},
// 关闭新增用户组件
handleCreateClose
(
flagEOrC
,
data
)
{
...
...
src/views/customer/user/index.vue
View file @
aea095d
...
...
@@ -259,7 +259,7 @@ export default {
this
.
columnParam
=
userDetailColumn
this
.
consoleParam
=
[]
this
.
flagRoleOrUser
=
false
this
.
apiParam
=
rows
[
index
]
.
id
this
.
apiParam
=
rows
[
index
]
this
.
userDetailDialogVisible
()
},
handleUserDetailClose
()
{
...
...
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