12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403 |
- <template>
- <div id="chapterContent">
- <el-tabs v-model="activeName" type="card" v-if="status">
- <el-tab-pane label="课程基本信息" name="first" disabled></el-tab-pane>
- <el-tab-pane label="课程章节内容" name="second"></el-tab-pane>
- </el-tabs>
- <ul class="fatherSty">
- <li class="floatLefts" v-for="(item, index) in headerData" :key="index">
- {{ item.label }}:{{
- item.scope === "more"
- ? pageInfo[item.prop1] + "-" + pageInfo[item.prop2]
- : pageInfo[item.prop]
- }}
- </li>
- <div style="clear: both"></div>
- </ul>
- <div class="mar_b">
- <el-button slot="reference" type="success" @click="openBoxs"
- >添加 模块/章/节</el-button
- >
- <div>
- <el-button type="primary" @click="openPreferenceBoxs"
- >配置优选</el-button
- >
- <el-button type="primary" @click="openSortBoxs">排序</el-button>
- </div>
- </div>
- <el-tree
- ref="tree"
- :data="tableDataInfos"
- lazy
- :load="load"
- :props="layoutTreeProps"
- @node-click="handleNodeClick"
- >
- <span class="custom-tree-node" slot-scope="{ node, data }">
- <span>{{ node.label }}</span>
- <span>
- <el-button
- v-if="data.isDels"
- type="text"
- size="mini"
- @click.stop="del(node, data)"
- >
- 删除
- </el-button>
- <el-button
- type="text"
- size="mini"
- style="color: green"
- @click.stop="openExamBox(node, data)"
- >
- 关联试卷
- </el-button>
- <el-button
- v-if="getShowStatus(data) || data.type === 3"
- type="text"
- size="mini"
- style="color: orange"
- @click.stop="preview(node, data)"
- >
- 预览
- </el-button>
- </span>
- </span>
- </el-tree>
- <div class="dis-f">
- <el-button @click="backPage">取消</el-button>
- <el-button
- type="primary"
- @click="submit"
- :disabled="!noStudent"
- :loading="disabledBtn"
- >确定</el-button
- >
- </div>
- <el-dialog
- :visible.sync="centerDialogVisible"
- width="300px"
- :show-close="false"
- :close-on-click-modal="false"
- >
- <div slot="title" class="hearders">
- <div class="leftTitle">添加模块/章/节</div>
- <div class="rightBoxs">
- <img
- src="@/assets/images/Close@2x.png"
- alt=""
- @click="centerDialogVisible = false"
- />
- </div>
- </div>
- <el-radio-group v-model="radio" class="dis-f">
- <el-radio :label="1">模块</el-radio>
- <el-radio :label="2">章</el-radio>
- <el-radio :label="3">节</el-radio>
- </el-radio-group>
- <span slot="footer" class="dialog-footer">
- <el-button @click="centerDialogVisible = false" size="small"
- >取 消</el-button
- >
- <el-button type="primary" @click="activeCheckBoxs" size="small"
- >确 定</el-button
- >
- </span>
- </el-dialog>
- <el-dialog
- :visible.sync="dialogVisible"
- width="800px"
- :show-close="false"
- :close-on-click-modal="false"
- >
- <div slot="title" class="hearders">
- <div class="leftTitle">
- {{ radio === 1 ? "添加模块" : radio === 2 ? "添加章" : "添加节" }}
- </div>
- <div class="rightBoxs">
- <img
- src="@/assets/images/Close@2x.png"
- alt=""
- @click="dialogVisible = false"
- />
- </div>
- </div>
- <search-box-new
- ref="searchBox"
- :formData="formData5"
- :formList="formList5"
- @search="getInfos"
- @init="init5"
- />
- <el-table
- ref="multipleTable"
- :data="boxtableData"
- border
- @selection-change="selectionChange"
- :row-key="getRowKeys"
- :header-cell-style="{
- 'background-color': '#eee',
- padding: '8px',
- color: '#333',
- }"
- >
- <el-table-column
- align="center"
- type="selection"
- width="55"
- header-align="center"
- :selectable="checkboxT"
- :reserve-selection="true"
- >
- </el-table-column>
- <el-table-column
- v-for="(item, index) in tableSet"
- :width="item.width"
- :key="index"
- :label="item.label"
- align="center"
- :show-overflow-tooltip="true"
- header-align="center"
- >
- <template slot-scope="scope">
- <span v-if="item.scope === 'Status'">
- {{
- scope.row[item.prop] === 1
- ? "发布"
- : scope.row[item.prop] === 0
- ? "未发布"
- : "未知"
- }}
- </span>
- <span v-else-if="item.scope === 'teshu'">
- {{ radio === 1 ? scope.row[item.prop] : scope.row[item.prop1] }}
- </span>
- <span v-else>{{ scope.row[item.prop] }}</span></template
- >
- </el-table-column>
- </el-table>
- <pagination
- :total="total5"
- :pageSize="formData5.pageSize"
- :currentPage="formData5.pageNum"
- @handleSizeChange="handleSizeChange"
- @handleCurrentChange="handleCurrentChange"
- />
- <span slot="footer" class="dialog-footer">
- <el-button @click="dialogVisible = false">取 消</el-button>
- <el-button
- type="primary"
- @click="submitForm"
- :disabled="activeLists.length === 0"
- >确 定</el-button
- >
- </span>
- </el-dialog>
- <el-dialog
- :visible.sync="aboutExamStatus"
- width="560px"
- :show-close="false"
- :close-on-click-modal="false"
- >
- <div slot="title" class="hearders">
- <div class="leftTitle">关联题卷</div>
- <div class="rightBoxs">
- <img src="@/assets/images/Close@2x.png" alt="" @click="closeExam" />
- </div>
- </div>
- <div>
- <div><el-button @click="openExamBoxs">选择题卷</el-button></div>
- <div v-for="(item, index) in activeArray" :key="index">
- <span>{{ item.examName }}</span>
- <el-button
- type="text"
- style="margin-left: 10px"
- @click="activeArray.splice(index, 1)"
- >删除</el-button
- >
- </div>
- </div>
- <span slot="footer" class="dialog-footer">
- <el-button @click="closeExam">取 消</el-button>
- <el-button type="primary" @click="submitExam">确 定</el-button>
- </span>
- </el-dialog>
- <el-dialog
- :visible.sync="sortTablesBoxs"
- width="560px"
- :show-close="false"
- :close-on-click-modal="false"
- >
- <div slot="title" class="hearders">
- <div class="leftTitle">排序</div>
- <div class="rightBoxs">
- <img
- src="@/assets/images/Close@2x.png"
- alt=""
- @click="sortTablesBoxs = false"
- />
- </div>
- </div>
- <div>
- <el-row>
- <el-col :span="22">
- <ul>
- <li
- v-for="(item, index) in sortList"
- :key="index"
- style="margin-bottom: 6px"
- >
- <el-input-number
- :controls="false"
- size="mini"
- v-model="sortList[index].sort"
- :min="0"
- style="width: 50px"
- ></el-input-number>
- <span style="margin-left: 10px">{{ item.name }}</span>
- </li>
- </ul>
- </el-col>
- <el-col :span="2">
- <button @click="initSort">重置</button>
- </el-col>
- </el-row>
- </div>
- <span slot="footer" class="dialog-footer">
- <el-button @click="sortTablesBoxs = false">取 消</el-button>
- <el-button type="primary" @click="submitTableBoxs">确 定</el-button>
- </span>
- </el-dialog>
- <el-dialog
- :visible.sync="dialogVisiblePZDown"
- width="1100px"
- :show-close="false"
- :close-on-click-modal="false"
- >
- <div slot="title" class="hearders">
- <div class="leftTitle">选择题卷</div>
- <div class="rightBoxs">
- <img src="@/assets/images/Close@2x.png" alt="" @click="closePZ" />
- </div>
- </div>
- <div v-if="dialogVisiblePZDown">
- <search-box-new
- ref="searchBox"
- :formData="formData6"
- :formList="formList6"
- @search="getSJ(1)"
- @init="init6"
- />
- <el-table
- ref="tableExam"
- row-key="examId"
- :data="tableDataExam"
- border
- :header-cell-style="{
- 'background-color': '#eee',
- padding: '8px',
- color: '#333',
- }"
- @selection-change="selectionChangeExam"
- >
- <el-table-column
- label=""
- width="45"
- align="center"
- v-if="ActiveExamType === 3"
- >
- <template scope="scope">
- <!-- <el-radio
- class="radioTables"
- :label="scope.row.examId"
- v-model="nowActiveCheckObj.examId"
- @change.native="getTemplateRow(scope.$index, scope.row)"
- >{{ "" }}</el-radio
- > -->
- <div
- class="radioTables"
- @click="getTemplateRow(scope.$index, scope.row)"
- >
- <div
- class="activeRadio"
- v-if="scope.row.examId === nowActiveCheckObj.examId"
- ></div>
- </div>
- </template>
- </el-table-column>
- <el-table-column
- type="selection"
- width="55"
- align="center"
- reserve-selection
- :selectable="checkboxExam"
- v-else
- >
- </el-table-column>
- <template v-for="(item, index) in tableListExam">
- <el-table-column
- v-if="item.scope !== 'inputs'"
- :width="item.width"
- :key="index"
- :label="item.label"
- align="center"
- header-align="center"
- >
- <!-- :show-overflow-tooltip="true" -->
- <template slot-scope="scope">
- <el-popover
- v-if="item.scope === 'moreList'"
- placement="right-end"
- trigger="hover"
- >
- <ul>
- <li
- v-for="(items, indexs) in scope.row['businessList']"
- :key="indexs"
- >
- {{ getBusinessName(items, item) }}
- </li>
- </ul>
- <ul slot="reference" style="cursor: pointer;">
- <li
- v-for="(items, indexs) in scope.row['businessList'].slice(0, 3)"
- :key="indexs"
- >
- {{ getBusinessName(items, item) }}
- </li>
- 等{{ scope.row['businessList'].length }}份试卷
- </ul>
- </el-popover>
-
- <span v-else-if="item.scope === 'status'">{{
- scope.row[item.prop] === 1
- ? "发布"
- : scope.row[item.prop] === 0
- ? "未发布"
- : "未知"
- }}</span>
- <span v-else>{{ scope.row[item.prop] }}</span></template
- >
- </el-table-column></template
- >
- </el-table>
- <pagination
- :total="total6"
- :pageSize="formData6.pageSize"
- :currentPage="formData6.pageNum"
- @handleSizeChange="handleSizeChange6"
- @handleCurrentChange="handleCurrentChange6"
- />
- </div>
- <span slot="footer" class="dialog-footer">
- <el-button @click="closePZ">取 消</el-button>
- <el-button type="primary" @click="submitPZ">确 定</el-button>
- </span>
- </el-dialog>
- <test-paper-preview ref="testPaperPreview" />
- <video-preview ref="preview" />
- <preference ref="preference" :tableDataInfos.sync="tableDataInfos" />
- </div>
- </template>
- <script>
- import searchBoxNew from "@/components/searchBoxNew";
- import pagination from "@/components/pagination";
- import testPaperPreview from "@/components/testPaperPreview";
- import videoPreview from "@/components/videoPreview";
- import preference from "./preference";
- export default {
- name: "ChapterContent",
- components: {
- searchBoxNew,
- pagination,
- testPaperPreview,
- videoPreview,
- preference,
- },
- data() {
- return {
- disabledBtn: false,
- sortTablesBoxs: false,
- activeName: "second",
- status: false,
- tableDataExam: [],
- tableListExam: [
- {
- label: "试卷编码",
- prop: "code",
- width: "120px",
- },
- {
- label: "标题前缀",
- prop: "prefixName",
- width: "160px",
- },
- {
- label: "试卷标题",
- prop: "examName",
- width: "300px",
- },
- {
- label: "业务层级",
- prop1: "educationName",
- prop2: "projectName",
- prop3: "businessName",
- prop4: "subjectName",
- scope: "moreList",
- width: "300px",
- },
- {
- label: "发布状态",
- prop: "publishStatus",
- scope: "status",
- },
- ],
- templateRadioLS: "",
- goodsNameLS: "",
- templateRadio: "",
- goodsName: "",
- menuExamList: [], //关联试卷列表
- onlyId: "",
- newShowObj: {}, //当前关联题卷OBJ
- dialogVisiblePZDown: false,
- aboutExamStatus: false, //关联试卷弹出
- centerDialogVisible: false,
- radio: "",
- headerData: [
- {
- label: "课程名称",
- prop: "courseName",
- },
- {
- label: "业务层次",
- prop1: "projectName",
- prop2: "businessName",
- scope: "more",
- },
- {
- label: "所属院校",
- prop: "schoolName",
- },
- // {
- // label: "所属专业",
- // prop: "categoryName",
- // },
- {
- label: "科目",
- prop: "subjectName",
- },
- ],
- pageInfo: {},
- tableData: [],
- tableDataInfos: [],
- tableSet: [
- { label: "编码", prop: "code", width: "120" },
- { label: "标题前缀", prop: "prefixName", width: "160" },
- {
- label: "标题",
- prop: "moduleName",
- prop1: "name",
- scope: "teshu",
- width: "300",
- },
- {
- label: "发布状态",
- prop: "publishStatus",
- scope: "Status",
- },
- ],
- dialogVisible: false,
- boxtableData: [],
- activeLists: [],
- total5: 0, //一共多少条
- formData5: {
- pageSize: 10,
- pageNum: 1,
- status: 1,
- publishStatus: 1,
- name: "",
- key: "",
- },
- formList5: [],
- total6: 0,
- formData6: {
- pageSize: 10,
- pageNum: 1,
- status: 1,
- publishStatus: 1,
- name: "",
- key: "",
- },
- formList6: [
- {
- placeholder: "试卷标题/试卷编码/标题前缀",
- prop: "key",
- },
- ],
- theModuleList: [],
- theChapterList: [],
- theSectionList: [],
- sortList: [],
- noStudent: true,
- layoutTreeProps: {
- label(data, node) {
- return data.name;
- },
- isLeaf(data, node) {
- return data.hasChildren ? false : true;
- },
- },
- activeArray: [],
- nowActiveCheck: [], //当前选中复选框
- nowActiveCheckObj: {}, //当前选中单选框
- ActiveExamType: null, //当前关联类型
- };
- },
- computed: {
- /**
- * 查询是否关联试卷
- */
- getShowStatus: function () {
- return function (item) {
- var ints = item.id.split("-").map(Number);
- if (ints[0] === 1) {
- var atys = `${ints[1]}-${ints[2] || 0}-${ints[3] || 0}`;
- }
- if (ints[0] === 2) {
- var atys = `0-${ints[1]}-${ints[2] || 0}`;
- }
- if (ints[0] === 3) {
- var atys = `0-0-${ints[1]}`;
- }
- var setTs = this.menuExamList.some((items) => {
- return items.onlyId == atys;
- });
- return setTs;
- };
- },
- // 获取业务层次列全称
- getBusinessName: function() {
- return function(items, item) {
- return `${items[item.prop1]}-${items[item.prop2]}-${items[item.prop3]}-${items[item.prop4]}`
- }
- }
- },
- mounted() {
- this.$api
- .gradecheckGoodsChange({ courseId: this.$route.query.id })
- .then((res) => {
- if (res.data > 0) {
- // this.noStudent = false;
- }
- });
- // this.getDs();
- this.search();
- },
- methods: {
- openPreferenceBoxs() {
- this.$refs.preference.openBoxs(
- JSON.parse(JSON.stringify(this.tableDataInfos))
- );
- },
- allowDrag(node) {
- if (node.level == 1) {
- return true;
- } else {
- return false;
- }
- },
- allowDrop(draggingNode, dropNode, type) {
- if (
- (type === "prev" || type === "next") &&
- draggingNode.level == 1 &&
- dropNode.level == 1
- ) {
- return true;
- }
- },
- selectionChangeExam(a) {
- this.nowActiveCheck = a;
- },
- preview(node, data) {
- if (data.type === 1 || data.type === 2) {
- var ints = data.id.split("-").map(Number);
- if (ints[0] === 1) {
- var atys = `${ints[1]}-${ints[2] || 0}-${ints[3] || 0}`;
- }
- if (ints[0] === 2) {
- var atys = `0-${ints[1]}-${ints[2] || 0}`;
- }
- if (ints[0] === 3) {
- var atys = `0-0-${ints[1]}`;
- }
- if (this.menuExamList.some((items) => items.onlyId == atys)) {
- const array = this.menuExamList.filter((item) => item.onlyId == atys);
- this.$refs.testPaperPreview.openBox(1, array);
- }
- }
- if (data.type === 3) {
- this.$api.obtainCourseSection(data.CodeId).then((res) => {
- this.$refs.preview.diavosFun(res.data);
- });
- }
- },
- initSort() {
- this.sortList = JSON.parse(JSON.stringify(this.tableDataInfos));
- },
- submitTableBoxs() {
- let arr = this.sortList.map((items) => {
- return items.sort;
- });
- if (new Set(arr).size != arr.length) {
- this.$message.warning("排序不允许有重复值");
- return;
- }
- this.tableDataInfos = this.sortList.sort((a, b) => a.sort - b.sort);
- this.sortTablesBoxs = false;
- },
- openSortBoxs() {
- this.sortList = JSON.parse(JSON.stringify(this.tableDataInfos));
- this.sortTablesBoxs = true;
- },
- openExamBoxs() {
- this.getSJ(2);
- if (this.ActiveExamType === 3) {
- if (this.activeArray.length === 0) {
- this.nowActiveCheckObj = {};
- } else {
- this.nowActiveCheckObj = JSON.parse(
- JSON.stringify(this.activeArray[0])
- );
- }
- } else {
- this.nowActiveCheck = [];
- }
- this.dialogVisiblePZDown = true;
- this.$nextTick(() => {
- this.$refs.tableExam.clearSelection();
- });
- },
- //单选触发
- getTemplateRow(index, row) {
- this.nowActiveCheckObj = row;
- console.log(row.examId, this.nowActiveCheckObj.examId);
- },
- //2确定变化选项
- submitPZ() {
- if (this.ActiveExamType !== 3) {
- this.activeArray.push(...this.nowActiveCheck);
- } else {
- this.activeArray = [this.nowActiveCheckObj];
- }
- this.dialogVisiblePZDown = false;
- },
- closePZ() {
- this.dialogVisiblePZDown = false;
- },
- //1确定关联试卷弹窗
- submitExam() {
- if (this.ActiveExamType === 3 && this.activeArray.length > 1) {
- this.$message.error("只允许关联一张试卷");
- return;
- }
- this.menuExamList = this.menuExamList.filter(
- (item) => item.onlyId != this.onlyId
- );
- if (this.activeArray.length !== 0) {
- let ast = this.onlyId.split("-").map(Number);
- var newList = this.activeArray.map((item) => {
- return {
- onlyId: this.onlyId,
- courseId: Number(this.$route.query.id),
- moduleId: ast[0],
- chapterId: ast[1],
- sectionId: ast[2],
- examId: item.examId,
- examName: item.examName,
- };
- });
- this.menuExamList.push(...newList);
- }
- this.aboutExamStatus = false;
- },
- //开启关联试卷盒子
- openExamBox(node, item) {
- var ints = item.id.split("-").map(Number);
- if (ints[0] === 1) {
- var atys = `${ints[1]}-${ints[2] || 0}-${ints[3] || 0}`;
- }
- if (ints[0] === 2) {
- var atys = `0-${ints[1]}-${ints[2] || 0}`;
- }
- if (ints[0] === 3) {
- var atys = `0-0-${ints[1]}`;
- }
- if (this.menuExamList.some((i) => i.onlyId == atys)) {
- this.activeArray = this.menuExamList.filter(
- (items) => items.onlyId == atys
- );
- } else {
- this.activeArray = [];
- }
- this.onlyId = atys;
- this.ActiveExamType = item.type;
- this.aboutExamStatus = true;
- },
- //关闭关联试卷盒子
- closeExam() {
- this.aboutExamStatus = false;
- },
- search() {
- this.$api.obtainCourseS(this.$route.query.id).then((res) => {
- this.pageInfo = res.data;
- });
- this.$api
- .inquireCoursemenuListS({ courseId: this.$route.query.id })
- .then((res) => {
- this.tableData = res.rows;
- this.changeApis();
- this.getList();
- });
- },
- getList() {
- this.$api
- .inquireCourseListSmenuexam({ courseId: this.$route.query.id })
- .then((res) => {
- res.rows.forEach((item) => {
- item.onlyId = `${item.moduleId || 0}-${item.chapterId || 0}-${
- item.sectionId || 0
- }`;
- });
- this.menuExamList = res.rows;
- });
- },
- getDs() {
- this.$api.inquireCourseListmodule({ status: 1 }).then((res) => {
- this.theModuleList = res.rows;
- });
- this.$api.inquireCourseListchapter({ status: 1 }).then((res) => {
- this.theChapterList = res.rows;
- });
- this.$api.inquireCourseSection({ status: 1 }).then((res) => {
- this.theSectionList = res.rows;
- });
- },
- getSJ(int) {
- if (int === 1) {
- this.formData6.pageNum = 1;
- }
- if (int === 2) {
- this.formData6.name = "";
- this.formData6.key = "";
- this.formData6.pageNum = 1;
- this.formData6.pageSize = 10;
- }
- var data = JSON.parse(JSON.stringify(this.formData6));
- data.businessId = this.pageInfo.businessId;
- data.subjectId = this.pageInfo.subjectId;
- data.name = this.formData6.name;
- data.exclude = 1;
- this.$api.inquirebankexamList(data).then((res) => {
- this.tableDataExam = res.rows;
- this.total6 = res.total;
- });
- },
- openBoxs() {
- this.radio = "";
- this.centerDialogVisible = true;
- },
- activeCheckBoxs() {
- var self = this;
- if (!this.radio) {
- this.$message.error("请选择添加类型");
- return;
- }
- if (this.radio === 1) {
- this.formList5 = [
- {
- placeholder: "模块标题/模块编码/标题前缀",
- prop: "key",
- },
- ];
- this.moduleApi(2);
- }
- if (this.radio === 2) {
- this.formList5 = [
- {
- placeholder: "章标题/章编码/标题前缀",
- prop: "key",
- },
- ];
- this.chapterApi(2);
- }
- if (this.radio === 3) {
- this.formList5 = [
- {
- placeholder: "节标题/节编码/标题前缀",
- prop: "key",
- },
- ];
- this.sectionApi(2);
- }
- this.centerDialogVisible = false;
- this.dialogVisible = true;
- this.$nextTick(function () {
- self.activeLists = [];
- self.$refs.multipleTable.clearSelection();
- });
- },
- init5() {
- this.getInfos(2);
- },
- getInfos(int) {
- if (this.radio === 1) {
- this.moduleApi(int);
- }
- if (this.radio === 2) {
- this.chapterApi(int);
- }
- if (this.radio === 3) {
- this.sectionApi(int);
- }
- },
- moduleApi(int) {
- if (int === 1) {
- this.formData5.pageNum = 1;
- }
- if (int === 2) {
- this.formData5.name = "";
- this.formData5.key = "";
- this.formData5.pageNum = 1;
- this.formData5.pageSize = 10;
- }
- var data = JSON.parse(JSON.stringify(this.formData5));
- data.businessId = this.pageInfo.businessId;
- data.subjectId = this.pageInfo.subjectId;
- data.name = this.formData5.name;
- this.$api.inquireCourseListmodule(data).then((res) => {
- this.boxtableData = res.rows;
- this.total5 = res.total;
- });
- },
- chapterApi(int) {
- if (int === 1) {
- this.formData5.pageNum = 1;
- }
- if (int === 2) {
- this.formData5.name = "";
- this.formData5.pageNum = 1;
- this.formData5.key = "";
- this.formData5.pageSize = 10;
- }
- var data = JSON.parse(JSON.stringify(this.formData5));
- data.businessId = this.pageInfo.businessId;
- data.subjectId = this.pageInfo.subjectId;
- data.name = this.formData5.name;
- this.$api.inquireCourseListchapter(data).then((res) => {
- this.boxtableData = res.rows;
- this.total5 = res.total;
- });
- },
- sectionApi(int) {
- if (int === 1) {
- this.formData5.pageNum = 1;
- }
- if (int === 2) {
- this.formData5.name = "";
- this.formData5.key = "";
- this.formData5.pageNum = 1;
- this.formData5.pageSize = 10;
- }
- var data = JSON.parse(JSON.stringify(this.formData5));
- data.businessId = this.pageInfo.businessId;
- data.subjectId = this.pageInfo.subjectId;
- data.name = this.formData5.name;
- this.$api.inquireCourseSection(data).then((res) => {
- this.boxtableData = res.rows;
- this.total5 = res.total;
- });
- },
- // 查询是否存在下级 模块
- quireModule(id) {
- return new Promise((resolve, reject) => {
- this.$api.inquireCourseListmodulechapter(id).then((result) => {
- if (result.data.length === 0) {
- resolve(false);
- } else {
- resolve(true);
- }
- });
- });
- },
- // 查询是否存在下级 章
- quireChapter(id) {
- return new Promise((resolve, reject) => {
- this.$api.inquireCoursechaptersectionlist(id).then((result) => {
- if (result.data.length === 0) {
- resolve(false);
- } else {
- resolve(true);
- }
- });
- });
- },
- changeApis() {
- //inquireCourseListmodulechapter 模块与章关系
- // inquireCoursechaptersectionlist 章与节关系
- var arrays = [];
- this.tableData.map((item, index) => {
- if (item.type === 1) {
- // this.$api.obtainCoursemodule(item.menuId).then(async (res) => {
- var arr = {
- id: "1-" + item.menuId,
- CodeId: item.menuId,
- name: item.menuName,
- hasChildren: true,
- type: 1,
- isDels: true,
- sort: item.sort,
- };
- //查询是否存在下级
- arrays.push(arr);
- // });
- }
- if (item.type === 2) {
- // this.$api.obtainCoursechapter(item.menuId).then(async (res) => {
- var arr = {
- id: "2-" + item.menuId,
- CodeId: item.menuId,
- name: item.menuName,
- hasChildren: true,
- type: 2,
- isDels: true,
- sort: item.sort,
- firstChoiceStatus: item.firstChoiceStatus || 0,
- };
- arrays.push(arr);
- // });
- }
- if (item.type === 3) {
- // this.$api.obtainCourseSection(item.menuId).then((res) => {
- var arr = {
- id: "3-" + item.menuId,
- CodeId: item.menuId,
- name: item.menuName,
- hasChildren: false,
- type: 3,
- isDels: true,
- sort: item.sort,
- };
- arrays.push(arr);
- // });
- }
- });
- this.$nextTick(() => {
- this.tableDataInfos = arrays;
- });
- },
- del(node, item) {
- this.tableDataInfos.map((items, indexs) => {
- if (items.id === item.id) {
- this.tableDataInfos.splice(indexs, 1);
- }
- });
- this.tableDataInfos = JSON.parse(JSON.stringify(this.tableDataInfos));
- if (item.type === 1) {
- this.menuExamList = this.menuExamList.filter((items) => {
- return items.moduleId !== item.CodeId;
- });
- }
- if (item.type === 2) {
- this.menuExamList = this.menuExamList.filter((items) => {
- if (items.moduleId === 0) {
- if (items.chapterId !== item.CodeId) {
- return true;
- } else {
- return false;
- }
- } else {
- return true;
- }
- });
- }
- },
- getRowKeys(row) {
- if (this.radio === 1) {
- return row.moduleId;
- }
- if (this.radio === 2) {
- return row.chapterId;
- }
- if (this.radio === 3) {
- return row.sectionId;
- }
- },
- checkboxT(row, index) {
- var array = [];
- array = this.tableDataInfos.map((item) => {
- if (item.type === this.radio) {
- return item.CodeId;
- }
- });
- if (
- array.indexOf(
- this.radio === 1
- ? row.moduleId
- : this.radio === 2
- ? row.chapterId
- : row.sectionId
- ) !== -1
- ) {
- return false;
- } else {
- return true;
- }
- },
- checkboxExam(row, index) {
- return this.activeArray.findIndex((item) => item.examId == row.examId) ===
- -1
- ? true
- : false;
- },
- submitForm() {
- if (this.activeLists.length === 0) {
- this.dialogVisible = false;
- return;
- }
- var array = [];
- if (this.tableDataInfos.length) {
- if (this.radio === 1) {
- this.activeLists.map((item) => {
- array.push({
- id: 1 + "-" + item.moduleId,
- CodeId: item.moduleId,
- name: item.moduleName,
- isDels: true,
- hasChildren: true,
- type: 1,
- sort: 0,
- });
- });
- } else if (this.radio === 2) {
- this.activeLists.map((item) => {
- array.push({
- id: 2 + "-" + item.chapterId,
- CodeId: item.chapterId,
- name: item.name,
- isDels: true,
- hasChildren: true,
- type: 2,
- sort: 0,
- });
- });
- } else if (this.radio === 3) {
- this.activeLists.map((item) => {
- array.push({
- id: 3 + "-" + item.sectionId,
- CodeId: item.sectionId,
- name: item.name,
- type: 3,
- sort: 0,
- isDels: true,
- });
- });
- }
- let maxIndex = 0;
- this.tableDataInfos.forEach((item) => {
- if (item.sort > maxIndex) {
- maxIndex = item.sort;
- }
- });
- array.forEach((item, index) => {
- item.sort = maxIndex + index + 1;
- });
- } else {
- if (this.radio === 1) {
- this.activeLists.map((item) => {
- array.push({
- id: 1 + "-" + item.moduleId,
- CodeId: item.moduleId,
- name: item.moduleName,
- isDels: true,
- hasChildren: true,
- type: 1,
- sort: 0,
- });
- });
- } else if (this.radio === 2) {
- this.activeLists.map((item) => {
- array.push({
- id: 2 + "-" + item.chapterId,
- CodeId: item.chapterId,
- name: item.name,
- isDels: true,
- hasChildren: true,
- type: 2,
- sort: 0,
- });
- });
- } else if (this.radio === 3) {
- this.activeLists.map((item) => {
- array.push({
- id: 3 + "-" + item.sectionId,
- CodeId: item.sectionId,
- name: item.name,
- type: 3,
- sort: 0,
- isDels: true,
- });
- });
- }
- array.forEach((item, index) => {
- item.sort = index + 1;
- });
- }
- for (let i = 0; i < array.length; i++) {
- this.tableDataInfos.unshift(array[i]);
- }
- // this.tableDataInfos = this.tableDataInfos.concat(array);
- this.activeLists = [];
- this.dialogVisible = false;
- this.$message.success("添加成功");
- },
- handleNodeClick() {},
- async load(node, resolve) {
- const tree = node.data;
- if (tree.type === 1) {
- var arrays = [];
- await this.$api
- .inquireCourseListmodulechapter(tree.CodeId)
- .then((res) => {
- res.data.map((item, index) => {
- var arr = {
- id: tree.id + "-" + item.chapterId,
- CodeId: item.chapterId,
- name: item.name,
- hasChildren: true,
- type: 2,
- };
- arrays.push(arr);
- });
- });
- resolve(arrays);
- }
- if (tree.type === 2) {
- this.$api.inquireCoursechaptersectionlist(tree.CodeId).then((res) => {
- var arrays = [];
- res.data.map((item, index) => {
- var arr = {
- id: tree.id + "-" + item.sectionId,
- CodeId: item.sectionId,
- name: item.name,
- type: 3,
- };
- arrays.push(arr);
- });
- resolve(arrays);
- });
- }
- if (tree.type === 3) {
- resolve([]);
- }
- return;
- },
- handleSizeChange(v) {
- this.formData5.pageSize = v;
- this.formData5.pageNum = 1;
- this.getInfos();
- },
- handleCurrentChange(v) {
- this.formData5.pageNum = v;
- this.getInfos();
- },
- handleSizeChange6(v) {
- this.formData6.pageSize = v;
- this.formData6.pageNum = 1;
- this.getSJ();
- },
- handleCurrentChange6(v) {
- this.formData6.pageNum = v;
- this.getSJ();
- },
- init6() {
- this.getSJ(2);
- },
- /**
- * 多选框变化触发
- */
- selectionChange(arr) {
- this.activeLists = arr;
- },
- backPage() {
- this.$store.dispatch("tagsView/delView", this.$route).then((res) => {
- this.$router.push({
- path: "courseManagement",
- });
- });
- },
- submit() {
- this.disabledBtn = true;
- var array = [];
- this.tableDataInfos.map((item) => {
- array.push({
- courseId: Number(this.$route.query.id),
- menuId: item.CodeId,
- parentId: 0,
- status: 1,
- type: item.type,
- sort: item.sort,
- firstChoiceStatus: item.firstChoiceStatus || 0,
- });
- });
- if (this.menuExamList && this.menuExamList.length > 0) {
- this.menuExamList.forEach((item) => {
- if (
- item.moduleId != 0 &&
- item.sectionId == 0 &&
- item.chapterId == 0
- ) {
- item.type = 3;
- } else if (item.sectionId != 0) {
- item.type = 2;
- } else {
- item.type = 1;
- }
- });
- }
- var data = {
- courseId: Number(this.$route.query.id),
- menuExamList: this.menuExamList,
- menuList: array,
- };
- this.$api
- .editCoursemenu(data)
- .then((res) => {
- this.$message.success("编辑成功");
- setTimeout(() => {
- this.$store
- .dispatch("tagsView/exitView", this.$route)
- .then((res) => {
- this.$router.push({
- path: "courseManagement",
- });
- });
- }, 300);
- })
- .catch(() => {
- this.disabledBtn = false;
- });
- },
- },
- };
- </script>
- <style lang="less" scoped>
- .radioTables {
- border-radius: 50%;
- width: 18px;
- height: 18px;
- border: 1px solid #eee;
- background-color: #fff;
- cursor: pointer;
- position: relative;
- & > .activeRadio {
- position: absolute;
- transition: all 0.3s;
- left: 50%;
- top: 50%;
- transform: translateX(-50%) translateY(-50%);
- width: 12px;
- height: 12px;
- border-radius: 50%;
- overflow: hidden;
- background-color: rgb(24, 144, 255);
- animation: radios 0.3s;
- }
- }
- @keyframes radios {
- 0% {
- opacity: 0;
- }
- 100% {
- opacity: 1;
- }
- }
- .fatherSty {
- background-color: #eee;
- padding: 10px;
- margin-bottom: 15px;
- }
- .floatLefts {
- font-size: 14px;
- float: left;
- margin-right: 30px;
- }
- .mar_b {
- display: flex;
- align-items: center;
- justify-content: space-between;
- margin-bottom: 12px;
- }
- .dis-f {
- margin-top: 20px;
- display: flex;
- align-items: center;
- justify-content: center;
- }
- /deep/.el-tree-node__content {
- height: 35px;
- }
- .custom-tree-node {
- flex: 1;
- display: flex;
- align-items: center;
- justify-content: space-between;
- padding-right: 8px;
- }
- /deep/.el-button {
- border-radius: 8px;
- }
- /deep/.el-dialog {
- border-radius: 8px;
- .el-dialog__header {
- padding: 0;
- .hearders {
- height: 40px;
- display: flex;
- align-items: center;
- justify-content: space-between;
- padding: 0px 18px 0px 20px;
- border-bottom: 1px solid #e2e2e2;
- .leftTitle {
- font-size: 14px;
- font-weight: bold;
- color: #2f4378;
- }
- .rightBoxs {
- display: flex;
- align-items: center;
- img {
- width: 14px;
- height: 14px;
- margin-left: 13px;
- cursor: pointer;
- }
- }
- }
- }
- .el-dialog__footer {
- padding: 0;
- .dialog-footer {
- padding: 0px 40px;
- height: 70px;
- border-top: 1px solid #e2e2e2;
- display: flex;
- align-items: center;
- justify-content: flex-end;
- }
- }
- }
- </style>
|