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. @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. >
  280. <el-option
  281. v-for="item in courseInfoSelect"
  282. :label="item.courseInfo"
  283. :value="item.courseNo"
  284. :key="item.courseNo"
  285. >
  286. </el-option>
  287. </el-select>
  288. </el-form-item>
  289. </el-row>
  290. <el-row class="margin_top_10 margin_left_120">
  291. <el-button type="primary" @click="submitCopy('copyPaperForm')"
  292. >保 存</el-button
  293. >
  294. <el-button @click="resetForm2('copyPaperForm')"
  295. ><i class="el-icon-refresh"></i> 重 置</el-button
  296. >
  297. <el-button @click="back2('copyPaperForm')" type="primary"
  298. ><i class="el-icon-arrow-left"></i> 返 回</el-button
  299. >
  300. </el-row>
  301. </el-form>
  302. </el-dialog>
  303. <el-dialog
  304. title="属性修改"
  305. :visible.sync="quesPropertyDialog"
  306. width="500px"
  307. >
  308. <el-form
  309. :loading="quesLoading"
  310. label-position="right"
  311. label-width="120px"
  312. >
  313. <el-row>
  314. <el-form-item label="难 度">
  315. <el-select v-model="difficultyDegree" class="dialog_input_width">
  316. <el-option
  317. v-for="item in difficultyDegreeList"
  318. :label="item.label"
  319. :value="item.value"
  320. :key="item.value"
  321. ></el-option>
  322. </el-select>
  323. </el-form-item>
  324. </el-row>
  325. <el-row>
  326. <el-form-item label="公开度">
  327. <el-select v-model="publicity" class="dialog_input_width">
  328. <el-option
  329. v-for="item in publicityList"
  330. :label="item.label"
  331. :value="item.value"
  332. :key="item.value"
  333. ></el-option>
  334. </el-select>
  335. </el-form-item>
  336. </el-row>
  337. <el-row class="margin_top_10 margin_left_120">
  338. <el-button
  339. type="primary"
  340. @click="submitUpdate()"
  341. v-loading.fullscreen.lock="quesLoading"
  342. >保 存</el-button
  343. >
  344. <el-button @click="resetForm"
  345. ><i class="el-icon-refresh"></i> 重 置</el-button
  346. >
  347. <el-button @click="closePropertyDialog" type="primary"
  348. ><i class="el-icon-arrow-left"></i> 返 回</el-button
  349. >
  350. </el-row>
  351. </el-form>
  352. </el-dialog>
  353. </section>
  354. </template>
  355. <script>
  356. import { CORE_API, QUESTION_API } from "@/constants/constants";
  357. import { LEVEL_TYPE, PUBLICITY_LIST } from "../constants/constants";
  358. import { mapState } from "vuex";
  359. import LinkTitlesCustom from "@/components/LinkTitlesCustom.vue";
  360. export default {
  361. components: { LinkTitlesCustom },
  362. data() {
  363. return {
  364. courseLoading: false,
  365. quesLoading: false,
  366. formSearch: {
  367. courseNo: "",
  368. courseName: "",
  369. level: "",
  370. name: ""
  371. },
  372. tableData: [],
  373. levelList: LEVEL_TYPE,
  374. currentPage: 1,
  375. pageSize: 10,
  376. isClear: 0,
  377. total: 0,
  378. loading: false,
  379. courseList: [],
  380. options: [],
  381. selectedPaperIds: [],
  382. cloneLoading: false,
  383. copyPaperDialog: false,
  384. copyPaperForm: {
  385. paperName: "",
  386. courseNo: null
  387. },
  388. copyPaperId: "",
  389. quesPropertyDialog: false,
  390. difficultyDegree: 0.1,
  391. publicity: true,
  392. updateType: "",
  393. difficultyDegreeList: [
  394. { label: 0.1, value: 0.1 },
  395. { label: 0.2, value: 0.2 },
  396. { label: 0.3, value: 0.3 },
  397. { label: 0.4, value: 0.4 },
  398. { label: 0.5, value: 0.5 },
  399. { label: 0.6, value: 0.6 },
  400. { label: 0.7, value: 0.7 },
  401. { label: 0.8, value: 0.8 },
  402. { label: 0.9, value: 0.9 },
  403. { label: 1.0, value: 1.0 }
  404. ],
  405. publicityList: PUBLICITY_LIST,
  406. rules: {
  407. paperName: [
  408. { required: true, message: "请输试卷名称", trigger: "blur" }
  409. ],
  410. courseNo: [
  411. { required: true, message: "请选择课程名称", trigger: "change" }
  412. ]
  413. }
  414. };
  415. },
  416. methods: {
  417. searchFrom() {
  418. this.currentPage = 1;
  419. this.searchImportPaper();
  420. },
  421. searchImportPaper() {
  422. var pageNo = Number(this.currentPage);
  423. this.currentPage = 1;
  424. this.loading = true;
  425. var url = QUESTION_API + "/importPaper/" + pageNo + "/" + this.pageSize;
  426. this.$http.get(url, { params: this.formSearch }).then(response => {
  427. this.tableData = response.data.content;
  428. this.total = response.data.totalElements;
  429. this.currentPage = pageNo;
  430. this.loading = false;
  431. });
  432. },
  433. handleCurrentChange(val) {
  434. this.currentPage = val;
  435. this.searchImportPaper();
  436. },
  437. handleSizeChange(val) {
  438. this.pageSize = val;
  439. this.currentPage = 1;
  440. this.searchImportPaper();
  441. },
  442. getCourseName(courseNo) {
  443. for (let course of this.courseList) {
  444. if (course.code == courseNo) {
  445. this.formSearch.courseName = course.name;
  446. }
  447. }
  448. },
  449. editImportPaper(row) {
  450. //缓存查询对象
  451. this.getCourseName(this.formSearch.courseNo);
  452. sessionStorage.setItem("import_paper", JSON.stringify(this.formSearch));
  453. sessionStorage.setItem("import_paper_currentPage", this.currentPage);
  454. this.$router.push({
  455. path: "/edit_paper/" + row.id + "/import_paper"
  456. });
  457. },
  458. deleteImportPaper(row) {
  459. this.$confirm("确认删除试卷吗?", "提示", {
  460. type: "warning"
  461. }).then(() => {
  462. this.loading = true;
  463. this.$http.delete(QUESTION_API + "/paper/" + row.id).then(
  464. () => {
  465. this.$notify({
  466. message: "删除成功",
  467. type: "success"
  468. });
  469. this.searchImportPaper();
  470. },
  471. error => {
  472. this.$notify({
  473. message: error.response.data.msg,
  474. type: "error"
  475. });
  476. this.loading = false;
  477. }
  478. );
  479. });
  480. },
  481. selectChange(row) {
  482. this.selectedPaperIds = [];
  483. row.forEach(element => {
  484. this.selectedPaperIds.push(element.id);
  485. });
  486. },
  487. batchDeletePaper() {
  488. var paperIds = this.paperIds;
  489. this.$confirm("确认删除试卷吗?", "提示", {
  490. type: "warning"
  491. }).then(() => {
  492. this.loading = true;
  493. this.$http.delete(QUESTION_API + "/paper/" + paperIds).then(
  494. () => {
  495. this.$notify({
  496. message: "删除成功",
  497. type: "success"
  498. });
  499. this.searchImportPaper();
  500. this.selectedPaperIds = [];
  501. },
  502. error => {
  503. this.$notify({
  504. message: error.response.data.msg,
  505. type: "error"
  506. });
  507. this.loading = false;
  508. }
  509. );
  510. });
  511. },
  512. //导入试卷
  513. impPaper() {
  514. this.$router.push({
  515. path: "/questions/import_paper_info"
  516. });
  517. },
  518. //查询所有课程
  519. getCourses(query) {
  520. this.courseLoading = true;
  521. this.$http
  522. .get(CORE_API + "/course/query?name=" + query + "&enable=true")
  523. .then(response => {
  524. this.courseList = response.data;
  525. this.courseLoading = false;
  526. });
  527. },
  528. useBasePaper() {
  529. this.loading = true;
  530. this.$http
  531. .put(QUESTION_API + "/useBasePaper/" + this.selectedPaperIds)
  532. .then(
  533. response => {
  534. console.log("come in response:", response);
  535. if (!response.data.desc) {
  536. this.$notify({
  537. message: "操作成功",
  538. type: "success"
  539. });
  540. } else {
  541. this.$notify({
  542. message: response.data.desc,
  543. type: "error"
  544. });
  545. }
  546. this.loading = false;
  547. },
  548. error => {
  549. var message = error.response.data.desc;
  550. var err = message
  551. .replace("[", "")
  552. .replace("]", "")
  553. .substring(message.indexOf("desc") + 4);
  554. this.$notify({
  555. message: err,
  556. type: "error"
  557. });
  558. this.loading = false;
  559. }
  560. );
  561. },
  562. //克隆试卷
  563. copyImportPaper(row) {
  564. this.copyPaperForm.paperName = "";
  565. this.copyPaperForm.courseNo = "";
  566. this.copyPaperId = row.id;
  567. this.copyPaperDialog = true;
  568. },
  569. //保存
  570. submitCopy(formData) {
  571. this.$refs[formData].validate(valid => {
  572. if (valid) {
  573. this.cloneLoading = true;
  574. this.$http
  575. .post(
  576. QUESTION_API +
  577. "/clonePaper/" +
  578. this.copyPaperId +
  579. "/" +
  580. this.copyPaperForm.paperName +
  581. "/" +
  582. this.copyPaperForm.courseNo
  583. )
  584. .then(() => {
  585. this.$notify({
  586. message: "复制成功",
  587. type: "success"
  588. });
  589. this.cloneLoading = false;
  590. this.copyPaperDialog = false;
  591. this.searchImportPaper();
  592. })
  593. .catch(() => {
  594. this.$notify({
  595. type: "error",
  596. message: "试卷名称重复,请重新命名"
  597. });
  598. this.cloneLoading = false;
  599. });
  600. } else {
  601. return false;
  602. }
  603. });
  604. },
  605. removeItem() {
  606. sessionStorage.removeItem("import_paper");
  607. sessionStorage.removeItem("import_paper_currentPage");
  608. },
  609. expQuesType() {
  610. if (!this.formSearch.courseNo) {
  611. this.$notify({
  612. title: "警告",
  613. message: "请输入课程",
  614. type: "warning"
  615. });
  616. return;
  617. }
  618. var key = this.user.key;
  619. var token = this.user.token;
  620. window.location.href =
  621. QUESTION_API +
  622. "/paper/export/course/question/" +
  623. this.formSearch.courseNo +
  624. "?$key=" +
  625. key +
  626. "&$token=" +
  627. token;
  628. },
  629. exportOriginalPaper(row) {
  630. var key = this.user.key;
  631. var token = this.user.token;
  632. //window.location.href = QUESTION_API+"/originalPaper/export/"+row.id+"/"+ this.user.displayName;
  633. window.open(
  634. QUESTION_API +
  635. "/originalPaper/export/" +
  636. row.id +
  637. "/" +
  638. this.user.displayName +
  639. "?$key=" +
  640. key +
  641. "&$token=" +
  642. token
  643. );
  644. },
  645. openInit() {
  646. this.difficultyDegree = 0.1;
  647. this.publicity = true;
  648. this.quesPropertyDialog = true;
  649. },
  650. //重置
  651. resetForm() {
  652. this.difficultyDegree = 0.1;
  653. this.publicity = true;
  654. },
  655. resetForm2(formData) {
  656. this.copyPaperForm.paperName = "";
  657. this.copyPaperForm.courseNo = "";
  658. this.$refs[formData].clearValidate();
  659. },
  660. back2(formData) {
  661. this.resetForm2(formData);
  662. this.copyPaperDialog = false;
  663. },
  664. //试卷修改属性 openQuesPro
  665. openQuesPro() {
  666. if (!this.selectedPaperIds || this.selectedPaperIds.length < 1) {
  667. this.$notify({
  668. title: "警告",
  669. message: "请选择试卷",
  670. type: "warning"
  671. });
  672. return;
  673. }
  674. this.updateType = "paper";
  675. this.openInit();
  676. },
  677. //课程修改属性 openQuesProC
  678. openQuesProC() {
  679. if (!this.formSearch.courseNo) {
  680. this.$notify({
  681. title: "警告",
  682. message: "请输入课程",
  683. type: "warning"
  684. });
  685. return;
  686. }
  687. this.updateType = "course";
  688. this.openInit();
  689. },
  690. closePropertyDialog() {
  691. this.quesPropertyDialog = false;
  692. },
  693. submitUpdate() {
  694. console.log("aaa");
  695. if (this.updateType == "paper") {
  696. console.log("paper");
  697. this.updateQuesPropertyByPaper();
  698. }
  699. if (this.updateType == "course") {
  700. console.log("course");
  701. this.updateQuesPropertyByCourse();
  702. }
  703. },
  704. updateQuesPropertyByPaper() {
  705. this.quesLoading = true;
  706. this.$http
  707. .put(
  708. QUESTION_API +
  709. "/question/updatePro/paperIds/" +
  710. this.selectedPaperIds +
  711. "/" +
  712. this.difficultyDegree +
  713. "/" +
  714. this.publicity
  715. )
  716. .then(() => {
  717. this.$notify({
  718. message: "更新成功",
  719. type: "success"
  720. });
  721. this.searchImportPaper();
  722. this.quesLoading = false;
  723. this.closePropertyDialog();
  724. })
  725. .catch(() => {
  726. this.$notify({
  727. type: "error",
  728. message: "更新失败"
  729. });
  730. this.quesLoading = false;
  731. this.closePropertyDialog();
  732. });
  733. },
  734. updateQuesPropertyByCourse() {
  735. this.quesLoading = true;
  736. var orgId = this.user.rootOrgId;
  737. this.$http
  738. .put(
  739. QUESTION_API +
  740. "/question/updatePro/courseCode/" +
  741. this.formSearch.courseNo +
  742. "/" +
  743. this.difficultyDegree +
  744. "/" +
  745. this.publicity +
  746. "/" +
  747. orgId
  748. )
  749. .then(() => {
  750. this.$notify({
  751. message: "更新成功",
  752. type: "success"
  753. });
  754. this.quesLoading = false;
  755. this.closePropertyDialog();
  756. })
  757. .catch(() => {
  758. this.$notify({
  759. type: "error",
  760. message: "更新失败"
  761. });
  762. this.quesLoading = false;
  763. this.closePropertyDialog();
  764. });
  765. },
  766. initVue() {
  767. this.isClear = this.$route.params.isClear;
  768. if (this.isClear == 0 || !this.isClear) {
  769. this.removeItem();
  770. this.formSearch = {
  771. courseNo: "",
  772. level: "",
  773. name: ""
  774. };
  775. this.currentPage = 1;
  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.handleCurrentChange(this.currentPage);
  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>