index.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. <template>
  2. <div class="m-container">
  3. <h2>
  4. <div class="squrt"></div>
  5. 平台角色管理
  6. </h2>
  7. <div class="m-core">
  8. <save-form
  9. :inline="true"
  10. ref="searchForm"
  11. :model="searchForm"
  12. @submit="search"
  13. @reset="onReSet"
  14. >
  15. <el-form-item prop="search">
  16. <el-input
  17. v-model.trim="searchForm.search"
  18. clearable
  19. @keyup.enter.native="
  20. (e) => {
  21. e.target.blur();
  22. $refs.searchForm.save();
  23. search();
  24. }
  25. "
  26. placeholder="请输入角色类型"
  27. ></el-input>
  28. </el-form-item>
  29. <el-form-item>
  30. <el-button native-type="submit" type="primary">搜索</el-button>
  31. <el-button native-type="reset" type="danger">重置</el-button>
  32. </el-form-item>
  33. </save-form>
  34. <el-button
  35. style="margin-bottom: 20px"
  36. type="primary"
  37. v-permission="'role/add'"
  38. @click="onAdminOperation('create')"
  39. icon="el-icon-plus"
  40. >添加</el-button
  41. >
  42. <!-- 列表 -->
  43. <div class="tableWrap">
  44. <el-table :data="tableList" header-cell-class-name="headerName">
  45. <el-table-column align="center" prop="roleName" label="角色类型">
  46. </el-table-column>
  47. <el-table-column align="center" prop="roleDesc" label="角色描述">
  48. </el-table-column>
  49. <el-table-column align="center" label="操作">
  50. <template slot-scope="scope">
  51. <el-button
  52. @click="onAdminOperation('update', scope.row)"
  53. v-permission="'role/update'"
  54. type="text"
  55. >修改</el-button
  56. >
  57. </template>
  58. </el-table-column>
  59. </el-table>
  60. <pagination
  61. :total.sync="pageInfo.total"
  62. :page.sync="pageInfo.page"
  63. :limit.sync="pageInfo.limit"
  64. :page-sizes="pageInfo.page_size"
  65. @pagination="getList"
  66. />
  67. </div>
  68. </div>
  69. </div>
  70. </template>
  71. <script>
  72. import pagination from "@/components/Pagination/index";
  73. import { roleQueryPage } from "@/api/systemManage";
  74. export default {
  75. name: "adminManager",
  76. components: { pagination },
  77. data() {
  78. return {
  79. tableList: [],
  80. searchForm:{
  81. search:''
  82. },
  83. pageInfo: {
  84. // 分页规则
  85. limit: 10, // 限制显示条数
  86. page: 1, // 当前页
  87. total: 0, // 总条数
  88. page_size: [10, 20, 40, 50], // 选择限制显示条数
  89. },
  90. };
  91. },
  92. created() {
  93. },
  94. // activated() {
  95. // this.init();
  96. // },
  97. mounted() {
  98. this.init();
  99. },
  100. methods: {
  101. search() {
  102. this.pageInfo.page = 1;
  103. this.getList();
  104. },
  105. onReSet() {
  106. this.$refs.searchForm.resetFields();
  107. this.search();
  108. },
  109. init() {
  110. this.$route.query.page
  111. ? (this.pageInfo.page = parseInt(this.$route.query.page))
  112. : (this.pageInfo.page = 1);
  113. this.getList();
  114. },
  115. getList() {
  116. roleQueryPage({
  117. rows: this.pageInfo.limit,
  118. page: this.pageInfo.page,
  119. ...this.searchForm,
  120. tenantId:-1
  121. }).then((res) => {
  122. if (res.code == 200 && res.data) {
  123. this.tableList = res.data.rows;
  124. this.pageInfo.total = res.data.total;
  125. }
  126. });
  127. },
  128. onAdminOperation(type, row) {
  129. let params = {
  130. path: "/platformManager/adminOperation",
  131. query: {
  132. type: type,
  133. page: this.pageInfo.page,
  134. isplatform:true
  135. },
  136. };
  137. let tagTitle = "添加";
  138. if (row) {
  139. params.query.id = row.id;
  140. tagTitle = "修改";
  141. }
  142. this.$router.push(params, (route) => {
  143. route.meta.title = tagTitle + "平台角色";
  144. });
  145. },
  146. },
  147. };
  148. </script>
  149. <style lang="scss">
  150. .headerName {
  151. background-color: #edeef0 !important;
  152. color: #444444;
  153. }
  154. </style>