ImportPaper.vue 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826
  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="40"></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, 200, 300]"
  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. sessionStorage.setItem("question_back", "false");
  456. this.$router.push({
  457. path: "/edit_paper/" + row.id + "/import_paper"
  458. });
  459. },
  460. deleteImportPaper(row) {
  461. this.$confirm("确认删除试卷吗?", "提示", {
  462. type: "warning"
  463. }).then(() => {
  464. this.loading = true;
  465. this.$http.delete(QUESTION_API + "/paper/" + row.id).then(
  466. () => {
  467. this.$notify({
  468. message: "删除成功",
  469. type: "success"
  470. });
  471. this.searchImportPaper();
  472. },
  473. error => {
  474. this.$notify({
  475. message: error.response.data.msg,
  476. type: "error"
  477. });
  478. this.loading = false;
  479. }
  480. );
  481. });
  482. },
  483. selectChange(row) {
  484. this.selectedPaperIds = [];
  485. row.forEach(element => {
  486. this.selectedPaperIds.push(element.id);
  487. });
  488. },
  489. batchDeletePaper() {
  490. var paperIds = this.paperIds;
  491. this.$confirm("确认删除试卷吗?", "提示", {
  492. type: "warning"
  493. }).then(() => {
  494. this.loading = true;
  495. this.$http.delete(QUESTION_API + "/paper/" + paperIds).then(
  496. () => {
  497. this.$notify({
  498. message: "删除成功",
  499. type: "success"
  500. });
  501. this.searchImportPaper();
  502. this.selectedPaperIds = [];
  503. },
  504. error => {
  505. this.$notify({
  506. message: error.response.data.msg,
  507. type: "error"
  508. });
  509. this.loading = false;
  510. }
  511. );
  512. });
  513. },
  514. //导入试卷
  515. impPaper() {
  516. this.$router.push({
  517. path: "/questions/import_paper_info"
  518. });
  519. },
  520. //查询所有课程
  521. getCourses(query) {
  522. this.courseLoading = true;
  523. this.$http
  524. .get(CORE_API + "/course/query?name=" + query + "&enable=true")
  525. .then(response => {
  526. this.courseList = response.data;
  527. this.courseLoading = false;
  528. });
  529. },
  530. useBasePaper() {
  531. this.loading = true;
  532. this.$http
  533. .put(QUESTION_API + "/useBasePaper/" + this.selectedPaperIds)
  534. .then(
  535. response => {
  536. console.log("come in response:", response);
  537. if (!response.data.desc) {
  538. this.$notify({
  539. message: "操作成功",
  540. type: "success"
  541. });
  542. } else {
  543. this.$notify({
  544. message: response.data.desc,
  545. type: "error"
  546. });
  547. }
  548. this.loading = false;
  549. },
  550. error => {
  551. var message = error.response.data.desc;
  552. var err = message
  553. .replace("[", "")
  554. .replace("]", "")
  555. .substring(message.indexOf("desc") + 4);
  556. this.$notify({
  557. message: err,
  558. type: "error"
  559. });
  560. this.loading = false;
  561. }
  562. );
  563. },
  564. //克隆试卷
  565. copyImportPaper(row) {
  566. this.copyPaperForm.paperName = "";
  567. this.copyPaperForm.courseNo = "";
  568. this.copyPaperId = row.id;
  569. this.copyPaperDialog = true;
  570. },
  571. //保存
  572. submitCopy(formData) {
  573. this.$refs[formData].validate(valid => {
  574. if (valid) {
  575. this.cloneLoading = true;
  576. this.$http
  577. .post(
  578. QUESTION_API +
  579. "/clonePaper/" +
  580. this.copyPaperId +
  581. "/" +
  582. this.copyPaperForm.paperName +
  583. "/" +
  584. this.copyPaperForm.courseNo
  585. )
  586. .then(() => {
  587. this.$notify({
  588. message: "复制成功",
  589. type: "success"
  590. });
  591. this.cloneLoading = false;
  592. this.copyPaperDialog = false;
  593. this.searchImportPaper();
  594. })
  595. .catch(error => {
  596. this.$notify({
  597. type: "error",
  598. message: error.response.data.msg
  599. });
  600. this.cloneLoading = false;
  601. });
  602. } else {
  603. return false;
  604. }
  605. });
  606. },
  607. removeItem() {
  608. sessionStorage.removeItem("import_paper");
  609. sessionStorage.removeItem("import_paper_currentPage");
  610. },
  611. expQuesType() {
  612. if (!this.formSearch.courseNo) {
  613. this.$notify({
  614. title: "警告",
  615. message: "请输入课程",
  616. type: "warning"
  617. });
  618. return;
  619. }
  620. var key = this.user.key;
  621. var token = this.user.token;
  622. window.location.href =
  623. QUESTION_API +
  624. "/paper/export/course/question/" +
  625. this.formSearch.courseNo +
  626. "?$key=" +
  627. key +
  628. "&$token=" +
  629. token;
  630. },
  631. exportOriginalPaper(row) {
  632. var key = this.user.key;
  633. var token = this.user.token;
  634. //window.location.href = QUESTION_API+"/originalPaper/export/"+row.id+"/"+ this.user.displayName;
  635. window.open(
  636. QUESTION_API +
  637. "/originalPaper/export/" +
  638. row.id +
  639. "/" +
  640. this.user.displayName +
  641. "?$key=" +
  642. key +
  643. "&$token=" +
  644. token
  645. );
  646. },
  647. openInit() {
  648. this.difficultyDegree = 0.1;
  649. this.publicity = true;
  650. this.quesPropertyDialog = true;
  651. },
  652. //重置
  653. resetForm() {
  654. this.difficultyDegree = 0.1;
  655. this.publicity = true;
  656. },
  657. resetForm2(formData) {
  658. this.copyPaperForm.paperName = "";
  659. this.copyPaperForm.courseNo = "";
  660. this.$refs[formData].clearValidate();
  661. },
  662. back2(formData) {
  663. this.resetForm2(formData);
  664. this.copyPaperDialog = false;
  665. },
  666. //试卷修改属性 openQuesPro
  667. openQuesPro() {
  668. if (!this.selectedPaperIds || this.selectedPaperIds.length < 1) {
  669. this.$notify({
  670. title: "警告",
  671. message: "请选择试卷",
  672. type: "warning"
  673. });
  674. return;
  675. }
  676. this.updateType = "paper";
  677. this.openInit();
  678. },
  679. //课程修改属性 openQuesProC
  680. openQuesProC() {
  681. if (!this.formSearch.courseNo) {
  682. this.$notify({
  683. title: "警告",
  684. message: "请输入课程",
  685. type: "warning"
  686. });
  687. return;
  688. }
  689. this.updateType = "course";
  690. this.openInit();
  691. },
  692. closePropertyDialog() {
  693. this.quesPropertyDialog = false;
  694. },
  695. submitUpdate() {
  696. console.log("aaa");
  697. if (this.updateType == "paper") {
  698. console.log("paper");
  699. this.updateQuesPropertyByPaper();
  700. }
  701. if (this.updateType == "course") {
  702. console.log("course");
  703. this.updateQuesPropertyByCourse();
  704. }
  705. },
  706. updateQuesPropertyByPaper() {
  707. this.quesLoading = true;
  708. this.$http
  709. .put(
  710. QUESTION_API +
  711. "/question/updatePro/paperIds/" +
  712. this.selectedPaperIds +
  713. "/" +
  714. this.difficultyDegree +
  715. "/" +
  716. this.publicity
  717. )
  718. .then(() => {
  719. this.$notify({
  720. message: "更新成功",
  721. type: "success"
  722. });
  723. this.searchImportPaper();
  724. this.quesLoading = false;
  725. this.closePropertyDialog();
  726. })
  727. .catch(() => {
  728. this.$notify({
  729. type: "error",
  730. message: "更新失败"
  731. });
  732. this.quesLoading = false;
  733. this.closePropertyDialog();
  734. });
  735. },
  736. updateQuesPropertyByCourse() {
  737. this.quesLoading = true;
  738. var orgId = this.user.rootOrgId;
  739. this.$http
  740. .put(
  741. QUESTION_API +
  742. "/question/updatePro/courseCode/" +
  743. this.formSearch.courseNo +
  744. "/" +
  745. this.difficultyDegree +
  746. "/" +
  747. this.publicity +
  748. "/" +
  749. orgId
  750. )
  751. .then(() => {
  752. this.$notify({
  753. message: "更新成功",
  754. type: "success"
  755. });
  756. this.quesLoading = false;
  757. this.closePropertyDialog();
  758. })
  759. .catch(() => {
  760. this.$notify({
  761. type: "error",
  762. message: "更新失败"
  763. });
  764. this.quesLoading = false;
  765. this.closePropertyDialog();
  766. });
  767. },
  768. initVue() {
  769. this.isClear = this.$route.params.isClear;
  770. if (this.isClear == 0 || !this.isClear) {
  771. this.removeItem();
  772. this.formSearch = {
  773. courseNo: "",
  774. level: "",
  775. name: ""
  776. };
  777. this.currentPage = 1;
  778. } else {
  779. this.formSearch = JSON.parse(sessionStorage.getItem("import_paper"));
  780. this.currentPage =
  781. sessionStorage.getItem("import_paper_currentPage") == null
  782. ? 1
  783. : parseInt(sessionStorage.getItem("import_paper_currentPage"));
  784. }
  785. if (this.formSearch.courseName) {
  786. this.getCourses(this.formSearch.courseName);
  787. }
  788. this.handleCurrentChange(this.currentPage);
  789. }
  790. },
  791. computed: {
  792. paperIds() {
  793. var paperIds = "";
  794. for (let paperId of this.selectedPaperIds) {
  795. if (!paperIds) {
  796. paperIds += paperId;
  797. } else {
  798. paperIds += "," + paperId;
  799. }
  800. }
  801. return paperIds;
  802. },
  803. courseInfoSelect() {
  804. var courseList = [];
  805. for (let course of this.courseList) {
  806. var courseInfo = course.name + "(" + course.code + ")";
  807. var courseNo = course.code;
  808. courseList.push({ courseNo: courseNo, courseInfo: courseInfo });
  809. }
  810. return courseList;
  811. },
  812. noBatchSelected() {
  813. return this.selectedPaperIds.length === 0;
  814. },
  815. ...mapState({ user: state => state.user })
  816. },
  817. watch: {
  818. $route: "initVue"
  819. },
  820. created() {
  821. this.initVue();
  822. }
  823. };
  824. </script>
  825. <style scoped src="../styles/Common.css"></style>