index.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. <template>
  2. <div class="org-manager">
  3. <el-input v-model="search" type="text" prefix-icon="el-icon-search" @keyup.enter.native="queryOrgList">
  4. <el-button slot="append" icon="el-icon-search" @click="queryOrgList"></el-button>
  5. </el-input>
  6. <div class="org-manager-list">
  7. <div class="org-manager-list-title">
  8. <div>机构管理</div>
  9. <div>
  10. <el-button icon="el-icon-plus" @click="$router.push('/add_org')">创建机构</el-button>
  11. </div>
  12. </div>
  13. <el-table :data="org_list">
  14. <el-table-column prop="name" label="名称" width="240" />
  15. <el-table-column prop="teacher_count" label="注册教师人数" width="110" />
  16. <el-table-column prop="teacher_count_audited" label="审核通过的注册教师人数" width="180" />
  17. <el-table-column prop="admin_user_name" label="机构管理员" />
  18. <el-table-column fixed="right" width="70">
  19. <template slot-scope="{ row }">
  20. <a @click="showOrg(row.id)">查看</a>
  21. </template>
  22. </el-table-column>
  23. <el-table-column fixed="right" width="120">
  24. <template slot-scope="{ row }">
  25. <el-dropdown placement="top">
  26. <a class="el-dropdown-link">管理</a>
  27. <el-dropdown-menu slot="dropdown">
  28. <el-dropdown-item @click.native="updateOrg(row.id)">修改</el-dropdown-item>
  29. <el-dropdown-item @click.native="resetOrgAdminPassword(row.admin_user_id)">
  30. 重置机构管理员密码
  31. </el-dropdown-item>
  32. </el-dropdown-menu>
  33. </el-dropdown>
  34. </template>
  35. </el-table-column>
  36. </el-table>
  37. </div>
  38. <el-pagination
  39. background
  40. :page-sizes="[10, 20, 30, 40, 50]"
  41. :page-size="page_capacity"
  42. layout="prev, pager, next, total, sizes, jumper"
  43. :total="total_count"
  44. :current-page="cur_page"
  45. @prev-click="changePage"
  46. @next-click="changePage"
  47. @current-change="changePage"
  48. @size-change="changePageSize"
  49. />
  50. <reset-password ref="reset" :user-id="curUserId" />
  51. <show-org ref="showOrg" :org-id="curOrgId" />
  52. <update-org ref="updateOrg" :org-id="curOrgId" />
  53. </div>
  54. </template>
  55. <script>
  56. import ResetPassword from '@/components/ResetPassword';
  57. import ShowOrg from './ShowOrg';
  58. import UpdateOrg from './UpdateOrg';
  59. import { pageQueryOrgList } from '@/api/list';
  60. export default {
  61. name: 'OrgManager',
  62. components: {
  63. ResetPassword,
  64. ShowOrg,
  65. UpdateOrg
  66. },
  67. data() {
  68. return {
  69. search: '',
  70. page_capacity: 10,
  71. cur_page: 1,
  72. org_list: [],
  73. total_count: 0,
  74. curUserId: '',
  75. curOrgId: ''
  76. };
  77. },
  78. created() {
  79. this.queryOrgList();
  80. },
  81. methods: {
  82. changePage(newPage) {
  83. this.cur_page = newPage;
  84. this.queryOrgList();
  85. },
  86. changePageSize(pageSize) {
  87. this.page_capacity = pageSize;
  88. this.queryOrgList();
  89. },
  90. queryOrgList() {
  91. pageQueryOrgList({
  92. name: this.search,
  93. page_capacity: this.page_capacity,
  94. cur_page: this.cur_page
  95. }).then(({ cur_page, org_list, total_count }) => {
  96. this.cur_page = cur_page;
  97. this.org_list = org_list;
  98. this.total_count = total_count;
  99. });
  100. },
  101. showOrg(id) {
  102. this.curOrgId = id;
  103. this.$refs.showOrg.show();
  104. },
  105. updateOrg(id) {
  106. this.curOrgId = id;
  107. this.$refs.updateOrg.show();
  108. },
  109. resetOrgAdminPassword(id) {
  110. this.curUserId = id;
  111. this.$refs.reset.show();
  112. }
  113. }
  114. };
  115. </script>
  116. <style lang="scss" scope>
  117. @import '~@/styles/mixin';
  118. .org-manager {
  119. @include container;
  120. @include pagination;
  121. padding: 24px 0 46px;
  122. > .el-input {
  123. width: 528px;
  124. }
  125. &-list {
  126. @include list;
  127. &-title {
  128. display: flex;
  129. justify-content: space-between;
  130. &:first-child {
  131. font-size: 24px;
  132. font-weight: 700;
  133. }
  134. }
  135. }
  136. }
  137. </style>