index.vue 29 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052
  1. <template>
  2. <div id="topicManagement">
  3. <search-box-new
  4. ref="searchBox"
  5. :formData="formData"
  6. :formList="formList"
  7. @search="search"
  8. @init="init"
  9. />
  10. <table-list
  11. :tableSets="tableSet"
  12. :tableData="tableData"
  13. :navText="navText"
  14. @addClick="addClick"
  15. :loading="loading"
  16. @editInfo="editInfo"
  17. ref="tableList"
  18. rowKey="questionId"
  19. >
  20. <template slot="customize">
  21. <el-button size="medium" @click="dialogDRword = true" type="success"
  22. >Word批量导入</el-button
  23. ><el-button size="medium" @click="dialogDRexcel = true" type="success"
  24. >Excel批量导入</el-button
  25. >
  26. <el-button size="medium" @click="batchDel" type="warning"
  27. >批量删除</el-button
  28. >
  29. </template>
  30. <template slot="btn" slot-scope="props">
  31. <el-button type="text" @click="addClick(props.scope.row, 0)"
  32. >修改</el-button
  33. >
  34. <el-button type="text" @click="del(props.scope.row)">删除</el-button>
  35. </template>
  36. </table-list>
  37. <pagination
  38. :total="total"
  39. :pageSize="formData.pageSize"
  40. :currentPage="formData.pageNum"
  41. @handleSizeChange="handleSizeChange"
  42. @handleCurrentChange="handleCurrentChange"
  43. />
  44. <!-- ------------------- -->
  45. <el-dialog
  46. @closed="clearData"
  47. :visible.sync="dialogDRword"
  48. :append-to-body="true"
  49. width="780px"
  50. :show-close="false"
  51. :close-on-click-modal="false"
  52. >
  53. <div slot="title" class="hearders">
  54. <div class="leftTitle">批量导入</div>
  55. <div class="rightBoxs">
  56. <img
  57. src="@/assets/images/Close@2x.png"
  58. alt=""
  59. @click="dialogDRword = false"
  60. />
  61. </div>
  62. </div>
  63. <word-pop @search="search" ref="wordpop" />
  64. <span slot="footer" class="dialog-footer">
  65. <el-button @click="dialogDRword = false">取 消</el-button>
  66. </span>
  67. </el-dialog>
  68. <batch-import-dialoga
  69. :dialogVisible.sync="dialogDRexcel"
  70. temUrl="/oss/images/file/20220307/1646623385198.xlsx"
  71. apiKey="importDatabankquestion"
  72. :isCheck="false"
  73. :isShowTip="false"
  74. :isSuccessBack="true"
  75. @success="success"
  76. ></batch-import-dialoga>
  77. <el-dialog
  78. @closed="loadingClose"
  79. width="1180px"
  80. :visible.sync="innerVisiblePaperTopic"
  81. append-to-body
  82. :show-close="false"
  83. :fullscreen="fullscreenChildPaperTopic"
  84. :close-on-click-modal="false"
  85. >
  86. <div slot="title" class="hearders">
  87. <div class="leftTitle">
  88. {{ statusPop === 1 ? "添加" : statusPop === 0 ? "修改" : "详情" }}
  89. </div>
  90. <div class="rightBoxs">
  91. <img
  92. src="@/assets/images/Max@2x.png"
  93. alt=""
  94. @click="fullscreenChildPaperTopic = !fullscreenChildPaperTopic"
  95. />
  96. <img src="@/assets/images/Close@2x.png" alt="" @click="closeBefore" />
  97. </div>
  98. </div>
  99. <div v-if="statusHide">
  100. <busIns
  101. @amdis="changeAmdis"
  102. ref="sujects"
  103. :sujectApisTable="sujectApis"
  104. :newSujectApisTable="newSujectApis"
  105. :typeBus="typeBus"
  106. />
  107. <el-form
  108. label-position="right"
  109. label-width="110px"
  110. :model="listData"
  111. ref="listData"
  112. :rules="rulesTest"
  113. >
  114. <el-form-item
  115. v-for="(items, indexs) in listitem"
  116. :key="indexs"
  117. :label="items.label"
  118. :prop="items.prop"
  119. >
  120. <div v-if="items.scope === 'bussing'">
  121. <div v-if="!activeExam.length">请在下面输入框添加知识点</div>
  122. <ul v-else class="BusBoxs">
  123. <li
  124. class="fot_Le"
  125. v-for="(item, index) in activeExam"
  126. :key="index"
  127. >
  128. {{ item.knowledgeName }}
  129. <i
  130. class="el-icon-error icon_clear"
  131. @click="clearBusName(index)"
  132. ></i>
  133. </li>
  134. <div style="clear: both"></div>
  135. </ul>
  136. <el-select
  137. v-model="value"
  138. placeholder="请选择知识点"
  139. @change="changeKnow"
  140. >
  141. <el-option
  142. v-for="item in options"
  143. :key="item.knowledgeId"
  144. :label="item.knowledgeName"
  145. :value="item.knowledgeId"
  146. :disabled="comLs(item)"
  147. >
  148. </el-option>
  149. </el-select>
  150. <!-- <el-button @click="addExam">自定义添加</el-button> -->
  151. </div>
  152. <el-radio-group
  153. v-else-if="items.scope === 'radio'"
  154. v-model="listData[items.prop]"
  155. >
  156. <el-radio :label="1">发布</el-radio>
  157. <el-radio :label="0">未发布</el-radio>
  158. </el-radio-group>
  159. <el-input
  160. v-model="listData[items.prop]"
  161. v-else
  162. ></el-input> </el-form-item
  163. ></el-form>
  164. <questionBank
  165. v-for="(item, index) in listNums"
  166. :key="index"
  167. :dingFormInfo="item"
  168. :nums="index"
  169. ref="child"
  170. />
  171. </div>
  172. <span slot="footer" class="dialog-footer">
  173. <el-button @click="closeBefore">关 闭</el-button>
  174. <el-button
  175. @click="submitForm('listData')"
  176. :loading="disabledBtn"
  177. v-if="statusPop === 1 || statusPop === 0"
  178. >完成</el-button
  179. >
  180. <el-button
  181. type="primary"
  182. v-if="statusPop === 1"
  183. :loading="disabledBtn"
  184. @click="submitForm('listData', 1)"
  185. >完成,并继续添加</el-button
  186. >
  187. </span>
  188. </el-dialog>
  189. <el-dialog
  190. :visible.sync="dialogVisible"
  191. :append-to-body="true"
  192. width="780px"
  193. :show-close="false"
  194. :close-on-click-modal="false"
  195. >
  196. <div slot="title" class="hearders">
  197. <div class="leftTitle">添加</div>
  198. <div class="rightBoxs">
  199. <img src="@/assets/images/Close@2x.png" alt="" @click="closeBoxs" />
  200. </div>
  201. </div>
  202. <div>
  203. <el-form label-position="right" label-width="110px">
  204. <el-form-item label="知识点">
  205. <div>
  206. <div v-if="!BusNameList.length">请在下面输入框添加知识点</div>
  207. <ul v-else class="BusBoxs">
  208. <li
  209. class="fot_Le"
  210. v-for="(item, index) in BusNameList"
  211. :key="index"
  212. >
  213. {{ item }}
  214. <i
  215. class="el-icon-error icon_clear"
  216. @click="clearBus(index)"
  217. ></i>
  218. </li>
  219. <div style="clear: both"></div>
  220. </ul>
  221. <el-input
  222. style="width: 40%; margin-right: 10px"
  223. v-model="BusName"
  224. ></el-input
  225. ><el-button @click="addBusName">添加</el-button>
  226. </div></el-form-item
  227. ></el-form
  228. >
  229. </div>
  230. <span slot="footer" class="dialog-footer">
  231. <el-button @click="closeBoxs">取 消</el-button>
  232. <el-button type="primary" @click="submit">确 定</el-button>
  233. </span>
  234. </el-dialog>
  235. </div>
  236. </template>
  237. <script>
  238. import searchBoxNew from "@/components/searchBoxNew";
  239. import tableList from "@/components/tableList";
  240. import pagination from "@/components/pagination";
  241. import busIns from "@/components/busIns";
  242. import questionBank from "@/components/questionBank";
  243. import batchImportDialoga from "@/components/Comon/batchImportDialog.vue";
  244. import wordPop from "./wordPop.vue";
  245. import { questionBatchDel } from "@/api/resource/volumeManagement";
  246. export default {
  247. components: {
  248. questionBank,
  249. busIns,
  250. tableList,
  251. pagination,
  252. searchBoxNew,
  253. wordPop,
  254. batchImportDialoga,
  255. },
  256. name: "TopicManagement",
  257. data() {
  258. return {
  259. dialogDRword: false,
  260. dialogDRexcel: false,
  261. disabledBtn: false,
  262. statusHide: false,
  263. loading: false, //当前表单加载是否加载动画
  264. navText: {
  265. title: "题目管理",
  266. index: 0,
  267. ch: "条",
  268. num: false,
  269. border: true,
  270. choice: true,
  271. addHide: false,
  272. openCheckMore: true,
  273. backFatherBtn: {
  274. status: false,
  275. title: "未定义",
  276. },
  277. },
  278. //搜索
  279. formList: [
  280. {
  281. prop: "educationTypeId",
  282. placeholder: "教育类型",
  283. scope: "educationType",
  284. },
  285. {
  286. prop: "businessId",
  287. placeholder: "业务层次",
  288. scope: "businessLevel",
  289. edu: "educationTypeId",
  290. },
  291. {
  292. prop: "subjectId",
  293. placeholder: "科目",
  294. scope: "sujectType",
  295. edu: "educationTypeId",
  296. },
  297. {
  298. prop: "prefixName",
  299. placeholder: "请输入标题前缀",
  300. },
  301. {
  302. prop: "type",
  303. placeholder: "题目类型",
  304. scope: "selectBank",
  305. },
  306. {
  307. prop: "publishStatus",
  308. placeholder: "发布状态",
  309. scope: "select",
  310. options: [
  311. {
  312. label: "已发布",
  313. value: 1,
  314. },
  315. {
  316. label: "未发布",
  317. value: 0,
  318. },
  319. ],
  320. },
  321. {
  322. prop: "key",
  323. placeholder: "题目编码/标题前缀/题目标题",
  324. },
  325. ],
  326. formData: {
  327. status: "0,1",
  328. pageSize: 10,
  329. pageNum: 1,
  330. },
  331. // 表单
  332. tableSet: [
  333. {
  334. label: "题目编码",
  335. prop: "code",
  336. hidden: false,
  337. },
  338. {
  339. label: "题目类型",
  340. prop: "type",
  341. hidden: true,
  342. scope: "topic",
  343. width: "140px",
  344. },
  345. {
  346. label: "标题前缀",
  347. prop: "prefixName",
  348. hidden: false,
  349. },
  350. {
  351. label: "题目详细",
  352. prop: "content",
  353. hidden: true,
  354. scope: "htmlInfo",
  355. width: "600px",
  356. dontCenter: true,
  357. },
  358. {
  359. label: "知识点",
  360. prop: "knowledgeList",
  361. hidden: false,
  362. scope: "knowledge",
  363. showTooltip: true,
  364. },
  365. {
  366. label: "适用业务层级",
  367. prop: "businessList",
  368. hidden: false,
  369. scope: "mapTypesMores",
  370. },
  371. {
  372. label: "最后编辑时间",
  373. prop: "updateTime",
  374. scope: "aTimeList",
  375. hidden: false,
  376. },
  377. {
  378. label: "创建时间",
  379. prop: "createTime",
  380. scope: "aTimeList",
  381. hidden: false,
  382. },
  383. {
  384. label: "发布状态",
  385. prop: "publishStatus",
  386. hidden: true,
  387. scope: "isOptions",
  388. options: [
  389. {
  390. label: "已发布",
  391. value: 1,
  392. },
  393. {
  394. label: "未发布",
  395. value: 0,
  396. },
  397. ],
  398. },
  399. {
  400. label: "关联试卷",
  401. prop: "examList",
  402. prop1: "examName",
  403. hidden: false,
  404. scope: "aboutChapter",
  405. int: 5,
  406. },
  407. ],
  408. sujectApis: [],
  409. newSujectApis: [],
  410. tableData: [], //表单数据
  411. total: 0, //一共多少条
  412. //-----------------------------------------------
  413. dialogVisible: false,
  414. innerVisiblePaperTopic: false,
  415. fullscreenChildPaperTopic: false,
  416. statusPop: 1,
  417. dingForm: {},
  418. questionId: "",
  419. queryData: {},
  420. allOptions: [], //知识点列表
  421. options: [], //当前知识点列表
  422. activeExam: [], // 已选知识点列表
  423. value: "",
  424. BusName: "", //弹窗新增知识点输入框
  425. BusNameList: [],
  426. listNums: [],
  427. typeBus: 1,
  428. listData: {
  429. publishStatus: "",
  430. prefixName: "",
  431. },
  432. int: "",
  433. listitem: [
  434. {
  435. label: "标题前缀",
  436. prop: "prefixName",
  437. },
  438. {
  439. label: "知识点",
  440. scope: "bussing",
  441. },
  442. {
  443. label: "发布状态",
  444. prop: "publishStatus",
  445. scope: "radio",
  446. },
  447. ],
  448. rulesTest: {
  449. publishStatus: [
  450. { required: true, message: "请选择发布状态", trigger: "change" },
  451. ],
  452. },
  453. };
  454. },
  455. mounted() {
  456. this.getFns();
  457. this.search();
  458. },
  459. activated() {
  460. this.getFns();
  461. this.search();
  462. },
  463. methods: {
  464. batchDel() {
  465. if (!this.$refs.tableList.allCheckData.length) {
  466. this.$message.warning("请勾选需要删除的题目");
  467. return;
  468. }
  469. this.$confirm(
  470. `此操作将永久删除所勾选的${this.$refs.tableList.allCheckData.length}条题目, 是否继续?`,
  471. "提示",
  472. {
  473. confirmButtonText: "确定",
  474. cancelButtonText: "取消",
  475. type: "warning",
  476. }
  477. )
  478. .then(() => {
  479. const ids = this.$refs.tableList.allCheckData.map((item) => {
  480. return item.questionId;
  481. });
  482. questionBatchDel({
  483. status: -1,
  484. ids,
  485. }).then((res) => {
  486. this.$message.success("批量删除成功");
  487. this.$refs.tableList.clearMoreActive();
  488. this.search(1);
  489. });
  490. })
  491. .catch(() => {});
  492. // console.log(this.$refs.tableList.)
  493. },
  494. clearData() {
  495. this.$refs.wordpop.formData = {
  496. eduId: "",
  497. businessId: "",
  498. subjectId: "",
  499. projectId: "",
  500. };
  501. },
  502. loadingClose() {
  503. this.disabledBtn = false;
  504. },
  505. editInfo(v) {
  506. this.addClick(v, 0);
  507. },
  508. search(int) {
  509. this.loading = true;
  510. if (int === 1) {
  511. this.formData.pageNum = 1;
  512. }
  513. if (int === 2) {
  514. this.formData = {
  515. status: "0,1",
  516. pageSize: 10,
  517. pageNum: 1,
  518. };
  519. this.$refs.tableList.clearMoreActive();
  520. }
  521. this.$api
  522. .inquirebankquestionList(this.formData)
  523. .then((res) => {
  524. for (let i = 0; i < res.rows.length; i++) {
  525. if (res.rows[i].knowledgeList) {
  526. for (let j = 0; j < res.rows[i].knowledgeList.length; j++) {
  527. res.rows[i].knowledgeList[j].knowledgeName =
  528. res.rows[i].knowledgeList[j].knowledgeName + " ";
  529. }
  530. }
  531. }
  532. // res.rows.forEach(item => {
  533. // item.knowledgeList.forEach(items => {
  534. // items.knowledgeName = items.knowledgeName + ' '
  535. // })
  536. // })
  537. this.tableData = res.rows;
  538. this.total = res.total;
  539. this.navText.index = res.total;
  540. })
  541. .finally(() => {
  542. this.loading = false;
  543. });
  544. },
  545. success({ msg }) {
  546. if (msg == "操作成功") {
  547. this.$message.success("导入成功");
  548. } else {
  549. let url = baseUrls.baseURL + "common/download?fileName=" + msg;
  550. let link = document.createElement("a");
  551. let fileName = "导入模板" + ".xlsx";
  552. document.body.appendChild(link);
  553. link.href = url;
  554. link.dowmload = fileName;
  555. link.click();
  556. link.remove();
  557. this.$message.warning("导入有误,请打开文档查看错误原因");
  558. }
  559. this.search(2);
  560. },
  561. init() {
  562. this.search(2);
  563. },
  564. del(v) {
  565. this.$alert(
  566. "确定删除此内容?<br />内容删除后将无法恢复,请慎重考虑",
  567. "提示",
  568. {
  569. dangerouslyUseHTMLString: true,
  570. }
  571. )
  572. .then(() => {
  573. var data = {
  574. questionId: v.questionId,
  575. status: -1,
  576. };
  577. this.$api.editbankquestion(data).then((res) => {
  578. this.$message.success("删除成功");
  579. this.search();
  580. });
  581. })
  582. .catch(() => {
  583. this.$message({
  584. type: "info",
  585. message: "已取消删除",
  586. });
  587. });
  588. },
  589. addClick(v, int) {
  590. this.disabledBtn = false;
  591. var self = this;
  592. self.listNums = [];
  593. if (v === undefined) {
  594. self.statusPop = 1;
  595. self.innerVisiblePaperTopic = true;
  596. self.statusHide = true;
  597. self.$nextTick(() => {
  598. var datas = {
  599. type: 1,
  600. optionsList: [],
  601. answerQuestionList: [],
  602. content: "",
  603. status: "",
  604. analysisContent: "",
  605. answerQuestion: "",
  606. };
  607. for (let i = 0; i < 4; i++) {
  608. datas.optionsList.push({
  609. content: "",
  610. imgUrl: null,
  611. optionsId: i + 1,
  612. });
  613. }
  614. self.listNums = [datas];
  615. self.$refs.sujects.eduType = "";
  616. self.$refs.sujects.courType = "";
  617. self.options = [];
  618. self.sujectApis = [];
  619. self.newSujectApis = [];
  620. self.listData = {
  621. publishStatus: 1,
  622. };
  623. self.activeExam = [];
  624. });
  625. } else {
  626. self.statusPop = int;
  627. self.$api.obtainbankquestion(v.questionId).then((res) => {
  628. self.questionId = v.questionId;
  629. res.data.optionsList = JSON.parse(res.data.jsonStr);
  630. if (res.data.knowledgeIds) {
  631. var a = [];
  632. res.data.knowledgeIds
  633. .split(",")
  634. .map(Number)
  635. .map((items) => {
  636. self.allOptions.map((item) => {
  637. if (item.knowledgeId === items) {
  638. a.push(item);
  639. }
  640. });
  641. });
  642. self.activeExam = a;
  643. } else {
  644. self.activeExam = [];
  645. }
  646. if (res.data.type === 2) {
  647. if (res.data.answerQuestion) {
  648. res.data.answerQuestionList = res.data.answerQuestion
  649. .split(",")
  650. .map(Number);
  651. }
  652. } else if (res.data.type === 4) {
  653. res.data.optionsList.map((item) => {
  654. if (item.type === 2) {
  655. if (item.answerQuestion) {
  656. item.answerQuestionList = item.answerQuestion
  657. .split(",")
  658. .map(Number);
  659. }
  660. } else {
  661. item.answerQuestionList = [];
  662. }
  663. });
  664. } else {
  665. res.data.answerQuestionList = [];
  666. }
  667. self.$refs.sujects.eduType = "";
  668. self.$refs.sujects.courType = "";
  669. self.listData.prefixName = res.data.prefixName;
  670. self.listData.publishStatus = res.data.publishStatus;
  671. self.listNums.push(res.data);
  672. });
  673. this.$api
  674. .inquirebankquestionListbusiness({ majorId: v.questionId, type: 1 })
  675. .then((res) => {
  676. var arrays = [];
  677. res.rows.map((item) => {
  678. arrays.push(item.businessId + "-" + item.subjectId);
  679. });
  680. self.sujectApis = arrays;
  681. self.newSujectApis = res.rows;
  682. });
  683. this.innerVisiblePaperTopic = true;
  684. this.statusHide = true;
  685. }
  686. },
  687. handleSizeChange(v) {
  688. this.formData.pageSize = v;
  689. this.formData.pageNum = 1;
  690. this.search();
  691. },
  692. handleCurrentChange(v) {
  693. document.documentElement.scrollTop = 0;
  694. this.formData.pageNum = v;
  695. this.search();
  696. },
  697. //-----------------------------------------------
  698. comLs(item) {
  699. var os = this.activeExam.some((items) => {
  700. return items.knowledgeId === item.knowledgeId;
  701. });
  702. if (os) {
  703. return true;
  704. } else {
  705. return false;
  706. }
  707. },
  708. getFns() {
  709. return new Promise((resolve, reject) => {
  710. this.$api.inquireKnowledgeExamListS({ status: 1 }).then((res) => {
  711. this.allOptions = res.rows;
  712. resolve();
  713. });
  714. });
  715. },
  716. addBusName() {
  717. if (this.BusName.trim()) {
  718. var as = this.allOptions.some((item) => {
  719. return item.knowledgeName == this.BusName;
  720. });
  721. if (as) {
  722. this.$message.warning("当前知识点名称已存在");
  723. return;
  724. }
  725. this.BusNameList.push(this.BusName);
  726. this.BusName = "";
  727. } else {
  728. this.$message({
  729. message: "请输入知识点内容",
  730. type: "warning",
  731. duration: 1200,
  732. });
  733. this.BusName = "";
  734. }
  735. },
  736. submit() {
  737. var data = {
  738. examKnowledgeBusinessAddBoList: this.newSujectApis,
  739. knowledgeName: this.BusNameList,
  740. status: 1,
  741. };
  742. this.$api.addKnowledgeExam(data).then(async (res) => {
  743. this.$message.success("添加成功");
  744. this.dialogVisible = false;
  745. await this.getFns();
  746. this.changeAmdis();
  747. });
  748. },
  749. closeBoxs() {
  750. this.dialogVisible = false;
  751. },
  752. addExam() {
  753. if (!this.$refs.sujects.courType) {
  754. this.$message.warning("请选择业务层级");
  755. return;
  756. }
  757. this.BusNameList = [];
  758. this.BusName = "";
  759. this.dialogVisible = true;
  760. },
  761. clearBus() {
  762. this.BusNameList.splice(index, 1);
  763. },
  764. //子组件回调 业务层及变换-知识点重新筛选
  765. changeAmdis() {
  766. var int = this.$refs.sujects.courType;
  767. var ao = [];
  768. for (let i = 0; i < this.allOptions.length; i++) {
  769. let acts = this.allOptions[i].courseBusinessList.some((items) => {
  770. return items.businessId === int;
  771. });
  772. if (acts) {
  773. ao.push(this.allOptions[i]);
  774. }
  775. }
  776. // this.allOptions.map((item, index) => {
  777. // });
  778. this.options = ao;
  779. },
  780. clearBusName(index) {
  781. this.activeExam.splice(index, 1);
  782. },
  783. changeKnow(item) {
  784. this.allOptions.map((items) => {
  785. if (items.knowledgeId === item) {
  786. this.activeExam.push(items);
  787. }
  788. });
  789. this.value = "";
  790. },
  791. addListNums() {
  792. this.listNums.push({
  793. type: 1,
  794. optionsList: [],
  795. answerQuestionList: [],
  796. content: "",
  797. status: "",
  798. analysisContent: "",
  799. answerQuestion: "",
  800. });
  801. },
  802. closeBefore() {
  803. this.innerVisiblePaperTopic = false;
  804. this.statusHide = false;
  805. },
  806. async submitForm(formName, int) {
  807. this.$refs[formName].validate((valid) => {
  808. if (valid) {
  809. var self = this;
  810. if (!this.$refs.sujects.newSujectApis.length) {
  811. this.$message.error("请选择科目");
  812. return;
  813. }
  814. var data = this.$refs.child[0].getInfosPage();
  815. if (!data.content || data.content == "<p><br></p>") {
  816. self.$message.error("请填写题目内容");
  817. return;
  818. }
  819. if (data.type != 3 && data.type != 5 && !data.optionsList.length) {
  820. self.$message.error("请添加选项");
  821. return;
  822. }
  823. if (data.type != 3 && data.type != 4 && data.optionsList.length) {
  824. var ast = data.optionsList.some((item) => {
  825. return !item.content && !item.imgUrl;
  826. });
  827. if (ast) {
  828. self.$message.error("请完善选项内容");
  829. return;
  830. }
  831. }
  832. if (data.type != 5 && data.type != 4) {
  833. if (data.type === 2 && !data.answerQuestionList.length) {
  834. self.$message.error("请选择正确答案");
  835. return;
  836. }
  837. if (data.type !== 2 && !data.answerQuestion) {
  838. self.$message.error("请选择正确答案");
  839. return;
  840. }
  841. }
  842. if (data.type == 4 && data.optionsList.length) {
  843. for (let i = 0; i < data.optionsList.length; i++) {
  844. if (
  845. !data.optionsList[i].content ||
  846. data.optionsList[i].content == "<p><br></p>"
  847. ) {
  848. self.$message.error("请填写题目内容");
  849. return;
  850. }
  851. if (
  852. data.optionsList[i].type != 3 &&
  853. data.optionsList[i].type != 5 &&
  854. !data.optionsList[i].optionsList.length
  855. ) {
  856. self.$message.error("请添加选项");
  857. return;
  858. }
  859. if (
  860. data.optionsList[i].type != 3 &&
  861. data.optionsList[i].optionsList.length
  862. ) {
  863. var ast = data.optionsList[i].optionsList.some((item) => {
  864. return !item.content && !item.imgUrl;
  865. });
  866. if (ast) {
  867. self.$message.error("请完善选项内容");
  868. return;
  869. }
  870. }
  871. if (data.optionsList[i].type != 5) {
  872. if (
  873. data.optionsList[i].type === 2 &&
  874. !data.optionsList[i].answerQuestionList.length
  875. ) {
  876. self.$message.error("请选择正确答案");
  877. return;
  878. }
  879. if (
  880. data.optionsList[i].type !== 2 &&
  881. !data.optionsList[i].answerQuestion
  882. ) {
  883. self.$message.error("请选择正确答案");
  884. return;
  885. }
  886. }
  887. }
  888. }
  889. this.disabledBtn = true;
  890. var numList = [];
  891. this.activeExam.map((item) => {
  892. numList.push(item.knowledgeId);
  893. });
  894. data.prefixName = this.listData.prefixName;
  895. data.knowledgeIds = numList.toString();
  896. data.publishStatus = this.listData.publishStatus;
  897. data.businessList = this.$refs.sujects.newSujectApis;
  898. if (data.type === 2) {
  899. if (data.answerQuestionList.length) {
  900. data.answerQuestion = data.answerQuestionList.toString();
  901. }
  902. }
  903. if (data.type === 4) {
  904. data.optionsList.map((item) => {
  905. if (item.type === 2) {
  906. if (item.answerQuestionList.length) {
  907. item.answerQuestion = item.answerQuestionList.toString();
  908. }
  909. }
  910. });
  911. }
  912. if (this.statusPop === 1) {
  913. data.status = 1;
  914. this.$api
  915. .addbankquestion(data)
  916. .then((res) => {
  917. self.$methodsTools.cacheBusinessList(
  918. self.$refs.sujects.newSujectApis
  919. );
  920. self.$refs.sujects.UPDates();
  921. self.$message.success("添加成功");
  922. self.innerVisiblePaperTopic = false;
  923. self.statusHide = true;
  924. self.search();
  925. if (int === 1) {
  926. self.addClick();
  927. }
  928. })
  929. .catch(() => {
  930. this.disabledBtn = false;
  931. });
  932. }
  933. if (this.statusPop === 0) {
  934. data.questionId = self.questionId;
  935. this.$api
  936. .editbankquestion(data)
  937. .then((res) => {
  938. self.$message.success("修改成功");
  939. self.innerVisiblePaperTopic = false;
  940. self.statusHide = true;
  941. self.search();
  942. })
  943. .catch(() => {
  944. this.disabledBtn = false;
  945. });
  946. }
  947. } else {
  948. console.log("error submit!!");
  949. return false;
  950. }
  951. });
  952. },
  953. //保存且添加下一题
  954. async submitAndNext() {
  955. var data = JSON.parse(JSON.stringify(this.dingForm));
  956. data.parentType = Number(this.queryData.typeId);
  957. data.examId = Number(this.queryData.examId) || 0;
  958. data.bankSectionId = Number(this.queryData.bankSectionId) || 0;
  959. this.$message.success("添加成功");
  960. this.innerVisiblePaperTopic = false;
  961. this.statusHide = true;
  962. // this.search();
  963. this.dingForm = {
  964. jsonStr: [],
  965. };
  966. },
  967. },
  968. };
  969. </script>
  970. <style lang="less" scoped>
  971. .BusBoxs {
  972. min-height: 100px;
  973. border: 1px solid #a4a4a4;
  974. margin-bottom: 10px;
  975. border-radius: 8px;
  976. max-height: 280px;
  977. padding: 10px;
  978. overflow-y: auto;
  979. .fot_Le {
  980. border-radius: 12px;
  981. border: 1px solid yellowgreen;
  982. padding: 0px 10px;
  983. height: 30px;
  984. line-height: 30px;
  985. text-align: center;
  986. float: left;
  987. margin-right: 6px;
  988. margin-bottom: 6px;
  989. .icon_clear {
  990. margin-left: 2px;
  991. font-size: 15px;
  992. color: #f56c6c;
  993. cursor: pointer;
  994. }
  995. }
  996. }
  997. .marg_play {
  998. display: flex;
  999. margin-bottom: 15px;
  1000. .spans {
  1001. text-align: right;
  1002. width: 80px;
  1003. }
  1004. }
  1005. /deep/.el-button {
  1006. border-radius: 8px;
  1007. }
  1008. /deep/.el-dialog {
  1009. border-radius: 8px;
  1010. .el-dialog__header {
  1011. padding: 0;
  1012. .hearders {
  1013. height: 40px;
  1014. display: flex;
  1015. align-items: center;
  1016. justify-content: space-between;
  1017. padding: 0px 18px 0px 20px;
  1018. border-bottom: 1px solid #e2e2e2;
  1019. .leftTitle {
  1020. font-size: 14px;
  1021. font-weight: bold;
  1022. color: #2f4378;
  1023. }
  1024. .rightBoxs {
  1025. display: flex;
  1026. align-items: center;
  1027. img {
  1028. width: 14px;
  1029. height: 14px;
  1030. margin-left: 13px;
  1031. cursor: pointer;
  1032. }
  1033. }
  1034. }
  1035. }
  1036. .el-dialog__footer {
  1037. padding: 0;
  1038. .dialog-footer {
  1039. padding: 0px 40px;
  1040. height: 70px;
  1041. border-top: 1px solid #e2e2e2;
  1042. display: flex;
  1043. align-items: center;
  1044. justify-content: center;
  1045. }
  1046. }
  1047. }
  1048. </style>