ImportPaper.vue 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824
  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. >
  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" type="primary" @click="impPaper"
  72. ><i class="el-icon-upload2"></i> 导入</el-button
  73. >
  74. <el-dropdown class="button_left">
  75. <el-button type="primary" size="small">
  76. 更多 <i class="el-icon-arrow-down el-icon--right"></i>
  77. </el-button>
  78. <el-dropdown-menu slot="dropdown">
  79. <el-dropdown-item>
  80. <el-button size="small" type="primary" @click="expQuesType"
  81. >试题分布</el-button
  82. >
  83. </el-dropdown-item>
  84. <el-dropdown-item>
  85. <el-button size="small" type="primary" @click="openQuesPro"
  86. >试卷属性</el-button
  87. >
  88. </el-dropdown-item>
  89. <el-dropdown-item>
  90. <el-button size="small" type="primary" @click="openQuesProC"
  91. >课程属性</el-button
  92. >
  93. </el-dropdown-item>
  94. </el-dropdown-menu>
  95. </el-dropdown>
  96. </div>
  97. </el-col>
  98. </el-row>
  99. <div
  100. style="width: 100%; border-bottom: 1px solid #ddd; margin: 10px 0;"
  101. ></div>
  102. <el-row>
  103. <el-form-item>
  104. <span>批量操作:</span>
  105. <el-button
  106. size="small"
  107. type="primary"
  108. @click="useBasePaper"
  109. :disabled="noBatchSelected"
  110. ><i class="el-icon-star-on"></i> 使用原卷</el-button
  111. >
  112. <el-button
  113. size="small"
  114. type="danger"
  115. @click="batchDeletePaper"
  116. :disabled="noBatchSelected"
  117. ><i class="el-icon-delete"></i> 删除原卷</el-button
  118. >
  119. </el-form-item>
  120. </el-row>
  121. </el-form>
  122. <div style="width: 100%;margin-bottom: 10px;"></div>
  123. <el-table
  124. v-loading="loading"
  125. element-loading-text="拼命加载中"
  126. :data="tableData"
  127. border
  128. style="width: 100%"
  129. @selection-change="selectChange"
  130. >
  131. <el-table-column type="selection" width="35"></el-table-column>
  132. <el-table-column label="课程名称" width="180">
  133. <template slot-scope="scope">
  134. <span>{{ scope.row.course.name }}</span>
  135. </template>
  136. </el-table-column>
  137. <el-table-column label="课程代码" width="80">
  138. <template slot-scope="scope">
  139. <span>{{ scope.row.course.code }}</span>
  140. </template>
  141. </el-table-column>
  142. <el-table-column label="试卷名称" width="180">
  143. <template slot-scope="scope">
  144. <span>{{ scope.row.name }}</span>
  145. </template>
  146. </el-table-column>
  147. <el-table-column
  148. label="试卷总分"
  149. width="103"
  150. sortable
  151. prop="totalScore"
  152. >
  153. </el-table-column>
  154. <el-table-column
  155. label="试卷难度"
  156. width="103"
  157. sortable
  158. prop="difficultyDegree"
  159. >
  160. </el-table-column>
  161. <el-table-column
  162. label="大题数量"
  163. width="103"
  164. sortable
  165. prop="paperDetailCount"
  166. >
  167. </el-table-column>
  168. <el-table-column label="录入员" width="150">
  169. <template slot-scope="scope">
  170. <span>{{ scope.row.creator }}</span>
  171. </template>
  172. </el-table-column>
  173. <el-table-column
  174. label="创建时间"
  175. width="153"
  176. sortable
  177. prop="createTime"
  178. >
  179. </el-table-column>
  180. <el-table-column label="修改人" width="150">
  181. <template slot-scope="scope">
  182. <span>{{ scope.row.lastModifyName }}</span>
  183. </template>
  184. </el-table-column>
  185. <el-table-column label="操作" width="180" fixed="right">
  186. <template slot-scope="scope">
  187. <div class="operate_left">
  188. <el-button
  189. size="mini"
  190. type="primary"
  191. @click="editImportPaper(scope.row)"
  192. plain
  193. ><i class="el-icon-edit"></i>编辑</el-button
  194. >
  195. <el-dropdown class="button_left">
  196. <el-button type="primary" size="mini" plain>
  197. 更多 <i class="el-icon-arrow-down el-icon--right"></i>
  198. </el-button>
  199. <el-dropdown-menu slot="dropdown">
  200. <el-dropdown-item>
  201. <el-button
  202. size="mini"
  203. type="primary"
  204. @click="copyImportPaper(scope.row)"
  205. plain
  206. ><i class="el-icon-tickets"></i> 复制</el-button
  207. >
  208. </el-dropdown-item>
  209. <el-dropdown-item>
  210. <el-button
  211. size="mini"
  212. type="primary"
  213. @click="exportOriginalPaper(scope.row)"
  214. plain
  215. ><i class="el-icon-download"></i> 下载</el-button
  216. >
  217. </el-dropdown-item>
  218. <el-dropdown-item>
  219. <el-button
  220. size="mini"
  221. type="danger"
  222. @click="deleteImportPaper(scope.row)"
  223. ><i class="el-icon-delete"></i> 删除</el-button
  224. >
  225. </el-dropdown-item>
  226. </el-dropdown-menu>
  227. </el-dropdown>
  228. </div>
  229. </template>
  230. </el-table-column>
  231. </el-table>
  232. <div class="page pull-right">
  233. <el-pagination
  234. @current-change="handleCurrentChange"
  235. :current-page="currentPage"
  236. :page-size="pageSize"
  237. :page-sizes="[10, 20, 50, 100]"
  238. @size-change="handleSizeChange"
  239. layout="total, sizes, prev, pager, next, jumper"
  240. :total="total"
  241. >
  242. </el-pagination>
  243. </div>
  244. </div>
  245. <el-dialog
  246. title="克隆试卷"
  247. :visible.sync="copyPaperDialog"
  248. v-loading.body="cloneLoading"
  249. width="500px"
  250. >
  251. <el-form
  252. :model="copyPaperForm"
  253. ref="copyPaperForm"
  254. :rules="rules"
  255. label-position="right"
  256. label-width="120px"
  257. inline-message
  258. >
  259. <el-row>
  260. <el-form-item label="试卷名称" prop="paperName">
  261. <el-input
  262. class="dialog_input_width"
  263. v-model="copyPaperForm.paperName"
  264. placeholder="请输试卷名称"
  265. ></el-input>
  266. </el-form-item>
  267. </el-row>
  268. <el-row>
  269. <el-form-item label="课程名称" prop="courseNo">
  270. <el-select
  271. class="dialog_input_width"
  272. v-model="copyPaperForm.courseNo"
  273. :remote-method="getCourses"
  274. remote
  275. filterable
  276. clearable
  277. placeholder="全部"
  278. >
  279. <el-option
  280. v-for="item in courseInfoSelect"
  281. :label="item.courseInfo"
  282. :value="item.courseNo"
  283. :key="item.courseNo"
  284. >
  285. </el-option>
  286. </el-select>
  287. </el-form-item>
  288. </el-row>
  289. <el-row class="margin_top_10 margin_left_120">
  290. <el-button type="primary" @click="submitCopy('copyPaperForm')"
  291. >保 存</el-button
  292. >
  293. <el-button @click="resetForm2('copyPaperForm')"
  294. ><i class="el-icon-refresh"></i> 重 置</el-button
  295. >
  296. <el-button @click="back2('copyPaperForm')" type="primary"
  297. ><i class="el-icon-arrow-left"></i> 返 回</el-button
  298. >
  299. </el-row>
  300. </el-form>
  301. </el-dialog>
  302. <el-dialog
  303. title="属性修改"
  304. :visible.sync="quesPropertyDialog"
  305. width="500px"
  306. >
  307. <el-form
  308. :loading="quesLoading"
  309. label-position="right"
  310. label-width="120px"
  311. >
  312. <el-row>
  313. <el-form-item label="难 度">
  314. <el-select v-model="difficultyDegree" class="dialog_input_width">
  315. <el-option
  316. v-for="item in difficultyDegreeList"
  317. :label="item.label"
  318. :value="item.value"
  319. :key="item.value"
  320. ></el-option>
  321. </el-select>
  322. </el-form-item>
  323. </el-row>
  324. <el-row>
  325. <el-form-item label="公开度">
  326. <el-select v-model="publicity" class="dialog_input_width">
  327. <el-option
  328. v-for="item in publicityList"
  329. :label="item.label"
  330. :value="item.value"
  331. :key="item.value"
  332. ></el-option>
  333. </el-select>
  334. </el-form-item>
  335. </el-row>
  336. <el-row class="margin_top_10 margin_left_120">
  337. <el-button
  338. type="primary"
  339. @click="submitUpdate()"
  340. v-loading.fullscreen.lock="quesLoading"
  341. >保 存</el-button
  342. >
  343. <el-button @click="resetForm"
  344. ><i class="el-icon-refresh"></i> 重 置</el-button
  345. >
  346. <el-button @click="closePropertyDialog" type="primary"
  347. ><i class="el-icon-arrow-left"></i> 返 回</el-button
  348. >
  349. </el-row>
  350. </el-form>
  351. </el-dialog>
  352. </section>
  353. </template>
  354. <script>
  355. import { CORE_API, QUESTION_API } from "@/constants/constants";
  356. import { LEVEL_TYPE, PUBLICITY_LIST } from "../constants/constants";
  357. import { mapState } from "vuex";
  358. import LinkTitlesCustom from "@/components/LinkTitlesCustom.vue";
  359. export default {
  360. components: { LinkTitlesCustom },
  361. data() {
  362. return {
  363. courseLoading: false,
  364. quesLoading: false,
  365. formSearch: {
  366. courseNo: "",
  367. courseName: "",
  368. level: "",
  369. name: ""
  370. },
  371. tableData: [],
  372. levelList: LEVEL_TYPE,
  373. currentPage: 1,
  374. pageSize: 10,
  375. isClear: 0,
  376. total: 0,
  377. loading: false,
  378. courseList: [],
  379. options: [],
  380. selectedPaperIds: [],
  381. cloneLoading: false,
  382. copyPaperDialog: false,
  383. copyPaperForm: {
  384. paperName: "",
  385. courseNo: null
  386. },
  387. copyPaperId: "",
  388. quesPropertyDialog: false,
  389. difficultyDegree: 0.1,
  390. publicity: true,
  391. updateType: "",
  392. difficultyDegreeList: [
  393. { label: 0.1, value: 0.1 },
  394. { label: 0.2, value: 0.2 },
  395. { label: 0.3, value: 0.3 },
  396. { label: 0.4, value: 0.4 },
  397. { label: 0.5, value: 0.5 },
  398. { label: 0.6, value: 0.6 },
  399. { label: 0.7, value: 0.7 },
  400. { label: 0.8, value: 0.8 },
  401. { label: 0.9, value: 0.9 },
  402. { label: 1.0, value: 1.0 }
  403. ],
  404. publicityList: PUBLICITY_LIST,
  405. rules: {
  406. paperName: [
  407. { required: true, message: "请输试卷名称", trigger: "blur" }
  408. ],
  409. courseNo: [
  410. { required: true, message: "请选择课程名称", trigger: "change" }
  411. ]
  412. }
  413. };
  414. },
  415. methods: {
  416. searchFrom() {
  417. this.currentPage = 1;
  418. this.searchImportPaper();
  419. },
  420. searchImportPaper() {
  421. this.loading = true;
  422. var url =
  423. QUESTION_API + "/importPaper/" + this.currentPage + "/" + this.pageSize;
  424. this.$http.get(url, { params: this.formSearch }).then(response => {
  425. this.tableData = response.data.content;
  426. this.total = response.data.totalElements;
  427. this.loading = false;
  428. });
  429. },
  430. handleCurrentChange(val) {
  431. this.currentPage = val;
  432. this.searchImportPaper();
  433. },
  434. handleSizeChange(val) {
  435. this.pageSize = val;
  436. this.currentPage = 1;
  437. this.searchImportPaper();
  438. },
  439. getCourseName(courseNo) {
  440. for (let course of this.courseList) {
  441. if (course.code == courseNo) {
  442. this.formSearch.courseName = course.name;
  443. }
  444. }
  445. },
  446. editImportPaper(row) {
  447. //缓存查询对象
  448. this.getCourseName(this.formSearch.courseNo);
  449. sessionStorage.setItem("import_paper", JSON.stringify(this.formSearch));
  450. sessionStorage.setItem("import_paper_currentPage", this.currentPage);
  451. this.$router.push({
  452. path: "/edit_paper/" + row.id + "/import_paper"
  453. });
  454. },
  455. deleteImportPaper(row) {
  456. this.$confirm("确认删除试卷吗?", "提示", {
  457. type: "warning"
  458. }).then(() => {
  459. this.loading = true;
  460. this.$http.delete(QUESTION_API + "/paper/" + row.id).then(
  461. () => {
  462. this.$notify({
  463. message: "删除成功",
  464. type: "success"
  465. });
  466. this.searchImportPaper();
  467. },
  468. error => {
  469. this.$notify({
  470. message: error.response.data.msg,
  471. type: "error"
  472. });
  473. this.loading = false;
  474. }
  475. );
  476. });
  477. },
  478. selectChange(row) {
  479. this.selectedPaperIds = [];
  480. row.forEach(element => {
  481. this.selectedPaperIds.push(element.id);
  482. });
  483. },
  484. batchDeletePaper() {
  485. var paperIds = this.paperIds;
  486. this.$confirm("确认删除试卷吗?", "提示", {
  487. type: "warning"
  488. }).then(() => {
  489. this.loading = true;
  490. this.$http.delete(QUESTION_API + "/paper/" + paperIds).then(
  491. () => {
  492. this.$notify({
  493. message: "删除成功",
  494. type: "success"
  495. });
  496. this.searchImportPaper();
  497. this.selectedPaperIds = [];
  498. },
  499. error => {
  500. this.$notify({
  501. message: error.response.data.msg,
  502. type: "error"
  503. });
  504. this.loading = false;
  505. }
  506. );
  507. });
  508. },
  509. //导入试卷
  510. impPaper() {
  511. this.$router.push({
  512. path: "/questions/import_paper_info"
  513. });
  514. },
  515. //查询所有课程
  516. getCourses(query) {
  517. if (query) {
  518. this.courseLoading = true;
  519. this.$http
  520. .get(CORE_API + "/course/query?name=" + query + "&enable=true")
  521. .then(response => {
  522. this.courseList = response.data;
  523. this.courseLoading = false;
  524. });
  525. } else {
  526. this.courseList = [];
  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. } else {
  777. this.formSearch = JSON.parse(sessionStorage.getItem("import_paper"));
  778. this.currentPage =
  779. sessionStorage.getItem("import_paper_currentPage") == null
  780. ? 1
  781. : parseInt(sessionStorage.getItem("import_paper_currentPage"));
  782. }
  783. if (this.formSearch.courseName) {
  784. this.getCourses(this.formSearch.courseName);
  785. }
  786. this.searchImportPaper();
  787. }
  788. },
  789. computed: {
  790. paperIds() {
  791. var paperIds = "";
  792. for (let paperId of this.selectedPaperIds) {
  793. if (!paperIds) {
  794. paperIds += paperId;
  795. } else {
  796. paperIds += "," + paperId;
  797. }
  798. }
  799. return paperIds;
  800. },
  801. courseInfoSelect() {
  802. var courseList = [];
  803. for (let course of this.courseList) {
  804. var courseInfo = course.name + "(" + course.code + ")";
  805. var courseNo = course.code;
  806. courseList.push({ courseNo: courseNo, courseInfo: courseInfo });
  807. }
  808. return courseList;
  809. },
  810. noBatchSelected() {
  811. return this.selectedPaperIds.length === 0;
  812. },
  813. ...mapState({ user: state => state.user })
  814. },
  815. watch: {
  816. $route: "initVue"
  817. },
  818. created() {
  819. this.initVue();
  820. }
  821. };
  822. </script>
  823. <style scoped src="../styles/Common.css"></style>