AuditQuestionApply.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. <template>
  2. <div class="audit-paper-audited">
  3. <el-form class="part-filter-form" :model="filter" inline>
  4. <el-form-item label="审核状态">
  5. <el-select v-model="filter.auditStatus" clearable placeholder="请选择">
  6. <el-option label="待审核" value="WITHDRAW"> </el-option>
  7. <el-option label="审核中" value="IN_REVIEW"> </el-option>
  8. <el-option label="已入库" value="PASS"> </el-option>
  9. <el-option label="已驳回" value="NOT_PASS"> </el-option>
  10. </el-select>
  11. </el-form-item>
  12. <el-form-item>
  13. <el-button type="primary" @click="toPage(1)">查询</el-button>
  14. </el-form-item>
  15. </el-form>
  16. <div>
  17. <el-table
  18. v-loading="loading"
  19. element-loading-text="拼命加载中"
  20. :data="dataList"
  21. >
  22. <el-table-column label="试题">
  23. <div slot-scope="scope" @click="toDetail(scope.row)">
  24. <rich-text
  25. class="row-question-body"
  26. title="点击查看试题"
  27. :text-json="scope.row.quesBody"
  28. ></rich-text>
  29. </div>
  30. </el-table-column>
  31. <el-table-column label="课程">
  32. <template slot-scope="scope">
  33. <span
  34. >{{ scope.row.course.name }}({{ scope.row.course.code }})</span
  35. >
  36. </template>
  37. </el-table-column>
  38. <el-table-column label="提交时间" prop="updateTime" width="170">
  39. </el-table-column>
  40. <el-table-column label="当前审核状态" prop="inReviewStatus" width="140">
  41. </el-table-column>
  42. <el-table-column label="状态" prop="auditStatusName" width="100">
  43. </el-table-column>
  44. <el-table-column label="操作" width="170" fixed="right">
  45. <template slot-scope="scope">
  46. <div class="operate_left">
  47. <el-button
  48. size="medium"
  49. type="text"
  50. class="normal"
  51. @click="toDetail(scope.row)"
  52. >详情</el-button
  53. >
  54. <el-button
  55. size="medium"
  56. type="text"
  57. class="normal"
  58. @click="toWithdraw(scope.row)"
  59. >撤回</el-button
  60. >
  61. </div>
  62. </template>
  63. </el-table-column>
  64. </el-table>
  65. <div class="part-page">
  66. <el-pagination
  67. :current-page="currentPage"
  68. :page-size="pageSize"
  69. :page-sizes="[10, 20, 50, 100, 200, 300]"
  70. layout="total, sizes, prev, pager, next, jumper"
  71. :total="total"
  72. @current-change="toPage"
  73. @size-change="handleSizeChange"
  74. >
  75. </el-pagination>
  76. </div>
  77. </div>
  78. <!-- QuestionPreviewDialog -->
  79. <question-preview-dialog
  80. ref="QuestionPreviewDialog"
  81. :list-info="listInfo"
  82. :fetchPage="toPage"
  83. show-switch
  84. ></question-preview-dialog>
  85. </div>
  86. </template>
  87. <script>
  88. import { auditQuestionApplyPageListApi, withdrawQuestionApi } from "../api";
  89. import QuestionPreviewDialog from "./QuestionPreviewDialog.vue";
  90. export default {
  91. name: "AuditQuestionApply",
  92. components: { QuestionPreviewDialog },
  93. data() {
  94. return {
  95. filter: { auditStatus: "" },
  96. dataList: [],
  97. currentPage: 1,
  98. pageSize: 10,
  99. total: 0,
  100. totalPages: 0,
  101. loading: false,
  102. curQuestion: {},
  103. curQuestionIndex: 0,
  104. };
  105. },
  106. computed: {
  107. listInfo() {
  108. return {
  109. dataList: this.dataList,
  110. curIndex: this.curQuestionIndex,
  111. pageNumber: this.currentPage,
  112. totalPages: this.totalPages,
  113. };
  114. },
  115. },
  116. mounted() {
  117. this.toPage(1);
  118. },
  119. methods: {
  120. async toPage(page) {
  121. this.currentPage = page;
  122. await this.getList();
  123. },
  124. async getList() {
  125. this.loading = true;
  126. const res = await auditQuestionApplyPageListApi({
  127. ...this.filter,
  128. curPage: this.currentPage,
  129. pageSize: this.pageSize,
  130. }).catch(() => {});
  131. this.loading = false;
  132. if (!res) return;
  133. this.dataList = res.data.content;
  134. this.total = res.data.totalElements;
  135. this.totalPages = res.data.totalPages;
  136. },
  137. handleSizeChange(val) {
  138. this.pageSize = val;
  139. this.toPage(1);
  140. },
  141. toDetail(row) {
  142. this.curQuestionIndex = this.dataList.findIndex((q) => q.id === row.id);
  143. this.$refs.QuestionPreviewDialog.open();
  144. },
  145. async toWithdraw(row) {
  146. const confirm = await this.$confirm(
  147. `确定要撤销该试题的提交吗?`,
  148. "系统通知",
  149. {
  150. type: "warning",
  151. }
  152. ).catch(() => {});
  153. if (confirm !== "confirm") return;
  154. await withdrawQuestionApi([row.id]);
  155. this.$message.success("操作成功!");
  156. this.getList();
  157. },
  158. },
  159. };
  160. </script>