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 b2ccf800
authored
Sep 20, 2018
by
胡悦
Browse Files
Options
Browse Files
Tag
Download
Plain Diff
hebing
2 parents
3f353380
4691a4f7
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
324 additions
and
258 deletions
src/api/roleApi.js
src/common/commonConst.js
src/common/roleConst.js
src/components/LeftManager/src/main.vue
src/components/RightForm/src/main.vue
src/components/RoleCreate/src/main.vue
src/components/Tree/src/main.vue
src/components/UserDetail/src/main.vue
src/date.js
src/views/customer/department/index.vue
src/views/customer/menu/index.vue
src/views/customer/role/index.vue
src/views/customer/user/index.vue
src/api/roleApi.js
View file @
b2ccf80
...
...
@@ -39,7 +39,9 @@ const getRoleList = {
const
saveRoleList
=
{
p
:
[
__sSaveRoleList
],
// req: params => GlAxios.post(__sSaveRoleList, JSON.stringify(params), { headers: { 'Content/-Type': 'application/json;charset=UTF-8' }})
// req: params => GlAxios.get(__sSaveRoleList, params)
// req: params => GlAxios.post(__sSaveRoleList, params, { headers: { 'Content-Type': 'application/x-www-form-urlencoded' }})
// req: params => GlAxios.post(__sSaveRoleList, params, { headers: { 'Content-Type': 'application/json; charset=utf-8' }})
req
:
params
=>
GlAxios
.
post
(
__sSaveRoleList
,
params
)
}
...
...
src/common/commonConst.js
View file @
b2ccf80
import
{
roleCreateStructure
,
userRoleDetailColumn
,
userRoleDetailConsole
}
from
'./roleConst'
import
{
roleCreateStructure
,
roleDataColumn
,
userRoleDetailColumn
,
userRoleDetailConsole
}
from
'./roleConst'
import
{
userForm
,
userDetailColumn
}
from
'./userConst'
export
{
roleCreateStructure
,
roleDataColumn
,
userRoleDetailColumn
,
userRoleDetailConsole
,
userDetailColumn
,
...
...
src/common/roleConst.js
View file @
b2ccf80
import
{
deleteUserRoleById
}
from
'@/api/api'
const
roleCreateStructure
=
{
id
:
Number
,
roleName
:
''
,
description
:
''
,
departId
:
''
,
departName
:
''
,
departPath
:
''
,
rights
:
Array
,
state
:
1
,
createTime
:
''
}
const
roleDataColumn
=
[{
label
:
'序号'
,
prop
:
'id'
},
{
label
:
'角色名字'
,
prop
:
'roleName'
},
{
label
:
'所属部门'
,
prop
:
'departName'
},
{
label
:
'状态'
,
prop
:
'state'
,
formatter
:
(
cellValue
)
=>
{
return
cellValue
<
1
?
'禁止'
:
'启动'
}
},
{
label
:
'创建时间'
,
prop
:
'createTime'
}]
const
userRoleDetailColumn
=
[{
label
:
'序号'
,
prop
:
'userId'
...
...
@@ -32,14 +56,22 @@ const userRoleDetailConsole = {
label
:
'删除'
,
type
:
'text'
,
callback
:
(
index
,
rows
)
=>
{
rows
.
splice
(
index
,
1
)
// this.$alert(rows[index])
const
data
=
rows
[
index
]
const
params
=
{
roleId
:
data
.
roleId
,
userId
:
data
.
userId
}
deleteUserRoleById
.
req
(
params
).
then
(
res
=>
{
// 加入提示消息!!!
rows
.
splice
(
index
,
1
)
// console.log(res)
}).
catch
(
err
=>
{
console
.
log
(
err
)
})
}
}]
}
export
{
roleCreateStructure
,
roleDataColumn
,
userRoleDetailColumn
,
userRoleDetailConsole
}
src/components/LeftManager/src/main.vue
View file @
b2ccf80
...
...
@@ -9,6 +9,7 @@
<tree
ref=
'tree'
@
node-click=
'nodeClick'
:isDepart=
'isDepart'
></tree>
</div>
</
template
>
...
...
@@ -33,7 +34,8 @@ export default {
default
:
()
=>
{
return
null
}
}
},
isDepart
:
Boolean
},
methods
:
{
// 展开与关闭
...
...
@@ -60,6 +62,7 @@ export default {
this
.
clearFrom
()
},
clearFrom
()
{
this
.
value
.
showDetails
=
true
this
.
value
.
btnTxt
=
'保存'
this
.
value
.
del
=
false
for
(
const
key
in
this
.
value
.
form
)
{
...
...
src/components/RightForm/src/main.vue
View file @
b2ccf80
...
...
@@ -30,13 +30,13 @@
</gl-form-item>
<gl-form-item>
<gl-button
type=
"primary"
@
click=
"submit"
>
{{
value
.
btnTxt
}}
</gl-button>
<gl-button
type=
"danger"
v-show=
'value.del'
@
click=
"
centerDialogVisible
= true "
>
删除
</gl-button>
<gl-button
type=
"danger"
v-show=
'value.del'
@
click=
"
dialog
= true "
>
删除
</gl-button>
<gl-button
@
click=
'value.showDetails = false'
style=
"float:right"
>
取消
</gl-button>
</gl-form-item>
</gl-form>
<gl-dialog
title=
"提示"
:visible
.
sync=
"
centerDialogVisible
"
:visible
.
sync=
"
dialog
"
width=
"30%"
center
>
<div
style=
"text-align:center"
>
确定是否要删除
</div>
...
...
@@ -47,13 +47,13 @@
</gl-dialog>
</div>
</
template
>
<
script
type=
'text/ecmascript-6'
>
import
{
delDepartment
,
delMenu
,
editMenu
}
from
'@/api/api'
export
default
{
name
:
'rightForm'
,
data
()
{
return
{
centerDialogVisible
:
false
dialog
:
false
}
},
props
:
{
...
...
@@ -61,29 +61,43 @@ export default {
form
:
{
type
:
Array
,
default
:
()
=>
[]
}
},
isDepart
:
Boolean
},
watch
:
{
'value.form.name'
(
val
)
{
if
(
val
!==
''
)
this
.
$refs
.
name
[
0
].
$el
.
classList
.
remove
(
'err'
)
}
},
mounted
()
{
},
methods
:
{
// 删除
delData
()
{
for
(
let
index
=
0
;
index
<
this
.
value
.
node
.
parent
.
childNodes
.
length
;
index
++
)
{
if
(
this
.
value
.
node
.
parent
.
childNodes
[
index
]
===
this
.
value
.
node
)
this
.
value
.
node
.
level
===
1
?
this
.
value
.
node
.
parent
.
data
.
splice
(
index
,
1
)
:
this
.
value
.
node
.
parent
.
data
.
children
.
splice
(
index
,
1
)
}
this
.
$notify
({
title
:
'删除成功'
,
type
:
'success'
})
this
.
centerDialogVisible
=
false
this
.
$set_session_config
(
this
.
value
.
data
)
this
.
value
.
showDetails
=
false
delete
this
.
value
.
form
[
'name'
]
console
.
log
(
this
.
value
.
form
)
this
.
isDepart
?
delDepartment
.
req
(
this
.
value
.
form
).
then
(
res
=>
{
this
.
$notify
({
title
:
'删除成功'
,
type
:
'success'
})
this
.
dialog
=
false
this
.
value
.
showDetails
=
false
}).
catch
(
err
=>
{
console
.
log
(
err
)
})
:
delMenu
.
req
(
this
.
value
.
form
).
then
(
res
=>
{
console
.
log
(
res
)
this
.
$notify
({
title
:
'删除成功'
,
type
:
'success'
})
this
.
dialog
=
false
this
.
value
.
showDetails
=
false
}).
catch
(
err
=>
{
console
.
log
(
err
)
})
},
cancel
()
{
this
.
centerDialogVisible
=
false
this
.
dialog
=
false
this
.
$notify
({
title
:
'已取消'
,
type
:
'info'
...
...
@@ -91,47 +105,29 @@ export default {
},
// 保存修改
submit
()
{
if
(
this
.
value
.
form
.
name
!==
''
&&
this
.
value
.
form
.
name
!==
null
)
{
let
arr
=
{}
delete
this
.
value
.
form
[
'name'
]
if
(
this
.
value
.
form
[
this
.
form
[
0
].
value
]
!==
''
&&
this
.
value
.
form
[
this
.
form
[
0
].
value
]
!==
null
)
{
// 添加同级
if
(
this
.
value
.
sublings
)
{
arr
=
{
id
:
this
.
value
.
form
.
index
,
level
:
this
.
value
.
node
.
level
,
createTime
:
new
Date
().
format
(
'yyyy-MM-dd HH:mm:ss'
)
}
arr
[
this
.
value
.
props
.
label
]
=
this
.
value
.
form
.
name
if
(
this
.
value
.
node
.
level
===
1
)
{
this
.
value
.
data
.
push
(
arr
)
}
else
{
if
(
this
.
value
.
node
.
parent
.
data
.
children
===
undefined
)
this
.
$set
(
this
.
value
.
node
.
parent
.
data
,
'children'
,
[])
this
.
value
.
node
.
parent
.
data
.
children
.
push
(
arr
)
}
console
.
log
(
1
)
// 添加子级
}
else
if
(
this
.
value
.
children
)
{
arr
=
{
id
:
this
.
value
.
form
.
index
,
level
:
this
.
value
.
node
.
level
+
1
,
createTime
:
new
Date
().
format
(
'yyyy-MM-dd HH:mm:ss'
)
}
arr
[
this
.
value
.
props
.
label
]
=
this
.
value
.
form
.
name
if
(
this
.
value
.
allNode
.
children
===
undefined
)
this
.
$set
(
this
.
value
.
allNode
,
'children'
,
[])
this
.
value
.
allNode
.
children
.
push
(
arr
)
console
.
log
(
2
)
// 修改
}
else
{
this
.
value
.
node
.
data
.
id
=
this
.
value
.
form
.
index
this
.
value
.
node
.
data
[
this
.
value
.
props
.
label
]
=
this
.
value
.
form
.
name
if
(
this
.
value
.
node
.
data
.
changeTime
===
undefined
)
this
.
$set
(
this
.
value
.
node
.
data
,
'changeTime'
,
''
)
this
.
value
.
node
.
data
.
changeTime
=
new
Date
().
format
(
'yyyy-MM-dd HH:mm:ss'
)
editMenu
.
req
(
this
.
value
.
form
).
then
(
res
=>
{
console
.
log
(
res
)
this
.
$notify
({
title
:
'操作成功'
,
type
:
'success'
})
}).
catch
(
err
=>
{
console
.
log
(
err
)
})
}
this
.
value
.
showDetails
=
false
this
.
$notify
({
title
:
'操作成功'
,
type
:
'success'
})
this
.
$set_session_config
(
this
.
value
.
data
)
}
else
{
this
.
$refs
.
n
ame
[
0
].
$el
.
classList
.
add
(
'err'
)
this
.
$refs
.
urlN
ame
[
0
].
$el
.
classList
.
add
(
'err'
)
}
}
}
...
...
src/components/RoleCreate/src/main.vue
View file @
b2ccf80
<!-- createRoleComponent -->
<
template
>
<gl-dialog
:title=
"
createOrEditT
itle"
:visible
.
sync=
"createVisible"
:before-close=
"handleCreateCancel"
>
<gl-dialog
:title=
"
t
itle"
:visible
.
sync=
"createVisible"
:before-close=
"handleCreateCancel"
>
<gl-form
:model=
"createRuleForm"
:rules=
"createRules"
ref=
"createRuleForm"
label-width=
"105px"
>
<gl-form-item
label=
"角色名称:"
prop=
"roleName"
>
<gl-input
v-model=
"createRuleForm.roleName"
clearable
></gl-input>
...
...
@@ -13,18 +13,15 @@
<span
style=
"position:absolute; right:5px; top:-20px;"
>
/200
</span>
</gl-form-item>
<gl-form-item
label=
"所属部门:"
prop=
"departName"
>
<gl-select
v-model=
"createRuleForm.departName"
placeholder=
"请选择"
>
<gl-option
label=
"运营平台"
value=
"运营平台"
></gl-option>
<gl-select
placeholder=
"请选择"
v-model=
"createRuleForm.departName"
>
<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-form-item>
<gl-form-item
label=
"菜单选项:"
>
<tree
ref=
'tree'
:show-checkbox=
"show_checkbox"
:defaultExpandAll=
"defaultExpandAll"
@
input=
"getMenuOption"
style=
"height:160px"
></tree>
<gl-form-item
label=
"菜单选项:"
prop=
"rights"
>
<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>
<div
slot=
"footer"
class=
"dialog-footer"
>
...
...
@@ -35,30 +32,32 @@
</
template
>
<
script
>
import
{
roleCreateStructure
}
from
'@/common/commonConst'
import
{
saveRoleList
,
updateRole
}
from
'@/api/api'
export
default
{
name
:
'RoleCreate'
,
props
:
{
createOrEditTitle
:
String
,
createVisible
:
Boolean
,
roleParam
:
Object
createRuleForm
:
Object
,
flagCOrE
:
[
Boolean
,
Array
,
Function
],
roleMenuTree
:
Array
},
watch
:
{
createVisible
(
val
)
{
!
val
&&
this
.
$refs
[
'createRuleForm'
].
resetFields
()
// 考虑一下放这里还是放下面
this
.
createRuleForm
.
rights
=
this
.
roleMenuTree
},
roleParam
(
val
)
{
if
(
val
!==
this
.
createRuleForm
)
{
this
.
createRuleForm
=
this
.
$deep_clone
(
val
)
}
flagCOrE
(
val
)
{
this
.
title
=
val
?
'新建角色'
:
'角色列表'
// this.createRuleForm.rights = this.roleMenuTree
}
},
data
()
{
return
{
createRuleForm
:
roleCreateStructur
e
,
isDepart
:
tru
e
,
show_checkbox
:
true
,
defaultExpandAll
:
true
,
departName
:
[],
title
:
''
,
createRules
:
{
roleName
:
[
{
required
:
true
,
message
:
'请输入角色名称!'
,
trigger
:
'blur'
}
...
...
@@ -69,6 +68,9 @@ export default {
],
departName
:
[
{
required
:
true
,
message
:
'请输入所属部门!'
,
trigger
:
'change'
}
],
rights
:
[
{
required
:
true
,
message
:
'请选择菜单选项!'
,
trigger
:
'change'
}
]
}
}
...
...
@@ -78,50 +80,40 @@ export default {
getMenuOption
(
params
)
{
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
getParams
()
{
return
this
.
$deep_clone
(
this
.
createRuleForm
)
},
// 接口
addRole
(
flagEOrC
,
editData
)
{
// editData = { roleName: editData.roleName }
// const aa = JSON.stringify(editData)
// console.log(aa)
// console.log(editData)
saveRoleList
.
req
(
editData
).
then
((
data
)
=>
{
console
.
log
(
data
)
this
.
$emit
(
'createClose'
,
flagEOrC
,
editData
)
}).
catch
(
err
=>
{
console
.
log
(
err
)
})
},
updateRoleInfo
(
flagEOrC
,
editData
)
{
updateRole
.
req
(
editData
).
then
((
data
)
=>
{
console
.
log
(
data
)
this
.
$emit
(
'createClose'
,
flagEOrC
,
editData
)
}).
catch
(
err
=>
{
console
.
log
(
err
)
})
},
// 接口
handleCreateSubmit
(
formName
)
{
const
editData
=
this
.
getParams
()
console
.
log
(
editData
)
// eidt:true;create:false
const
flagEOrC
=
editData
.
id
!==
Number
// console.log(flagEOrC)
// console.log(editData)
this
.
$refs
[
formName
].
validate
((
valid
)
=>
{
if
(
valid
)
{
!
flagEOrC
&&
this
.
addRole
(
flagEOrC
,
editData
)
flagEOrC
&&
this
.
updateRoleInfo
(
flagEOrC
,
editData
)
// this.$emit('createClose', flagEOrC, editData)
this
.
$emit
(
'createClose'
,
editData
)
}
else
{
return
false
}
})
},
handleCreateCancel
()
{
this
.
$emit
(
'createClose'
)
this
.
$emit
(
'createClose'
,
false
)
}
}
}
...
...
src/components/Tree/src/main.vue
View file @
b2ccf80
<
template
>
<div
class=
"tree"
:style=
"treeStyle"
>
<<<<<<
< HEAD
<gl-tree
ref=
'tree'
highlight-current
:data=
'data'
:show-checkbox=
'showCheckbox'
node-key=
'id'
:props=
'props'
:default-expand-all=
'defaultExpandAll'
@
check=
'check'
@
node-click=
'nodeClick'
></gl-tree>
=======
<gl-tree
ref=
'tree'
highlight-current
...
...
@@ -15,34 +12,17 @@
@
check=
'check'
@
node-click=
'nodeClick'
></gl-tree>
>>>>>>> 9bf4d2fc7a08913f8a8bbac501752e7dc6d5f705
</div>
</
template
>
<
script
>
import
{
findMenuTree
}
from
'@/api/api'
function
fn
(
data
,
pid
)
{
var
result
=
[]
let
temp
=
null
for
(
var
i
in
data
)
{
if
(
data
[
i
].
parent
==
pid
)
{
result
.
push
(
data
[
i
])
temp
=
fn
(
data
,
data
[
i
].
id
)
if
(
temp
.
length
>
0
)
{
data
[
i
].
children
=
temp
}
}
}
return
result
}
import
{
findMenuTree
,
findDepartTree
}
from
'@/api/api'
export
default
{
name
:
'Tree'
,
data
()
{
return
{
// data: this.$get_session_config().resources || this.$get_session_config(),
data
:
[
Array
,
Function
],
data
:
null
,
props
:
{
// label: 'title'
label
:
'text'
}
}
...
...
@@ -55,17 +35,8 @@ export default {
defaultCheckedKeys
:
{
type
:
Array
,
default
:
()
=>
[]
}
},
mounted
()
{
findMenuTree
.
req
().
then
(
res
=>
{
// this.data = res
// this.data = this.$get_menus(res, '#', 'parent')
this
.
data
=
fn
(
res
,
'#'
)
// console.log(this.data)
}).
catch
(
err
=>
{
console
.
log
(
err
)
})
},
isDepart
:
Boolean
},
methods
:
{
nodeClick
(
data
,
treeData
,
vue
)
{
...
...
@@ -74,7 +45,34 @@ export default {
check
(
data
,
treeData
)
{
this
.
$emit
(
'input'
,
{
data
,
treeData
})
}
},
mounted
()
{
!
this
.
isDepart
?
findMenuTree
.
req
().
then
(
res
=>
{
this
.
data
=
fn
(
res
,
'#'
)
}).
catch
(
err
=>
{
console
.
log
(
err
)
})
:
findDepartTree
.
req
().
then
(
res
=>
{
this
.
data
=
fn
(
res
,
'#'
)
}).
catch
(
err
=>
{
console
.
log
(
err
)
})
}
}
function
fn
(
data
,
pid
)
{
var
result
=
[]
var
temp
=
null
for
(
var
i
in
data
)
{
if
(
data
[
i
].
parent
==
pid
)
{
result
.
push
(
data
[
i
])
temp
=
fn
(
data
,
data
[
i
].
id
)
if
(
temp
.
length
>
0
)
{
data
[
i
].
children
=
temp
}
}
}
return
result
}
</
script
>
<
style
scoped
>
...
...
src/components/UserDetail/src/main.vue
View file @
b2ccf80
...
...
@@ -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,12 +28,9 @@ export default {
consoleParam
(
val
)
{
this
.
tableParam
.
console
=
val
},
flagRoleOrUser
(
val
)
{
this
.
flag
=
val
},
apiParam
(
val
)
{
this
.
id
=
val
this
.
id
!==
Number
&&
this
.
callApi
()
this
.
id
=
val
.
id
this
.
id
&&
this
.
callApi
()
}
},
data
()
{
...
...
@@ -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,18 @@ 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
.
flag
RoleOrUser
&&
this
.
selectUser
()
!
this
.
flag
RoleOrUser
&&
(
this
.
tableParam
.
data
=
[
this
.
apiParam
]
)
},
handleClose
()
{
this
.
$emit
(
'userDetailClose'
)
...
...
src/date.js
View file @
b2ccf80
function
format
(
formatStr
)
{
const
date
=
this
var
zeroize
=
function
(
value
,
length
)
{
if
(
!
length
)
{
length
=
2
}
for
(
var
i
=
0
,
zeros
=
''
;
i
<
(
length
-
value
.
length
);
i
++
)
{
let
zeros
=
''
if
(
!
length
)
length
=
2
value
=
value
.
toString
()
for
(
let
i
=
0
;
i
<
(
length
-
value
.
length
);
i
++
)
{
zeros
+=
'0'
}
return
zeros
+
value
...
...
src/views/customer/department/index.vue
View file @
b2ccf80
<!-- departmentManagement -->
<
template
>
<gl-row
:gutter=
"
10
0"
>
<gl-row
:gutter=
"
5
0"
>
<gl-col
:span=
'8'
>
<left-manager
:title=
'"部门列表"'
v-model=
"department"
:nodeClick=
'nodeClick'
></left-manager>
<left-manager
:title=
'"部门列表"'
isDepart
v-model=
"department"
:nodeClick=
'nodeClick'
></left-manager>
</gl-col>
<gl-col
:span=
'16'
>
<right-form
:form=
'form'
v-model=
"department"
></right-form>
<right-form
:form=
'form'
isDepart
v-model=
"department"
></right-form>
</gl-col>
</gl-row>
</
template
>
<
script
>
import
{
LeftManager
,
RightForm
}
from
'@/components/index'
import
{
getDepartTreeNode
}
from
'@/api/api'
export
default
{
name
:
'department'
,
data
()
{
...
...
@@ -30,13 +31,13 @@ export default {
form
:
{
name
:
''
,
upDepartment
:
''
,
i
ndex
:
''
i
order
:
''
}
},
form
:
[
{
label
:
'部门名称'
,
value
:
'name'
},
{
label
:
'上级部门'
,
value
:
'upDepartment'
,
disabled
:
true
},
{
label
:
'排序'
,
value
:
'i
ndex
'
}
{
label
:
'排序'
,
value
:
'i
order
'
}
]
}
},
...
...
@@ -56,9 +57,13 @@ export default {
this
.
department
.
children
=
false
this
.
department
.
del
=
true
this
.
department
.
push
=
false
this
.
department
.
form
.
name
=
data
[
props
.
label
]
this
.
department
.
form
.
upDepartment
=
node
.
level
===
1
?
'广联赛讯'
:
node
.
parent
.
data
[
props
.
label
]
this
.
department
.
form
.
index
=
node
.
data
.
id
getDepartTreeNode
.
req
({
id
:
data
.
id
}).
then
(
res
=>
{
this
.
department
.
form
.
name
=
res
.
name
this
.
department
.
form
.
iorder
=
res
.
iorder
}).
catch
(
err
=>
{
console
.
log
(
err
)
})
}
}
}
...
...
src/views/customer/menu/index.vue
View file @
b2ccf80
...
...
@@ -11,6 +11,7 @@
<
script
>
import
{
LeftManager
,
RightForm
}
from
'@/components/index'
import
{
findMenuById
}
from
'@/api/api'
export
default
{
name
:
'menuMG'
,
data
()
{
...
...
@@ -27,49 +28,57 @@ export default {
allNode
:
null
,
data
:
[],
form
:
{
urlName
:
''
,
hostName
:
''
,
openStyle
:
'新系统'
,
menuType
:
''
,
name
:
''
,
newName
:
''
,
open
:
'新系统'
,
type
:
''
,
upMenu
:
''
,
path
:
''
,
url
:
''
,
router
:
''
,
defaultUrl
:
''
,
index
:
''
,
Show
:
true
,
baseUrl
:
''
,
iorder
:
null
,
isHidden
:
0
,
createTime
:
null
,
changeTime
:
null
updateTime
:
null
,
grade
:
0
,
iconUrl
:
''
,
id
:
0
,
lastOperatorId
:
0
,
lastOperatorName
:
''
,
parentId
:
0
,
state
:
0
,
title
:
''
}
},
form
:
[
{
label
:
'名称'
,
value
:
'
n
ame'
},
{
label
:
'主机自定义名称'
,
value
:
'
new
Name'
},
{
label
:
'名称'
,
value
:
'
urlN
ame'
},
{
label
:
'主机自定义名称'
,
value
:
'
host
Name'
},
{
label
:
'打开模式'
,
value
:
'open'
,
value
:
'open
Style
'
,
type
:
'select'
,
options
:
[
{
value
:
'选项1'
,
value
:
0
,
label
:
'本系统'
},
{
value
:
'选项2'
,
value
:
1
,
label
:
'新系统'
}
]
},
{
label
:
'功能类型'
,
value
:
'
t
ype'
,
value
:
'
menuT
ype'
,
type
:
'select'
,
options
:
[
{
value
:
'选项1'
,
value
:
0
,
label
:
'菜单路由'
},
{
value
:
'选项2'
,
value
:
1
,
label
:
'菜单'
},
{
...
...
@@ -78,14 +87,14 @@ export default {
}
]
},
{
label
:
'上级菜单'
,
value
:
'
upMenu
'
,
disabled
:
true
},
{
label
:
'菜单路径'
,
value
:
'
url
'
,
disabled
:
true
},
{
label
:
'路由'
,
value
:
'
router
'
},
{
label
:
'基础路径'
,
value
:
'
default
Url'
},
{
label
:
'排序'
,
value
:
'i
ndex
'
},
{
label
:
'是否隐藏'
,
value
:
'
Show
'
,
type
:
'switch'
},
{
label
:
'上级菜单'
,
value
:
'
name
'
,
disabled
:
true
},
{
label
:
'菜单路径'
,
value
:
'
path
'
,
disabled
:
true
},
{
label
:
'路由'
,
value
:
'
url
'
},
{
label
:
'基础路径'
,
value
:
'
base
Url'
},
{
label
:
'排序'
,
value
:
'i
order
'
},
{
label
:
'是否隐藏'
,
value
:
'
isHidden
'
,
type
:
'switch'
},
{
label
:
'创建时间'
,
value
:
'createTime'
,
disabled
:
true
},
{
label
:
'修改时间'
,
value
:
'
chang
eTime'
,
disabled
:
true
}
{
label
:
'修改时间'
,
value
:
'
updat
eTime'
,
disabled
:
true
}
]
}
},
...
...
@@ -105,12 +114,22 @@ export default {
this
.
menuMG
.
children
=
false
this
.
menuMG
.
del
=
true
this
.
menuMG
.
push
=
false
this
.
menuMG
.
form
.
name
=
data
[
props
.
label
]
this
.
menuMG
.
form
.
upMenu
=
node
.
level
===
1
?
'顶级菜单'
:
node
.
parent
.
data
[
props
.
label
]
this
.
menuMG
.
form
.
defaultUrl
=
data
.
path
this
.
menuMG
.
form
.
index
=
node
.
data
.
id
this
.
menuMG
.
form
.
createTime
=
data
.
createTime
this
.
menuMG
.
form
.
changeTime
=
data
.
changeTime
findMenuById
.
req
({
id
:
data
.
id
}).
then
(
res
=>
{
console
.
log
(
res
)
for
(
const
key
in
this
.
menuMG
.
form
)
{
if
(
key
===
'isHidden'
)
{
this
.
menuMG
.
form
[
key
]
=
res
[
key
]
===
0
}
else
if
(
key
===
'createTime'
||
key
===
'updateTime'
)
{
this
.
menuMG
.
form
[
key
]
=
new
Date
(
res
[
key
]).
format
(
'yyyy-MM-dd HH:mm:ss'
)
}
else
if
(
key
===
'name'
)
{
this
.
menuMG
.
form
[
key
]
=
node
.
level
===
1
?
'顶级菜单'
:
node
.
parent
.
data
[
props
.
label
]
}
else
{
this
.
menuMG
.
form
[
key
]
=
res
[
key
]
}
}
}).
catch
(
err
=>
{
console
.
log
(
err
)
})
}
}
}
...
...
src/views/customer/role/index.vue
View file @
b2ccf80
...
...
@@ -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"
:
roleParam=
"roleParam"
:createOrEditTitle=
"createOrEditTitl
e"
@
createClose=
"handleCreateClose"
></role-create>
<gl-button
class=
"control-tabledata-button"
size=
"small"
@
click=
"handleCreateOrEdit(
flagCOrE = true
)"
>
创建
</gl-button>
<role-create
:createVisible=
"createVisible"
:
createRuleForm=
"roleParam"
:flagCOrE=
"flagCOrE"
:roleMenuTree=
"roleMenuTre
e"
@
createClose=
"handleCreateClose"
></role-create>
<div
class=
"m-b8"
>
<transition>
<gl-table
:table=
"roleData"
></gl-table>
...
...
@@ -25,14 +25,16 @@
<
script
>
import
{
RoleCreate
,
RoleDetail
,
UserDetail
}
from
'@/components/index'
// 接口
import
{
getRoleList
,
deleteRoleById
}
from
'@/api/api'
import
{
roleCreateStructure
,
userRoleDetailColumn
,
userRoleDetailConsole
}
from
'@/common/commonConst'
import
{
getRoleList
,
deleteRoleById
,
selectMenuTreeRoleId
,
saveRoleList
,
updateRole
}
from
'@/api/api'
import
{
roleCreateStructure
,
roleDataColumn
,
userRoleDetailColumn
,
userRoleDetailConsole
}
from
'@/common/commonConst'
export
default
{
name
:
'role'
,
components
:
{
RoleCreate
,
RoleDetail
,
UserDetail
UserDetail
,
saveRoleList
,
updateRole
},
data
()
{
return
{
...
...
@@ -45,7 +47,9 @@ export default {
columnParam
:
[],
consoleParam
:
[],
apiParam
:
Number
,
flagRoleOrUser
:
Boolean
,
flagRoleOrUser
:
true
,
flagCOrE
:
Boolean
,
roleMenuTree
:
[],
createOrEditTitle
:
'新增角色'
,
userDetailTitle
:
'用户列表'
,
// 分页所需参数-start
...
...
@@ -57,25 +61,7 @@ export default {
border
:
true
,
height
:
400
,
data
:
[],
column
:
[{
label
:
'序号'
,
prop
:
'id'
},
{
label
:
'角色名字'
,
prop
:
'roleName'
},
{
label
:
'所属部门'
,
prop
:
'departName'
},
{
label
:
'状态'
,
prop
:
'state'
,
formatter
:
(
cellValue
)
=>
{
return
cellValue
<
1
?
'禁止'
:
'启动'
}
},
{
label
:
'创建时间'
,
prop
:
'createTime'
}],
column
:
roleDataColumn
,
console
:
{
label
:
'操作'
,
prop
:
'roleOptions'
,
...
...
@@ -83,7 +69,8 @@ export default {
label
:
'编辑'
,
type
:
'text'
,
callback
:
(
index
,
rows
)
=>
{
this
.
handleCreateOrEdit
(
rows
[
index
],
'角色列表'
)
this
.
roleParam
=
this
.
$deep_clone
(
rows
[
index
])
this
.
handleCreateOrEdit
(
this
.
flagCOrE
=
false
)
}
},
{
label
:
'详细'
,
...
...
@@ -134,7 +121,7 @@ export default {
cancelButtonText
:
'取消'
,
type
:
'warning'
}).
then
(()
=>
{
// 删除角色,根据返回的code值来判断是否删除成功
// 删除角色,根据返回的code值来判断是否删除成功
(已有拦截器)
this
.
deleteRole
(
rows
[
index
].
id
)
}).
catch
(()
=>
{
this
.
message
(
'取消删除'
)
...
...
@@ -166,21 +153,50 @@ export default {
deleteRoleById
.
req
({
roleId
:
params
}).
then
(
res
=>
{
this
.
message
(
'删除成功'
,
'success'
)
this
.
getList
()
}).
catch
(
message
=>
{
this
.
message
(
message
,
'error'
)
})
},
// 获得角色的相关权限详细信息,并返回树形数据
getMenuTree
(
params
)
{
selectMenuTreeRoleId
.
req
({
id
:
params
}).
then
(
res
=>
{
res
.
forEach
(
item
=>
{
this
.
roleMenuTree
.
push
(
item
.
id
)
})
this
.
createDialogVisible
()
}).
catch
(
err
=>
{
console
.
log
(
err
)
})
},
// 添加角色
addRole
(
params
)
{
console
.
log
(
params
)
this
.
createOrEditSuccess
()
// editData = { roleName: editData.roleName }
// const aa = { role: editData }
// const aa = JSON.stringify(editData)
// console.log(aa)
// console.log(editData)
// const cc = { roleName: 'ggg' }
// saveRoleList.req(params).then((data) => {
// console.log(data)
// this.createOrEditSuccess()
// }).catch(err => {
// console.log(err)
// })
},
// 编辑角色
updateRoleInfo
(
params
)
{
console
.
log
(
params
)
this
.
createOrEditSuccess
()
// updateRole.req(params).then((data) => {
// console.log(data)
// this.createOrEditSuccess()
// }).catch(err => {
// console.log(err)
// })
},
// 接口请求-end---------------------------------------
// 新增用户到页面
// addRole(data) {
// 后台获取----------------------
// data.id = '1038'
// data.createTime = new Date().toLocaleString().split('/').join('-')
// 后台获取----------------------
// const newData = data
// this.roleData.data.push(newData)
// this.message('创建角色成功!', 'success')
// },
createDialogVisible
()
{
this
.
createVisible
=
!
this
.
createVisible
},
...
...
@@ -190,6 +206,11 @@ export default {
userDetailDialogVisible
()
{
this
.
userDetailVisible
=
!
this
.
userDetailVisible
},
createOrEditSuccess
()
{
this
.
createDialogVisible
()
this
.
message
(
this
.
flagCOrE
?
'创建角色成功!'
:
'已经成功修改数据!'
,
'success'
)
this
.
getList
()
},
// 调取接口相关函数
handleSizeChange
(
val
)
{
this
.
pageSize
=
val
...
...
@@ -214,26 +235,30 @@ 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
.
getList
()
this
.
apiParam
=
Number
},
handleCreateOrEdit
(
params
,
title
)
{
this
.
createDialogVisible
()
this
.
createOrEditTitle
=
title
this
.
roleParam
=
params
handleCreateOrEdit
()
{
this
.
roleParam
=
this
.
flagCOrE
?
roleCreateStructure
:
this
.
roleParam
this
.
flagCOrE
&&
this
.
createDialogVisible
()
!
this
.
flagCOrE
&&
this
.
getMenuTree
(
this
.
roleParam
.
id
)
},
// 关闭新增用户组件
handleCreateClose
(
flagEOrC
,
data
)
{
this
.
createDialogVisible
()
this
.
roleParam
=
roleCreateStructure
!
data
&&
this
.
message
(
'取消创建角色'
)
handleCreateClose
(
data
)
{
this
.
roleMenuTree
=
[]
if
(
!
data
)
{
this
.
createDialogVisible
()
this
.
message
(
this
.
flagCOrE
?
'取消创建角色'
:
'取消编辑角色'
)
return
false
}
// 将数据提交给后台,根据返回结果做判断
data
&&
!
flagEOrC
&&
this
.
getList
()
&&
this
.
message
(
'创建角色成功!'
,
'success'
)
data
&&
flagEOrC
&&
this
.
getList
()
&&
this
.
message
(
'已经成功修改数据!'
,
'success'
)
this
.
flagCOrE
&&
this
.
addRole
(
data
)
!
this
.
flagCOrE
&&
this
.
updateRoleInfo
(
data
)
}
}
}
...
...
src/views/customer/user/index.vue
View file @
b2ccf80
...
...
@@ -301,7 +301,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