MarkManage.vue 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  1. <template>
  2. <div class="mark-manage">
  3. <div class="part-box part-box-filter part-box-flex">
  4. <el-form ref="FilterForm" label-position="left" label-width="85px" inline>
  5. <template v-if="checkPrivilege('condition', 'condition')">
  6. <secp-select
  7. v-model="filter"
  8. defaultSelectExam
  9. @exam-default="search"
  10. ></secp-select>
  11. </template>
  12. <el-form-item label="完成进度">
  13. <el-select
  14. v-model="filter.progressStatus"
  15. style="width: 120px"
  16. placeholder="完成进度"
  17. clearable
  18. >
  19. <el-option :value="1">已完成</el-option>
  20. <el-option :value="0">未完成</el-option>
  21. </el-select>
  22. </el-form-item>
  23. <el-form-item label-width="0px">
  24. <el-button
  25. v-if="checkPrivilege('button', 'select')"
  26. type="primary"
  27. @click="search"
  28. >查询</el-button
  29. >
  30. </el-form-item>
  31. </el-form>
  32. <div class="part-box-action">
  33. <el-button
  34. v-if="checkPrivilege('button', 'Export')"
  35. type="primary"
  36. @click="toExport"
  37. >
  38. 导出评卷员工作量
  39. </el-button>
  40. <el-button
  41. v-if="checkPrivilege('button', 'BatchFinish')"
  42. type="primary"
  43. :disabled="!multipleSelection.length"
  44. @click="toBatchFinish"
  45. >
  46. 结束评卷
  47. </el-button>
  48. </div>
  49. </div>
  50. <div class="part-box part-box-pad">
  51. <el-table
  52. ref="TableList"
  53. :data="dataList"
  54. @selection-change="handleSelectionChange"
  55. >
  56. <el-table-column
  57. type="selection"
  58. width="55"
  59. align="center"
  60. ></el-table-column>
  61. <el-table-column prop="courseName" label="课程(代码)" min-width="200">
  62. <template slot-scope="scope">
  63. {{ scope.row.courseName }}({{ scope.row.courseCode }})
  64. </template>
  65. </el-table-column>
  66. <el-table-column
  67. prop="paperNumber"
  68. label="试卷编号"
  69. min-width="140"
  70. ></el-table-column>
  71. <el-table-column prop="percent" label="完成进度" width="120">
  72. <span slot-scope="scope">{{ scope.row.percent || 0 }}%</span>
  73. </el-table-column>
  74. <el-table-column
  75. class-name="action-column"
  76. label="操作"
  77. width="200"
  78. fixed="right"
  79. >
  80. <template slot-scope="scope">
  81. <el-button
  82. v-if="checkPrivilege('link', 'Detail')"
  83. class="btn-primary"
  84. type="text"
  85. @click="toDetail(scope.row)"
  86. >查看详情</el-button
  87. >
  88. <el-button
  89. v-if="checkPrivilege('link', 'Finish')"
  90. class="btn-primary"
  91. type="text"
  92. @click="toSimpleFinish(scope.row)"
  93. >结束评卷</el-button
  94. >
  95. </template>
  96. </el-table-column>
  97. </el-table>
  98. <div class="part-page">
  99. <el-pagination
  100. background
  101. layout="total, sizes, prev, pager, next, jumper"
  102. :pager-count="5"
  103. :current-page="current"
  104. :total="total"
  105. :page-size="size"
  106. @current-change="toPage"
  107. @size-change="pageSizeChange"
  108. >
  109. </el-pagination>
  110. </div>
  111. </div>
  112. </div>
  113. </template>
  114. <script>
  115. import {
  116. markManageListPage,
  117. markManageItemFinish,
  118. markManageListExport,
  119. } from "../api";
  120. import { downloadByApi } from "@/plugins/download";
  121. export default {
  122. name: "mark-manage",
  123. components: {},
  124. data() {
  125. return {
  126. filter: {
  127. semesterId: "",
  128. examId: "",
  129. courseCode: "",
  130. paperNumber: "",
  131. progressStatus: null,
  132. },
  133. current: 1,
  134. size: this.GLOBAL.pageSize,
  135. total: 0,
  136. dataList: [],
  137. curRow: {},
  138. multipleSelection: [],
  139. downloading: false,
  140. };
  141. },
  142. methods: {
  143. async getList() {
  144. if (!this.checkPrivilege("list", "list")) return;
  145. const datas = {
  146. ...this.filter,
  147. pageNumber: this.current,
  148. pageSize: this.size,
  149. };
  150. if (datas.progressStatus !== null && datas.progressStatus !== "")
  151. datas.progressStatus = !!datas.progressStatus;
  152. const data = await markManageListPage(datas);
  153. this.dataList = data.records;
  154. this.total = data.total;
  155. },
  156. toPage(page) {
  157. this.current = page;
  158. this.getList();
  159. },
  160. search() {
  161. this.toPage(1);
  162. },
  163. handleSelectionChange(val) {
  164. this.multipleSelection = val;
  165. },
  166. async toExport() {
  167. if (this.downloading) return;
  168. this.downloading = true;
  169. const res = await downloadByApi(() => {
  170. return markManageListExport({
  171. ...this.filter,
  172. });
  173. }).catch((e) => {
  174. this.$message.error(e || "下载失败,请重新尝试!");
  175. });
  176. this.downloading = false;
  177. if (!res) return;
  178. this.$message.success("下载成功!");
  179. },
  180. toDetail(row) {
  181. // TODO:
  182. console.log(row);
  183. },
  184. async toBatchFinish() {
  185. if (!this.multipleSelection.length) return;
  186. const confirm = await this.$confirm("确定要结束选中的评卷?", "提示", {
  187. type: "warning",
  188. }).catch(() => {});
  189. if (confirm !== "confirm") return;
  190. this.toFinish(
  191. this.multipleSelection[0].examId,
  192. this.multipleSelection.map((item) => item.paperNumber)
  193. );
  194. },
  195. async toSimpleFinish(row) {
  196. const confirm = await this.$confirm("确定要结束当前评卷?", "提示", {
  197. type: "warning",
  198. }).catch(() => {});
  199. if (confirm !== "confirm") return;
  200. this.toFinish(row.examId, [row.paperNumber]);
  201. },
  202. async toFinish(examId, paperNumbers) {
  203. if (!paperNumbers.length) return;
  204. await markManageItemFinish({
  205. examId,
  206. paperNumbers,
  207. status: "FINISH",
  208. });
  209. this.$message.success("操作成功!");
  210. this.getList();
  211. },
  212. toBatchModifySetting() {
  213. if (!this.multipleSelection.length) {
  214. this.$message.error("请选择数据");
  215. return;
  216. }
  217. },
  218. },
  219. };
  220. </script>