ImportPaper.vue 26 KB

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