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 e11ad8ae
authored
Sep 08, 2018
by
cwq0219
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
role-create组件复用成edit
1 parent
571e0165
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
43 additions
and
45 deletions
src/common/roleCommon.js
src/components/RoleCreate/src/main.vue
src/views/customer/menu/index.vue
src/views/customer/role/index.vue
src/common/roleCommon.js
View file @
e11ad8a
const
roleCreateStructure
=
{
const
roleCreateStructure
=
{
roleId
:
''
,
roleName
:
''
,
roleName
:
''
,
roleDescript
:
''
,
roleDescript
:
''
,
department
:
''
,
department
:
''
,
menuOption
:
''
menuOption
:
''
,
roleStatus
:
'启动'
,
roleCreateTime
:
''
}
}
export
{
roleCreateStructure
}
export
{
roleCreateStructure
}
src/components/RoleCreate/src/main.vue
View file @
e11ad8a
...
@@ -32,19 +32,16 @@ export default {
...
@@ -32,19 +32,16 @@ export default {
name
:
'RoleCreate'
,
name
:
'RoleCreate'
,
props
:
{
props
:
{
createVisible
:
Boolean
,
createVisible
:
Boolean
,
editParam
s
:
Object
editParam
:
Object
},
},
watch
:
{
watch
:
{
createVisible
(
val
)
{
createVisible
(
val
)
{
!
val
&&
this
.
$refs
[
'createRuleForm'
].
resetFields
()
!
val
&&
this
.
$refs
[
'createRuleForm'
].
resetFields
()
},
},
editParam
s
(
val
)
{
editParam
(
val
)
{
if
(
val
)
{
if
(
val
!==
this
.
createRuleForm
)
{
this
.
createRuleForm
=
val
this
.
createRuleForm
=
this
.
$deep_clone
(
val
)
}
}
console
.
log
(
'editParamsChange----------------------------'
)
console
.
log
(
this
.
createRuleForm
)
console
.
log
(
'editParamsChange----------------------------'
)
}
}
},
},
data
()
{
data
()
{
...
@@ -65,22 +62,13 @@ export default {
...
@@ -65,22 +62,13 @@ export default {
}
}
},
},
methods
:
{
methods
:
{
message
(
message
,
type
)
{
type
&&
this
.
$message
({
showClose
:
true
,
type
:
type
,
message
:
message
})
!
type
&&
this
.
$message
({
showClose
:
true
,
message
:
message
})
},
handleCreateSubmit
(
formName
)
{
handleCreateSubmit
(
formName
)
{
const
editData
=
this
.
$deep_clone
(
this
.
createRuleForm
)
// eidt:true;create:false
const
flagEOrC
=
editData
.
roleId
this
.
$refs
[
formName
].
validate
((
valid
)
=>
{
this
.
$refs
[
formName
].
validate
((
valid
)
=>
{
if
(
valid
)
{
if
(
valid
)
{
this
.
$emit
(
'createClose'
,
this
.
createRuleForm
)
this
.
$emit
(
'createClose'
,
flagEOrC
,
editData
)
this
.
message
(
'创建角色成功'
,
'success'
)
}
else
{
}
else
{
return
false
return
false
}
}
...
@@ -88,7 +76,6 @@ export default {
...
@@ -88,7 +76,6 @@ export default {
},
},
handleCreateCancel
()
{
handleCreateCancel
()
{
this
.
$emit
(
'createClose'
)
this
.
$emit
(
'createClose'
)
this
.
message
(
'取消创建角色'
)
}
}
}
}
}
}
...
...
src/views/customer/menu/index.vue
View file @
e11ad8a
<
template
>
<
template
>
<div>
<div>
<
tree
:data=
'res'
:title=
"'菜单列表'"
:props=
'props'
consoleItem
></tree
>
<
!--
<tree
:data=
'res'
:title=
"'菜单列表'"
:props=
'props'
consoleItem
></tree>
--
>
</div>
</div>
</
template
>
</
template
>
...
@@ -9,10 +9,10 @@ export default {
...
@@ -9,10 +9,10 @@ export default {
name
:
'menuMG'
,
name
:
'menuMG'
,
data
()
{
data
()
{
return
{
return
{
res
:
this
.
$get_session_config
(),
//
res: this.$get_session_config(),
props
:
{
//
props: {
label
:
'title'
//
label: 'title'
}
//
}
}
}
}
}
}
}
...
...
src/views/customer/role/index.vue
View file @
e11ad8a
...
@@ -7,8 +7,8 @@
...
@@ -7,8 +7,8 @@
</div>
</div>
<hr>
<hr>
<div
class=
"default p-t15"
>
<div
class=
"default p-t15"
>
<gl-button
class=
"control-tabledata-button"
size=
"small"
@
click=
"handleCreateRole
(editParams)
"
>
创建
</gl-button>
<gl-button
class=
"control-tabledata-button"
size=
"small"
@
click=
"handleCreateRole"
>
创建
</gl-button>
<role-create
:createVisible=
"createVisible"
:editParam
s=
"editParams
"
@
createClose=
"handleCreateClose"
></role-create>
<role-create
:createVisible=
"createVisible"
:editParam
=
"editParam
"
@
createClose=
"handleCreateClose"
></role-create>
<div
class=
"m-b8"
>
<div
class=
"m-b8"
>
<gl-table
:table=
"roleData"
:pagination=
"pagination"
></gl-table>
<gl-table
:table=
"roleData"
:pagination=
"pagination"
></gl-table>
</div>
</div>
...
@@ -29,7 +29,7 @@ export default {
...
@@ -29,7 +29,7 @@ export default {
return
{
return
{
roleName
:
''
,
roleName
:
''
,
createVisible
:
false
,
createVisible
:
false
,
editParam
s
:
roleCreateStructure
,
editParam
:
roleCreateStructure
,
roleData
:
{
roleData
:
{
border
:
true
,
border
:
true
,
height
:
400
,
height
:
400
,
...
@@ -57,7 +57,7 @@ export default {
...
@@ -57,7 +57,7 @@ export default {
label
:
'编辑'
,
label
:
'编辑'
,
type
:
'text'
,
type
:
'text'
,
callback
:
(
index
,
rows
)
=>
{
callback
:
(
index
,
rows
)
=>
{
this
.
handle
Create
Role
(
rows
[
index
])
this
.
handle
Edit
Role
(
rows
[
index
])
}
}
},
{
},
{
label
:
'详细'
,
label
:
'详细'
,
...
@@ -116,29 +116,37 @@ export default {
...
@@ -116,29 +116,37 @@ export default {
this
.
message
(
'取消删除'
)
this
.
message
(
'取消删除'
)
})
})
},
},
// dateFormat() {
// const currentTime = new Date()
// const date = currentTime.toLocaleDateString().split('/').forEach((item) => { console.log(item) })
// console.log(date)
// },
// 新增用户到页面
// 新增用户到页面
addRole
(
data
)
{
addRole
(
data
)
{
const
newData
=
{
roleId
:
'1038'
,
roleName
:
data
.
roleName
,
department
:
data
.
department
,
roleStatus
:
'开启'
,
roleCreateTime
:
new
Date
().
toLocaleString
().
split
(
'/'
).
join
(
'-'
)
}
// 后台获取----------------------
data
.
roleId
=
'1038'
data
.
roleCreateTime
=
new
Date
().
toLocaleString
().
split
(
'/'
).
join
(
'-'
)
// 后台获取----------------------
const
newData
=
data
this
.
roleData
.
data
.
push
(
newData
)
this
.
roleData
.
data
.
push
(
newData
)
this
.
message
(
'创建角色成功!'
,
'success'
)
},
createDialogVisible
()
{
this
.
createVisible
=
!
this
.
createVisible
},
},
handleSearchRoleName
()
{
handleSearchRoleName
()
{
this
.
roleName
=
''
this
.
roleName
=
''
},
},
handleCreateRole
(
params
)
{
handleCreateRole
()
{
// console.log(params)
this
.
createDialogVisible
()
this
.
editParams
=
params
this
.
editParam
=
roleCreateStructure
this
.
createVisible
=
!
this
.
createVisible
},
handleEditRole
(
param
)
{
this
.
createDialogVisible
()
this
.
editParam
=
param
},
},
// 关闭新增用户组件
// 关闭新增用户组件
handleCreateClose
(
data
)
{
handleCreateClose
(
flagEOrC
,
data
)
{
this
.
handleCreateRole
()
this
.
createDialogVisible
()
data
&&
!
this
.
editParams
&&
this
.
addRole
(
data
)
!
data
&&
this
.
message
(
'取消创建角色'
)
this
.
editParams
=
roleCreateStructure
// 将数据提交给后台,根据返回结果做判断
data
&&
!
flagEOrC
&&
this
.
addRole
(
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