index.vue 25 KB

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