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 4768b0fc
authored
Sep 08, 2018
by
胡悦
Browse Files
Options
Browse Files
Tag
Download
Plain Diff
Merge branch 'master' of
https://github.com/glsx-web/authority
2 parents
4de45599
e11ad8ae
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
53 additions
and
47 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
0 → 100644
View file @
4768b0f
const
roleCreateStructure
=
{
roleId
:
''
,
roleName
:
''
,
roleDescript
:
''
,
department
:
''
,
menuOption
:
''
,
roleStatus
:
'启动'
,
roleCreateTime
:
''
}
export
{
roleCreateStructure
}
src/components/RoleCreate/src/main.vue
View file @
4768b0f
...
...
@@ -27,31 +27,26 @@
</
template
>
<
script
>
import
{
roleCreateStructure
}
from
'@/common/roleCommon'
export
default
{
name
:
'RoleCreate'
,
props
:
{
createVisible
:
Boolean
,
editParam
s
:
Object
editParam
:
Object
},
watch
:
{
createVisible
(
val
)
{
!
val
&&
this
.
$refs
[
'createRuleForm'
].
resetFields
()
},
editParam
s
(
val
)
{
if
(
val
)
{
this
.
createRuleForm
=
val
editParam
(
val
)
{
if
(
val
!==
this
.
createRuleForm
)
{
this
.
createRuleForm
=
this
.
$deep_clone
(
val
)
}
console
.
log
(
this
.
createRuleForm
)
}
},
data
()
{
return
{
createRuleForm
:
{
roleName
:
''
,
roleDescript
:
''
,
department
:
''
,
menuOption
:
''
},
createRuleForm
:
roleCreateStructure
,
createRules
:
{
roleName
:
[
{
required
:
true
,
message
:
'请输入角色名称!'
,
trigger
:
'blur'
}
...
...
@@ -67,22 +62,13 @@ export default {
}
},
methods
:
{
message
(
message
,
type
)
{
type
&&
this
.
$message
({
showClose
:
true
,
type
:
type
,
message
:
message
})
!
type
&&
this
.
$message
({
showClose
:
true
,
message
:
message
})
},
handleCreateSubmit
(
formName
)
{
const
editData
=
this
.
$deep_clone
(
this
.
createRuleForm
)
// eidt:true;create:false
const
flagEOrC
=
editData
.
roleId
this
.
$refs
[
formName
].
validate
((
valid
)
=>
{
if
(
valid
)
{
this
.
$emit
(
'createClose'
,
this
.
createRuleForm
)
this
.
message
(
'创建角色成功'
,
'success'
)
this
.
$emit
(
'createClose'
,
flagEOrC
,
editData
)
}
else
{
return
false
}
...
...
@@ -90,7 +76,6 @@ export default {
},
handleCreateCancel
()
{
this
.
$emit
(
'createClose'
)
this
.
message
(
'取消创建角色'
)
}
}
}
...
...
src/views/customer/menu/index.vue
View file @
4768b0f
<
template
>
<div>
<
tree
:data=
'res'
:title=
"'菜单列表'"
:props=
'props'
consoleItem
></tree
>
<
!--
<tree
:data=
'res'
:title=
"'菜单列表'"
:props=
'props'
consoleItem
></tree>
--
>
</div>
</
template
>
...
...
@@ -9,10 +9,10 @@ export default {
name
:
'menuMG'
,
data
()
{
return
{
res
:
this
.
$get_session_config
(),
props
:
{
label
:
'title'
}
//
res: this.$get_session_config(),
//
props: {
//
label: 'title'
//
}
}
}
}
...
...
src/views/customer/role/index.vue
View file @
4768b0f
...
...
@@ -7,8 +7,8 @@
</div>
<hr>
<div
class=
"default p-t15"
>
<gl-button
class=
"control-tabledata-button"
size=
"small"
@
click=
"handleCreateRole
(editParams)
"
>
创建
</gl-button>
<role-create
:createVisible=
"createVisible"
:editParam
s=
"editParams
"
@
createClose=
"handleCreateClose"
></role-create>
<gl-button
class=
"control-tabledata-button"
size=
"small"
@
click=
"handleCreateRole"
>
创建
</gl-button>
<role-create
:createVisible=
"createVisible"
:editParam
=
"editParam
"
@
createClose=
"handleCreateClose"
></role-create>
<div
class=
"m-b8"
>
<gl-table
:table=
"roleData"
:pagination=
"pagination"
></gl-table>
</div>
...
...
@@ -19,6 +19,7 @@
<
script
>
import
{
RoleCreate
}
from
'@/components/index'
import
{
getInfo
}
from
'@/api/user'
import
{
roleCreateStructure
}
from
'@/common/roleCommon'
export
default
{
name
:
'role'
,
components
:
{
...
...
@@ -28,7 +29,7 @@ export default {
return
{
roleName
:
''
,
createVisible
:
false
,
editParam
s
:
{}
,
editParam
:
roleCreateStructure
,
roleData
:
{
border
:
true
,
height
:
400
,
...
...
@@ -56,7 +57,7 @@ export default {
label
:
'编辑'
,
type
:
'text'
,
callback
:
(
index
,
rows
)
=>
{
this
.
handle
Create
Role
(
rows
[
index
])
this
.
handle
Edit
Role
(
rows
[
index
])
}
},
{
label
:
'详细'
,
...
...
@@ -115,28 +116,37 @@ export default {
this
.
message
(
'取消删除'
)
})
},
// dateFormat() {
// const currentTime = new Date()
// const date = currentTime.toLocaleDateString().split('/').forEach((item) => { console.log(item) })
// console.log(date)
// },
// 新增用户到页面
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
.
message
(
'创建角色成功!'
,
'success'
)
},
createDialogVisible
()
{
this
.
createVisible
=
!
this
.
createVisible
},
handleSearchRoleName
()
{
this
.
roleName
=
''
},
handleCreateRole
(
params
)
{
console
.
log
(
params
)
this
.
editParams
=
params
this
.
createVisible
=
!
this
.
createVisible
handleCreateRole
()
{
this
.
createDialogVisible
()
this
.
editParam
=
roleCreateStructure
},
handleEditRole
(
param
)
{
this
.
createDialogVisible
()
this
.
editParam
=
param
},
// 关闭新增用户组件
handleCreateClose
(
data
)
{
this
.
handleCreateRole
()
data
&&
!
this
.
editParams
&&
this
.
addRole
(
data
)
handleCreateClose
(
flagEOrC
,
data
)
{
this
.
createDialogVisible
()
!
data
&&
this
.
message
(
'取消创建角色'
)
// 将数据提交给后台,根据返回结果做判断
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