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 4691a4f7
authored
Sep 20, 2018
by
cwq0219
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
role创建-编辑组件修改
1 parent
a9d6bb18
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
38 additions
and
24 deletions
src/common/roleConst.js
src/components/RoleCreate/src/main.vue
src/views/customer/role/index.vue
src/common/roleConst.js
View file @
4691a4f
...
@@ -4,7 +4,9 @@ const roleCreateStructure = {
...
@@ -4,7 +4,9 @@ const roleCreateStructure = {
id
:
Number
,
id
:
Number
,
roleName
:
''
,
roleName
:
''
,
description
:
''
,
description
:
''
,
departId
:
''
,
departName
:
''
,
departName
:
''
,
departPath
:
''
,
rights
:
Array
,
rights
:
Array
,
state
:
1
,
state
:
1
,
createTime
:
''
createTime
:
''
...
...
src/components/RoleCreate/src/main.vue
View file @
4691a4f
...
@@ -13,20 +13,15 @@
...
@@ -13,20 +13,15 @@
<span
style=
"position:absolute; right:5px; top:-20px;"
>
/200
</span>
<span
style=
"position:absolute; right:5px; top:-20px;"
>
/200
</span>
</gl-form-item>
</gl-form-item>
<gl-form-item
label=
"所属部门:"
prop=
"departName"
>
<gl-form-item
label=
"所属部门:"
prop=
"departName"
>
<gl-select
v-model=
"createRuleForm.departName"
placeholder=
"请选择"
>
<gl-select
placeholder=
"请选择"
v-model=
"createRuleForm.departName"
>
<gl-option
label=
"运营平台"
value=
"运营平台"
></gl-option>
<gl-option
style=
"height:160px"
>
<tree
ref=
'tree'
:isDepart=
"isDepart"
v-model=
"createRuleForm.departName"
:defaultExpandAll=
"defaultExpandAll"
@
node-click=
'clickDepart'
style=
"height:160px"
></tree>
</gl-option>
<!--
<gl-option
label=
"运营平台"
value=
"运营平台"
></gl-option>
-->
</gl-select>
</gl-select>
</gl-form-item>
</gl-form-item>
<gl-form-item
label=
"菜单选项:"
prop=
"rights"
>
<gl-form-item
label=
"菜单选项:"
prop=
"rights"
>
<tree
<tree
ref=
'tree'
v-model=
"createRuleForm.rights"
:show-checkbox=
"show_checkbox"
:defaultExpandAll=
"defaultExpandAll"
:defaultCheckedKeys=
"roleMenuTree"
@
input=
"getMenuOption"
style=
"height:160px"
></tree>
ref=
'tree'
v-model=
"createRuleForm.rights"
:show-checkbox=
"show_checkbox"
:defaultExpandAll=
"defaultExpandAll"
:defaultCheckedKeys=
"roleMenuTree"
@
input=
"getMenuOption"
style=
"height:160px"
></tree>
</gl-form-item>
</gl-form-item>
</gl-form>
</gl-form>
<div
slot=
"footer"
class=
"dialog-footer"
>
<div
slot=
"footer"
class=
"dialog-footer"
>
...
@@ -49,18 +44,19 @@ export default {
...
@@ -49,18 +44,19 @@ export default {
createVisible
(
val
)
{
createVisible
(
val
)
{
!
val
&&
this
.
$refs
[
'createRuleForm'
].
resetFields
()
!
val
&&
this
.
$refs
[
'createRuleForm'
].
resetFields
()
// 考虑一下放这里还是放下面
// 考虑一下放这里还是放下面
this
.
c
hangeMenuTree
=
this
.
roleMenuTree
this
.
c
reateRuleForm
.
rights
=
this
.
roleMenuTree
},
},
flagCOrE
(
val
)
{
flagCOrE
(
val
)
{
this
.
title
=
val
?
'新建角色'
:
'角色列表'
this
.
title
=
val
?
'新建角色'
:
'角色列表'
// this.c
hangeMenuTree
= this.roleMenuTree
// this.c
reateRuleForm.rights
= this.roleMenuTree
}
}
},
},
data
()
{
data
()
{
return
{
return
{
isDepart
:
true
,
show_checkbox
:
true
,
show_checkbox
:
true
,
defaultExpandAll
:
true
,
defaultExpandAll
:
true
,
changeMenuTre
e
:
[],
departNam
e
:
[],
title
:
''
,
title
:
''
,
createRules
:
{
createRules
:
{
roleName
:
[
roleName
:
[
...
@@ -82,11 +78,27 @@ export default {
...
@@ -82,11 +78,27 @@ export default {
methods
:
{
methods
:
{
// tree-strat
// tree-strat
getMenuOption
(
params
)
{
getMenuOption
(
params
)
{
this
.
changeMenuTree
=
params
.
treeData
.
checkedKeys
.
concat
(
params
.
treeData
.
halfCheckedKeys
)
this
.
createRuleForm
.
rights
=
params
.
treeData
.
checkedKeys
.
concat
(
params
.
treeData
.
halfCheckedKeys
)
},
clickDepart
(
data
,
treeData
,
vue
,
props
)
{
if
(
data
.
parent
!==
'#'
||
!
data
.
children
)
{
this
.
createRuleForm
.
departId
=
data
.
id
this
.
createRuleForm
.
departPath
=
data
.
type
this
.
getDepartName
(
treeData
)
this
.
createRuleForm
.
departName
=
this
.
departName
.
join
(
' - '
)
this
.
departName
=
[]
}
},
getDepartName
(
params
)
{
this
.
departName
.
unshift
(
params
.
data
.
text
)
if
(
params
.
data
.
parent
!==
'#'
)
{
this
.
getDepartName
(
params
.
parent
)
}
else
{
return
true
}
},
},
// tree-end
// tree-end
getParams
()
{
getParams
()
{
this
.
createRuleForm
.
rights
=
this
.
changeMenuTree
return
this
.
$deep_clone
(
this
.
createRuleForm
)
return
this
.
$deep_clone
(
this
.
createRuleForm
)
},
},
handleCreateSubmit
(
formName
)
{
handleCreateSubmit
(
formName
)
{
...
...
src/views/customer/role/index.vue
View file @
4691a4f
...
@@ -176,23 +176,23 @@ export default {
...
@@ -176,23 +176,23 @@ export default {
// console.log(aa)
// console.log(aa)
// console.log(editData)
// console.log(editData)
// const cc = { roleName: 'ggg' }
// const cc = { roleName: 'ggg' }
saveRoleList
.
req
(
params
).
then
((
data
)
=>
{
//
saveRoleList.req(params).then((data) => {
// console.log(data)
// console.log(data)
// this.createOrEditSuccess()
// this.createOrEditSuccess()
}).
catch
(
err
=>
{
//
}).catch(err => {
console
.
log
(
err
)
//
console.log(err)
})
//
})
},
},
// 编辑角色
// 编辑角色
updateRoleInfo
(
params
)
{
updateRoleInfo
(
params
)
{
console
.
log
(
params
)
console
.
log
(
params
)
this
.
createOrEditSuccess
()
this
.
createOrEditSuccess
()
updateRole
.
req
(
params
).
then
((
data
)
=>
{
//
updateRole.req(params).then((data) => {
// console.log(data)
// console.log(data)
// this.createOrEditSuccess()
// this.createOrEditSuccess()
}).
catch
(
err
=>
{
//
}).catch(err => {
console
.
log
(
err
)
//
console.log(err)
})
//
})
},
},
// 接口请求-end---------------------------------------
// 接口请求-end---------------------------------------
createDialogVisible
()
{
createDialogVisible
()
{
...
...
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