TaskReviewManage.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462
  1. <template>
  2. <div class="task-review-manage">
  3. <div class="mb-4 tab-btns">
  4. <el-button
  5. v-for="(val, key) in AUDITING_TYPE"
  6. :key="key"
  7. size="medium"
  8. :type="auditStatus == key ? 'primary' : 'default'"
  9. @click="selectMenu(key)"
  10. >{{ val }}</el-button
  11. >
  12. </div>
  13. <div class="part-box part-box-filter">
  14. <el-form ref="FilterForm" label-position="left" label-width="85px" inline>
  15. <template
  16. v-if="
  17. (AUDITED && checkPrivilege('condition', 'reviewCondition')) ||
  18. (!AUDITED && checkPrivilege('condition', 'notReviewCondition'))
  19. "
  20. >
  21. <secp-select v-model="filter" defaultSelectExam></secp-select>
  22. <el-form-item label="命题老师:">
  23. <question-teacher-select
  24. ref="QuestionTeacherSelect"
  25. v-model="filter.userId"
  26. :course-id="filter.courseId"
  27. placeholder="命题老师"
  28. ></question-teacher-select>
  29. </el-form-item>
  30. <el-form-item label="命题时间:">
  31. <el-date-picker
  32. v-model="createTime"
  33. type="datetimerange"
  34. :picker-options="pickerOptions"
  35. range-separator="至"
  36. start-placeholder="命题开始时间"
  37. end-placeholder="命题结束时间"
  38. value-format="timestamp"
  39. align="right"
  40. unlink-panels
  41. >
  42. </el-date-picker>
  43. </el-form-item>
  44. <el-form-item label="申请时间:">
  45. <el-date-picker
  46. v-model="applyTime"
  47. type="datetimerange"
  48. :picker-options="pickerOptions"
  49. range-separator="至"
  50. start-placeholder="申请开始时间"
  51. end-placeholder="申请结束时间"
  52. value-format="timestamp"
  53. align="right"
  54. unlink-panels
  55. >
  56. </el-date-picker>
  57. </el-form-item>
  58. </template>
  59. <el-form-item label-width="0px">
  60. <el-button
  61. v-if="
  62. (AUDITED && checkPrivilege('button', 'reviewSelect')) ||
  63. (!AUDITED && checkPrivilege('button', 'notReviewSelect'))
  64. "
  65. type="primary"
  66. @click="toPage(1)"
  67. >查询</el-button
  68. >
  69. </el-form-item>
  70. </el-form>
  71. <div class="box-justify" v-if="!AUDITED">
  72. <div>
  73. <el-button
  74. v-if="checkPrivilege('button', 'notReviewExport')"
  75. icon="el-icon-download"
  76. type="success"
  77. :disabled="loading"
  78. @click="toExport"
  79. >
  80. 导出审核样本
  81. </el-button>
  82. <el-button
  83. v-if="checkPrivilege('button', 'notReviewExport')"
  84. type="primary"
  85. icon="el-icon-s-order"
  86. @click="toDataTask"
  87. >导出结果查询</el-button
  88. >
  89. </div>
  90. <div>
  91. <!-- <el-button
  92. v-if="checkPrivilege('button', 'notReviewBatchNotPass')"
  93. icon="el-icon-circle-close"
  94. type="danger"
  95. @click="toBatchAudit(0)"
  96. >
  97. 批量不通过
  98. </el-button> -->
  99. <el-button
  100. v-if="checkPrivilege('button', 'notReviewBatchPass')"
  101. icon="el-icon-circle-check"
  102. type="primary"
  103. @click="toBatchAudit(1)"
  104. >
  105. 批量通过
  106. </el-button>
  107. </div>
  108. </div>
  109. </div>
  110. <div class="part-box part-box-pad">
  111. <el-table
  112. ref="TableList"
  113. :data="examTasks"
  114. @selection-change="handleSelectionChange"
  115. >
  116. <el-table-column
  117. v-if="!AUDITED"
  118. type="selection"
  119. fixed="left"
  120. width="55"
  121. align="center"
  122. :selectable="checkAbleSelected"
  123. ></el-table-column>
  124. <el-table-column
  125. type="index"
  126. label="序号"
  127. width="70"
  128. :index="indexMethod"
  129. ></el-table-column>
  130. <!-- <el-table-column
  131. prop="semesterName"
  132. label="学期"
  133. min-width="210"
  134. ></el-table-column>
  135. <el-table-column
  136. prop="examName"
  137. label="考试"
  138. min-width="160"
  139. ></el-table-column> -->
  140. <el-table-column prop="paperNumber" label="试卷编号"></el-table-column>
  141. <el-table-column prop="courseName" label="课程(代码)">
  142. <template slot-scope="scope">
  143. {{ scope.row.courseName }}({{ scope.row.courseCode }})
  144. </template>
  145. </el-table-column>
  146. <el-table-column
  147. prop="userName"
  148. label="命题老师"
  149. width="100"
  150. ></el-table-column>
  151. <el-table-column prop="startTime" label="命题开始时间">
  152. <span slot-scope="scope">{{
  153. scope.row.startTime | timestampFilter
  154. }}</span>
  155. </el-table-column>
  156. <el-table-column prop="endTime" label="命题结束时间">
  157. <span slot-scope="scope">{{
  158. scope.row.endTime | timestampFilter
  159. }}</span>
  160. </el-table-column>
  161. <el-table-column prop="createTime" label="申请时间">
  162. <template slot-scope="scope">
  163. {{ scope.row.createTime | timestampFilter }}
  164. </template>
  165. </el-table-column>
  166. <el-table-column class-name="action-column" label="操作" width="80px">
  167. <template slot-scope="scope">
  168. <el-button
  169. v-if="AUDITED && checkPrivilege('link', 'reviewPreview')"
  170. class="btn-primary"
  171. type="text"
  172. @click="toPreview(scope.row)"
  173. >查看详情</el-button
  174. >
  175. <el-button
  176. v-if="
  177. !AUDITED &&
  178. checkPrivilege('link', 'notReviewEdit') &&
  179. scope.row.myself
  180. "
  181. class="btn-primary"
  182. type="text"
  183. @click="toEdit(scope.row)"
  184. >审核</el-button
  185. >
  186. </template>
  187. </el-table-column>
  188. </el-table>
  189. <div class="part-page">
  190. <el-pagination
  191. background
  192. layout="total, sizes, prev, pager, next, jumper"
  193. :pager-count="5"
  194. :current-page="current"
  195. :total="total"
  196. :page-size="size"
  197. @current-change="toPage"
  198. @size-change="pageSizeChange"
  199. >
  200. </el-pagination>
  201. </div>
  202. </div>
  203. <!-- ModifyTaskApply -->
  204. <modify-task-apply
  205. v-if="
  206. checkPrivilege('link', 'notReviewEdit') ||
  207. checkPrivilege('link', 'reviewPreview')
  208. "
  209. ref="ModifyTaskApply"
  210. :type="editType"
  211. :row-data="curExamTask"
  212. @modified="taskModified"
  213. ></modify-task-apply>
  214. <!-- audit-dialog-->
  215. <el-dialog
  216. :visible.sync="auditDialogShow"
  217. title="审核不通过"
  218. width="500px"
  219. :close-on-click-modal="false"
  220. :close-on-press-escape="false"
  221. append-to-body
  222. >
  223. <el-form ref="AuditForm" :rules="auditRules" :model="auditModal">
  224. <el-form-item prop="reason">
  225. <el-input
  226. class="mb-2"
  227. v-model="auditModal.reason"
  228. type="textarea"
  229. resize="none"
  230. :rows="5"
  231. :maxlength="1000"
  232. clearable
  233. show-word-limit
  234. placeholder="建议不超过1000个字"
  235. ></el-input>
  236. </el-form-item>
  237. </el-form>
  238. <div slot="footer">
  239. <el-button type="primary" @click="auditNotPass">确认</el-button>
  240. <el-button type="danger" @click="auditDialogShow = false" plain
  241. >取消</el-button
  242. >
  243. </div>
  244. </el-dialog>
  245. <!-- data-task-dialog -->
  246. <data-task-dialog
  247. v-if="checkPrivilege('button', 'notReviewExport')"
  248. ref="DataTaskDialog"
  249. task-type="SAMPLE_EXPORT"
  250. ></data-task-dialog>
  251. </div>
  252. </template>
  253. <script>
  254. import ModifyTaskApply from "../components/taskApply/ModifyTaskApply.vue";
  255. import pickerOptions from "@/constants/datePickerOptions";
  256. import {
  257. taskReviewAuditedListPage,
  258. taskReviewUnauditedListPage,
  259. batchUpdateTaskReview,
  260. reviewSampleDataExport,
  261. } from "../api";
  262. import { mapActions } from "vuex";
  263. export default {
  264. name: "task-review-manage",
  265. components: {
  266. ModifyTaskApply,
  267. },
  268. data() {
  269. return {
  270. auditStatus: "NOT_AUDITED",
  271. filter: {
  272. semesterId: "",
  273. examId: "",
  274. userId: "",
  275. cardRuleId: "",
  276. courseId: "",
  277. paperNumber: "",
  278. startTime: null,
  279. endTime: null,
  280. startCreateTime: null,
  281. endCreateTime: null,
  282. createName: "",
  283. },
  284. current: 1,
  285. size: this.GLOBAL.pageSize,
  286. total: 0,
  287. editType: "AUDIT",
  288. AUDITING_TYPE: {
  289. NOT_AUDITED: "未审核",
  290. AUDITED: "已审核",
  291. },
  292. caches: {},
  293. examTasks: [],
  294. curExamTask: {},
  295. multipleSelection: [],
  296. loading: false,
  297. curUserId: this.$ls.get("user", { id: "" }).id,
  298. // audit-dialog
  299. auditDialogShow: false,
  300. auditModal: { reason: "" },
  301. auditRules: {
  302. reason: [
  303. { required: true, message: "请输入审核意见", trigger: "change" },
  304. ],
  305. },
  306. // date-picker
  307. createTime: [],
  308. applyTime: [],
  309. pickerOptions,
  310. };
  311. },
  312. watch: {
  313. "filter.examId": {
  314. handler(val, oldval) {
  315. if (val && val !== oldval) this.toPage(1);
  316. },
  317. immediate: true,
  318. },
  319. },
  320. computed: {
  321. AUDITED() {
  322. return this.auditStatus === "AUDITED";
  323. },
  324. },
  325. methods: {
  326. ...mapActions("exam", ["updateWaitTaskCount"]),
  327. async getList() {
  328. const valid =
  329. (this.AUDITED && this.checkPrivilege("list", "reviewList")) ||
  330. (!this.AUDITED && this.checkPrivilege("list", "notReviewList"));
  331. if (!valid) return;
  332. const datas = {
  333. ...this.filter,
  334. pageNumber: this.current,
  335. pageSize: this.size,
  336. };
  337. if (this.createTime) {
  338. datas.startTime = this.createTime[0];
  339. datas.endTime = this.createTime[1];
  340. }
  341. if (this.applyTime) {
  342. datas.startCreateTime = this.applyTime[0];
  343. datas.endCreateTime = this.applyTime[1];
  344. }
  345. const func = this.AUDITED
  346. ? taskReviewAuditedListPage
  347. : taskReviewUnauditedListPage;
  348. const data = await func(datas);
  349. this.examTasks = data.records;
  350. this.total = data.total;
  351. },
  352. toPage(page) {
  353. this.current = page;
  354. this.getList();
  355. this.multipleSelection = [];
  356. },
  357. handleSelectionChange(val) {
  358. this.multipleSelection = val.map((item) => item.id);
  359. console.log(this.multipleSelection);
  360. },
  361. checkAbleSelected(row) {
  362. return row.myself;
  363. },
  364. selectMenu(val) {
  365. if (this.auditStatus === val) return;
  366. this.caches[this.auditStatus] = {
  367. current: this.current,
  368. examTasks: this.examTasks,
  369. total: this.total,
  370. };
  371. this.auditStatus = val;
  372. if (this.caches[val] && this.caches[val].examTasks) {
  373. this.current = this.caches[val].current;
  374. this.total = this.caches[val].total;
  375. this.examTasks = this.caches[val].examTasks;
  376. } else {
  377. this.toPage(1);
  378. }
  379. },
  380. toBatchAudit(isPass) {
  381. if (!this.multipleSelection.length) {
  382. this.$message.error("请选择要审核的记录!");
  383. return;
  384. }
  385. const actionName = isPass ? "通过" : "不通过";
  386. this.$confirm(`确定${actionName}这些申请吗?`, "提示", {
  387. type: "warning",
  388. })
  389. .then(() => {
  390. this.auditModal.reason = "";
  391. if (isPass) {
  392. this.auditApply("PASS", this.multipleSelection);
  393. } else {
  394. this.auditDialogShow = true;
  395. }
  396. })
  397. .catch(() => {});
  398. },
  399. async auditNotPass() {
  400. const valid = await this.$refs.AuditForm.validate().catch(() => {});
  401. if (!valid) return;
  402. await this.auditApply("NOT_PASS", this.multipleSelection);
  403. this.auditDialogShow = false;
  404. },
  405. async auditApply(type, ids) {
  406. const data = await batchUpdateTaskReview({
  407. reviewStatus: type,
  408. examTaskIds: ids,
  409. reason: this.auditModal.reason,
  410. }).catch(() => {});
  411. if (!data) return;
  412. this.$message.success("审核成功!");
  413. this.taskModified();
  414. },
  415. async toExport() {
  416. if (!this.multipleSelection.length) {
  417. this.$message.error("请选择要导出的记录!");
  418. return;
  419. }
  420. if (this.loading) return;
  421. this.loading = true;
  422. const res = await reviewSampleDataExport({
  423. ids: this.multipleSelection,
  424. }).catch(() => {});
  425. this.loading = false;
  426. if (res) {
  427. this.$message.success("导出任务已提交!");
  428. } else {
  429. this.$message.error("导出任务提交失败,请重新尝试!");
  430. }
  431. },
  432. toEdit(row) {
  433. this.curExamTask = { ...row, source: "REVIEW" };
  434. this.editType = "AUDIT";
  435. this.$refs.ModifyTaskApply.open();
  436. },
  437. toPreview(row) {
  438. this.curExamTask = { ...row, source: "REVIEW" };
  439. this.editType = "PREVIEW";
  440. this.$refs.ModifyTaskApply.open();
  441. },
  442. taskModified() {
  443. this.getList();
  444. this.updateWaitTaskCount();
  445. },
  446. toDataTask() {
  447. this.$refs.DataTaskDialog.open();
  448. },
  449. },
  450. };
  451. </script>