AuditQuestionUnsubmit.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. <template>
  2. <div class="audit-question-unsubmit">
  3. <!-- <el-form class="part-filter-form" inline>
  4. <el-form-item label="提交人">
  5. <el-input
  6. v-model="filter.creatorName"
  7. placeholder="请输入提交人姓名"
  8. ></el-input>
  9. </el-form-item>
  10. <el-form-item>
  11. <el-button type="primary" @click="toPage(1)">查询</el-button>
  12. </el-form-item>
  13. </el-form> -->
  14. <div>
  15. <el-table
  16. v-loading="loading"
  17. element-loading-text="拼命加载中"
  18. :data="dataList"
  19. >
  20. <el-table-column label="试题">
  21. <div slot-scope="scope" @click="toViewQuestion(scope.row)">
  22. <rich-text
  23. class="row-question-body"
  24. title="点击查看试题"
  25. :text-json="scope.row.quesBody"
  26. ></rich-text>
  27. </div>
  28. </el-table-column>
  29. <el-table-column label="课程">
  30. <template slot-scope="scope">
  31. <span
  32. >{{ scope.row.course.name }}({{ scope.row.course.code }})</span
  33. >
  34. </template>
  35. </el-table-column>
  36. <el-table-column label="提交人" prop="creator" width="150">
  37. </el-table-column>
  38. <el-table-column label="修改时间" prop="updateTime" width="153">
  39. </el-table-column>
  40. <el-table-column label="操作" width="170" fixed="right">
  41. <template slot-scope="scope">
  42. <div class="operate_left">
  43. <el-button
  44. size="medium"
  45. type="text"
  46. class="normal"
  47. @click="toEdit(scope.row)"
  48. >编辑</el-button
  49. >
  50. <el-button
  51. size="medium"
  52. type="text"
  53. class="normal"
  54. @click="toSubmit(scope.row)"
  55. >提交</el-button
  56. >
  57. </div>
  58. </template>
  59. </el-table-column>
  60. </el-table>
  61. <div class="part-page">
  62. <el-pagination
  63. :current-page="currentPage"
  64. :page-size="pageSize"
  65. :page-sizes="[10, 20, 50, 100, 200, 300]"
  66. layout="total, sizes, prev, pager, next, jumper"
  67. :total="total"
  68. @current-change="toPage"
  69. @size-change="handleSizeChange"
  70. >
  71. </el-pagination>
  72. </div>
  73. </div>
  74. <!-- QuestionEditDialog -->
  75. <question-edit-dialog
  76. ref="QuestionEditDialog"
  77. :question="curQuestion"
  78. @modified="getList"
  79. ></question-edit-dialog>
  80. <!-- QuestionPreviewDialog -->
  81. <question-preview-dialog
  82. ref="QuestionPreviewDialog"
  83. :question="curQuestion"
  84. ></question-preview-dialog>
  85. </div>
  86. </template>
  87. <script>
  88. import { auditQuestionsUnsubmitPageListApi, submitQuestionApi } from "../api";
  89. import QuestionEditDialog from "./QuestionEditDialog.vue";
  90. import QuestionPreviewDialog from "./QuestionPreviewDialog.vue";
  91. export default {
  92. name: "AuditQuestionUnsubmit",
  93. components: { QuestionEditDialog, QuestionPreviewDialog },
  94. data() {
  95. return {
  96. filter: { creatorName: "" },
  97. dataList: [],
  98. currentPage: 1,
  99. pageSize: 10,
  100. total: 0,
  101. loading: false,
  102. curQuestion: {},
  103. };
  104. },
  105. mounted() {
  106. this.toPage(1);
  107. },
  108. methods: {
  109. toPage(page) {
  110. this.currentPage = page;
  111. this.getList();
  112. },
  113. async getList() {
  114. this.loading = true;
  115. const res = await auditQuestionsUnsubmitPageListApi({
  116. ...this.filter,
  117. curPage: this.currentPage,
  118. pageSize: this.pageSize,
  119. }).catch(() => {});
  120. this.loading = false;
  121. if (!res) return;
  122. this.dataList = res.data.content;
  123. this.total = res.data.totalElements;
  124. },
  125. handleSizeChange(val) {
  126. this.pageSize = val;
  127. this.toPage(1);
  128. },
  129. toViewQuestion(row) {
  130. this.curQuestion = row;
  131. this.$refs.QuestionPreviewDialog.open();
  132. },
  133. toEdit(row) {
  134. this.curQuestion = row;
  135. this.$refs.QuestionEditDialog.open();
  136. },
  137. async toSubmit(row) {
  138. const confirm = await this.$confirm(`确定要提交该试题吗?`, "提示", {
  139. type: "warning",
  140. }).catch(() => {});
  141. if (confirm !== "confirm") return;
  142. await submitQuestionApi([row.id]);
  143. this.$message.success("操作成功!");
  144. this.getList();
  145. },
  146. },
  147. };
  148. </script>