GenPaper.vue 24 KB

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