index.vue 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957
  1. <template>
  2. <div id="chapterContent">
  3. <ul class="fatherSty">
  4. <li class="floatLefts" v-for="(item, index) in headerData" :key="index">
  5. {{ item.label }}:{{
  6. item.scope === "more"
  7. ? pageInfo[item.prop1] + "-" + pageInfo[item.prop2]
  8. : pageInfo[item.prop]
  9. }}
  10. </li>
  11. <div style="clear: both"></div>
  12. </ul>
  13. <div class="mar_b">
  14. <el-button slot="reference" type="success" @click="openBoxs"
  15. >添加 模块/章节</el-button
  16. >
  17. </div>
  18. <el-tree
  19. ref="tree"
  20. :data="tableDataInfos"
  21. lazy
  22. :load="load"
  23. :props="layoutTreeProps"
  24. @node-click="handleNodeClick"
  25. >
  26. <span class="custom-tree-node" slot-scope="{ node, data }">
  27. <span>{{ node.label }}</span>
  28. <span>
  29. <el-button
  30. v-if="data.isDels"
  31. type="text"
  32. size="mini"
  33. @click.stop="del(node, data)"
  34. >
  35. 删除
  36. </el-button>
  37. <el-button
  38. type="text"
  39. size="mini"
  40. style="color: green"
  41. @click.stop="openExamBox(node, data)"
  42. >
  43. 关联试卷
  44. </el-button>
  45. </span>
  46. </span>
  47. </el-tree>
  48. <div class="dis-f">
  49. <el-button @click="backPage">取消</el-button>
  50. <el-button type="primary" @click="submit">确定</el-button>
  51. </div>
  52. <el-dialog
  53. :visible.sync="centerDialogVisible"
  54. width="300px"
  55. :show-close="false"
  56. :close-on-click-modal="false"
  57. >
  58. <div slot="title" class="hearders">
  59. <div class="leftTitle">添加模块/章/节</div>
  60. <div class="rightBoxs">
  61. <img
  62. src="@/assets/images/Close@2x.png"
  63. alt=""
  64. @click="centerDialogVisible = false"
  65. />
  66. </div>
  67. </div>
  68. <el-radio-group v-model="radio" class="dis-f">
  69. <el-radio :label="1">模板</el-radio>
  70. <el-radio :label="2">章</el-radio>
  71. <el-radio :label="3">节</el-radio>
  72. </el-radio-group>
  73. <span slot="footer" class="dialog-footer">
  74. <el-button @click="centerDialogVisible = false" size="small"
  75. >取 消</el-button
  76. >
  77. <el-button type="primary" @click="activeCheckBoxs" size="small"
  78. >确 定</el-button
  79. >
  80. </span>
  81. </el-dialog>
  82. <el-dialog
  83. :visible.sync="dialogVisible"
  84. width="800px"
  85. :show-close="false"
  86. :close-on-click-modal="false"
  87. >
  88. <div slot="title" class="hearders">
  89. <div class="leftTitle">
  90. {{ radio === 1 ? "添加模块" : radio === 2 ? "添加章" : "添加节" }}
  91. </div>
  92. <div class="rightBoxs">
  93. <img
  94. src="@/assets/images/Close@2x.png"
  95. alt=""
  96. @click="dialogVisible = false"
  97. />
  98. </div>
  99. </div>
  100. <el-table
  101. ref="multipleTable"
  102. :data="boxtableData"
  103. border
  104. @select-all="selectAll"
  105. @select="select"
  106. :row-key="getRowKeys"
  107. :header-cell-style="{
  108. 'background-color': '#eee',
  109. padding: '8px',
  110. color: '#333',
  111. }"
  112. >
  113. <el-table-column
  114. align="center"
  115. type="selection"
  116. width="55"
  117. header-align="center"
  118. :selectable="checkboxT"
  119. :reserve-selection="true"
  120. >
  121. </el-table-column>
  122. <template v-for="(item, index) in tableSet">
  123. <el-table-column
  124. :width="item.width"
  125. :key="index"
  126. :label="item.label"
  127. align="center"
  128. :show-overflow-tooltip="true"
  129. header-align="center"
  130. >
  131. <template slot-scope="scope">
  132. <span v-if="item.scope === 'Status'">
  133. {{
  134. scope.row[item.prop] === 1
  135. ? "发布"
  136. : scope.row[item.prop] === 0
  137. ? "未发布"
  138. : "未知"
  139. }}
  140. </span>
  141. <span v-else-if="item.scope === 'teshu'">
  142. {{ radio === 1 ? scope.row[item.prop] : scope.row[item.prop1] }}
  143. </span>
  144. <span v-else>{{ scope.row[item.prop] }}</span></template
  145. >
  146. </el-table-column></template
  147. >
  148. </el-table>
  149. <pagination
  150. :total="total"
  151. :pageSize="pageSize"
  152. :currentPage="currentPage"
  153. @handleSizeChange="handleSizeChange"
  154. @handleCurrentChange="handleCurrentChange"
  155. />
  156. <span slot="footer" class="dialog-footer">
  157. <el-button @click="dialogVisible = false">取 消</el-button>
  158. <el-button type="primary" @click="submitForm">确 定</el-button>
  159. </span>
  160. </el-dialog>
  161. <el-dialog
  162. :visible.sync="aboutExamStatus"
  163. width="560px"
  164. :show-close="false"
  165. :close-on-click-modal="false"
  166. >
  167. <div slot="title" class="hearders">
  168. <div class="leftTitle">关联题卷</div>
  169. <div class="rightBoxs">
  170. <img src="@/assets/images/Close@2x.png" alt="" @click="closeExam" />
  171. </div>
  172. </div>
  173. <div>
  174. <div><el-button @click="openExamBoxs">选择题卷</el-button></div>
  175. <div>
  176. <span>{{ goodsName }}</span>
  177. <el-button
  178. v-if="goodsName && templateRadio"
  179. type="text"
  180. style="margin-left: 10px"
  181. @click="delExam"
  182. >删除</el-button
  183. >
  184. </div>
  185. </div>
  186. <span slot="footer" class="dialog-footer">
  187. <el-button @click="closeExam">取 消</el-button>
  188. <el-button type="primary" @click="submitExam">确 定</el-button>
  189. </span>
  190. </el-dialog>
  191. <el-dialog
  192. :visible.sync="dialogVisiblePZDown"
  193. width="900px"
  194. :show-close="false"
  195. :close-on-click-modal="false"
  196. >
  197. <div slot="title" class="hearders">
  198. <div class="leftTitle">选择题卷</div>
  199. <div class="rightBoxs">
  200. <img src="@/assets/images/Close@2x.png" alt="" @click="closePZ" />
  201. </div>
  202. </div>
  203. <div>
  204. <el-table
  205. ref="multipleTable"
  206. :data="tableDataExam"
  207. border
  208. :header-cell-style="{
  209. 'background-color': '#eee',
  210. padding: '8px',
  211. color: '#333',
  212. }"
  213. >
  214. <el-table-column label="" width="45" align="center">
  215. <template scope="scope">
  216. <el-radio
  217. class="radioTables"
  218. :label="scope.row.examId"
  219. v-model="templateRadioLS"
  220. @change.native="getTemplateRow(scope.$index, scope.row)"
  221. >{{ "" }}</el-radio
  222. >
  223. </template>
  224. </el-table-column>
  225. <template v-for="(item, index) in tableListExam">
  226. <el-table-column
  227. v-if="item.scope !== 'inputs'"
  228. :width="item.width"
  229. :key="index"
  230. :label="item.label"
  231. align="center"
  232. :show-overflow-tooltip="true"
  233. header-align="center"
  234. >
  235. <template slot-scope="scope">
  236. <span v-if="item.scope === 'moreList'">
  237. {{
  238. scope.row[item.prop1] +
  239. "-" +
  240. scope.row[item.prop2] +
  241. "-" +
  242. scope.row[item.prop3]
  243. }}
  244. </span>
  245. <span v-else-if="item.prop === 'status'">{{
  246. scope.row[item.prop] === 1
  247. ? "发布"
  248. : scope.row[item.prop] === 0
  249. ? "未发布"
  250. : "未知"
  251. }}</span>
  252. <span v-else>{{ scope.row[item.prop] }}</span></template
  253. >
  254. </el-table-column></template
  255. >
  256. </el-table>
  257. </div>
  258. <span slot="footer" class="dialog-footer">
  259. <el-button @click="closePZ">取 消</el-button>
  260. <el-button type="primary" @click="submitPZ">确 定</el-button>
  261. </span>
  262. </el-dialog>
  263. </div>
  264. </template>
  265. <script>
  266. import pagination from "@/components/pagination";
  267. export default {
  268. components: { pagination },
  269. data() {
  270. return {
  271. tableDataExam: [],
  272. tableListExam: [
  273. {
  274. label: "试卷编码",
  275. prop: "code",
  276. },
  277. {
  278. label: "标题前缀",
  279. prop: "prefixName",
  280. },
  281. {
  282. label: "试卷标题",
  283. prop: "examName",
  284. },
  285. {
  286. label: "业务层级",
  287. prop1: "educationName",
  288. prop2: "projectName",
  289. prop3: "businessName",
  290. scope: "moreList",
  291. width: "250px",
  292. },
  293. {
  294. label: "发布状态",
  295. prop: "publishStatus",
  296. scope: "status",
  297. },
  298. ],
  299. templateRadioLS: "",
  300. goodsNameLS: "",
  301. templateRadio: "",
  302. goodsName: "",
  303. menuExamList: [],//关联试卷列表
  304. onlyId: "",
  305. newShowObj: {}, //当前关联题卷OBJ
  306. dialogVisiblePZDown: false,
  307. aboutExamStatus: false, //关联试卷弹出
  308. centerDialogVisible: false,
  309. radio: "",
  310. headerData: [
  311. {
  312. label: "课程名称",
  313. prop: "courseName",
  314. },
  315. {
  316. label: "业务层次",
  317. prop1: "projectName",
  318. prop2: "businessName",
  319. scope: "more",
  320. },
  321. {
  322. label: "所属院校",
  323. prop: "schoolName",
  324. },
  325. {
  326. label: "所属专业",
  327. prop: "categoryName",
  328. },
  329. {
  330. label: "科目",
  331. prop: "subjectName",
  332. },
  333. ],
  334. pageInfo: {},
  335. tableData: [],
  336. tableDataInfos: [],
  337. tableSet: [
  338. { label: "编码", prop: "code" },
  339. { label: "标题前缀", prop: "prefixName", width: "120" },
  340. { label: "标题", prop: "moduleName", prop1: "name", scope: "teshu" },
  341. {
  342. label: "发布状态",
  343. prop: "publishStatus",
  344. scope: "Status",
  345. width: "120",
  346. },
  347. ],
  348. dialogVisible: false,
  349. boxtableData: [],
  350. activeLists: [],
  351. total: 0, //一共多少条
  352. pageSize: 10, //每页多少条数据
  353. currentPage: 1, //当前页码
  354. theModuleList: [],
  355. theChapterList: [],
  356. theSectionList: [],
  357. layoutTreeProps: {
  358. label(data, node) {
  359. return data.name;
  360. },
  361. isLeaf(data, node) {
  362. return data.hasChildren ? false : true;
  363. },
  364. },
  365. };
  366. },
  367. mounted() {
  368. this.getDs();
  369. this.search();
  370. this.getSJ();
  371. },
  372. methods: {
  373. openExamBoxs() {
  374. this.templateRadioLS = this.templateRadio;
  375. this.dialogVisiblePZDown = true;
  376. },
  377. //单选触发
  378. getTemplateRow(index, row) {
  379. this.templateRadioLS = row.examId;
  380. this.goodsNameLS = row.examName;
  381. },
  382. //2确定变化选项
  383. submitPZ() {
  384. this.templateRadio = this.templateRadioLS;
  385. this.goodsName = this.goodsNameLS;
  386. this.dialogVisiblePZDown = false;
  387. },
  388. closePZ() {
  389. this.dialogVisiblePZDown = false;
  390. },
  391. //删除题卷
  392. delExam() {
  393. this.templateRadio = "";
  394. this.goodsName = "";
  395. },
  396. //1确定关联试卷弹窗
  397. submitExam() {
  398. if (!this.templateRadio && !this.goodsName) {
  399. this.menuExamList = this.menuExamList.filter((item) => {
  400. return item.onlyId != this.onlyId;
  401. });
  402. } else {
  403. var arrays = {};
  404. let ast = this.onlyId.split("-").map(Number);
  405. arrays = {
  406. onlyId: this.onlyId,
  407. courseId: Number(this.$route.query.id),
  408. moduleId: ast[0],
  409. chapterId: ast[1],
  410. sectionId: ast[2],
  411. examId: this.templateRadio,
  412. examName:this.goodsName,
  413. };
  414. var stu = this.menuExamList.some((item) => {
  415. return item.onlyId == this.onlyId;
  416. });
  417. if (stu) {
  418. for (let i = 0; i < this.menuExamList.length; i++) {
  419. if (this.menuExamList[i].onlyId == this.onlyId) {
  420. this.menuExamList[i] = arrays;
  421. }
  422. }
  423. } else {
  424. this.menuExamList.push(arrays);
  425. }
  426. }
  427. this.aboutExamStatus = false;
  428. },
  429. //开启关联试卷盒子
  430. openExamBox(node, item) {
  431. var ints = item.id.split("-").map(Number)
  432. var arr = []
  433. if(ints[0] === 1){
  434. arr.push(ints[1])
  435. if(ints[2]){
  436. arr.push(ints[2])
  437. }else{
  438. arr.push(0)
  439. }
  440. if(ints[3]){
  441. arr.push(ints[3])
  442. }else{
  443. arr.push(0)
  444. }
  445. }
  446. if(ints[0] === 2){
  447. arr.push(0)
  448. arr.push(ints[1])
  449. if(ints[2]){
  450. arr.push(ints[2])
  451. }else{
  452. arr.push(0)
  453. }
  454. }
  455. if(ints[0] === 3){
  456. arr.push(0)
  457. arr.push(0)
  458. arr.push(ints[1])
  459. }
  460. var atys = arr.join("-")
  461. var setTs = this.menuExamList.some((items) => {
  462. return items.onlyId == atys;
  463. });
  464. if (setTs) {
  465. this.menuExamList.map((items) => {
  466. if (items.onlyId == atys) {
  467. this.templateRadio = items.examId;
  468. this.goodsName = items.examName;
  469. }
  470. });
  471. } else {
  472. this.templateRadio = "";
  473. this.goodsName = "";
  474. }
  475. this.onlyId = atys;
  476. this.aboutExamStatus = true;
  477. },
  478. //关闭关联试卷盒子
  479. closeExam() {
  480. this.aboutExamStatus = false;
  481. },
  482. search() {
  483. this.$api.obtainCourseS(this.$route.query.id).then((res) => {
  484. this.pageInfo = res.data;
  485. });
  486. this.$api
  487. .inquireCoursemenuListS({ courseId: this.$route.query.id })
  488. .then((res) => {
  489. this.tableData = res.rows;
  490. this.changeApis();
  491. this.getList();
  492. });
  493. },
  494. getList() {
  495. this.$api
  496. .inquireCourseListSmenuexam({ courseId: this.$route.query.id })
  497. .then((res) => {
  498. res.rows.forEach(item => {
  499. var lets = []
  500. if(!item.moduleId){
  501. lets.push(0)
  502. }else{
  503. lets.push(item.moduleId)
  504. }
  505. if(!item.chapterId){
  506. lets.push(0)
  507. }else{
  508. lets.push(item.chapterId)
  509. }
  510. if(!item.sectionId){
  511. lets.push(0)
  512. }else{
  513. lets.push(item.sectionId)
  514. }
  515. item.onlyId = lets.join("-")
  516. })
  517. this.menuExamList =res.rows
  518. console.log(this.menuExamList)
  519. });
  520. },
  521. getDs() {
  522. this.$api.inquireCourseListmodule({ status: 1 }).then((res) => {
  523. this.theModuleList = res.rows;
  524. });
  525. this.$api.inquireCourseListchapter({ status: 1 }).then((res) => {
  526. this.theChapterList = res.rows;
  527. });
  528. this.$api.inquireCourseSection({ status: 1 }).then((res) => {
  529. this.theSectionList = res.rows;
  530. });
  531. },
  532. getSJ() {
  533. this.$api.inquirebankexamList({ status: 1 }).then((res) => {
  534. this.tableDataExam = res.rows;
  535. });
  536. },
  537. openBoxs() {
  538. this.radio = "";
  539. this.centerDialogVisible = true;
  540. },
  541. activeCheckBoxs() {
  542. var self = this;
  543. if (this.radio === 1) {
  544. this.moduleApi();
  545. }
  546. if (this.radio === 2) {
  547. this.chapterApi();
  548. }
  549. if (this.radio === 3) {
  550. this.sectionApi();
  551. }
  552. if (this.radio === "") {
  553. this.$message.error("请选择添加类型");
  554. return;
  555. }
  556. this.centerDialogVisible = false;
  557. this.dialogVisible = true;
  558. this.$nextTick(function () {
  559. self.$refs.multipleTable.clearSelection();
  560. });
  561. },
  562. getInfos() {
  563. if (this.radio === 1) {
  564. this.moduleApi();
  565. }
  566. if (this.radio === 2) {
  567. this.chapterApi();
  568. }
  569. if (this.radio === 3) {
  570. this.sectionApi();
  571. }
  572. },
  573. moduleApi() {
  574. this.$api
  575. .inquireCourseListmodule({
  576. status: 1,
  577. pageNum: this.currentPage,
  578. pageSize: this.pageSize,
  579. })
  580. .then((res) => {
  581. this.boxtableData = res.rows;
  582. this.total = res.total;
  583. });
  584. },
  585. chapterApi() {
  586. this.$api
  587. .inquireCourseListchapter({
  588. status: 1,
  589. pageNum: this.currentPage,
  590. pageSize: this.pageSize,
  591. })
  592. .then((res) => {
  593. this.boxtableData = res.rows;
  594. this.total = res.total;
  595. });
  596. },
  597. sectionApi() {
  598. this.$api
  599. .inquireCourseSection({
  600. status: 1,
  601. pageNum: this.currentPage,
  602. pageSize: this.pageSize,
  603. })
  604. .then((res) => {
  605. this.boxtableData = res.rows;
  606. this.total = res.total;
  607. });
  608. },
  609. // 查询是否存在下级 模块
  610. quireModule(id) {
  611. return new Promise((resolve, reject) => {
  612. this.$api.inquireCourseListmodulechapter(id).then((result) => {
  613. if (result.data.length === 0) {
  614. resolve(false);
  615. } else {
  616. resolve(true);
  617. }
  618. });
  619. });
  620. },
  621. // 查询是否存在下级 章
  622. quireChapter(id) {
  623. return new Promise((resolve, reject) => {
  624. this.$api.inquireCoursechaptersectionlist(id).then((result) => {
  625. if (result.data.length === 0) {
  626. resolve(false);
  627. } else {
  628. resolve(true);
  629. }
  630. });
  631. });
  632. },
  633. changeApis() {
  634. //inquireCourseListmodulechapter 模块与章关系
  635. // inquireCoursechaptersectionlist 章与节关系
  636. var arrays = [];
  637. this.tableData.map((item, index) => {
  638. if (item.type === 1) {
  639. // this.$api.obtainCoursemodule(item.menuId).then(async (res) => {
  640. var arr = {
  641. id: "1-" + item.menuId,
  642. CodeId: item.menuId,
  643. name: item.menuName,
  644. hasChildren: true,
  645. type: 1,
  646. isDels: true,
  647. };
  648. //查询是否存在下级
  649. arrays.push(arr);
  650. // });
  651. }
  652. if (item.type === 2) {
  653. // this.$api.obtainCoursechapter(item.menuId).then(async (res) => {
  654. var arr = {
  655. id: "2-" + item.menuId,
  656. CodeId: item.menuId,
  657. name: item.menuName,
  658. hasChildren: true,
  659. type: 2,
  660. isDels: true,
  661. };
  662. arrays.push(arr);
  663. // });
  664. }
  665. if (item.type === 3) {
  666. // this.$api.obtainCourseSection(item.menuId).then((res) => {
  667. var arr = {
  668. id: "3-" + item.menuId,
  669. CodeId: item.menuId,
  670. name: item.menuName,
  671. hasChildren: false,
  672. type: 3,
  673. isDels: true,
  674. };
  675. arrays.push(arr);
  676. // });
  677. }
  678. });
  679. this.$nextTick(() => {
  680. this.tableDataInfos = arrays;
  681. });
  682. },
  683. del(node, item) {
  684. this.tableDataInfos.map((items, indexs) => {
  685. if (items.id === item.id) {
  686. this.tableDataInfos.splice(indexs, 1);
  687. }
  688. });
  689. this.tableDataInfos = JSON.parse(JSON.stringify(this.tableDataInfos));
  690. },
  691. getRowKeys(row) {
  692. if (this.radio === 1) {
  693. return row.moduleId;
  694. }
  695. if (this.radio === 2) {
  696. return row.chapterId;
  697. }
  698. if (this.radio === 3) {
  699. return row.sectionId;
  700. }
  701. },
  702. checkboxT(row, index) {
  703. var array = [];
  704. this.tableDataInfos.map((item) => {
  705. if (item.type === this.radio) {
  706. array.push(item.CodeId);
  707. }
  708. });
  709. if (
  710. array.indexOf(
  711. this.radio === 1
  712. ? row.moduleId
  713. : this.radio === 2
  714. ? row.chapterId
  715. : row.sectionId
  716. ) !== -1
  717. ) {
  718. return false;
  719. } else {
  720. return true;
  721. }
  722. },
  723. submitForm() {
  724. if (this.activeLists.length === 0) {
  725. this.dialogVisible = false;
  726. return;
  727. }
  728. var array = [];
  729. if (this.radio === 1) {
  730. this.activeLists.map((item) => {
  731. array.push({
  732. id: 1 + "-" + item.moduleId,
  733. CodeId: item.moduleId,
  734. name: item.moduleName,
  735. isDels: true,
  736. hasChildren: true,
  737. type: 1,
  738. });
  739. });
  740. } else if (this.radio === 2) {
  741. this.activeLists.map((item) => {
  742. array.push({
  743. id: 2 + "-" + item.chapterId,
  744. CodeId: item.chapterId,
  745. name: item.name,
  746. isDels: true,
  747. hasChildren: true,
  748. type: 2,
  749. });
  750. });
  751. } else if (this.radio === 3) {
  752. this.activeLists.map((item) => {
  753. array.push({
  754. id: 3 + "-" + item.sectionId,
  755. CodeId: item.sectionId,
  756. name: item.name,
  757. type: 3,
  758. isDels: true,
  759. });
  760. });
  761. }
  762. this.tableDataInfos = this.tableDataInfos.concat(array);
  763. this.activeLists = [];
  764. this.dialogVisible = false;
  765. this.$message.success("添加成功");
  766. },
  767. handleNodeClick() {},
  768. async load(node, resolve) {
  769. const tree = node.data;
  770. if (tree.type === 1) {
  771. var arrays = [];
  772. await this.$api
  773. .inquireCourseListmodulechapter(tree.CodeId)
  774. .then((res) => {
  775. res.data.map((item, index) => {
  776. var arr = {
  777. id: tree.id + "-" + item.chapterId,
  778. CodeId: item.chapterId,
  779. name: item.name,
  780. hasChildren: true,
  781. type: 2,
  782. };
  783. arrays.push(arr);
  784. });
  785. });
  786. resolve(arrays);
  787. }
  788. if (tree.type === 2) {
  789. this.$api.inquireCoursechaptersectionlist(tree.CodeId).then((res) => {
  790. var arrays = [];
  791. res.data.map((item, index) => {
  792. var arr = {
  793. id: tree.id + "-" + item.sectionId,
  794. CodeId: item.sectionId,
  795. name: item.name,
  796. type: 3,
  797. };
  798. arrays.push(arr);
  799. });
  800. resolve(arrays);
  801. });
  802. }
  803. return;
  804. if (tree.type === 1) {
  805. var arrays = [];
  806. await this.$api
  807. .inquireCourseListmodulechapter(tree.CodeId)
  808. .then((res) => {
  809. res.data.map((item, index) => {
  810. var arr = {
  811. id: tree.id + "-" + item.chapterId,
  812. CodeId: item.chapterId,
  813. name: item.name,
  814. hasChildren: true,
  815. type: 2,
  816. };
  817. arrays.push(arr);
  818. });
  819. });
  820. resolve(arrays);
  821. }
  822. if (tree.type === 2) {
  823. this.$api.inquireCoursechaptersectionlist(tree.CodeId).then((res) => {
  824. var arrays = [];
  825. res.data.map((item, index) => {
  826. var arr = {
  827. id: tree.id + "-" + item.sectionId,
  828. CodeId: item.sectionId,
  829. name: item.name,
  830. type: 3,
  831. };
  832. arrays.push(arr);
  833. });
  834. resolve(arrays);
  835. });
  836. }
  837. },
  838. handleSizeChange(v) {
  839. this.pageSize = v;
  840. this.currentPage = 1;
  841. this.getInfos();
  842. },
  843. handleCurrentChange(v) {
  844. this.currentPage = v;
  845. this.getInfos();
  846. },
  847. selectAll(value) {
  848. this.activeLists = value;
  849. },
  850. select(value) {
  851. this.activeLists = value;
  852. },
  853. backPage() {
  854. this.$router.go(-1);
  855. },
  856. submit() {
  857. var array = [];
  858. this.tableDataInfos.map((item) => {
  859. array.push({
  860. courseId: Number(this.$route.query.id),
  861. menuId: item.CodeId,
  862. parentId: 0,
  863. status: 1,
  864. type: item.type,
  865. });
  866. });
  867. var data = {
  868. courseId: Number(this.$route.query.id),
  869. menuExamList:this.menuExamList,
  870. menuList: array,
  871. };
  872. this.$api.editCoursemenu(data).then((res) => {
  873. this.$message.success("编辑成功");
  874. setTimeout(() => {
  875. this.$router.go(-1);
  876. }, 500);
  877. });
  878. },
  879. },
  880. };
  881. </script>
  882. <style lang="less" scoped>
  883. .fatherSty {
  884. background-color: #eee;
  885. padding: 10px;
  886. margin-bottom: 15px;
  887. }
  888. .floatLefts {
  889. font-size: 14px;
  890. float: left;
  891. margin-right: 30px;
  892. }
  893. .mar_b {
  894. margin-bottom: 12px;
  895. }
  896. .dis-f {
  897. margin-top: 20px;
  898. display: flex;
  899. align-items: center;
  900. justify-content: center;
  901. }
  902. /deep/.el-tree-node__content {
  903. height: 35px;
  904. }
  905. .custom-tree-node {
  906. flex: 1;
  907. display: flex;
  908. align-items: center;
  909. justify-content: space-between;
  910. padding-right: 8px;
  911. }
  912. /deep/.el-button {
  913. border-radius: 8px;
  914. }
  915. /deep/.el-dialog {
  916. border-radius: 8px;
  917. .el-dialog__header {
  918. padding: 0;
  919. .hearders {
  920. height: 40px;
  921. display: flex;
  922. align-items: center;
  923. justify-content: space-between;
  924. padding: 0px 18px 0px 20px;
  925. border-bottom: 1px solid #e2e2e2;
  926. .leftTitle {
  927. font-size: 14px;
  928. font-weight: bold;
  929. color: #2f4378;
  930. }
  931. .rightBoxs {
  932. display: flex;
  933. align-items: center;
  934. img {
  935. width: 14px;
  936. height: 14px;
  937. margin-left: 13px;
  938. cursor: pointer;
  939. }
  940. }
  941. }
  942. }
  943. .el-dialog__footer {
  944. padding: 0;
  945. .dialog-footer {
  946. padding: 0px 40px;
  947. height: 70px;
  948. border-top: 1px solid #e2e2e2;
  949. display: flex;
  950. align-items: center;
  951. justify-content: flex-end;
  952. }
  953. }
  954. }
  955. </style>