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 f6a3fe54
authored
Sep 11, 2018
by
cwq0219
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
用户详情组件复用
1 parent
c6e49daa
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
84 additions
and
23 deletions
src/common/common.js
src/common/roleCommon.js
src/common/userCommon.js
src/components/UserDetail/src/main.vue
src/views/customer/role/index.vue
src/views/customer/user/index.vue
src/common/common.js
0 → 100644
View file @
f6a3fe5
import
{
roleCreateStructure
,
userRoleDetailColumn
,
userRoleDetailConsole
}
from
'./roleCommon'
import
{
userDetailColumn
}
from
'./userCommon'
export
{
roleCreateStructure
,
userRoleDetailColumn
,
userRoleDetailConsole
,
userDetailColumn
}
src/common/roleCommon.js
View file @
f6a3fe5
...
@@ -29,7 +29,8 @@ const userRoleDetailConsole = {
...
@@ -29,7 +29,8 @@ const userRoleDetailConsole = {
label
:
'删除'
,
label
:
'删除'
,
type
:
'text'
,
type
:
'text'
,
callback
:
(
index
,
rows
)
=>
{
callback
:
(
index
,
rows
)
=>
{
this
.
$alert
(
rows
[
index
])
rows
.
splice
(
index
,
1
)
// this.$alert(rows[index])
}
}
}]
}]
}
}
...
...
src/common/userCommon.js
0 → 100644
View file @
f6a3fe5
const
userDetailColumn
=
[{
label
:
'用户名'
,
prop
:
'username'
},
{
label
:
'真实姓名'
,
prop
:
'realname'
},
{
label
:
'管理员'
,
prop
:
'isadmin'
},
{
label
:
'手机号码'
,
prop
:
'mobile'
},
{
label
:
'邮箱'
,
prop
:
'email'
},
{
label
:
'角色选项'
,
prop
:
'roles'
},
{
label
:
'状态'
,
prop
:
'state'
}]
export
{
userDetailColumn
}
src/components/UserDetail/src/main.vue
View file @
f6a3fe5
<!-- -->
<!-- -->
<
template
>
<
template
>
<div>
<div>
<gl-dialog
:title=
"userDetailTitle"
:visible
.
sync=
"userDetailVisible"
:before-close=
"handleClose"
>
<gl-dialog
:title=
"userDetailTitle"
:visible
.
sync=
"userDetailVisible"
:before-close=
"handleClose"
>
<gl-table
:table=
"tableParam"
></gl-table>
<gl-table
:table=
"tableParam"
></gl-table>
</gl-dialog>
</gl-dialog>
</div>
</div>
</
template
>
</
template
>
...
@@ -13,27 +13,37 @@ export default {
...
@@ -13,27 +13,37 @@ export default {
props
:
{
props
:
{
userDetailTitle
:
String
,
userDetailTitle
:
String
,
userDetailVisible
:
Boolean
,
userDetailVisible
:
Boolean
,
// dataParam:
Object
,
// dataParam:
Array
,
columnParam
:
Array
,
columnParam
:
Array
,
consoleParam
:
[
Array
,
Object
]
consoleParam
:
[
Array
,
Object
]
},
},
watch
:
{
watch
:
{
columnParam
(
val
)
{
columnParam
(
val
)
{
this
.
tableParam
.
column
=
this
.
$deep_clone
(
val
)
this
.
tableParam
.
column
=
val
},
},
consoleParam
(
val
)
{
consoleParam
(
val
)
{
this
.
tableParam
.
console
=
this
.
$deep_clone
(
val
)
this
.
tableParam
.
console
=
val
}
}
},
},
data
()
{
data
()
{
return
{
return
{
tableParam
:
{
tableParam
:
{
border
:
true
,
border
:
true
,
// role-data
// data: [{
// id: '1006',
// username: 'text11',
// realname: '陈婉清',
// state: '启动'
// }],
data
:
[{
data
:
[{
id
:
'1006'
,
username
:
'abc'
,
username
:
'text11'
,
realname
:
'陈婉清'
,
realname
:
'陈婉清'
,
state
:
'启动'
isadmin
:
'否'
,
mobile
:
'13033333333'
,
email
:
'abc@didihu.com'
,
roles
:
'好车主'
,
state
:
'开启'
}],
}],
column
:
[],
column
:
[],
console
:
[]
console
:
[]
...
...
src/views/customer/role/index.vue
View file @
f6a3fe5
...
@@ -9,10 +9,10 @@
...
@@ -9,10 +9,10 @@
<div
class=
"default p-t15"
>
<div
class=
"default p-t15"
>
<gl-button
class=
"control-tabledata-button"
size=
"small"
@
click=
"handleCreateOrEdit(roleParam, '新增角色')"
>
创建
</gl-button>
<gl-button
class=
"control-tabledata-button"
size=
"small"
@
click=
"handleCreateOrEdit(roleParam, '新增角色')"
>
创建
</gl-button>
<role-create
:createVisible=
"createVisible"
:roleParam=
"roleParam"
:createOrEditTitle=
"createOrEditTitle"
@
createClose=
"handleCreateClose"
></role-create>
<role-create
:createVisible=
"createVisible"
:roleParam=
"roleParam"
:createOrEditTitle=
"createOrEditTitle"
@
createClose=
"handleCreateClose"
></role-create>
<role-detail
:detailVisible=
"detailVisible"
:roleParam=
"roleParam"
@
detailClose=
"handleDetailClose"
></role-detail>
<user-detail
:userDetailVisible=
"userDetailVisible"
:userDetailTitle=
"userDetailTitle"
@
userDetailClose=
"handleUserDetailClose"
:dataParam=
"[]"
:columnParam=
"columnParam"
:consoleParam=
"consoleParam"
></user-detail>
<div
class=
"m-b8"
>
<div
class=
"m-b8"
>
<gl-table
:table=
"roleData"
:pagination=
"pagination"
></gl-table>
<gl-table
:table=
"roleData"
:pagination=
"pagination"
></gl-table>
<role-detail
:detailVisible=
"detailVisible"
:roleParam=
"roleParam"
@
detailClose=
"handleDetailClose"
></role-detail>
<user-detail
:userDetailVisible=
"userDetailVisible"
:userDetailTitle=
"userDetailTitle"
@
userDetailClose=
"handleUserDetailClose"
:dataParam=
"[]"
:columnParam=
"columnParam"
:consoleParam=
"consoleParam"
></user-detail>
</div>
</div>
</div>
</div>
</div>
</div>
...
@@ -21,7 +21,7 @@
...
@@ -21,7 +21,7 @@
<
script
>
<
script
>
import
{
RoleCreate
,
RoleDetail
,
UserDetail
}
from
'@/components/index'
import
{
RoleCreate
,
RoleDetail
,
UserDetail
}
from
'@/components/index'
import
{
roleTest
}
from
'@/api/roleApi'
import
{
roleTest
}
from
'@/api/roleApi'
import
{
roleCreateStructure
,
userRoleDetailColumn
,
userRoleDetailConsole
}
from
'@/common/
roleC
ommon'
import
{
roleCreateStructure
,
userRoleDetailColumn
,
userRoleDetailConsole
}
from
'@/common/
c
ommon'
export
default
{
export
default
{
name
:
'role'
,
name
:
'role'
,
components
:
{
components
:
{
...
@@ -139,7 +139,7 @@ export default {
...
@@ -139,7 +139,7 @@ export default {
createDialogVisible
()
{
createDialogVisible
()
{
this
.
createVisible
=
!
this
.
createVisible
this
.
createVisible
=
!
this
.
createVisible
},
},
de
tal
eDialogVisible
()
{
de
let
eDialogVisible
()
{
this
.
detailVisible
=
!
this
.
detailVisible
this
.
detailVisible
=
!
this
.
detailVisible
},
},
userDetailDialogVisible
()
{
userDetailDialogVisible
()
{
...
@@ -150,21 +150,19 @@ export default {
...
@@ -150,21 +150,19 @@ export default {
},
},
handleGetRoleDetail
(
params
)
{
handleGetRoleDetail
(
params
)
{
this
.
roleParam
=
params
this
.
roleParam
=
params
this
.
de
tal
eDialogVisible
()
this
.
de
let
eDialogVisible
()
},
},
handleDetailClose
()
{
handleDetailClose
()
{
this
.
de
tal
eDialogVisible
()
this
.
de
let
eDialogVisible
()
this
.
roleParam
=
roleCreateStructure
this
.
roleParam
=
roleCreateStructure
},
},
handleGetUserDetail
()
{
handleGetUserDetail
()
{
this
.
columnParam
=
this
.
$deep_clone
(
userRoleDetailColumn
)
this
.
columnParam
=
userRoleDetailColumn
this
.
consoleParam
=
this
.
$deep_clone
(
userRoleDetailConsole
)
this
.
consoleParam
=
userRoleDetailConsole
this
.
userDetailDialogVisible
()
this
.
userDetailDialogVisible
()
},
},
handleUserDetailClose
()
{
handleUserDetailClose
()
{
this
.
userDetailDialogVisible
()
this
.
userDetailDialogVisible
()
this
.
columnParam
=
[]
this
.
consoleParam
=
[]
},
},
handleCreateOrEdit
(
params
,
title
)
{
handleCreateOrEdit
(
params
,
title
)
{
this
.
createDialogVisible
()
this
.
createDialogVisible
()
...
...
src/views/customer/user/index.vue
View file @
f6a3fe5
...
@@ -14,23 +14,30 @@
...
@@ -14,23 +14,30 @@
</div>
</div>
<div
class=
"m-b8"
>
<div
class=
"m-b8"
>
<gl-table
:table=
"userData"
ref=
"multipleTable"
:pagination=
"pagination"
></gl-table>
<gl-table
:table=
"userData"
ref=
"multipleTable"
:pagination=
"pagination"
></gl-table>
<user-detail
:userDetailVisible=
"userDetailVisible"
:userDetailTitle=
"userDetailTitle"
@
userDetailClose=
"handleUserDetailClose"
:dataParam=
"[]"
:columnParam=
"columnParam"
:consoleParam=
"consoleParam"
></user-detail>
</div>
</div>
</div>
</div>
</div>
</div>
</
template
>
</
template
>
<
script
>
<
script
>
import
UserForm
from
'@/components/UserCreate
'
import
{
UserForm
,
UserDetail
}
from
'@/components/index
'
import
{
getUserInfo
}
from
'@/api/userApi'
import
{
getUserInfo
}
from
'@/api/userApi'
import
{
userDetailColumn
}
from
'@/common/common'
export
default
{
export
default
{
name
:
'user'
,
name
:
'user'
,
components
:
{
components
:
{
UserForm
UserForm
,
UserDetail
},
},
data
()
{
data
()
{
return
{
return
{
userName
:
''
,
userName
:
''
,
dialogFormVisible
:
false
,
dialogFormVisible
:
false
,
userDetailVisible
:
false
,
userDetailTitle
:
'用户详情'
,
columnParam
:
[],
consoleParam
:
[],
userData
:
{
userData
:
{
border
:
true
,
border
:
true
,
align
:
'center'
,
align
:
'center'
,
...
@@ -90,7 +97,8 @@ export default {
...
@@ -90,7 +97,8 @@ export default {
label
:
'用户'
,
label
:
'用户'
,
type
:
'text'
,
type
:
'text'
,
callback
:
(
index
,
rows
)
=>
{
callback
:
(
index
,
rows
)
=>
{
this
.
$alert
(
rows
[
index
])
this
.
handleGetUserDetail
()
// this.$alert(rows[index])
}
}
}]
}]
},
},
...
@@ -157,6 +165,17 @@ export default {
...
@@ -157,6 +165,17 @@ export default {
},
},
changeShowNumber
(
command
)
{
changeShowNumber
(
command
)
{
this
.
showNumber
=
command
this
.
showNumber
=
command
},
userDetailDialogVisible
()
{
this
.
userDetailVisible
=
!
this
.
userDetailVisible
},
handleGetUserDetail
()
{
this
.
columnParam
=
userDetailColumn
this
.
consoleParam
=
[]
this
.
userDetailDialogVisible
()
},
handleUserDetailClose
()
{
this
.
userDetailDialogVisible
()
}
}
}
}
}
}
...
...
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