generating.vue 37 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365
  1. <template>
  2. <div class="generating_container app-container">
  3. <el-card>
  4. <div class="header_top">
  5. <div class="pointer" :class="tabActive == 0 ? 'active ' : ''" @click="switchTab(0)">
  6. 手动组卷
  7. </div>
  8. <div class="pointer" :class="tabActive == 1 ? 'active' : ''" @click="switchTab(1)">
  9. 智能组卷
  10. </div>
  11. <div class="pointer" :class="tabActive == 2 ? 'active' : ''" @click="switchTab(2)">
  12. 组卷记录
  13. </div>
  14. </div>
  15. <div class="radio_contianer">
  16. <div v-if="tabActive != 2">
  17. <span>选题</span>
  18. <el-radio-group v-model="selectQueId" size="mini" @change="toggleSelect">
  19. <el-radio-button :label="index" v-for="(item, index) in selectQue" :key="index">{{ item }}</el-radio-button>
  20. </el-radio-group>
  21. </div>
  22. <div v-show="tabActive == 2">
  23. <span>科目</span>
  24. <el-radio-group v-model="zujuanSubjectId" size="mini" @change="toggleZujuanSubject">
  25. <el-radio-button :label="null"> 所有 </el-radio-button>
  26. <el-radio-button :label="item.subjectid" v-for="(item, index) in subjectList" :key="index">
  27. {{ item.subjectname }}
  28. </el-radio-button>
  29. </el-radio-group>
  30. </div>
  31. <div v-show="tabActive != 2">
  32. <span>科目</span>
  33. <el-radio-group v-model="form.subjectId" size="mini" @change="toggleSub">
  34. <el-radio-button :label="item.subjectid" v-for="(item, index) in subjectList" :key="index">
  35. {{ item.subjectname }}
  36. </el-radio-button>
  37. </el-radio-group>
  38. </div>
  39. <div v-show="selectQueId == 0 && tabActive != 2">
  40. <span>版本</span>
  41. <el-radio-group v-model="form.editionId" size="mini" @change="toggleEdi">>
  42. <el-radio-button :label="key" v-for="(value, key) in editionList" :key="key">
  43. {{ value }}
  44. </el-radio-button>
  45. </el-radio-group>
  46. </div>
  47. <div v-show="selectQueId == 0 && tabActive != 2">
  48. <span>学册</span>
  49. <el-radio-group v-model="form.gradeId" size="mini" @change="toggleGrade">>
  50. <el-radio-button :label="item.gradeid" v-for="item in gradeList" :key="item.gradeid">
  51. {{ item.gradename }}
  52. </el-radio-button>
  53. </el-radio-group>
  54. </div>
  55. <div v-show="tabActive == 0 && tabActive != 2">
  56. <span>题型</span>
  57. <el-radio-group v-model="form.queTypeName" size="mini" @change="toggleType">
  58. <el-radio-button :label="item" v-for="(item, index) in queTypeList" :key="index">{{ item }}
  59. </el-radio-button>
  60. </el-radio-group>
  61. </div>
  62. </div>
  63. </el-card>
  64. <!-- 主体 -->
  65. <el-container v-show="tabActive != 2">
  66. <el-aside width="284px" style="
  67. padding-bottom: 104px;
  68. background: #fff;
  69. margin-right: 24px;
  70. height: 600px;
  71. overflow: scroll;
  72. overflow-x: hidden;
  73. ">
  74. <div class="aside_header">
  75. <span>CONTACT</span>
  76. <span>{{selectQueId == 0?'章节目录':'知识点目录'}}</span>
  77. </div>
  78. <div class="aside_content" v-show="selectQueId == 0">
  79. <el-tree highlight-current :expand-on-click-node="false" :data="treeList" :props="defaultProps" node-key="$treeNodeId" @node-click="clickChapterNode" ref="chapterTree"></el-tree>
  80. </div>
  81. <div class="aside_content" v-show="selectQueId == 1">
  82. <el-tree highlight-current :expand-on-click-node="false" :data="knowledgeTree" :props="knowledgeProps" node-key="$treeNodeId" @node-click="clickKonwNode" ref="knowTree"></el-tree>
  83. </div>
  84. </el-aside>
  85. <!-- 手动组卷 -->
  86. <el-main style="background: #fff" v-show="tabActive == 0">
  87. <!-- 头部 -->
  88. <div class="main_header">
  89. <div class="left">
  90. <div class="main_tit">{{ title }}</div>
  91. <!-- 暂不支持 -->
  92. <div class="filter" style="display: flex; align-items: center" v-if="false">
  93. <input type="checkbox" /><span>过滤已做题</span>
  94. </div>
  95. </div>
  96. <div class="search_box">
  97. <input v-model="searchText" placeholder="请输入内容" />
  98. <img src="@/assets/images/icon_search2.png" alt="" @click="toggleType(form.queTypeName)" />
  99. </div>
  100. </div>
  101. <!-- 主题内容 -->
  102. <div class="main_con">
  103. <!-- 题目 -->
  104. <div class="paper_questions" id="question_list">
  105. <div class="que_item" v-for="(item, index) in queList" :key="item.id">
  106. <div class="que_content">
  107. <div class="que-content-title">
  108. <div class="index">{{ (pageSize*(pageNum-1)+index+1) }}.</div>
  109. <div v-html="item.title"></div>
  110. </div>
  111. <div class="que-option">
  112. <div v-if="item.optionA">
  113. <span>A</span>
  114. <span v-html="item.optionA"></span>
  115. </div>
  116. <div v-if="item.optionB">
  117. <span>B</span>
  118. <span v-html="item.optionB"></span>
  119. </div>
  120. <div v-if="item.optionC">
  121. <span>C</span>
  122. <span v-html="item.optionC"></span>
  123. </div>
  124. <div v-if="item.optionD">
  125. <span>D</span>
  126. <span v-html="item.optionD"></span>
  127. </div>
  128. </div>
  129. </div>
  130. <div class="que_footer">
  131. <div class="spans">
  132. <span class="id">ID: {{ item.id }}</span>
  133. <span>题型: {{ item.qtpye }}</span>
  134. <span>难度: 一般</span>
  135. </div>
  136. <div class="operation">
  137. <div class="shoucan">
  138. <div v-show="item.collect" @click="toCancelCollectQue(item)" style="display: flex; align-items: center">
  139. <img src="@/assets/images/icon_shoucang_s.png" alt="" style="margin-right: 8px" />
  140. <span>已收藏</span>
  141. </div>
  142. <div v-show="!item.collect" @click="toCollectQue(item)" style="display: flex; align-items: center">
  143. <img src="@/assets/images/icon_shoucang_n.png" style="margin-right: 8px" alt="" />
  144. <span>收藏</span>
  145. </div>
  146. </div>
  147. <div class="jiucuo" @click="$refs.correct.open(item.id)">
  148. <img src="@/assets/images/icon_jiucuo.png" alt="" />
  149. <span>纠错</span>
  150. </div>
  151. <div class="detail" @click="viewDetail(index)">
  152. <img src="@/assets/images/icon_chakan.png" alt="" />
  153. <span>查看详情>></span>
  154. </div>
  155. <div class="addQue">
  156. <el-button @click="addQueCard(item)" icon="el-icon-shopping-cart-2" type="success" plain :disabled="
  157. queCardForm.queList.some((q) => q.id == item.id)
  158. ">加入选题</el-button>
  159. </div>
  160. </div>
  161. </div>
  162. <div class="parse" v-show="item.createTime" v-html="item.answer2"></div>
  163. </div>
  164. <div v-if="queList.length == 0" class="empty-text">
  165. 暂时没有内容
  166. </div>
  167. </div>
  168. </div>
  169. <pagination v-if="total > 0" :total="total" :page.sync="pageNum" :limit.sync="pageSize" @pagination="handleSizeChange" />
  170. </el-main>
  171. <!-- 智能组卷 -->
  172. <el-main v-show="tabActive == 1" style="background: #fff">
  173. <div class="knowPoints">
  174. <div class="tit">
  175. <span>已选知识点({{ tags.length }})</span>
  176. <div class="clear">
  177. <img src="@/assets/images/icon_qingkong.png" alt="" />
  178. <span>清空</span>
  179. </div>
  180. </div>
  181. <el-divider></el-divider>
  182. <!-- tags -->
  183. <div class="tags">
  184. <el-tag v-for="tag in tags" :key="tag.id" closable style="margin-right: 24px; margin-bottom: 24px" @close="handleClose(tag)">
  185. {{ tag.name }}
  186. </el-tag>
  187. </div>
  188. </div>
  189. <div class="que">
  190. <div class="tit">
  191. <span>题型/题量</span>
  192. <div class="clear">
  193. <img src="@/assets/images/icon_qingkong.png" alt="" />
  194. <span>清空</span>
  195. </div>
  196. </div>
  197. <el-divider></el-divider>
  198. <!-- 计数器 -->
  199. <div class="computer">
  200. <div class="computer_item" v-for="(item, index) in queCount" :key="index">
  201. <span class="tit">{{ item.name }}</span>
  202. <el-input-number controls-position="right" @change="handleChange" v-model="item.count" :min="0" :max="item.num" style="margin: 0 8px"></el-input-number>
  203. <span class="select">可选{{ item.num }}道</span>
  204. </div>
  205. </div>
  206. </div>
  207. <!-- 生成试卷 -->
  208. <div style="
  209. display: flex;
  210. justify-content: center;
  211. margin-top: 90px;
  212. margin-bottom: 90px;
  213. ">
  214. <span class="generateExam" @click="getQuestionsByQTypeAndNum">生成试卷</span>
  215. </div>
  216. </el-main>
  217. </el-container>
  218. <!-- 组卷记录 -->
  219. <el-container style="background: #fff; min-height: 500px; display: block" v-show="tabActive == 2">
  220. <el-table :data="examRecord" style="width: 100%" v-loading="tableLoading">
  221. <el-table-column type="index" label="序号" width="50px">
  222. </el-table-column>
  223. <el-table-column prop="subjectName" label="科目"> </el-table-column>
  224. <el-table-column prop="name" label="试卷标题">
  225. <template slot-scope="scope">
  226. <el-link @click="clickEditPaperName(scope.row)"><i class="el-icon-edit"></i>{{ scope.row.name }}</el-link>
  227. </template>
  228. </el-table-column>
  229. <el-table-column prop="remark" label="试卷概要"> </el-table-column>
  230. <el-table-column prop="status" label="状态"> </el-table-column>
  231. <el-table-column prop="createdTime" label="组卷时间"> </el-table-column>
  232. <el-table-column label="操作">
  233. <template slot-scope="scope">
  234. <div>
  235. <span style="color: #47c6a2; margin-right: 16px; cursor: pointer" @click="clickEditPaper(scope.row)">编辑</span>
  236. <span style="color: #ff4e00; margin-right: 16px; cursor: pointer" @click="clickDownloadPaper(scope.row.paperId)">下载</span>
  237. <i class="el-icon-delete table-delete-icon" @click="clickDeletePopup(scope.$index, examRecord)"></i>
  238. </div>
  239. <div v-hasPermi="['front:generatingPaperCenter:saveToPersonResources']" style="color: #608edf; margin-right: 16px; cursor: pointer" @click="clickSendToResource(scope.row.paperId)">
  240. 发送至个人资源库
  241. </div>
  242. </template>
  243. </el-table-column>
  244. <template slot="empty">
  245. <img src="@/assets/images/icon_data.png" />
  246. <span>没有信息</span>
  247. </template>
  248. </el-table>
  249. <el-pagination :page-sizes="[100, 200, 300, 400]" :page-size="100" layout="prev,pager,next,jumper,total,sizes" :total="examRecordTotal">
  250. </el-pagination>
  251. </el-container>
  252. <!-- 试题篮 -->
  253. <div class="queBoxer" v-show="tabActive == 0">
  254. <div class="left">
  255. <div class="tit">
  256. <i class="el-icon-shopping-cart-2" style="margin-bottom: 10px"></i>
  257. <div style="width: 17px; margin-bottom: 10px">试题篮</div>
  258. <span class="count" style="background: #ff4e00; padding: 2px 5px; margin-bottom: 15px">{{ queCardForm.queList.length }}</span>
  259. </div>
  260. <div style="cursor: pointer" @click="show = !show">
  261. <i :class="show ? 'el-icon-arrow-right' : 'el-icon-arrow-left'"></i>
  262. </div>
  263. </div>
  264. <div class="main">
  265. <el-collapse-transition>
  266. <div v-show="show">
  267. <div style="margin-bottom: 30px">
  268. <div style="margin-bottom: 10px">
  269. 共({{ queCardForm.queList.length }})道题
  270. </div>
  271. <div v-for="(value, key) in groupedCardQueList" :key="key + value.length" style="margin-top: 3px; color: #666666">
  272. <span>{{ key }}</span><span> {{ value.length }} </span>道
  273. </div>
  274. </div>
  275. <div>
  276. <p style="
  277. color: #ff4e00;
  278. text-align: right;
  279. border-bottom: 1px solid #dedede;
  280. ">
  281. <span @click="clearQueCard" style="cursor: pointer"> 清空</span>
  282. </p>
  283. </div>
  284. <div class="btn" @click="createdPaper">生成试卷</div>
  285. </div>
  286. </el-collapse-transition>
  287. </div>
  288. </div>
  289. <!-- 弹出警告 -->
  290. <el-dialog title="警告" :visible.sync="dialogVisible" width="30%">
  291. <span>科目不一致,请清空试题篮或选择同一科目</span>
  292. <span slot="footer" class="dialog-footer">
  293. <el-button type="primary" @click="dialogVisible = false">确 定</el-button>
  294. </span>
  295. </el-dialog>
  296. <el-dialog title="修改试卷标题" :visible.sync="dialogPaperNameVisible" width="400px">
  297. <el-input v-model="dialogPaperName" placeholder="请输入试卷标题"></el-input>
  298. <span slot="footer" class="dialog-footer">
  299. <el-button type="primary" @click="savePaperName">确 定</el-button>
  300. </span>
  301. </el-dialog>
  302. <correct-question ref="correct"></correct-question>
  303. </div>
  304. </template>
  305. <script>
  306. import {
  307. smartSubjectList,
  308. smartGradeList,
  309. editionList,
  310. qtBySubject,
  311. treeList,
  312. listByChapter,
  313. knowledgeTree,
  314. listByKnowledge,
  315. countByChapter,
  316. queCollect,
  317. queCancelCollect,
  318. countByKnowledge,
  319. paperRecords,
  320. getQuestionCardList,
  321. deleteQuestionCard,
  322. addToQuestionCard,
  323. listBottoms,
  324. savePaperInfo,
  325. knowByChapter,
  326. deletePaper,
  327. getQuestionsByQTypeAndNum,
  328. getQuestionsByIds,
  329. download,
  330. listCustomerPaperQeustions,
  331. saveToPersonResources,
  332. updateNameById,
  333. } from "@/api/webApi/webQue.js";
  334. import { mapGetters } from "vuex"
  335. import correctQuestion from '../../components/MxPaper/plus/correct-question-dialog.vue';
  336. export default {
  337. components: { correctQuestion },
  338. data() {
  339. return {
  340. dialogVisible: false,
  341. tableLoading: false,
  342. examRecord: [],
  343. tabActive: 0,
  344. searchText: '',
  345. form: {
  346. subjectId: 0,
  347. editionId: 0,
  348. gradeId: 0,
  349. queTypeName: "",
  350. chapterId: 0,
  351. knowledgeId: 0,
  352. knowledgeIds: [],
  353. listBottoms: [],
  354. },
  355. show: false,
  356. // 知识点标签
  357. tags: [],
  358. // 题型/选题数据
  359. queCount: [],
  360. knowledgeProps: {
  361. label: "name",
  362. children: "children",
  363. },
  364. defaultProps: {
  365. label: "name",
  366. children: "children",
  367. },
  368. selectQueId: 0,
  369. selectQue: ["按章节选题", "按知识点选题"],
  370. subjectList: [],
  371. gradeList: [],
  372. editionList: [],
  373. queTypeList: [],
  374. allQueType: "所有",
  375. treeList: [],
  376. queList: [],
  377. title: "",
  378. knowledgeTree: [],
  379. queCardForm: {
  380. queList: [],
  381. },
  382. total: 0,
  383. pageNum: 0,
  384. pageSize: 10,
  385. examRecordTotal: 0,
  386. // 在选题栏里面的题目id集合
  387. topicblueIds: [],
  388. // 修改试卷标题
  389. dialogPaperNameVisible: false,
  390. dialogPager: {},
  391. dialogPaperName: "",
  392. zujuanSubjectId: null,
  393. };
  394. },
  395. computed: {
  396. formQueTypeName() {
  397. return this.form.queTypeName == this.allQueType
  398. ? ""
  399. : this.form.queTypeName;
  400. },
  401. groupedCardQueList() {
  402. let groupedCard = {};
  403. this.queCardForm.queList.forEach((que) => {
  404. if (!groupedCard[que.qtpye]) groupedCard[que.qtpye] = [];
  405. let groupedQueByType = groupedCard[que.qtpye];
  406. groupedQueByType.push(que);
  407. });
  408. return groupedCard;
  409. },
  410. ...mapGetters(["period"])
  411. },
  412. created() {
  413. let query = this.$route.query;
  414. if (query.hasOwnProperty("tabActive")) {
  415. this.switchTab(query.tabActive);
  416. }
  417. this.getSubjectList();
  418. getQuestionCardList().then((res) => {
  419. this.queCardForm.queList = res.data;
  420. this.topicblueIds = res.data.map((item) => {
  421. return item.id;
  422. });
  423. });
  424. },
  425. methods: {
  426. getQuestionsByQTypeAndNum() {
  427. // 智能组卷的生成试卷
  428. if (this.tabActive == 1) {
  429. let queCount = this.queCount;
  430. let req = [];
  431. let allQue = 0;
  432. queCount.forEach((item) => {
  433. if (item.count > 0) {
  434. allQue = allQue + item.count;
  435. req.push({
  436. subjectid: this.form.subjectId,
  437. qtpye: item.name,
  438. diff: 1,
  439. number: item.count,
  440. chapterid: this.form.chapterId,
  441. gradeid: this.form.gradeId,
  442. editionid: this.form.editionId,
  443. knowledgeIds: this.form.knowledgeIds,
  444. });
  445. }
  446. });
  447. if (allQue > 100) {
  448. this.msgError("选题上限是100题哦");
  449. return;
  450. } else if (allQue == 0) {
  451. this.msgError("你还未选择题目");
  452. return;
  453. }
  454. getQuestionsByQTypeAndNum(req).then((res) => {
  455. console.log(res);
  456. localStorage.setItem(
  457. "paperData",
  458. JSON.stringify({
  459. paperTitle: null,
  460. subjectId: this.form.subjectId,
  461. })
  462. );
  463. localStorage.setItem("questionList", JSON.stringify(res.data));
  464. this.$router.push({
  465. path: "/question-center/generatingPaperCenter/paper",
  466. });
  467. });
  468. } else if (this.tabActive == 0) {
  469. localStorage.setItem(
  470. "paperData",
  471. JSON.stringify({
  472. paperTitle: null,
  473. subjectId: this.form.subjectId,
  474. })
  475. );
  476. localStorage.setItem(
  477. "questionList",
  478. JSON.stringify(this.queCardForm.queList)
  479. );
  480. this.$router.push({
  481. path: "/question-center/generatingPaperCenter/paper",
  482. });
  483. }
  484. },
  485. createdPaper() {
  486. if (this.queCardForm.queList && this.queCardForm.queList.length > 0) {
  487. localStorage.setItem(
  488. "paperData",
  489. JSON.stringify({
  490. paperTitle: null,
  491. subjectId: this.form.subjectId,
  492. })
  493. );
  494. localStorage.setItem(
  495. "questionList",
  496. JSON.stringify(this.queCardForm.queList)
  497. );
  498. this.$router.push({
  499. path: "/question-center/generatingPaperCenter/paper",
  500. });
  501. }
  502. },
  503. toSavePaperInfo() {
  504. let req = [
  505. {
  506. subjectid: 1,
  507. qtpye: "选择题",
  508. diff: 1,
  509. number: 1,
  510. chapterid: 1,
  511. knowledgeIds: [1, 2, 3],
  512. },
  513. ];
  514. savePaperInfo(req).then((res) => {
  515. console.log(res);
  516. });
  517. },
  518. switchTab(index) {
  519. this.tabActive = index;
  520. if (this.tabActive == 2) {
  521. this.getPaperRecords();
  522. }
  523. },
  524. clearQueCard() {
  525. if (this.queCardForm.queList.length > 0) {
  526. deleteQuestionCard().then((res) => {
  527. console.log(res);
  528. this.queCardForm.queList = [];
  529. this.msgSuccess("清空成功");
  530. });
  531. }
  532. },
  533. // 查询组卷记录
  534. getPaperRecords() {
  535. paperRecords({
  536. subjectId: this.zujuanSubjectId,
  537. }).then((res) => {
  538. this.examRecordTotal = res.total;
  539. this.examRecord = res.rows;
  540. });
  541. },
  542. /**
  543. * 删除试卷
  544. */
  545. httpDeletePaper(id) {
  546. deletePaper({
  547. paperId: id,
  548. }).then((res) => {
  549. this.getPaperRecords();
  550. this.$message({
  551. type: "success",
  552. message: "删除成功!",
  553. });
  554. });
  555. },
  556. clickDeletePopup(index, data) {
  557. let self = this;
  558. if (data[index] && data[index]["paperId"]) {
  559. this.$confirm("是否删除该试卷?", "提示", {
  560. confirmButtonText: "确定",
  561. cancelButtonText: "取消",
  562. type: "warning",
  563. }).then(() => {
  564. self.httpDeletePaper(data[index]["paperId"]);
  565. });
  566. }
  567. },
  568. clickEditPaper(paper) {
  569. listCustomerPaperQeustions(paper.paperId).then((res) => {
  570. localStorage.setItem(
  571. "paperData",
  572. JSON.stringify({
  573. paperId: paper.paperId,
  574. paperTitle: paper.name,
  575. subjectId: paper.subjectid,
  576. })
  577. );
  578. localStorage.setItem("questionList", JSON.stringify(res.rows));
  579. this.$router.push({
  580. path: "/question-center/generatingPaperCenter/paper",
  581. });
  582. });
  583. },
  584. clickDownloadPaper(paperId) {
  585. download(paperId, this.period);
  586. },
  587. clickSendToResource(paperId) {
  588. this.tableLoading = true;
  589. saveToPersonResources(paperId).then((res) => {
  590. this.tableLoading = false;
  591. this.msgSuccess("发送成功");
  592. });
  593. },
  594. clickEditPaperName(paper) {
  595. this.dialogPager = paper;
  596. this.dialogPaperName = paper.name;
  597. this.dialogPaperNameVisible = true;
  598. },
  599. savePaperName() {
  600. const paperName = this.dialogPaperName?.trim();
  601. if (!paperName) {
  602. this.msgError("试卷标题不能为空");
  603. return;
  604. }
  605. updateNameById(this.dialogPager.paperId, paperName).then((res) => {
  606. this.dialogPager.name = paperName;
  607. this.dialogPaperNameVisible = false;
  608. this.msgSuccess("修改成功");
  609. });
  610. },
  611. // 添加试题
  612. addQueCard(item) {
  613. if (this.queCardForm.queList.length == 0) {
  614. console.log("直接添加");
  615. // 为0直接添加
  616. addToQuestionCard({
  617. questionId: item.id,
  618. }).then((res) => {
  619. this.queCardForm.queList.push(item);
  620. console.log(res);
  621. });
  622. } else {
  623. console.log(this.queCardForm.queList[0]);
  624. // 判断是否是同一个科目下的题目
  625. if (item.subjectid == this.queCardForm.queList[0].subjectid) {
  626. // 是,则添加
  627. addToQuestionCard({
  628. questionId: item.id,
  629. }).then((res) => {
  630. this.queCardForm.queList.push(item);
  631. console.log(res);
  632. console.log("this.queCardForm.queList", this.queCardForm.queList);
  633. });
  634. } else {
  635. // 不是,弹出警告
  636. this.dialogVisible = true;
  637. }
  638. }
  639. },
  640. clickChapterNode(item) {
  641. console.log(item);
  642. this.form.chapterId = item.id;
  643. if (this.tabActive == 0) {
  644. this.title = item.name;
  645. this.getQueBychapter();
  646. } else if (this.tabActive == 1) {
  647. this.getKnowByChapter();
  648. /* this.getCountByChapter(); */
  649. }
  650. },
  651. clickKonwNode(item) {
  652. console.log(item);
  653. this.form.knowledgeId = item.id;
  654. if (this.tabActive == 0) {
  655. this.title = item.name;
  656. this.getQueByKnowleged();
  657. } else if (this.tabActive == 1) {
  658. this.getListBottoms();
  659. }
  660. },
  661. handleClose(tag) {
  662. this.tags.splice(this.tags.indexOf(tag), 1);
  663. console.log(tag);
  664. if (this.selectQueId == 0) {
  665. let index = this.form.knowledgeIds.findIndex((item) => item == tag.id);
  666. this.form.knowledgeIds.splice(index, 1);
  667. this.getCountByChapter();
  668. } else if (this.selectQueId == 1) {
  669. console.log(1111);
  670. let index = this.form.listBottoms.findIndex((item) => item == tag.id);
  671. this.form.listBottoms.splice(index, 1);
  672. this.getCountByKnowledged();
  673. }
  674. },
  675. handleChange(e) { },
  676. // 课程
  677. getSubjectList() {
  678. smartSubjectList().then((res) => {
  679. this.form.subjectId = res.rows[0].subjectid;
  680. this.subjectList = res.rows;
  681. this.getEidtion();
  682. });
  683. },
  684. getQueType() {
  685. qtBySubject({
  686. subjectId: this.form.subjectId,
  687. gradeId: this.form.gradeId,
  688. editionId: this.form.editionId,
  689. }).then((res) => {
  690. const qTypes = [this.allQueType, ...res.data];
  691. this.form.queTypeName = qTypes[0];
  692. this.queTypeList = qTypes;
  693. console.log(res);
  694. });
  695. },
  696. // 获取所有版本
  697. getEidtion() {
  698. editionList({
  699. subjectId: this.form.subjectId,
  700. }).then((res) => {
  701. this.form.editionId = Object.keys(res.data)[0];
  702. this.editionList = res.data;
  703. this.getGrade();
  704. });
  705. },
  706. // 获取所有的学册
  707. getGrade() {
  708. smartGradeList({
  709. subjectId: this.form.subjectId,
  710. editionId: this.form.editionId,
  711. }).then((res) => {
  712. console.log(res);
  713. if (res.data.length > 0) {
  714. this.form.gradeId = res.data[0].gradeid;
  715. }
  716. this.gradeList = res.data;
  717. this.getTree();
  718. this.getQueType();
  719. });
  720. },
  721. // 获取章节树
  722. getTree() {
  723. treeList({
  724. ...this.form,
  725. }).then((res) => {
  726. console.log(res);
  727. this.treeList = res.data;
  728. this.clickChapterNode(this.treeList[0]);
  729. this.$nextTick(() => {
  730. if (!this.$refs.chapterTree) {
  731. return;
  732. }
  733. this.$refs.chapterTree.$el.children[0].classList.add("is_current");
  734. this.$refs.chapterTree.setCurrentKey(this.treeList[0].$treeNodeId);
  735. let d = this.$refs.chapterTree.getCheckedNodes();
  736. });
  737. });
  738. },
  739. // 根据知识点获取题库列表
  740. getQueByKnowleged() {
  741. listByKnowledge({
  742. pageNum: this.pageNum,
  743. pageSize: this.pageSize,
  744. qtpye: this.formQueTypeName,
  745. knowledgeId: this.form.knowledgeId,
  746. subjectId: this.form.subjectId,
  747. searchTerm: this.searchText
  748. }).then((res) => {
  749. console.log(res);
  750. this.total = res.total;
  751. this.queList = res.rows;
  752. this.$nextTick((_) => this.mxGlobal.MathQueue("question_list"));
  753. });
  754. },
  755. handleSizeChange(data) {
  756. this.pageNum = data.page || 1;
  757. this.pageSize = data.limit || 10;
  758. this.getQueBychapter();
  759. },
  760. // 根据章节获取题库列表
  761. getQueBychapter() {
  762. listByChapter({
  763. pageNum: this.pageNum,
  764. pageSize: this.pageSize,
  765. qtpye: this.formQueTypeName,
  766. chapterId: this.form.chapterId,
  767. subjectId: this.form.subjectId,
  768. searchTerm: this.searchText
  769. }).then((res) => {
  770. console.log(res);
  771. this.total = res.total;
  772. this.queList = res.rows;
  773. this.$nextTick((_) => this.mxGlobal.MathQueue("question_list"));
  774. console.log(this.queList);
  775. });
  776. },
  777. // 根据章节获取题库类型和数量
  778. getCountByChapter() {
  779. countByChapter({
  780. chapterId: this.form.chapterId,
  781. subjectId: this.form.subjectId,
  782. editionId: this.form.editionId,
  783. gradeId: this.form.gradeId,
  784. knowledgeIds: this.form.knowledgeIds.join(","),
  785. }).then((res) => {
  786. console.log(res);
  787. this.queCount = res.data;
  788. });
  789. },
  790. // 根据知识点获取题库类型和数量
  791. getCountByKnowledged() {
  792. console.log(this.form.listBottoms);
  793. countByKnowledge({
  794. knowledgeIds: this.form.listBottoms.join(","),
  795. subjectId: this.form.subjectId,
  796. }).then((res) => {
  797. console.log(res);
  798. this.queCount = res.data;
  799. });
  800. },
  801. toggleZujuanSubject(e) {
  802. this.zujuanSubjectId = e;
  803. if (this.tabActive == 2) {
  804. this.getPaperRecords();
  805. return;
  806. }
  807. },
  808. toggleSub(e) {
  809. this.form.subjectId = e;
  810. if (this.selectQueId == 1) {
  811. this.getKnowledges();
  812. return;
  813. }
  814. this.getEidtion();
  815. },
  816. toggleEdi(e) {
  817. this.form.editionId = e;
  818. this.getGrade();
  819. },
  820. toggleGrade(e) {
  821. this.form.gradeId = e;
  822. this.getTree();
  823. this.getQueType();
  824. },
  825. viewDetail(index) {
  826. if (this.queList[index].createTime) {
  827. this.queList[index].createTime = false;
  828. } else {
  829. this.queList[index].createTime = true;
  830. }
  831. },
  832. getKnowledges() {
  833. knowledgeTree({
  834. subjectId: this.form.subjectId,
  835. pharseId: 3,
  836. }).then((res) => {
  837. this.knowledgeTree = res.data;
  838. this.clickKonwNode(res.data[0]);
  839. });
  840. },
  841. toggleSelect(e) {
  842. this.selectQueId = e;
  843. if (e == 1) {
  844. this.getKnowledges();
  845. }
  846. },
  847. toggleType(e) {
  848. this.form.queTypeName = e;
  849. this.pageNum = 1
  850. if (this.selectQueId == 0) {
  851. if (this.tabActive == 0) {
  852. this.getQueBychapter();
  853. } else {
  854. this.getCountByChapter();
  855. }
  856. } else if (this.selectQueId == 1) {
  857. if (this.tabActive == 0) {
  858. this.getQueByKnowleged();
  859. } else {
  860. this.getCountByKnowledged();
  861. }
  862. }
  863. },
  864. // 获取底层知识
  865. getListBottoms() {
  866. listBottoms({
  867. knowledgeId: this.form.knowledgeId,
  868. }).then((res) => {
  869. this.form.listBottoms = res.data.map((item) => {
  870. return item.id;
  871. });
  872. this.tags = res.data;
  873. this.getCountByKnowledged();
  874. });
  875. },
  876. // 根据章节查找知识点
  877. getKnowByChapter() {
  878. knowByChapter({
  879. chapterId: this.form.chapterId,
  880. gradeId: this.form.gradeId,
  881. subjectId: this.form.subjectId,
  882. }).then((res) => {
  883. let arr = [];
  884. for (let item of res.data) {
  885. arr.push(item.id);
  886. }
  887. this.form.knowledgeIds = arr;
  888. this.tags = res.data;
  889. this.getCountByChapter();
  890. });
  891. },
  892. toCollectQue(item) {
  893. queCollect({
  894. questionId: item.id,
  895. }).then((res) => {
  896. item.collect = !item.collect;
  897. this.msgSuccess("收藏成功");
  898. console.log(res);
  899. });
  900. },
  901. toCancelCollectQue(item) {
  902. queCancelCollect({
  903. questionId: item.id,
  904. }).then((res) => {
  905. item.collect = !item.collect;
  906. this.msgSuccess("取消收藏成功");
  907. console.log(res);
  908. });
  909. },
  910. },
  911. };
  912. </script>
  913. <style scoped>
  914. .active {
  915. color: #47c6a2;
  916. }
  917. .active::after {
  918. content: "";
  919. width: 100%;
  920. height: 4px;
  921. position: absolute;
  922. background: #47c6a2;
  923. left: 0;
  924. transform: translateY(50%);
  925. bottom: 0;
  926. }
  927. .header_top {
  928. display: flex;
  929. border-bottom: 1px solid #b7b7b7;
  930. margin-bottom: 20px;
  931. }
  932. .header_top > div {
  933. position: relative;
  934. flex: 1;
  935. text-align: center;
  936. padding: 30px 0;
  937. }
  938. .radio_contianer .el-radio-button {
  939. margin-right: 8px;
  940. }
  941. .radio_contianer > div {
  942. margin-bottom: 16px;
  943. display: flex;
  944. justify-content: flex-start;
  945. align-items: center;
  946. }
  947. .radio_contianer > div > span {
  948. flex-shrink: 0;
  949. font-size: 14px;
  950. font-family: PingFangSC-Regular, PingFang SC;
  951. font-weight: 400;
  952. color: #232323;
  953. line-height: 20px;
  954. height: 20px;
  955. width: 50px;
  956. }
  957. .el-card {
  958. margin-bottom: 20px;
  959. }
  960. .el-aside {
  961. margin-bottom: 0;
  962. padding: 24px 0 0 16px;
  963. }
  964. .aside_header {
  965. display: flex;
  966. flex-direction: column;
  967. justify-content: left;
  968. }
  969. .aside_header > span:first-child {
  970. width: 173px;
  971. height: 27px;
  972. background: -webkit-gradient(
  973. linear,
  974. left top,
  975. left bottom,
  976. from(#ffffff),
  977. to(#47c6a2)
  978. );
  979. background: linear-gradient(180deg, #ffffff 0%, #47c6a2 100%);
  980. opacity: 0.5;
  981. }
  982. .aside_header > span:last-child {
  983. margin-bottom: 20px;
  984. }
  985. .aside_header > span {
  986. margin-top: 5px;
  987. width: 84px;
  988. height: 22px;
  989. font-size: 16px;
  990. font-family: PingFangSC-Medium, PingFang SC;
  991. font-weight: 500;
  992. color: #343434;
  993. line-height: 22px;
  994. }
  995. .el-main {
  996. padding: 37px 28px 0 28px;
  997. }
  998. .main_header {
  999. display: flex;
  1000. align-items: center;
  1001. justify-content: space-between;
  1002. margin-bottom: 20px;
  1003. }
  1004. .main_header .main_tit {
  1005. font-size: 16px;
  1006. font-weight: 500;
  1007. color: #47c6a2;
  1008. line-height: 22px;
  1009. margin-right: 64px;
  1010. }
  1011. .main_header .filter {
  1012. font-weight: 400;
  1013. color: #4c4c4c;
  1014. line-height: 20px;
  1015. }
  1016. .main_header .left {
  1017. display: flex;
  1018. }
  1019. .search_box {
  1020. display: flex;
  1021. flex-direction: row;
  1022. align-items: center;
  1023. justify-content: flex-end;
  1024. position: relative;
  1025. margin-right: 20px;
  1026. }
  1027. .search_box img {
  1028. position: absolute;
  1029. right: 20px;
  1030. cursor: pointer;
  1031. top: 6px;
  1032. }
  1033. .search_box input {
  1034. background: #f7f7ff;
  1035. border-radius: 20px;
  1036. border: 1px solid #c6cbf5;
  1037. outline: none;
  1038. width: 340px;
  1039. height: 32px;
  1040. padding-left: 24px;
  1041. }
  1042. .que_item {
  1043. border-radius: 1px;
  1044. border: 1px solid #dedede;
  1045. margin-bottom: 8px;
  1046. }
  1047. .que_content {
  1048. padding: 12px 24px 0 33px;
  1049. font-size: 14px;
  1050. font-family: PingFangSC-Medium, PingFang SC;
  1051. font-weight: 500;
  1052. color: #4c4c4c;
  1053. line-height: 27px;
  1054. margin-bottom: 40px;
  1055. }
  1056. .que-content-title {
  1057. font-size: 14px;
  1058. display: flex;
  1059. }
  1060. .que-option {
  1061. line-height: 40px;
  1062. }
  1063. .que-option span {
  1064. margin-right: 5px;
  1065. }
  1066. .que_footer {
  1067. border-top: 1px solid #dedede;
  1068. padding-left: 33px;
  1069. overflow: hidden;
  1070. padding-bottom: 23px;
  1071. padding-top: 21px;
  1072. }
  1073. .que_footer .spans {
  1074. float: left;
  1075. font-size: 12px;
  1076. font-family: PingFangSC-Regular, PingFang SC;
  1077. font-weight: 400;
  1078. color: #979797;
  1079. line-height: 20px;
  1080. }
  1081. .que_footer .spans > span {
  1082. margin-right: 20px;
  1083. }
  1084. .operation {
  1085. display: flex;
  1086. align-items: center;
  1087. font-size: 14px;
  1088. font-family: PingFangSC-Regular, PingFang SC;
  1089. font-weight: 400;
  1090. color: #47c6a2;
  1091. line-height: 20px;
  1092. float: right;
  1093. }
  1094. .operation > div {
  1095. display: flex;
  1096. align-items: center;
  1097. cursor: pointer;
  1098. }
  1099. .operation .shoucan {
  1100. margin-right: 46px;
  1101. }
  1102. .operation .jiucuo {
  1103. color: #ff4e00;
  1104. margin-right: 32px;
  1105. }
  1106. .operation .detail span {
  1107. border-radius: 1px;
  1108. border-bottom: 1px solid #47c6a2;
  1109. }
  1110. .operation .detail {
  1111. margin-right: 32px;
  1112. }
  1113. .operation > div > img {
  1114. margin-right: 10px;
  1115. }
  1116. .knowPoints .tags {
  1117. margin-top: 24px;
  1118. margin-bottom: 72px;
  1119. }
  1120. .knowPoints .tit {
  1121. margin-bottom: 16px;
  1122. overflow: hidden;
  1123. color: #47c6a2;
  1124. }
  1125. .knowPoints .clear {
  1126. float: right;
  1127. margin-right: 40px;
  1128. }
  1129. .knowPoints .clear img {
  1130. margin-right: 16px;
  1131. }
  1132. .que .tit {
  1133. margin-bottom: 16px;
  1134. overflow: hidden;
  1135. color: #47c6a2;
  1136. }
  1137. .que .clear {
  1138. float: right;
  1139. margin-right: 40px;
  1140. }
  1141. .que .clear img {
  1142. margin-right: 16px;
  1143. }
  1144. .el-divider {
  1145. margin: 0;
  1146. background: #47c6a2;
  1147. }
  1148. .computer {
  1149. margin-top: 24px;
  1150. display: flex;
  1151. justify-content: flex-start;
  1152. flex-wrap: wrap;
  1153. }
  1154. .computer .computer_item {
  1155. flex: 33% 0 0;
  1156. margin-bottom: 32px;
  1157. }
  1158. .computer .computer_item .tit {
  1159. height: 20px;
  1160. font-size: 14px;
  1161. font-family: PingFangSC-Regular, PingFang SC;
  1162. font-weight: 400;
  1163. color: #343434;
  1164. line-height: 20px;
  1165. }
  1166. .computer .computer_item .select {
  1167. width: 58px;
  1168. height: 17px;
  1169. font-size: 12px;
  1170. font-family: PingFangSC-Regular, PingFang SC;
  1171. font-weight: 400;
  1172. color: #969696;
  1173. line-height: 17px;
  1174. }
  1175. .parse {
  1176. padding: 20px;
  1177. }
  1178. ::-webkit-scrollbar {
  1179. width: 4px;
  1180. }
  1181. ::-webkit-scrollbar-thumb {
  1182. -webkit-box-shadow: inset 0 0 1px rgba(136, 136, 136, 0.3);
  1183. background-color: rgb(238, 241, 245);
  1184. }
  1185. .queBoxer {
  1186. display: flex;
  1187. position: fixed;
  1188. right: 0;
  1189. top: 50%;
  1190. transform: translateY(-50%);
  1191. }
  1192. .queBoxer .main {
  1193. border-top: 2px solid #47c6a2;
  1194. padding: 10px 0;
  1195. border-bottom: 2px solid #47c6a2;
  1196. background: #fff;
  1197. }
  1198. .queBoxer > div > div {
  1199. padding: 0 10px;
  1200. }
  1201. .queBoxer .left {
  1202. padding: 10px;
  1203. background: #47c6a2;
  1204. color: white;
  1205. display: flex;
  1206. flex-direction: column;
  1207. justify-content: space-between;
  1208. align-items: center;
  1209. }
  1210. .queBoxer .main .btn {
  1211. background: #47c6a2;
  1212. color: white;
  1213. border-radius: 4px;
  1214. padding: 4px;
  1215. cursor: pointer;
  1216. margin: 5px 10px;
  1217. text-align: center;
  1218. }
  1219. .queBoxer .left .tit {
  1220. display: flex;
  1221. writing-mode: lr-tb;
  1222. align-items: center;
  1223. flex-direction: column;
  1224. justify-content: space-between;
  1225. }
  1226. .generateExam {
  1227. padding: 14px 29px;
  1228. background: #47c6a2;
  1229. border-radius: 4px;
  1230. cursor: pointer;
  1231. color: white;
  1232. }
  1233. /deep/.el-button--success.is-plain.is-disabled {
  1234. background-color: #ffffff;
  1235. border-color: #e6ebf5;
  1236. color: #c0c4cc;
  1237. }
  1238. /deep/ .el-tree-node__content {
  1239. padding-top: 6px;
  1240. padding-bottom: 6px;
  1241. height: 32px;
  1242. font-size: 14px;
  1243. font-family: PingFangSC-Medium, PingFang SC;
  1244. font-weight: 500;
  1245. color: #343434;
  1246. line-height: 20px;
  1247. }
  1248. .generating_container >>> .el-radio-button__inner {
  1249. border-left: 1px solid #dcdfe6;
  1250. }
  1251. .generating_container >>> .radio_contianer .el-radio-button .el-radio-button__inner {
  1252. border-radius: 16px;
  1253. }
  1254. .generating_container >>> .split_page .el-pager > li {
  1255. border-radius: 50%;
  1256. }
  1257. .generating_container >>> .el-tree-node {
  1258. padding-left: 16px;
  1259. }
  1260. .generating_container >>> .el-tree-node__expand-icon.expanded {
  1261. content: "";
  1262. }
  1263. .generating_container >>> .el-tree-node__content > .el-tree-node__expand-icon {
  1264. padding: 6px;
  1265. /* position: absolute; */
  1266. right: 16px;
  1267. }
  1268. .generating_container >>> .radio_contianer .is-active .el-radio-button__inner{
  1269. border-left: none;
  1270. }
  1271. .empty-text {
  1272. margin-top: 150px;
  1273. text-align: center;
  1274. color: #ccc;
  1275. }
  1276. .generating_container >>>.el-input-number.is-controls-right .el-input-number__decrease {
  1277. width: 16px;
  1278. }
  1279. .generating_container >>>.el-input-number.is-controls-right[class*="medium"] [class*="increase"],
  1280. .generating_container >>>.el-input-number.is-controls-right[class*="medium"] [class*="decrease"] {
  1281. width: 16px;
  1282. }
  1283. .generating_container >>>.el-tree--highlight-current .el-tree-node.is-current > .el-tree-node__content {
  1284. color: #47c6a2;
  1285. background: #ffffff;
  1286. }
  1287. .generating_container >>>.table-delete-icon {
  1288. cursor: pointer;
  1289. }
  1290. </style>