studentList.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. <template>
  2. <div class="m-container">
  3. <h2>
  4. <div class="squrt"></div>学员列表
  5. </h2>
  6. <div class="m-core">
  7. <!-- <div class="newBand">声部调整</div> -->
  8. <!-- 搜索标题 -->
  9. <el-form :inline="true"
  10. class="searchForm"
  11. v-model="searchForm">
  12. <el-form-item>
  13. <el-input placeholder="家长联系电话"
  14. @keyup.enter.native='onSearch'
  15. v-model="searchForm.search"></el-input>
  16. </el-form-item>
  17. <el-form-item prop='organId'>
  18. <el-select class='multiple'
  19. v-model="searchForm.organId"
  20. clearable
  21. placeholder="请选择分部">
  22. <el-option v-for="(item,index) in organList"
  23. :key="index"
  24. :label="item.name"
  25. :value="item.id"></el-option>
  26. </el-select>
  27. </el-form-item>
  28. <el-form-item>
  29. <el-input placeholder="学生姓名"
  30. @keyup.enter.native='onSearch'
  31. v-model="searchForm.studentName"></el-input>
  32. </el-form-item>
  33. <el-form-item>
  34. <el-button @click="onSearch"
  35. type="danger">搜索</el-button>
  36. <el-button @click="onReSet"
  37. type="primary">重置</el-button>
  38. </el-form-item>
  39. </el-form>
  40. <!-- 列表 -->
  41. <div class="tableWrap">
  42. <el-table :data='tableList'
  43. :header-cell-style="{background:'#EDEEF0',color:'#444'}">
  44. <el-table-column align='center'
  45. prop="userId"
  46. label="学员编号">
  47. </el-table-column>
  48. <el-table-column align='center'
  49. prop="realName"
  50. label="学员姓名">
  51. </el-table-column>
  52. <el-table-column align='center'
  53. label="性别">
  54. <template slot-scope="scope">
  55. {{ scope.row.gender ? '男': '女' }}
  56. </template>
  57. </el-table-column>
  58. <el-table-column align='center'
  59. prop="parentsName"
  60. label="家长姓名">
  61. </el-table-column>
  62. <el-table-column align='center'
  63. prop="parentsPhone"
  64. label="家长联系电话">
  65. </el-table-column>
  66. <el-table-column align='center'
  67. prop="courseBalance"
  68. label="课程余额(元)">
  69. </el-table-column>
  70. <el-table-column align='center'
  71. label="操作">
  72. <template slot-scope="scope">
  73. <router-link style="color:#409EFF"
  74. v-permission="'/studentDetail'"
  75. :to="{path:`/business/studentDetail?userId=${scope.row.userId}`,query:{search:JSON.stringify(searchForm),rules:JSON.stringify(pageInfo)}}">查看</router-link>
  76. </template>
  77. </el-table-column>
  78. </el-table>
  79. <pagination :total="pageInfo.total"
  80. :page.sync="pageInfo.page"
  81. :limit.sync="pageInfo.limit"
  82. :page-sizes="pageInfo.page_size"
  83. @pagination="getList" />
  84. </div>
  85. </div>
  86. </div>
  87. </template>
  88. <script>
  89. import pagination from '@/components/Pagination/index'
  90. import { queryStudentList } from '@/api/studentManager'
  91. import { getEmployeeOrgan } from '@/api/buildTeam'
  92. import store from '@/store'
  93. export default {
  94. name: 'studentList',
  95. components: { pagination },
  96. data () {
  97. return {
  98. searchForm: {
  99. organId: null,
  100. search: null,
  101. studentName: null
  102. },
  103. searchList: [],
  104. tableList: [],
  105. organList: [],
  106. pageInfo: {
  107. // 分页规则
  108. limit: 10, // 限制显示条数
  109. page: 1, // 当前页
  110. total: 0, // 总条数
  111. page_size: [10, 20, 40, 50] // 选择限制显示条数
  112. },
  113. }
  114. },
  115. mounted () {
  116. if (this.$route.query.search) {
  117. this.$route.query.search instanceof Object ? this.searchForm = this.$route.query.search : this.searchForm = JSON.parse(this.$route.query.search);
  118. }
  119. if (this.$route.query.rules) {
  120. this.$route.query.rules instanceof Object ? this.pageInfo = this.$route.query.rules : this.pageInfo = JSON.parse(this.$route.query.rules);
  121. }
  122. getEmployeeOrgan().then(res => {
  123. if (res.code == 200) {
  124. this.organList = res.data;
  125. }
  126. })
  127. this.getList();
  128. },
  129. methods: {
  130. onSearch () {
  131. this.pageInfo.page = 1;
  132. this.getList()
  133. },
  134. getList () {
  135. let params = this.searchForm
  136. params.rows = this.pageInfo.limit
  137. params.page = this.pageInfo.page
  138. params.organId ? params.organId : params.organId = null;
  139. queryStudentList(params).then(res => {
  140. if (res.code == 200) {
  141. this.tableList = res.data.rows
  142. this.pageInfo.total = res.data.total
  143. }
  144. })
  145. },
  146. onReSet () {
  147. this.searchForm = {
  148. organId: null,
  149. search: null,
  150. studentName: null
  151. }
  152. }
  153. }
  154. }
  155. </script>
  156. <style lang="scss">
  157. </style>