ExamMarkIndex.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. <template>
  2. <el-container>
  3. <el-header height="220">
  4. <el-row>
  5. <el-select
  6. v-model="queryInfo.subjectId"
  7. clearable
  8. placeholder="请选择试卷"
  9. style="margin-left: 5px"
  10. @change="paperChange"
  11. >
  12. <el-option
  13. v-for="item in allPapers"
  14. :key="item.key"
  15. :label="item.value"
  16. :value="item.key"
  17. />
  18. </el-select>
  19. </el-row>
  20. </el-header>
  21. <el-main>
  22. <el-table
  23. :data="dataList"
  24. border
  25. style="width: 100%"
  26. >
  27. <el-table-column
  28. fixed="left"
  29. label="No"
  30. type="index"
  31. />
  32. <el-table-column
  33. prop="name"
  34. label="试卷名称"
  35. width="150"
  36. />
  37. <el-table-column
  38. prop="examTime"
  39. label="考试时间"
  40. width="150"
  41. />
  42. <el-table-column
  43. prop="totalScore"
  44. label="考试总分"
  45. />
  46. <el-table-column
  47. prop="student"
  48. label="参考学生"
  49. />
  50. <el-table-column
  51. fixed="right"
  52. label="操作"
  53. width="320"
  54. >
  55. <template slot-scope="scope">
  56. <el-button
  57. size="mini"
  58. type="warning"
  59. @click="markPaper(scope.$index, scope.row)"
  60. >去批改</el-button>
  61. </template>
  62. </el-table-column>
  63. </el-table>
  64. <el-pagination
  65. background
  66. :small="screenWidth <= 768"
  67. layout="prev, pager, next"
  68. :page-size="pageSize"
  69. :current-page="currentPage"
  70. :total="totalSize"
  71. @current-change="handleCurrentChange"
  72. @prev-click="handleCurrentChange"
  73. @next-click="handleCurrentChange"
  74. />
  75. </el-main>
  76. </el-container>
  77. </template>
  78. <script>
  79. import { getExamMarkList, getPaperKeyValues } from '@/api/exam'
  80. export default {
  81. name: 'ExamMarkIndex',
  82. data() {
  83. return {
  84. // 屏幕宽度, 为了控制分页条的大小
  85. screenWidth: document.body.clientWidth,
  86. currentPage: 1,
  87. pageSize: 20,
  88. totalSize: 0,
  89. dataList: [],
  90. // **********************************************************************
  91. queryInfo: {
  92. pageNumber: 1,
  93. pageSize: 10,
  94. paperId: null,
  95. marked: false
  96. },
  97. allPapers: [],
  98. allSubject: []
  99. }
  100. },
  101. created() {
  102. document.title = '阅卷管理'
  103. this.getData(this.queryInfo)
  104. this.getPapers()
  105. },
  106. methods: {
  107. handleCurrentChange(pageNumber) {
  108. this.currentPage = pageNumber
  109. this.queryInfo.pageNumber = this.currentPage
  110. this.queryInfo.pageSize = this.pageSize
  111. this.getData(this.queryInfo)
  112. // 回到顶部
  113. scrollTo(0, 0)
  114. },
  115. getData(queryInfo) {
  116. getExamMarkList(queryInfo).then(resp => {
  117. if (resp.code === 0) {
  118. this.dataList = resp.data.list
  119. this.totalSize = resp.data.totalSize
  120. } else {
  121. this.$notify({
  122. title: '提示',
  123. message: resp.msg,
  124. type: 'warning',
  125. duration: 3000
  126. })
  127. }
  128. }).catch(error => {
  129. this.$notify({
  130. title: '提示',
  131. message: error.message,
  132. type: 'error',
  133. duration: 3000
  134. })
  135. })
  136. },
  137. getPapers() {
  138. getPaperKeyValues().then(resp => {
  139. if (resp.code === 0) {
  140. this.allPapers = resp.data
  141. }
  142. })
  143. },
  144. // 试卷变化
  145. paperChange(val) {
  146. this.queryInfo.paperId = val
  147. this.queryInfo.pageNumber = this.currentPage
  148. this.queryInfo.pageSize = this.pageSize
  149. this.getData(this.queryInfo)
  150. },
  151. markPaper(index, row) {
  152. const paperId = row.paperId
  153. const userId = row.userId
  154. const routeUrl = this.$router.resolve({
  155. path: '/exam/paper/detail',
  156. query: {
  157. paperId: paperId,
  158. viewType: 3,
  159. userId: userId
  160. }
  161. })
  162. window.open(routeUrl.href, '_blank')
  163. }
  164. }
  165. }
  166. </script>
  167. <style>
  168. </style>