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 734ac25d
authored
Sep 18, 2018
by
cwq0219
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
修改
1 parent
3356373c
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
66 additions
and
45 deletions
src/api/roleApi.js
src/common/roleConst.js
src/common/userConst.js
src/components/RoleCreate/src/main.vue
src/components/Tree/src/main.vue
src/components/UserDetail/src/main.vue
src/config/common.conf.js
src/views/customer/role/index.vue
src/views/customer/user/index.vue
src/api/roleApi.js
View file @
734ac25
...
@@ -39,6 +39,7 @@ const getRoleList = {
...
@@ -39,6 +39,7 @@ const getRoleList = {
const
saveRoleList
=
{
const
saveRoleList
=
{
p
:
[
__sSaveRoleList
],
p
:
[
__sSaveRoleList
],
// req: params => GlAxios.post(__sSaveRoleList, JSON.stringify(params), { headers: { 'Content/-Type': 'application/json;charset=UTF-8' }})
req
:
params
=>
GlAxios
.
post
(
__sSaveRoleList
,
params
)
req
:
params
=>
GlAxios
.
post
(
__sSaveRoleList
,
params
)
}
}
...
...
src/common/roleConst.js
View file @
734ac25
const
roleCreateStructure
=
{
const
roleCreateStructure
=
{
roleI
d
:
Number
,
i
d
:
Number
,
roleName
:
''
,
roleName
:
''
,
description
:
''
,
description
:
''
,
departName
:
''
,
departName
:
''
,
right
:
Array
,
right
s
:
Array
,
state
:
Number
,
state
:
1
,
createTime
:
''
createTime
:
''
}
}
...
@@ -19,7 +19,10 @@ const userRoleDetailColumn = [{
...
@@ -19,7 +19,10 @@ const userRoleDetailColumn = [{
prop
:
'realname'
prop
:
'realname'
},
{
},
{
label
:
'状态'
,
label
:
'状态'
,
prop
:
'state'
prop
:
'state'
,
formatter
:
(
cellValue
)
=>
{
return
cellValue
<
1
?
'禁止'
:
'启动'
}
}]
}]
const
userRoleDetailConsole
=
{
const
userRoleDetailConsole
=
{
...
...
src/common/userConst.js
View file @
734ac25
...
@@ -6,7 +6,10 @@ const userDetailColumn = [{
...
@@ -6,7 +6,10 @@ const userDetailColumn = [{
prop
:
'realname'
prop
:
'realname'
},
{
},
{
label
:
'管理员'
,
label
:
'管理员'
,
prop
:
'isadmin'
prop
:
'isadmin'
,
formatter
:
(
cellValue
)
=>
{
return
cellValue
<
1
?
'否'
:
'是'
}
},
{
},
{
label
:
'手机号码'
,
label
:
'手机号码'
,
prop
:
'mobile'
prop
:
'mobile'
...
@@ -18,7 +21,10 @@ const userDetailColumn = [{
...
@@ -18,7 +21,10 @@ const userDetailColumn = [{
prop
:
'roles'
prop
:
'roles'
},
{
},
{
label
:
'状态'
,
label
:
'状态'
,
prop
:
'state'
prop
:
'state'
,
formatter
:
(
cellValue
)
=>
{
return
cellValue
<
1
?
'禁止'
:
'启动'
}
}]
}]
export
{
userDetailColumn
}
export
{
userDetailColumn
}
src/components/RoleCreate/src/main.vue
View file @
734ac25
...
@@ -76,24 +76,29 @@ export default {
...
@@ -76,24 +76,29 @@ export default {
methods
:
{
methods
:
{
// tree-strat
// tree-strat
getMenuOption
(
params
)
{
getMenuOption
(
params
)
{
this
.
createRuleForm
.
right
=
params
this
.
createRuleForm
.
rights
=
params
.
treeData
.
checkedKeys
.
concat
(
params
.
treeData
.
halfCheckedKeys
)
return
params
},
},
// tree-end
// tree-end
getParams
()
{
getParams
()
{
return
this
.
$deep_clone
(
this
.
createRuleForm
)
return
this
.
$deep_clone
(
this
.
createRuleForm
)
},
},
// 接口
// 接口
addRole
()
{
addRole
(
flagEOrC
,
editData
)
{
saveRoleList
.
req
(
this
.
getParams
()).
then
((
data
)
=>
{
// editData = { roleName: editData.roleName }
// const aa = JSON.stringify(editData)
// console.log(aa)
// console.log(editData)
saveRoleList
.
req
(
editData
).
then
((
data
)
=>
{
console
.
log
(
data
)
console
.
log
(
data
)
this
.
$emit
(
'createClose'
,
flagEOrC
,
editData
)
}).
catch
(
err
=>
{
}).
catch
(
err
=>
{
console
.
log
(
err
)
console
.
log
(
err
)
})
})
},
},
updateRoleInfo
()
{
updateRoleInfo
(
flagEOrC
,
editData
)
{
updateRole
.
req
(
this
.
getParams
()
).
then
((
data
)
=>
{
updateRole
.
req
(
editData
).
then
((
data
)
=>
{
console
.
log
(
data
)
console
.
log
(
data
)
this
.
$emit
(
'createClose'
,
flagEOrC
,
editData
)
}).
catch
(
err
=>
{
}).
catch
(
err
=>
{
console
.
log
(
err
)
console
.
log
(
err
)
})
})
...
@@ -103,13 +108,13 @@ export default {
...
@@ -103,13 +108,13 @@ export default {
const
editData
=
this
.
getParams
()
const
editData
=
this
.
getParams
()
console
.
log
(
editData
)
console
.
log
(
editData
)
// eidt:true;create:false
// eidt:true;create:false
const
flagEOrC
=
editData
.
id
=
==
Number
const
flagEOrC
=
editData
.
id
!
==
Number
// console.log(flagEOrC)
// console.log(flagEOrC)
this
.
$refs
[
formName
].
validate
((
valid
)
=>
{
this
.
$refs
[
formName
].
validate
((
valid
)
=>
{
if
(
valid
)
{
if
(
valid
)
{
!
flagEOrC
&&
this
.
addRole
()
!
flagEOrC
&&
this
.
addRole
(
flagEOrC
,
editData
)
flagEOrC
&&
this
.
updateRoleInfo
()
flagEOrC
&&
this
.
updateRoleInfo
(
flagEOrC
,
editData
)
this
.
$emit
(
'createClose'
,
flagEOrC
,
editData
)
//
this.$emit('createClose', flagEOrC, editData)
}
else
{
}
else
{
return
false
return
false
}
}
...
...
src/components/Tree/src/main.vue
View file @
734ac25
<
template
>
<
template
>
<div
class=
"tree"
:style=
"treeStyle"
>
<div
class=
"tree"
:style=
"treeStyle"
>
<gl-tree
<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>
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>
</div>
</div>
</
template
>
</
template
>
<
script
>
<
script
>
import
{
findMenuTree
}
from
'@/api/api'
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
}
export
default
{
export
default
{
name
:
'Tree'
,
name
:
'Tree'
,
data
()
{
data
()
{
return
{
return
{
// data: this.$get_session_config().resources || this.$get_session_config(),
// data: this.$get_session_config().resources || this.$get_session_config(),
data
:
Object
,
data
:
[
Array
,
Function
]
,
props
:
{
props
:
{
// label: 'title'
label
:
'text'
label
:
'text'
}
}
}
}
...
@@ -35,9 +40,10 @@ export default {
...
@@ -35,9 +40,10 @@ export default {
},
},
mounted
()
{
mounted
()
{
findMenuTree
.
req
().
then
(
res
=>
{
findMenuTree
.
req
().
then
(
res
=>
{
console
.
log
(
res
)
// this.data = res
// this.data = res
this
.
data
=
this
.
$get_menus
(
res
,
0
,
'parent'
)
// this.data = this.$get_menus(res, '#', 'parent')
this
.
data
=
fn
(
res
,
'#'
)
// console.log(this.data)
}).
catch
(
err
=>
{
}).
catch
(
err
=>
{
console
.
log
(
err
)
console
.
log
(
err
)
})
})
...
@@ -53,8 +59,8 @@ export default {
...
@@ -53,8 +59,8 @@ export default {
}
}
</
script
>
</
script
>
<
style
scoped
>
<
style
scoped
>
.tree
{
.tree
{
height
:
550px
;
height
:
550px
;
overflow-y
:
scroll
;
overflow-y
:
scroll
;
}
}
</
style
>
</
style
>
src/components/UserDetail/src/main.vue
View file @
734ac25
...
@@ -45,6 +45,7 @@ export default {
...
@@ -45,6 +45,7 @@ export default {
flag
:
Number
,
flag
:
Number
,
tableParam
:
{
tableParam
:
{
border
:
true
,
border
:
true
,
align
:
'center'
,
data
:
[],
data
:
[],
column
:
[],
column
:
[],
console
:
[]
console
:
[]
...
...
src/config/common.conf.js
View file @
734ac25
export
default
{
export
default
{
axios
:
{
axios
:
{
//
baseURL: 'http://cas.dev.glsx.net/admin-operating-auth/',
baseURL
:
'http://cas.dev.glsx.net/admin-operating-auth/'
,
baseURL
:
'http://192.168.3.171:7300/mock/5b91805391b67469b43e2921/subsystem/'
,
//
baseURL: 'http://192.168.3.171:7300/mock/5b91805391b67469b43e2921/subsystem/',
whiteList
:
[
'role/deleteRoleById'
,
'role/deleteUserRoleById'
,
'role/getRoleDetail'
,
'role/getRoleDetail'
,
'role/getRoleList'
,
'role/isRoleNameExit'
,
'role/saveRoleList'
,
'role/selectMenuTreeRoleId'
,
'role/selectUserRoleByRoleId'
,
'role/updateRole'
,
'user/batcheDel'
,
'user/findAll'
,
'user/get'
,
'user/getWithRoles'
,
'user/operatUser'
,
'user/updateUser'
,
'department/del'
,
'department/findTree'
,
'department/getPName'
,
'department/getTreeNode'
,
'department/updateDepartment'
,
'menu/add'
,
'menu/del'
,
'menu/edit'
,
'menu/findById'
,
'menu/findTree'
,
'menu/getByUserId'
,
'menu/getPName'
],
whiteList
:
[
'role/deleteRoleById'
,
'role/deleteUserRoleById'
,
'role/getRoleDetail'
,
'role/getRoleDetail'
,
'role/getRoleList'
,
'role/isRoleNameExit'
,
'role/saveRoleList'
,
'role/selectMenuTreeRoleId'
,
'role/selectUserRoleByRoleId'
,
'role/updateRole'
,
'user/batcheDel'
,
'user/findAll'
,
'user/get'
,
'user/getWithRoles'
,
'user/operatUser'
,
'user/updateUser'
,
'department/del'
,
'department/findTree'
,
'department/getPName'
,
'department/getTreeNode'
,
'department/updateDepartment'
,
'menu/add'
,
'menu/del'
,
'menu/edit'
,
'menu/findById'
,
'menu/findTree'
,
'menu/getByUserId'
,
'menu/getPName'
],
timeout
:
15000
,
timeout
:
15000
,
result
:
{
result
:
{
...
...
src/views/customer/role/index.vue
View file @
734ac25
...
@@ -69,7 +69,7 @@ export default {
...
@@ -69,7 +69,7 @@ export default {
},
{
},
{
label
:
'状态'
,
label
:
'状态'
,
prop
:
'state'
,
prop
:
'state'
,
formatter
:
(
row
,
column
,
cellValue
,
index
)
=>
{
formatter
:
(
cellValue
)
=>
{
return
cellValue
<
1
?
'禁止'
:
'启动'
return
cellValue
<
1
?
'禁止'
:
'启动'
}
}
},
{
},
{
...
@@ -111,7 +111,6 @@ export default {
...
@@ -111,7 +111,6 @@ export default {
mounted
()
{
mounted
()
{
this
.
getList
()
this
.
getList
()
},
},
// search--------------------
watch
:
{
watch
:
{
roleName
(
val
)
{
roleName
(
val
)
{
!
val
&&
this
.
getList
()
!
val
&&
this
.
getList
()
...
@@ -137,8 +136,6 @@ export default {
...
@@ -137,8 +136,6 @@ export default {
}).
then
(()
=>
{
}).
then
(()
=>
{
// 删除角色,根据返回的code值来判断是否删除成功
// 删除角色,根据返回的code值来判断是否删除成功
this
.
deleteRole
(
rows
[
index
].
id
)
this
.
deleteRole
(
rows
[
index
].
id
)
rows
.
splice
(
index
,
1
)
this
.
message
(
'删除成功'
,
'success'
)
}).
catch
(()
=>
{
}).
catch
(()
=>
{
this
.
message
(
'取消删除'
)
this
.
message
(
'取消删除'
)
})
})
...
@@ -151,9 +148,6 @@ export default {
...
@@ -151,9 +148,6 @@ export default {
keyWork
:
this
.
roleName
keyWork
:
this
.
roleName
}
}
},
},
reqList
()
{
// const params = this.getParams()
},
// 接口请求-start---------------------------------------
// 接口请求-start---------------------------------------
// 获取展示数据,请求表格数据
// 获取展示数据,请求表格数据
getList
()
{
getList
()
{
...
@@ -169,8 +163,9 @@ export default {
...
@@ -169,8 +163,9 @@ export default {
},
},
// 删除角色
// 删除角色
deleteRole
(
params
)
{
deleteRole
(
params
)
{
deleteRoleById
.
req
(
params
).
then
(
res
=>
{
deleteRoleById
.
req
({
roleId
:
params
}).
then
(
res
=>
{
console
.
log
(
res
)
this
.
message
(
'删除成功'
,
'success'
)
this
.
getList
()
}).
catch
(
err
=>
{
}).
catch
(
err
=>
{
console
.
log
(
err
)
console
.
log
(
err
)
})
})
...
@@ -206,7 +201,6 @@ export default {
...
@@ -206,7 +201,6 @@ export default {
},
},
handleSearchRoleName
()
{
handleSearchRoleName
()
{
this
.
getList
()
this
.
getList
()
// this.roleName = ''
},
},
handleGetRoleDetail
(
params
)
{
handleGetRoleDetail
(
params
)
{
this
.
roleParam
=
params
this
.
roleParam
=
params
...
...
src/views/customer/user/index.vue
View file @
734ac25
...
@@ -74,7 +74,7 @@ export default {
...
@@ -74,7 +74,7 @@ export default {
},
{
},
{
label
:
'状态'
,
label
:
'状态'
,
prop
:
'state'
,
prop
:
'state'
,
formatter
:
(
row
,
column
,
cellValue
,
index
)
=>
{
formatter
:
(
cellValue
)
=>
{
return
cellValue
<
1
?
'禁止'
:
'启动'
return
cellValue
<
1
?
'禁止'
:
'启动'
}
}
},
{
},
{
...
@@ -125,6 +125,11 @@ export default {
...
@@ -125,6 +125,11 @@ export default {
mounted
()
{
mounted
()
{
this
.
findUserList
()
this
.
findUserList
()
},
},
watch
:
{
userName
(
val
)
{
!
val
&&
this
.
findUserList
()
}
},
methods
:
{
methods
:
{
// 获取所需字段
// 获取所需字段
getParams
()
{
getParams
()
{
...
...
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