GenPaper.vue 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868
  1. <template>
  2. <section class="content gen-paper">
  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.courseId"
  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.courseId"
  19. :label="item.courseInfo"
  20. :value="item.courseId"
  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 v-model="formSearch.level" clearable placeholder="请选择">
  30. <el-option
  31. v-for="item in levelList"
  32. :key="item.value"
  33. :label="item.label"
  34. :value="item.value"
  35. >
  36. </el-option>
  37. </el-select>
  38. </el-form-item>
  39. <el-form-item label="录入人">
  40. <el-input
  41. v-model="formSearch.creator"
  42. placeholder="录入人"
  43. ></el-input>
  44. </el-form-item>
  45. <el-form-item label="修改人">
  46. <el-input
  47. v-model="formSearch.lastModifyName"
  48. placeholder="修改人"
  49. ></el-input>
  50. </el-form-item>
  51. <el-form-item>
  52. <el-button type="danger" @click="searchFrom">查询</el-button>
  53. <el-button type="danger" plain @click="resetForm">重置</el-button>
  54. </el-form-item>
  55. </el-form>
  56. <div class="part-box-action">
  57. <div>
  58. <el-button
  59. type="danger"
  60. plain
  61. icon="icon icon-delete"
  62. :disabled="noBatchSelected"
  63. @click="batchDeleteGenPaper"
  64. >删除成卷
  65. </el-button>
  66. <el-button
  67. type="danger"
  68. plain
  69. icon="icon icon-delete"
  70. :disabled="noBatchSelected"
  71. @click="recoveryPapers"
  72. >回收
  73. </el-button>
  74. <el-button
  75. type="primary"
  76. plain
  77. icon="icon icon-export"
  78. :disabled="noBatchSelected"
  79. @click="openBatchExportPaperDialog"
  80. >下载成卷</el-button
  81. >
  82. <el-button
  83. type="primary"
  84. plain
  85. icon="icon icon-edit"
  86. :disabled="noBatchSelected"
  87. @click="openQuesPro"
  88. >试卷属性</el-button
  89. >
  90. </div>
  91. <div>
  92. <el-button
  93. type="primary"
  94. icon="icon icon-plus-white"
  95. @click="genPaperDetail"
  96. >组卷</el-button
  97. >
  98. </div>
  99. </div>
  100. </div>
  101. <div class="part-box">
  102. <el-table
  103. v-loading="loading"
  104. element-loading-text="拼命加载中"
  105. :data="tableData"
  106. @selection-change="selectChange"
  107. >
  108. <el-table-column
  109. type="selection"
  110. width="50"
  111. align="center"
  112. ></el-table-column>
  113. <el-table-column label="课程名称" width="180">
  114. <template slot-scope="scope">
  115. <span>{{ scope.row.course.name }}</span>
  116. </template>
  117. </el-table-column>
  118. <el-table-column label="课程代码" width="80">
  119. <template slot-scope="scope">
  120. <span>{{ scope.row.course.code }}</span>
  121. </template>
  122. </el-table-column>
  123. <el-table-column label="试卷名称" width="180">
  124. <template slot-scope="scope">
  125. <span>{{ scope.row.name }}</span>
  126. </template>
  127. </el-table-column>
  128. <el-table-column
  129. label="试卷总分"
  130. width="103"
  131. sortable
  132. prop="totalScore"
  133. >
  134. </el-table-column>
  135. <el-table-column
  136. label="试卷难度"
  137. width="103"
  138. sortable
  139. prop="difficultyDegree"
  140. >
  141. </el-table-column>
  142. <el-table-column
  143. label="大题数量"
  144. width="103"
  145. sortable
  146. prop="paperDetailCount"
  147. >
  148. </el-table-column>
  149. <el-table-column label="录入员" width="150">
  150. <template slot-scope="scope">
  151. <span>{{ scope.row.creator }}</span>
  152. </template>
  153. </el-table-column>
  154. <el-table-column
  155. label="创建时间"
  156. width="153"
  157. sortable
  158. prop="creationDate"
  159. >
  160. </el-table-column>
  161. <el-table-column label="修改人" width="150">
  162. <template slot-scope="scope">
  163. <span>{{ scope.row.lastModifyName }}</span>
  164. </template>
  165. </el-table-column>
  166. <el-table-column
  167. label="修改时间"
  168. width="153"
  169. sortable
  170. prop="updateDate"
  171. >
  172. </el-table-column>
  173. <el-table-column label="操作" width="180" fixed="right">
  174. <template slot-scope="scope">
  175. <div class="operate_left">
  176. <el-button
  177. size="mini"
  178. type="primary"
  179. plain
  180. @click="editGenPaper(scope.row)"
  181. >编辑</el-button
  182. >
  183. <el-dropdown>
  184. <el-button type="primary" size="mini" plain>
  185. 更多 <i class="el-icon-more el-icon--right"></i>
  186. </el-button>
  187. <el-dropdown-menu slot="dropdown" class="action-dropdown">
  188. <el-dropdown-item>
  189. <el-button
  190. size="mini"
  191. type="danger"
  192. plain
  193. @click="recoveryPaper(scope.row)"
  194. >
  195. 回收
  196. </el-button>
  197. </el-dropdown-item>
  198. <el-dropdown-item>
  199. <el-button
  200. size="mini"
  201. type="primary"
  202. plain
  203. @click="openExportDialog(scope.row)"
  204. >下载</el-button
  205. >
  206. </el-dropdown-item>
  207. <el-dropdown-item>
  208. <el-button
  209. size="mini"
  210. type="primary"
  211. plain
  212. @click="previewPDF2(scope.row)"
  213. >预览</el-button
  214. >
  215. </el-dropdown-item>
  216. </el-dropdown-menu>
  217. </el-dropdown>
  218. </div>
  219. </template>
  220. </el-table-column>
  221. </el-table>
  222. <div class="part-page">
  223. <el-pagination
  224. :current-page="currentPage"
  225. :page-size="pageSize"
  226. :page-sizes="[10, 20, 50, 100, 200, 300]"
  227. layout="total, sizes, prev, pager, next, jumper"
  228. :total="total"
  229. @current-change="handleCurrentChange"
  230. @size-change="handleSizeChange"
  231. >
  232. </el-pagination>
  233. </div>
  234. </div>
  235. <!-- 下载 -->
  236. <el-dialog
  237. title="导出"
  238. :visible.sync="exportDialog"
  239. width="600px"
  240. :modal="false"
  241. append-to-body
  242. custom-class="side-dialog"
  243. >
  244. <el-form :model="exportModel" label-position="right" label-width="80px">
  245. <el-form-item v-if="isShow" label="课程名称">
  246. {{ exportModel.courseName }}
  247. </el-form-item>
  248. <el-form-item v-if="isShow" label="课程代码">
  249. {{ exportModel.courseCode }}
  250. </el-form-item>
  251. <el-form-item label="导出内容">
  252. <el-checkbox-group v-model="exportModel.exportContentList">
  253. <el-checkbox label="PAPER">试卷</el-checkbox>
  254. <el-checkbox label="ANSWER">答案</el-checkbox>
  255. <el-checkbox label="THEMIS_PACKAGE">数据包</el-checkbox>
  256. <!-- <el-checkbox
  257. v-if="isShowPrintExamPackage"
  258. label="PRINT_EXAM_PACKAGE"
  259. >分布式印刷数据包
  260. </el-checkbox> -->
  261. <el-input
  262. v-if="isShowPrintExamPackagePassword"
  263. v-model="printExamPackagePassword"
  264. placeholder="加密密码 (可选)"
  265. type="password"
  266. style="width: 150px"
  267. ></el-input>
  268. </el-checkbox-group>
  269. </el-form-item>
  270. <el-form-item v-if="showSeqMode()" label="小题序号">
  271. <el-radio-group v-model="exportModel.seqMode" class="input">
  272. <el-radio label="MODE1">单题型连续</el-radio>
  273. <el-radio label="MODE2">客观题整体连续</el-radio>
  274. <el-radio label="MODE3">按大题独立</el-radio>
  275. <el-radio label="MODE5">整卷连续</el-radio>
  276. </el-radio-group>
  277. </el-form-item>
  278. </el-form>
  279. <div slot="footer">
  280. <el-button type="primary" @click="exportPaperInfo">开始导出</el-button>
  281. </div>
  282. </el-dialog>
  283. <!-- 试卷属性 -->
  284. <el-dialog
  285. title="属性修改"
  286. :visible.sync="quesPropertyDialog"
  287. width="500px"
  288. :modal="false"
  289. append-to-body
  290. custom-class="side-dialog"
  291. >
  292. <el-form :loading="quesLoading" :inline="true" label-width="100px">
  293. <el-form-item>
  294. <span slot="label">
  295. <el-checkbox
  296. v-model="difficultyDegreeDis"
  297. style="margin-right: 30px"
  298. ></el-checkbox>
  299. <span>难度</span>
  300. </span>
  301. <el-select
  302. v-model="difficultyDegree"
  303. class="dialog_input_width"
  304. :disabled="!difficultyDegreeDis"
  305. >
  306. <el-option
  307. v-for="item in difficultyDegreeList"
  308. :key="item.value"
  309. :label="item.label"
  310. :value="item.value"
  311. ></el-option>
  312. </el-select>
  313. </el-form-item>
  314. <el-form-item>
  315. <span slot="label">
  316. <el-checkbox
  317. v-model="publicityDis"
  318. style="margin-right: 16px"
  319. ></el-checkbox>
  320. <span>公开度</span>
  321. </span>
  322. <el-select
  323. v-model="publicity"
  324. class="dialog_input_width"
  325. :disabled="!publicityDis"
  326. >
  327. <el-option
  328. v-for="item in publicityList"
  329. :key="item.value"
  330. :label="item.label"
  331. :value="item.value"
  332. ></el-option>
  333. </el-select>
  334. </el-form-item>
  335. </el-form>
  336. <div slot="footer">
  337. <el-button
  338. v-loading.fullscreen.lock="quesLoading"
  339. type="primary"
  340. @click="updateQuesPropertyByPaper()"
  341. >保存</el-button
  342. >
  343. <el-button type="danger" plain @click="resetQuesProForm"
  344. >重置</el-button
  345. >
  346. <el-button type="danger" plain @click="closePropertyDialog"
  347. >返 回</el-button
  348. >
  349. </div>
  350. </el-dialog>
  351. </section>
  352. </template>
  353. <script>
  354. import { QUESTION_API } from "@/constants/constants";
  355. import { LEVEL_TYPE, PUBLICITY_LIST } from "../constants/constants";
  356. import { mapState } from "vuex";
  357. export default {
  358. data() {
  359. return {
  360. publicityDis: false,
  361. difficultyDegreeDis: false,
  362. quesLoading: false,
  363. quesPropertyDialog: false,
  364. difficultyDegree: 0.1,
  365. publicity: true,
  366. difficultyDegreeList: [
  367. { label: 0.1, value: 0.1 },
  368. { label: 0.2, value: 0.2 },
  369. { label: 0.3, value: 0.3 },
  370. { label: 0.4, value: 0.4 },
  371. { label: 0.5, value: 0.5 },
  372. { label: 0.6, value: 0.6 },
  373. { label: 0.7, value: 0.7 },
  374. { label: 0.8, value: 0.8 },
  375. { label: 0.9, value: 0.9 },
  376. { label: 1.0, value: 1.0 },
  377. ],
  378. publicityList: PUBLICITY_LIST,
  379. isClear: 0,
  380. courseLoading: false,
  381. formSearch: {
  382. courseId: "",
  383. courseName: "",
  384. creator: "",
  385. lastModifyName: "",
  386. level: "",
  387. name: "",
  388. },
  389. tableData: [],
  390. currentPage: 1,
  391. pageSize: 10,
  392. total: 0,
  393. loading: false,
  394. courseList: [],
  395. levelList: LEVEL_TYPE,
  396. dialogVisible: false,
  397. selectedPaperIds: [],
  398. fileList: [],
  399. uploadAction: "",
  400. formUpload: {
  401. paperName: "",
  402. },
  403. uploadData: {},
  404. fileLoading: false,
  405. exportDialog: false,
  406. exportModel: {
  407. id: "",
  408. courseCode: "",
  409. courseName: "",
  410. exportContentList: [],
  411. seqMode: "MODE1",
  412. },
  413. isShow: true,
  414. examList: [],
  415. dialogModel: false,
  416. rowIds: [],
  417. isShowPrintExamPackage: false,
  418. isShowPrintExamPackagePassword: false,
  419. printExamPackagePassword: "",
  420. printFrom: {
  421. examId: "",
  422. },
  423. rules: {
  424. examId: [{ required: true, message: "请输入名称", trigger: "change" }],
  425. },
  426. };
  427. },
  428. computed: {
  429. paperIds() {
  430. var paperIds = "";
  431. for (let paperId of this.selectedPaperIds) {
  432. if (!paperIds) {
  433. paperIds += paperId;
  434. } else {
  435. paperIds += "," + paperId;
  436. }
  437. }
  438. return paperIds;
  439. },
  440. courseInfoSelect() {
  441. var courseList = [];
  442. for (let course of this.courseList) {
  443. var courseInfo = course.name + "(" + course.code + ")";
  444. var courseId = course.id;
  445. var courseName = course.name;
  446. courseList.push({
  447. courseId: courseId,
  448. courseInfo: courseInfo,
  449. courseName: courseName,
  450. });
  451. }
  452. return courseList;
  453. },
  454. noBatchSelected() {
  455. return this.selectedPaperIds.length === 0;
  456. },
  457. ...mapState({ user: (state) => state.user }),
  458. },
  459. watch: {
  460. $route: "initVue",
  461. },
  462. created() {
  463. this.initVue();
  464. },
  465. methods: {
  466. recoveryPaper(row) {
  467. this.$confirm("确认回收试卷吗?", "提示", {
  468. type: "warning",
  469. }).then(() => {
  470. this.loading = true;
  471. this.$http.put(QUESTION_API + "/paper_storage/recovery/" + row.id).then(
  472. () => {
  473. this.$notify({
  474. message: "操作成功",
  475. type: "success",
  476. });
  477. this.searchGenPaper();
  478. },
  479. (response) => {
  480. this.$notify({
  481. message: response.response.data.desc,
  482. type: "error",
  483. });
  484. this.loading = false;
  485. }
  486. );
  487. });
  488. },
  489. recoveryPapers() {
  490. var paperIds = this.paperIds;
  491. if (this.selectedPaperIds.length != 0) {
  492. this.$confirm("确认回收试卷吗?", "提示", {
  493. type: "warning",
  494. }).then(() => {
  495. this.loading = true;
  496. this.$http
  497. .put(QUESTION_API + "/paper_storage/recovery/" + paperIds)
  498. .then(
  499. () => {
  500. this.$notify({
  501. message: "操作成功",
  502. type: "success",
  503. });
  504. this.selectedPaperIds = [];
  505. this.searchGenPaper();
  506. },
  507. (response) => {
  508. this.$notify({
  509. message: response.response.data.desc,
  510. type: "error",
  511. });
  512. this.loading = false;
  513. }
  514. );
  515. });
  516. } else {
  517. this.$notify({
  518. message: "请勾选回收的试卷",
  519. type: "warning",
  520. });
  521. }
  522. },
  523. showSeqMode() {
  524. for (let i = 0; i < this.exportModel.exportContentList.length; i++) {
  525. let element = this.exportModel.exportContentList[i];
  526. if (element == "PAPER" || element == "ANSWER") {
  527. // this.showSeqMode = true;
  528. return true;
  529. }
  530. }
  531. // this.showSeqMode = false;
  532. return false;
  533. },
  534. updateQuesPropertyByPaper() {
  535. if (!this.difficultyDegreeDis && !this.publicityDis) {
  536. this.$notify({
  537. title: "警告",
  538. message: "请勾选难度或公开度",
  539. type: "warning",
  540. });
  541. return;
  542. }
  543. var params = "?ids=" + this.selectedPaperIds;
  544. if (this.difficultyDegreeDis) {
  545. params = params + "&difficultyDegree=" + this.difficultyDegree;
  546. }
  547. if (this.publicityDis) {
  548. params = params + "&publicity=" + this.publicity;
  549. }
  550. this.quesLoading = true;
  551. this.$httpWithMsg
  552. .put(QUESTION_API + "/question/updatePro/paperIds" + params)
  553. .then(() => {
  554. this.$notify({
  555. message: "更新成功",
  556. type: "success",
  557. });
  558. this.searchGenPaper();
  559. this.quesLoading = false;
  560. this.closePropertyDialog();
  561. })
  562. .catch(() => {
  563. this.quesLoading = false;
  564. });
  565. },
  566. openQuesPro() {
  567. if (!this.selectedPaperIds || this.selectedPaperIds.length < 1) {
  568. this.$notify({
  569. title: "警告",
  570. message: "请选择试卷",
  571. type: "warning",
  572. });
  573. return;
  574. }
  575. this.difficultyDegree = 0.1;
  576. this.publicity = true;
  577. this.quesPropertyDialog = true;
  578. },
  579. closePropertyDialog() {
  580. this.quesPropertyDialog = false;
  581. },
  582. resetQuesProForm() {
  583. this.difficultyDegree = 0.1;
  584. this.publicity = true;
  585. },
  586. resetForm() {
  587. this.formSearch = {
  588. courseId: "",
  589. courseName: "",
  590. level: "",
  591. name: "",
  592. };
  593. },
  594. //查询
  595. searchFrom() {
  596. this.currentPage = 1;
  597. this.searchGenPaper();
  598. },
  599. searchGenPaper() {
  600. var pageNo = this.currentPage;
  601. this.currentPage = 1;
  602. this.loading = true;
  603. var url = QUESTION_API + "/genPaper/" + pageNo + "/" + this.pageSize;
  604. this.$http.get(url, { params: this.formSearch }).then((response) => {
  605. this.tableData = response.data.content;
  606. this.total = response.data.totalElements;
  607. this.currentPage = Number(pageNo);
  608. });
  609. this.loading = false;
  610. },
  611. genPaperDetail() {
  612. var courseId = this.formSearch.courseId;
  613. if (!courseId) {
  614. this.$notify({
  615. title: "警告",
  616. message: "请选择课程",
  617. type: "warning",
  618. });
  619. } else {
  620. var course = this.getCourseObj(courseId);
  621. this.formSearch.courseName = course.name;
  622. sessionStorage.setItem("gen_paper", JSON.stringify(this.formSearch));
  623. sessionStorage.setItem("gen_paper_currentPage", this.currentPage);
  624. this.$router.push({
  625. name: "gen_paper_detail",
  626. params: { courseId: courseId },
  627. });
  628. }
  629. },
  630. handleCurrentChange(val) {
  631. this.currentPage = val;
  632. this.searchGenPaper();
  633. },
  634. handleSizeChange(val) {
  635. this.pageSize = val;
  636. this.currentPage = 1;
  637. this.searchGenPaper();
  638. },
  639. getCourseObj(courseId) {
  640. for (let course of this.courseList) {
  641. if (course.id == courseId) {
  642. return course;
  643. }
  644. }
  645. return "";
  646. },
  647. editGenPaper(row) {
  648. var course = this.getCourseObj(this.formSearch.courseId);
  649. if (course) {
  650. this.formSearch.courseName = course.name;
  651. }
  652. sessionStorage.setItem("gen_paper", JSON.stringify(this.formSearch));
  653. sessionStorage.setItem("gen_paper_currentPage", this.currentPage);
  654. sessionStorage.setItem("question_back", "false");
  655. this.$router.push({
  656. path: "/edit_paper/" + row.id + "/gen_paper",
  657. });
  658. },
  659. deleteGenPaper(row) {
  660. this.$confirm("确认删除试卷吗?", "提示", {
  661. type: "warning",
  662. }).then(() => {
  663. this.loading = true;
  664. this.$http.delete(QUESTION_API + "/paper/" + row.id).then(
  665. () => {
  666. this.$notify({
  667. message: "删除成功",
  668. type: "success",
  669. });
  670. this.searchGenPaper();
  671. },
  672. (response) => {
  673. this.$notify({
  674. message: response.response.data.desc,
  675. type: "error",
  676. });
  677. this.loading = false;
  678. }
  679. );
  680. });
  681. },
  682. selectChange(row) {
  683. this.selectedPaperIds = [];
  684. row.forEach((element) => {
  685. this.selectedPaperIds.push(element.id);
  686. });
  687. },
  688. batchDeleteGenPaper() {
  689. var paperIds = this.paperIds;
  690. if (this.selectedPaperIds.length != 0) {
  691. this.$confirm("确认删除试卷吗?", "提示", {
  692. type: "warning",
  693. }).then(() => {
  694. this.loading = true;
  695. this.$http.delete(QUESTION_API + "/paper/" + paperIds).then(
  696. () => {
  697. this.$notify({
  698. message: "删除成功",
  699. type: "success",
  700. });
  701. this.searchGenPaper();
  702. this.selectedPaperIds = [];
  703. },
  704. (response) => {
  705. this.$notify({
  706. message: response.response.data.desc,
  707. type: "error",
  708. });
  709. this.loading = false;
  710. }
  711. );
  712. });
  713. } else {
  714. this.$notify({
  715. message: "请勾选删除的数据",
  716. type: "warning",
  717. });
  718. }
  719. },
  720. //查询所有课程
  721. getCourses(query) {
  722. if (query) {
  723. query = query.trim();
  724. }
  725. this.courseLoading = true;
  726. this.$http
  727. .get(QUESTION_API + "/course/query?name=" + query + "&enable=true")
  728. .then((response) => {
  729. this.courseList = response.data;
  730. this.courseLoading = false;
  731. });
  732. },
  733. //打开导出弹框
  734. openExportDialog(row) {
  735. this.isShow = true;
  736. this.isShow = true;
  737. this.exportDialog = true;
  738. this.exportModel.id = row.id;
  739. this.exportModel.courseCode = row.course.code;
  740. this.exportModel.courseName = row.course.name;
  741. this.exportModel.exportContentList = [];
  742. /* 分布式印刷数据包设置 */
  743. this.isShowPrintExamPackage = true;
  744. this.isShowPrintExamPackagePassword = false;
  745. this.printExamPackagePassword = "";
  746. },
  747. //打开批量弹出框
  748. openBatchExportPaperDialog() {
  749. if (this.selectedPaperIds.length != 0) {
  750. this.exportDialog = true;
  751. this.isShow = false;
  752. this.isShow = false;
  753. this.exportModel.exportContentList = [];
  754. } else {
  755. this.$notify({
  756. message: "请勾选导出的数据",
  757. type: "warning",
  758. });
  759. }
  760. /* 分布式印刷数据包设置 */
  761. this.isShowPrintExamPackage = false;
  762. this.isShowPrintExamPackagePassword = false;
  763. this.printExamPackagePassword = "";
  764. },
  765. //导出试卷,答案,机考数据包
  766. exportPaperInfo() {
  767. if (this.exportModel.exportContentList.length == 0) {
  768. this.$notify({
  769. message: "请选择导出内容",
  770. type: "error",
  771. });
  772. return false;
  773. }
  774. if (this.printExamPackagePassword.length > 0) {
  775. var reg = /^[0-9A-Za-z]{6,12}$/;
  776. if (!reg.test(this.printExamPackagePassword)) {
  777. this.$notify({
  778. message: "加密密码请输入6至12位的数字或字母!",
  779. type: "error",
  780. });
  781. return false;
  782. }
  783. }
  784. var key = this.user.key;
  785. var token = this.user.token;
  786. if (this.isShow) {
  787. window.location.href =
  788. QUESTION_API +
  789. "/paper/export/" +
  790. this.exportModel.id +
  791. "/" +
  792. this.exportModel.exportContentList +
  793. "/onLine" +
  794. "?psw=" +
  795. this.printExamPackagePassword +
  796. "&$key=" +
  797. key +
  798. "&$token=" +
  799. token +
  800. "&seqMode=" +
  801. this.exportModel.seqMode;
  802. this.exportDialog = false;
  803. } else {
  804. var paperIds = this.paperIds;
  805. window.location.href =
  806. QUESTION_API +
  807. "/paper/batch_export/" +
  808. paperIds +
  809. "/" +
  810. this.exportModel.exportContentList +
  811. "/onLine" +
  812. "?psw=" +
  813. this.printExamPackagePassword +
  814. "&$key=" +
  815. key +
  816. "&$token=" +
  817. token +
  818. "&seqMode=" +
  819. this.exportModel.seqMode;
  820. this.exportDialog = false;
  821. }
  822. },
  823. removeItem() {
  824. sessionStorage.removeItem("gen_paper");
  825. sessionStorage.removeItem("gen_paper_currentPage");
  826. },
  827. previewPDF2(row) {
  828. var key = this.user.key;
  829. var token = this.user.token;
  830. window.open(
  831. QUESTION_API +
  832. "/paper/pdf/" +
  833. row.id +
  834. "?$key=" +
  835. key +
  836. "&$token=" +
  837. token
  838. );
  839. },
  840. initVue() {
  841. this.isClear = this.$route.params.isClear;
  842. if (this.isClear == 0 || !this.isClear) {
  843. this.removeItem();
  844. this.formSearch = {
  845. courseId: "",
  846. courseName: "",
  847. level: "",
  848. name: "",
  849. };
  850. this.currentPage = 1;
  851. } else {
  852. this.formSearch = JSON.parse(sessionStorage.getItem("gen_paper"));
  853. this.currentPage =
  854. sessionStorage.getItem("gen_paper_currentPage") == null
  855. ? 1
  856. : parseInt(sessionStorage.getItem("gen_paper_currentPage"));
  857. }
  858. this.getCourses(this.formSearch.courseName);
  859. this.searchGenPaper();
  860. },
  861. },
  862. };
  863. </script>