StudentManagementDialog.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. <template>
  2. <div>
  3. <el-dialog
  4. ref="dialog"
  5. title="考试记录"
  6. width="800px"
  7. top="20px"
  8. :visible.sync="visible"
  9. @open="dialogOpen"
  10. @close="closeDialog"
  11. >
  12. <el-table :data="tableData" stripe style="width: 100%;">
  13. <el-table-column width="100" label="姓名">
  14. <span slot-scope="scope">{{ scope.row.name }}</span>
  15. </el-table-column>
  16. <el-table-column width="120" label="证件号">
  17. <span slot-scope="scope">{{ scope.row.identity }}</span>
  18. </el-table-column>
  19. <el-table-column label="批次名称">
  20. <span slot-scope="scope">{{ scope.row.examName }}</span>
  21. </el-table-column>
  22. <el-table-column width="100" label="课程">
  23. <span slot-scope="scope">{{ scope.row.courseName }}</span>
  24. </el-table-column>
  25. <el-table-column width="100" label="状态">
  26. <span slot-scope="scope">{{
  27. scope.row.status | examRecordStatusFilter
  28. }}</span>
  29. </el-table-column>
  30. <el-table-column width="100" label="操作">
  31. <template slot-scope="scope">
  32. <el-button
  33. v-if="scope.row.monitorRecord && scope.row.monitorRecord.length"
  34. size="mini"
  35. type="primary"
  36. plain
  37. @click="openMonitorRecord(scope.row)"
  38. >
  39. 监考回放
  40. </el-button>
  41. </template>
  42. </el-table-column>
  43. </el-table>
  44. <div class="part-page">
  45. <el-pagination
  46. background
  47. @current-change="handleCurrentChange"
  48. :current-page="currentPage"
  49. :page-size="pageSize"
  50. :page-sizes="[10, 20, 50, 100, 200, 300]"
  51. @size-change="handleSizeChange"
  52. layout="total, sizes, prev, pager, next, jumper"
  53. :total="total"
  54. />
  55. </div>
  56. <div class="my-2"></div>
  57. </el-dialog>
  58. </div>
  59. </template>
  60. <script>
  61. import { searchStudentExamRecord } from "@/api/examwork-student";
  62. export default {
  63. name: "StudentManagementDialog",
  64. props: {
  65. student: Object,
  66. },
  67. watch: {
  68. student() {
  69. this.tableData = [];
  70. this.pageSize = 10;
  71. this.total = 0;
  72. },
  73. },
  74. data() {
  75. return {
  76. visible: false,
  77. tableData: [],
  78. currentPage: 1,
  79. pageSize: 10,
  80. total: 10,
  81. };
  82. },
  83. methods: {
  84. dialogOpen() {
  85. this.handleCurrentChange(0);
  86. },
  87. openDialog() {
  88. this.visible = true;
  89. },
  90. closeDialog() {
  91. this.visible = false;
  92. },
  93. handleCurrentChange(val) {
  94. this.currentPage = val;
  95. this.searchForm();
  96. },
  97. handleSizeChange(val) {
  98. this.pageSize = val;
  99. this.currentPage = 1;
  100. this.searchForm();
  101. },
  102. async searchForm() {
  103. const res = await searchStudentExamRecord({
  104. studentId: this.student.id,
  105. pageNumber: this.currentPage,
  106. pageSize: this.pageSize,
  107. });
  108. this.tableData = res.data.data.records;
  109. this.total = res.data.data.total;
  110. if (this.total > 0 && this.tableData.length === 0) {
  111. this.handleCurrentChange(this.currentPage - 1);
  112. }
  113. },
  114. // monitor record
  115. openMonitorRecord(row) {
  116. console.log(row);
  117. window.sessionStorage.setItem("record", JSON.stringify(row));
  118. window.open(
  119. this.$router.resolve({
  120. name: "StudentMonitorRecord",
  121. }).href
  122. );
  123. },
  124. },
  125. };
  126. </script>
  127. <style></style>