GenPaper.vue 29 KB

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