userRecord.vue 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. <template>
  2. <div class="app-container">
  3. <form-search
  4. :searchformShow="{ clbum: '', class: '' }"
  5. :withoutSearchButton="true"
  6. ref="formSearch"
  7. @change="classGradeChange"
  8. @handleQuery="classGradeChange"
  9. ></form-search>
  10. <el-card
  11. v-if="dataList && dataList.length"
  12. class="box-card"
  13. style="margin-bottom: 30px"
  14. >
  15. <el-row>
  16. <el-col
  17. :span="99"
  18. v-for="(item, idx) in dataList"
  19. :key="idx"
  20. class="mb20 mt20 text-center"
  21. >
  22. <student-card
  23. @click.native="detail(item)"
  24. :name="item.customer && item.customer.name"
  25. :avatar="item.customer && item.customer.photo"
  26. ></student-card>
  27. </el-col>
  28. </el-row>
  29. </el-card>
  30. <evaluation-empty v-else />
  31. <pagination
  32. v-show="total > 0"
  33. :total="total"
  34. :page.sync="queryParams.pageNum"
  35. :limit.sync="queryParams.pageSize"
  36. :page-size="50"
  37. @pagination="getList"
  38. />
  39. </div>
  40. </template>
  41. <script>
  42. import { getStudents } from "@/api/webApi/back";
  43. export default {
  44. data() {
  45. return {
  46. total: 0,
  47. dataList: [],
  48. queryParams: { pageNum: 1, pageSize: 50 },
  49. };
  50. },
  51. created() {
  52. this.getList();
  53. },
  54. methods: {
  55. classGradeChange(data) {
  56. this.queryParams = { ...this.queryParams, ...data };
  57. if (data.class && !data.clbum) return; // 选了年级没有选班级
  58. this.queryParams.pageNum = 1;
  59. this.getList();
  60. },
  61. detail(user) {
  62. this.$store.dispatch('settings/setStudent', user)
  63. this.$router.push({ name: "UserStatisticsInfo"});
  64. },
  65. getList() {
  66. //if (!classId) return;
  67. getStudents({
  68. classId: this.queryParams.clbum,
  69. pageNum: this.queryParams.pageNum,
  70. pageSize: this.queryParams.pageSize,
  71. }).then((rep) => {
  72. console.log(
  73. "getStudents by classId[" + this.queryParams.clbum + "] rep=",
  74. rep
  75. );
  76. if (rep.code == 200 || rep.code == 0) {
  77. this.dataList = rep.rows || rep.data;
  78. this.total = rep.total || 0;
  79. } else {
  80. this.msgError(rep.msg || "getStudents请求异常");
  81. }
  82. this.loading = false;
  83. });
  84. },
  85. },
  86. };
  87. </script>
  88. <style scoped>
  89. .el-col-99 {
  90. width: 10%;
  91. }
  92. </style>