adminManager.vue 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. <template>
  2. <div class='m-container'>
  3. <h2>
  4. <div class="squrt"></div>角色管理
  5. </h2>
  6. <div class="m-core">
  7. <el-button style="margin-bottom: 20px;" type="primary" v-permission="'role/add'" @click="onAdminOperation('create')" icon="el-icon-plus">添加</el-button>
  8. <!-- 列表 -->
  9. <div class="tableWrap">
  10. <el-table :data='tableList'
  11. header-cell-class-name="headerName">
  12. <el-table-column align='center'
  13. prop="roleName"
  14. label="角色类型">
  15. </el-table-column>
  16. <el-table-column align='center'
  17. prop="roleDesc"
  18. label="角色描述">
  19. </el-table-column>
  20. <el-table-column align='center'
  21. label="操作">
  22. <template slot-scope="scope">
  23. <el-button @click="onAdminOperation('update', scope.row)"
  24. v-permission="'role/update'"
  25. type="text">修改</el-button>
  26. </template>
  27. </el-table-column>
  28. </el-table>
  29. <pagination :total.sync="pageInfo.total"
  30. :page.sync="pageInfo.page"
  31. :limit.sync="pageInfo.limit"
  32. :page-sizes="pageInfo.page_size"
  33. @pagination="getList" />
  34. </div>
  35. </div>
  36. </div>
  37. </template>
  38. <script>
  39. import pagination from '@/components/Pagination/index'
  40. import { roleQueryPage } from '@/api/systemManage'
  41. export default {
  42. name: 'adminManager',
  43. components: { pagination },
  44. data () {
  45. return {
  46. tableList: [],
  47. pageInfo: {
  48. // 分页规则
  49. limit: 10, // 限制显示条数
  50. page: 1, // 当前页
  51. total: 0, // 总条数
  52. page_size: [10, 20, 40, 50] // 选择限制显示条数
  53. }
  54. }
  55. },
  56. created () {
  57. this.init()
  58. },
  59. activated () {
  60. this.init()
  61. },
  62. mounted () {
  63. },
  64. methods: {
  65. init () {
  66. this.$route.query.page ? this.pageInfo.page = parseInt(this.$route.query.page) : this.pageInfo.page = 1
  67. this.getList()
  68. },
  69. getList () {
  70. roleQueryPage({
  71. rows: this.pageInfo.limit,
  72. page: this.pageInfo.page
  73. }).then(res => {
  74. if (res.code == 200 && res.data) {
  75. this.tableList = res.data.rows
  76. this.pageInfo.total = res.data.total
  77. }
  78. })
  79. },
  80. onAdminOperation (type, row) {
  81. let params = {
  82. path: '/systemManager/adminOperation',
  83. query: {
  84. type: type,
  85. page: this.pageInfo.page
  86. }
  87. }
  88. let tagTitle = '新建'
  89. if (row) {
  90. params.query.id = row.id
  91. tagTitle = '修改'
  92. }
  93. this.$router.push(params, (route) => {
  94. route.meta.title = tagTitle + '系统角色权限'
  95. })
  96. }
  97. }
  98. }
  99. </script>
  100. <style lang="scss">
  101. .headerName {
  102. background-color: #edeef0 !important;
  103. color: #444444;
  104. }
  105. </style>