ImportPaper.vue 24 KB

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