GenPaper.vue 30 KB

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