ExamPaperPendingTrial.vue 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794
  1. <template>
  2. <section class="content">
  3. <div class="part-box">
  4. <h2 class="part-box-title">考卷待审</h2>
  5. <el-form class="part-filter-form" :inline="true" :model="formSearch">
  6. <el-form-item label="课程名称">
  7. <el-select
  8. v-model="formSearch.courseNo"
  9. filterable
  10. :remote-method="getCourses"
  11. remote
  12. clearable
  13. placeholder="全部"
  14. @clear="getCourses('')"
  15. >
  16. <el-option
  17. v-for="item in courseInfoSelect"
  18. :key="item.courseNo"
  19. :label="item.courseInfo"
  20. :value="item.courseNo"
  21. >
  22. </el-option>
  23. </el-select>
  24. </el-form-item>
  25. <el-form-item label="试卷名称">
  26. <el-input v-model="formSearch.name" placeholder="试卷名称"></el-input>
  27. </el-form-item>
  28. <el-form-item label="审核状态">
  29. <el-select
  30. v-model="formSearch.auditStatus"
  31. clearable
  32. placeholder="请选择"
  33. >
  34. <el-option label="初级待审" value="FIRST_PENDING_TRIAL">
  35. </el-option>
  36. <el-option label="中级待审" value="SECOND_PENDING_TRIAL">
  37. </el-option>
  38. <el-option label="高级待审" value="THIRD_PENDING_TRIAL">
  39. </el-option>
  40. <el-option label="已撤回" value="WITHDRAW"> </el-option>
  41. <el-option label="审核未通过" value="NOT_PASS"> </el-option>
  42. </el-select>
  43. </el-form-item>
  44. <el-form-item label="录入人">
  45. <el-input
  46. v-model="formSearch.creator"
  47. placeholder="录入人"
  48. ></el-input>
  49. </el-form-item>
  50. <el-form-item label="修改人">
  51. <el-input
  52. v-model="formSearch.lastModifyName"
  53. placeholder="修改人"
  54. ></el-input>
  55. </el-form-item>
  56. <el-form-item>
  57. <el-button type="danger" @click="searchFrom">查询</el-button>
  58. <el-button type="danger" plain @click="resetForm">重置</el-button>
  59. </el-form-item>
  60. </el-form>
  61. <div class="part-box-action">
  62. <div>
  63. <el-button
  64. :disabled="noBatchSelected"
  65. type="danger"
  66. plain
  67. icon="icon icon-delete"
  68. @click="deletePapers"
  69. >批量删除</el-button
  70. >
  71. <el-button
  72. :disabled="noBatchSelected"
  73. type="primary"
  74. plain
  75. icon="icon icon-pass"
  76. @click="auditPapers('PASS')"
  77. >批量通过</el-button
  78. >
  79. <el-button
  80. :disabled="noBatchSelected"
  81. type="danger"
  82. plain
  83. icon="icon icon-delete"
  84. @click="auditPapers('NOT_PASS')"
  85. >批量不通过</el-button
  86. >
  87. <el-button
  88. :disabled="noBatchSelected"
  89. type="primary"
  90. plain
  91. icon="icon icon-cancel"
  92. @click="withdrawPapers()"
  93. >批量撤回</el-button
  94. >
  95. <el-button
  96. :disabled="noBatchSelected"
  97. type="primary"
  98. plain
  99. icon="icon icon-save"
  100. @click="submitPapers()"
  101. >批量提交</el-button
  102. >
  103. </div>
  104. </div>
  105. </div>
  106. <div class="part-box">
  107. <el-table
  108. v-loading="loading"
  109. element-loading-text="拼命加载中"
  110. :data="tableData"
  111. @selection-change="selectChange"
  112. >
  113. <el-table-column
  114. type="selection"
  115. width="50"
  116. align="center"
  117. ></el-table-column>
  118. <el-table-column label="课程名称" width="180">
  119. <template slot-scope="scope">
  120. <span>{{ scope.row.course.name }}</span>
  121. </template>
  122. </el-table-column>
  123. <el-table-column label="课程代码" width="80">
  124. <template slot-scope="scope">
  125. <span>{{ scope.row.course.code }}</span>
  126. </template>
  127. </el-table-column>
  128. <el-table-column label="试卷名称" width="180">
  129. <template slot-scope="scope">
  130. <span>{{ scope.row.name }}</span>
  131. </template>
  132. </el-table-column>
  133. <el-table-column
  134. label="试卷总分"
  135. width="103"
  136. sortable
  137. prop="totalScore"
  138. >
  139. </el-table-column>
  140. <el-table-column
  141. label="试卷难度"
  142. width="103"
  143. sortable
  144. prop="difficultyDegree"
  145. >
  146. </el-table-column>
  147. <el-table-column
  148. label="大题数量"
  149. width="103"
  150. sortable
  151. prop="paperDetailCount"
  152. >
  153. </el-table-column>
  154. <el-table-column width="100" label="审核状态">
  155. <span slot-scope="scope">{{
  156. scope.row.auditStatus | paperAuditStatusFilter
  157. }}</span>
  158. </el-table-column>
  159. <el-table-column label="录入员" width="150">
  160. <template slot-scope="scope">
  161. <span>{{ scope.row.creator }}</span>
  162. </template>
  163. </el-table-column>
  164. <el-table-column
  165. label="创建时间"
  166. width="153"
  167. sortable
  168. prop="creationDate"
  169. >
  170. </el-table-column>
  171. <el-table-column label="修改人" width="150">
  172. <template slot-scope="scope">
  173. <span>{{ scope.row.lastModifyName }}</span>
  174. </template>
  175. </el-table-column>
  176. <el-table-column
  177. label="修改时间"
  178. width="153"
  179. sortable
  180. prop="updateDate"
  181. >
  182. </el-table-column>
  183. <el-table-column label="操作" width="270" fixed="right">
  184. <template slot-scope="scope">
  185. <div class="operate_left">
  186. <el-button
  187. size="mini"
  188. type="primary"
  189. plain
  190. @click="editImportPaper(scope.row)"
  191. >详情</el-button
  192. >
  193. <el-dropdown v-if="isShowAuditBtn(scope.row)">
  194. <el-button type="primary" size="mini" plain>
  195. 审核<i class="el-icon-more el-icon--right"></i>
  196. </el-button>
  197. <el-dropdown-menu slot="dropdown" class="action-dropdown">
  198. <el-dropdown-item>
  199. <el-button
  200. size="mini"
  201. type="success"
  202. plain
  203. @click="auditPaper('PASS', scope.row.id)"
  204. >
  205. 通过
  206. </el-button>
  207. </el-dropdown-item>
  208. <el-dropdown-item>
  209. <el-button
  210. size="mini"
  211. type="danger"
  212. plain
  213. @click="auditPaper('NOT_PASS', scope.row.id)"
  214. >
  215. 不通过
  216. </el-button>
  217. </el-dropdown-item>
  218. </el-dropdown-menu>
  219. </el-dropdown>
  220. <el-dropdown>
  221. <el-button type="primary" size="mini" plain>
  222. 更多 <i class="el-icon-more el-icon--right"></i>
  223. </el-button>
  224. <el-dropdown-menu slot="dropdown" class="action-dropdown">
  225. <el-dropdown-item>
  226. <el-button
  227. v-show="isShowDeleteBtn(scope.row)"
  228. size="mini"
  229. type="danger"
  230. plain
  231. @click="deletePaper(scope.row)"
  232. >删除</el-button
  233. >
  234. </el-dropdown-item>
  235. <el-dropdown-item>
  236. <el-button
  237. v-show="isShowWithdrawBtn(scope.row)"
  238. size="mini"
  239. type="primary"
  240. plain
  241. @click="withdrawPaper(scope.row)"
  242. >撤回</el-button
  243. >
  244. </el-dropdown-item>
  245. <el-dropdown-item>
  246. <el-button
  247. v-show="isShowSubmitBtn(scope.row)"
  248. size="mini"
  249. type="primary"
  250. plain
  251. @click="submitPaper(scope.row)"
  252. >提交</el-button
  253. >
  254. </el-dropdown-item>
  255. <el-dropdown-item>
  256. <el-button
  257. size="mini"
  258. type="primary"
  259. plain
  260. @click="exportPaper(scope.row)"
  261. >下载</el-button
  262. >
  263. </el-dropdown-item>
  264. </el-dropdown-menu>
  265. </el-dropdown>
  266. </div>
  267. </template>
  268. </el-table-column>
  269. </el-table>
  270. <div class="part-page">
  271. <el-pagination
  272. :current-page="currentPage"
  273. :page-size="pageSize"
  274. :page-sizes="[10, 20, 50, 100, 200, 300]"
  275. layout="total, sizes, prev, pager, next, jumper"
  276. :total="total"
  277. @current-change="handleCurrentChange"
  278. @size-change="handleSizeChange"
  279. >
  280. </el-pagination>
  281. </div>
  282. </div>
  283. <el-dialog
  284. title="审核试卷"
  285. width="50%"
  286. :visible.sync="auditPaperDialog"
  287. :modal="false"
  288. append-to-body
  289. custom-class="side-dialog"
  290. >
  291. <AuditPaper
  292. v-if="auditPaperDialog"
  293. :paper-ids="selectedPaperIds"
  294. :audit-result="auditResult"
  295. @afterAudit="afterAudit"
  296. ></AuditPaper>
  297. </el-dialog>
  298. </section>
  299. </template>
  300. <script>
  301. import { QUESTION_API } from "@/constants/constants";
  302. import { LEVEL_TYPE } from "../constants/constants";
  303. import { mapState } from "vuex";
  304. import AuditPaper from "./AuditPaper.vue";
  305. export default {
  306. components: { AuditPaper },
  307. data() {
  308. return {
  309. auditPaperDialog: false,
  310. auditResult: "",
  311. publicityDis: false,
  312. difficultyDegreeDis: false,
  313. quesLoading: false,
  314. quesPropertyDialog: false,
  315. difficultyDegree: 0.1,
  316. publicity: true,
  317. isClear: 0,
  318. courseLoading: false,
  319. formSearch: {
  320. courseNo: "",
  321. courseName: "",
  322. creator: "",
  323. lastModifyName: "",
  324. auditStatus: "",
  325. name: "",
  326. },
  327. tableData: [],
  328. currentPage: 1,
  329. pageSize: 10,
  330. total: 0,
  331. loading: false,
  332. courseList: [],
  333. levelList: LEVEL_TYPE,
  334. dialogVisible: false,
  335. selectedPaperIds: [],
  336. fileList: [],
  337. uploadAction: "",
  338. formUpload: {
  339. paperName: "",
  340. },
  341. uploadData: {},
  342. fileLoading: false,
  343. exportDialog: false,
  344. exportModel: {
  345. id: "",
  346. courseCode: "",
  347. courseName: "",
  348. exportContentList: [],
  349. seqMode: "MODE1",
  350. },
  351. isShow: true,
  352. dialogModel: false,
  353. rowIds: [],
  354. isShowPrintExamPackage: false,
  355. isShowPrintExamPackagePassword: false,
  356. printExamPackagePassword: "",
  357. printFrom: {
  358. examId: "",
  359. },
  360. rules: {
  361. examId: [{ required: true, message: "请输入名称", trigger: "change" }],
  362. },
  363. };
  364. },
  365. computed: {
  366. ...mapState({
  367. user: (state) => state.user,
  368. }),
  369. paperIds() {
  370. var paperIds = "";
  371. for (let paperId of this.selectedPaperIds) {
  372. if (!paperIds) {
  373. paperIds += paperId;
  374. } else {
  375. paperIds += "," + paperId;
  376. }
  377. }
  378. return paperIds;
  379. },
  380. courseInfoSelect() {
  381. var courseList = [];
  382. for (let course of this.courseList) {
  383. var courseInfo = course.name + "(" + course.code + ")";
  384. var courseNo = course.code;
  385. var courseName = course.name;
  386. courseList.push({
  387. courseNo: courseNo,
  388. courseInfo: courseInfo,
  389. courseName: courseName,
  390. });
  391. }
  392. return courseList;
  393. },
  394. noBatchSelected() {
  395. return this.selectedPaperIds.length === 0;
  396. },
  397. },
  398. watch: {
  399. $route: "initVue",
  400. },
  401. created() {
  402. this.initVue();
  403. },
  404. methods: {
  405. getCourseName(courseNo) {
  406. for (let course of this.courseList) {
  407. if (course.code == courseNo) {
  408. this.formSearch.courseName = course.name;
  409. }
  410. }
  411. },
  412. editImportPaper(row) {
  413. //缓存查询对象
  414. this.getCourseName(this.formSearch.courseNo);
  415. sessionStorage.setItem("paper", JSON.stringify(this.formSearch));
  416. sessionStorage.setItem("paper_currentPage", this.currentPage);
  417. sessionStorage.setItem("question_back", "false");
  418. this.$router.push({
  419. path:
  420. "/edit_paper_pending_trial/" + row.id + "/exam_paper_pending_trial",
  421. });
  422. },
  423. afterAudit() {
  424. this.auditPaperDialog = false;
  425. this.searchPaper();
  426. },
  427. auditPapers(pass) {
  428. this.auditResult = pass;
  429. this.auditPaperDialog = true;
  430. },
  431. auditPaper(pass, id) {
  432. this.auditResult = pass;
  433. this.selectedPaperIds = [];
  434. this.selectedPaperIds.push(id);
  435. this.auditPaperDialog = true;
  436. },
  437. isShowAuditBtn(row) {
  438. if (
  439. row.auditStatus != "WITHDRAW" &&
  440. row.auditStatus != "NOT_PASS" &&
  441. this.isMyAudit(row)
  442. ) {
  443. return true;
  444. } else {
  445. return false;
  446. }
  447. },
  448. isMyAudit(row) {
  449. if (
  450. row.auditStatus == "FIRST_PENDING_TRIAL" &&
  451. this.user.auditAuthority == "FIRST"
  452. ) {
  453. return true;
  454. }
  455. if (
  456. row.auditStatus == "SECOND_PENDING_TRIAL" &&
  457. this.user.auditAuthority == "SECOND"
  458. ) {
  459. return true;
  460. }
  461. if (
  462. row.auditStatus == "THIRD_PENDING_TRIAL" &&
  463. this.user.auditAuthority == "THIRD"
  464. ) {
  465. return true;
  466. }
  467. return false;
  468. },
  469. exportPaper(row) {
  470. var key = this.user.key;
  471. var token = this.user.token;
  472. window.open(
  473. QUESTION_API +
  474. "/originalPaper/export/" +
  475. row.id +
  476. "?$key=" +
  477. key +
  478. "&$token=" +
  479. token
  480. );
  481. },
  482. submitPapers() {
  483. this.$confirm("确认提交试卷吗?", "提示", {
  484. type: "warning",
  485. }).then(() => {
  486. this.loading = true;
  487. this.$http
  488. .post(
  489. QUESTION_API + "/paper/submit",
  490. new URLSearchParams({ paperIds: this.selectedPaperIds })
  491. )
  492. .then(
  493. () => {
  494. this.$notify({
  495. message: "提交成功",
  496. type: "success",
  497. });
  498. this.searchPaper();
  499. },
  500. (error) => {
  501. this.$notify({
  502. message: error.response.data.desc,
  503. type: "error",
  504. });
  505. this.loading = false;
  506. this.searchPaper();
  507. }
  508. );
  509. });
  510. },
  511. submitPaper(row) {
  512. this.$confirm("确认提交试卷吗?", "提示", {
  513. type: "warning",
  514. }).then(() => {
  515. this.selectedPaperIds = [];
  516. this.selectedPaperIds.push(row.id);
  517. this.loading = true;
  518. this.$http
  519. .post(
  520. QUESTION_API + "/paper/submit",
  521. new URLSearchParams({ paperIds: this.selectedPaperIds })
  522. )
  523. .then(
  524. () => {
  525. this.$notify({
  526. message: "提交成功",
  527. type: "success",
  528. });
  529. this.searchPaper();
  530. },
  531. (error) => {
  532. this.$notify({
  533. message: error.response.data.desc,
  534. type: "error",
  535. });
  536. this.loading = false;
  537. }
  538. );
  539. });
  540. },
  541. isShowSubmitBtn(row) {
  542. if (
  543. row.creationBy == this.user.userId &&
  544. (row.auditStatus == "WITHDRAW" || row.auditStatus == "NOT_PASS")
  545. ) {
  546. return true;
  547. } else {
  548. return false;
  549. }
  550. },
  551. isShowWithdrawBtn(row) {
  552. if (
  553. row.creationBy == this.user.userId &&
  554. row.auditStatus != "WITHDRAW" &&
  555. row.auditStatus != "NOT_PASS"
  556. ) {
  557. return true;
  558. } else {
  559. return false;
  560. }
  561. },
  562. withdrawPapers() {
  563. this.$confirm("确认撤回试卷吗?", "提示", {
  564. type: "warning",
  565. }).then(() => {
  566. this.loading = true;
  567. this.$http
  568. .post(
  569. QUESTION_API + "/paper/withdraw",
  570. new URLSearchParams({ paperIds: this.selectedPaperIds })
  571. )
  572. .then(
  573. () => {
  574. this.$notify({
  575. message: "撤回成功",
  576. type: "success",
  577. });
  578. this.searchPaper();
  579. },
  580. (error) => {
  581. this.$notify({
  582. message: error.response.data.desc,
  583. type: "error",
  584. });
  585. this.loading = false;
  586. this.searchPaper();
  587. }
  588. );
  589. });
  590. },
  591. withdrawPaper(row) {
  592. this.$confirm("确认撤回试卷吗?", "提示", {
  593. type: "warning",
  594. }).then(() => {
  595. this.loading = true;
  596. this.selectedPaperIds = [];
  597. this.selectedPaperIds.push(row.id);
  598. this.$http
  599. .post(
  600. QUESTION_API + "/paper/withdraw",
  601. new URLSearchParams({ paperIds: this.selectedPaperIds })
  602. )
  603. .then(
  604. () => {
  605. this.$notify({
  606. message: "撤回成功",
  607. type: "success",
  608. });
  609. this.searchPaper();
  610. },
  611. (error) => {
  612. this.$notify({
  613. message: error.response.data.desc,
  614. type: "error",
  615. });
  616. this.loading = false;
  617. }
  618. );
  619. });
  620. },
  621. isShowDeleteBtn(row) {
  622. if (row.creationBy == this.user.userId && row.auditStatus == "WITHDRAW") {
  623. return true;
  624. } else {
  625. return false;
  626. }
  627. },
  628. deletePapers() {
  629. this.$confirm("确认删除试卷吗?", "提示", {
  630. type: "warning",
  631. }).then(() => {
  632. this.loading = true;
  633. this.$http
  634. .post(
  635. QUESTION_API + "/paper/audit/delete",
  636. new URLSearchParams({ paperIds: this.selectedPaperIds })
  637. )
  638. .then(
  639. () => {
  640. this.$notify({
  641. message: "删除成功",
  642. type: "success",
  643. });
  644. this.searchPaper();
  645. },
  646. (error) => {
  647. this.$notify({
  648. message: error.response.data.desc,
  649. type: "error",
  650. });
  651. this.loading = false;
  652. this.searchPaper();
  653. }
  654. );
  655. });
  656. },
  657. deletePaper(row) {
  658. this.$confirm("确认删除试卷吗?", "提示", {
  659. type: "warning",
  660. }).then(() => {
  661. this.loading = true;
  662. this.selectedPaperIds = [];
  663. this.selectedPaperIds.push(row.id);
  664. this.$http
  665. .post(
  666. QUESTION_API + "/paper/audit/delete",
  667. new URLSearchParams({ paperIds: this.selectedPaperIds })
  668. )
  669. .then(
  670. () => {
  671. this.$notify({
  672. message: "删除成功",
  673. type: "success",
  674. });
  675. this.searchPaper();
  676. },
  677. (error) => {
  678. this.$notify({
  679. message: error.response.data.desc,
  680. type: "error",
  681. });
  682. this.loading = false;
  683. }
  684. );
  685. });
  686. },
  687. resetForm() {
  688. this.formSearch = {
  689. courseNo: "",
  690. courseName: "",
  691. level: "",
  692. name: "",
  693. };
  694. },
  695. //查询
  696. searchFrom() {
  697. this.currentPage = 1;
  698. this.searchPaper();
  699. },
  700. searchPaper() {
  701. this.selectedPaperIds = [];
  702. var pageNo = this.currentPage;
  703. this.currentPage = 1;
  704. this.loading = true;
  705. var url =
  706. QUESTION_API +
  707. "/exam_pending_trial_paper/" +
  708. pageNo +
  709. "/" +
  710. this.pageSize;
  711. this.$http.get(url, { params: this.formSearch }).then((response) => {
  712. this.tableData = response.data.content;
  713. this.total = response.data.totalElements;
  714. this.currentPage = Number(pageNo);
  715. });
  716. this.loading = false;
  717. },
  718. handleCurrentChange(val) {
  719. this.currentPage = val;
  720. this.searchPaper();
  721. },
  722. handleSizeChange(val) {
  723. this.pageSize = val;
  724. this.currentPage = 1;
  725. this.searchPaper();
  726. },
  727. getCourseObj(courseNo) {
  728. for (let course of this.courseList) {
  729. if (course.code == courseNo) {
  730. return course;
  731. }
  732. }
  733. return "";
  734. },
  735. selectChange(row) {
  736. this.selectedPaperIds = [];
  737. row.forEach((element) => {
  738. this.selectedPaperIds.push(element.id);
  739. });
  740. },
  741. //查询所有课程
  742. getCourses(query) {
  743. if (query) {
  744. query = query.trim();
  745. }
  746. this.courseLoading = true;
  747. this.$http
  748. .get(QUESTION_API + "/course/query?name=" + query + "&enable=true")
  749. .then((response) => {
  750. this.courseList = response.data;
  751. this.courseLoading = false;
  752. });
  753. },
  754. removeItem() {
  755. sessionStorage.removeItem("paper");
  756. sessionStorage.removeItem("paper_currentPage");
  757. },
  758. cancel(formData) {
  759. this.resetForm2(formData);
  760. this.dialogModel = false;
  761. },
  762. resetForm2(formData) {
  763. this.printFrom.examId = "";
  764. this.$refs[formData].clearValidate();
  765. },
  766. initVue() {
  767. this.isClear = this.$route.params.isClear;
  768. if (this.isClear == 0 || !this.isClear) {
  769. this.removeItem();
  770. this.formSearch = {
  771. courseNo: "",
  772. courseName: "",
  773. level: "",
  774. name: "",
  775. };
  776. this.currentPage = 1;
  777. } else {
  778. this.formSearch = JSON.parse(sessionStorage.getItem("paper"));
  779. this.currentPage =
  780. sessionStorage.getItem("paper_currentPage") == null
  781. ? 1
  782. : parseInt(sessionStorage.getItem("paper_currentPage"));
  783. }
  784. this.getCourses(this.formSearch.courseName);
  785. this.searchPaper();
  786. },
  787. },
  788. };
  789. </script>