adminManager.vue 2.9 KB

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