-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
116 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
export default { | ||
name: 'Roles', | ||
data () { | ||
return { | ||
rolesList: [] | ||
} | ||
}, | ||
mounted () { | ||
this.getData() | ||
}, | ||
methods: { | ||
async getData () { | ||
const {data: {data, meta}} = await this.$http.get('roles') | ||
if (meta.status !== 200) return this.$message.error('获取角色失败') | ||
// 表格的data对数据格式是有固定的要求 | ||
// 以前数据中没有 children 选项 | ||
// 默认认为 有展开内容 而且回去使用children数据 | ||
// 如果数据的结构不符合要求 报错 | ||
// {id: 1, roleName: '管理员', roleDesc: '管理员123'} | ||
// 把后台返回的数据 处理一下 去除children数据 保留children有的数据 | ||
data.forEach(item => { | ||
item.child = item.children | ||
delete item.children | ||
item.child.forEach(item => { | ||
item.child = item.children | ||
delete item.children | ||
item.child.forEach(item => { | ||
item.child = item.children | ||
delete item.children | ||
}) | ||
}) | ||
}) | ||
this.rolesList = data | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
<template> | ||
<div class="roles_container"> | ||
<el-breadcrumb separator-class="el-icon-arrow-right"> | ||
<el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item> | ||
<el-breadcrumb-item>权限管理</el-breadcrumb-item> | ||
<el-breadcrumb-item>角色列表</el-breadcrumb-item> | ||
</el-breadcrumb> | ||
<el-card> | ||
<el-button type="primary" plain>添加角色</el-button> | ||
<el-table :data="rolesList"> | ||
<el-table-column type="expand"> | ||
<template slot-scope="scope"> | ||
<!--一级权限--> | ||
<el-row> | ||
<el-col :span="4"> | ||
<el-tag closable>权限管理</el-tag> | ||
<span class="el-icon-caret-right"></span> | ||
</el-col> | ||
<el-col :span="20"> | ||
<!--二级权限--> | ||
<el-row> | ||
<el-col :span="8"> | ||
<el-tag closable type="success">角色列表</el-tag> | ||
<span class="el-icon-caret-right"></span> | ||
</el-col> | ||
<el-col :span="16"> | ||
<!--三级权限--> | ||
<el-tag closable type="warning">添加角色</el-tag> | ||
</el-col> | ||
</el-row> | ||
<el-row> | ||
<el-col :span="8"> | ||
<el-tag closable type="success">角色列表</el-tag> | ||
<span class="el-icon-caret-right"></span> | ||
</el-col> | ||
<el-col :span="16"> | ||
<!--三级权限--> | ||
<el-tag closable type="warning">添加角色</el-tag> | ||
<el-tag closable type="warning">添加角色</el-tag> | ||
<el-tag closable type="warning">添加角色</el-tag> | ||
<el-tag closable type="warning">添加角色</el-tag> | ||
<el-tag closable type="warning">添加角色</el-tag> | ||
<el-tag closable type="warning">添加角色</el-tag> | ||
<el-tag closable type="warning">添加角色</el-tag> | ||
</el-col> | ||
</el-row> | ||
</el-col> | ||
</el-row> | ||
</template> | ||
</el-table-column> | ||
<el-table-column type="index" width="100px"></el-table-column> | ||
<el-table-column property="roleName" label="角色名称"></el-table-column> | ||
<el-table-column property="roleDesc" label="角色描述"></el-table-column> | ||
<el-table-column label="操作"> | ||
<template slot-scope="scope"> | ||
<el-button-group> | ||
<el-button icon="el-icon-edit" round></el-button> | ||
<el-button icon="el-icon-delete" round></el-button> | ||
<el-button icon="el-icon-setting" round></el-button> | ||
</el-button-group> | ||
</template> | ||
</el-table-column> | ||
</el-table> | ||
</el-card> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
import mixin from './Roles-Mixin' | ||
export default { | ||
mixins: [mixin] | ||
} | ||
</script> | ||
|
||
<style scoped> | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters