ImportPaper.vue 25 KB

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