SelectTeacher.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. <template>
  2. <el-dialog class="select-teacher" :visible="dialogVisible" width="900px" :title="$t('Key344')" @close="dialogClose">
  3. <!--查询条件-->
  4. <el-form :inline="true" :model="searchForm" size="mini">
  5. <el-form-item :label="$t('Key25')">
  6. <el-input v-model="searchForm.user_name" @keyup.enter.native="getTeacherUserList" />
  7. </el-form-item>
  8. <el-form-item :label="$t('Key27')">
  9. <el-input v-model="searchForm.user_real_name" @keyup.enter.native="getTeacherUserList" />
  10. </el-form-item>
  11. <el-form-item class="search-button">
  12. <el-button type="primary" @click="getTeacherUserList">
  13. <i class="el-icon-search" /> {{ $t('Key131') }}
  14. </el-button>
  15. </el-form-item>
  16. </el-form>
  17. <!--表格-->
  18. <el-table ref="teacherTable" :data="teacherList" height="35vh" @selection-change="handleSelectionChange">
  19. <el-table-column type="selection" width="55" />
  20. <el-table-column prop="user_name" :label="$t('Key191')" width="120" />
  21. <el-table-column prop="user_real_name" :label="$t('Key27')" width="120" />
  22. <el-table-column prop="org_name" :label="$t('Key204')" />
  23. </el-table>
  24. <el-pagination
  25. background
  26. :page-sizes="[10, 20, 30, 40, 50]"
  27. :page-size="page_capacity"
  28. layout="prev, pager, next, total, sizes, jumper"
  29. :total="total_count"
  30. :current-page="cur_page"
  31. @prev-click="changePage"
  32. @next-click="changePage"
  33. @current-change="changePage"
  34. @size-change="changePageSize"
  35. />
  36. <div slot="footer">
  37. <el-button size="mini" @click="dialogClose">
  38. {{ $t('Key83') }}
  39. </el-button>
  40. <el-button type="primary" size="mini" @click="confirmTeacher">
  41. {{ $t('Key94') }}
  42. </el-button>
  43. </div>
  44. </el-dialog>
  45. </template>
  46. <script>
  47. import { PageQueryOrgTeacherUserList } from '@/api/list';
  48. export default {
  49. name: 'SelectTeacher',
  50. props: {
  51. dialogVisible: {
  52. default: false,
  53. type: Boolean
  54. },
  55. orgId: {
  56. default: '',
  57. type: String
  58. }
  59. },
  60. data() {
  61. return {
  62. cur_page: 1,
  63. total_count: 0,
  64. page_capacity: 10,
  65. teacherList: [],
  66. orgList: [],
  67. searchForm: {
  68. user_name: '',
  69. user_real_name: ''
  70. }
  71. };
  72. },
  73. created() {
  74. this.getTeacherUserList();
  75. this.updateWordPack({
  76. word_key_list: ['Key344', 'Key25', 'Key27', 'Key131', 'Key191', 'Key204', 'Key94', 'Key83']
  77. });
  78. },
  79. methods: {
  80. getTeacherUserList() {
  81. let data = {
  82. org_id: this.orgId,
  83. user_name: this.searchForm.user_name,
  84. user_real_name: this.searchForm.user_real_name,
  85. page_capacity: this.page_capacity,
  86. cur_page: this.cur_page,
  87. is_valid: true,
  88. is_audited: true
  89. };
  90. PageQueryOrgTeacherUserList(data).then(({ cur_page, total_count, org_teacher_user_list }) => {
  91. this.cur_page = cur_page;
  92. this.total_count = total_count;
  93. this.teacherList = org_teacher_user_list;
  94. });
  95. },
  96. dialogClose() {
  97. this.$emit('dialogClose');
  98. this.$refs.teacherTable.clearSelection();
  99. },
  100. handleSelectionChange(arr) {
  101. this.orgList = arr.map(({ user_id }) => user_id);
  102. },
  103. changePage(newPage) {
  104. this.cur_page = newPage;
  105. this.getTeacherUserList();
  106. },
  107. changePageSize(pageSize) {
  108. this.page_capacity = pageSize;
  109. this.getTeacherUserList();
  110. },
  111. confirmTeacher() {
  112. this.$emit('selectTeaher', this.orgList);
  113. }
  114. }
  115. };
  116. </script>
  117. <style lang="scss">
  118. .select-teacher {
  119. .el-dialog__body {
  120. padding: 15px 20px 0;
  121. }
  122. .el-input {
  123. width: 100px;
  124. }
  125. .search-button {
  126. float: right;
  127. }
  128. .el-pagination {
  129. margin-top: 15px;
  130. }
  131. }
  132. </style>