diff --git a/admin-core/src/main/resources/static/js/lib.js b/admin-core/src/main/resources/static/js/lib.js index a2a971f3..2e5ed1fd 100644 --- a/admin-core/src/main/resources/static/js/lib.js +++ b/admin-core/src/main/resources/static/js/lib.js @@ -947,18 +947,20 @@ var Lib = { } }); return editor; - },getCourseInfo:function (key,courseInfoParentId,resourcesQuestionIdsIsNotNull){ //根据归属课程id查询下级所有章节并返显key + },getCourseInfo:function (key,courseInfoParentId,courseInfoType,sourceType,resourcesQuestionIdsIsNotNull){ //根据归属课程id查询下级所有章节并返显key var htm = ''; if(!$.isEmpty(courseInfoParentId)){ var paras = { - courseInfoParentId: courseInfoParentId + courseInfoParentId: courseInfoParentId, + courseInfoType:courseInfoType, + sourceType:sourceType } if(!$.isEmpty(resourcesQuestionIdsIsNotNull)){ // paras.resourcesQuestionIdsIsNotNull = resourcesQuestionIdsIsNotNull; }else { - paras.courseInfoStatus = 1; + //paras.courseInfoStatus = 1; } - var ret = Common.getAjax("/jlw/courseInfo/getValues.json",paras); + var ret = Common.getAjax("/jlw/courseInfo/getChapterSystemOAndUniversities.json",paras);//jlw/courseInfo/getValues.json if(ret.code == 0){ for (var i = 0;i < ret.data.length;i++){ htm += ''; diff --git a/web/src/main/resources/static/js/jlw/resourcesCompetition/add.js b/web/src/main/resources/static/js/jlw/resourcesCompetition/add.js index 6b1a7186..44ba7f89 100644 --- a/web/src/main/resources/static/js/jlw/resourcesCompetition/add.js +++ b/web/src/main/resources/static/js/jlw/resourcesCompetition/add.js @@ -81,7 +81,9 @@ layui.define([ 'form', 'laydate', 'table','laytpl','resourcesCompetitionApi'], f //选择归属课程 并且根据选择的课程查询章节 form.on('select(select_courseInfoIds)', function (obj) { - Lib.getCourseInfo($("select[name='courseInfoId_1']"),obj.value); + let sourceType = $("select[name='courseInfoId_0']").find('option:selected').attr("status"); + let courseInfoType = 2;//courseInfoType(2 章节,3 节) + Lib.getCourseInfo($("select[name='courseInfoId_1']"),obj.value,courseInfoType,sourceType); }); window.loadInfo = function (){ diff --git a/web/src/main/resources/static/js/jlw/resourcesCompetition/index.js b/web/src/main/resources/static/js/jlw/resourcesCompetition/index.js index cfa03c22..e7f55f9c 100644 --- a/web/src/main/resources/static/js/jlw/resourcesCompetition/index.js +++ b/web/src/main/resources/static/js/jlw/resourcesCompetition/index.js @@ -146,12 +146,18 @@ layui.define(['form', 'laydate', 'table'], function (exports) { } //选择归属课程 并且根据选择的课程查询章节 resourcesQuestionIdsIsNotNull:查询题目不为空的章节 form.on('select(select_courseInfoIds)', function (obj) { - Lib.getCourseInfo($("select[name='courseInfoId_1']"), obj.value, 1); + let sourceType = $("select[name='courseInfoId_0']").find('option:selected').attr("status"); + let courseInfoType = 2;//courseInfoType(2 章节,3 节) + Lib.getCourseInfo($("select[name='courseInfoId_1']"), obj.value,courseInfoType,sourceType, 1); + $("select[name='courseInfoId_2']").empty(); + layui.form.render(); }); //选择归属课程 并且根据选择的课程查询章节 form.on('select(select_courseInfoIds_)', function (obj) { - Lib.getCourseInfo($("select[name='courseInfoId_2']"), obj.value); + let sourceType = $("select[name='courseInfoId_0']").find('option:selected').attr("status"); + let courseInfoType = 3;//courseInfoType(2 章节,3 节) + Lib.getCourseInfo($("select[name='courseInfoId_2']"), obj.value,courseInfoType,sourceType); }); exports('index', view); diff --git a/web/src/main/resources/static/js/jlw/resourcesInfo/add.js b/web/src/main/resources/static/js/jlw/resourcesInfo/add.js index e8a3f72d..85fa3e09 100644 --- a/web/src/main/resources/static/js/jlw/resourcesInfo/add.js +++ b/web/src/main/resources/static/js/jlw/resourcesInfo/add.js @@ -101,12 +101,18 @@ layui.define([ 'form', 'laydate', 'table','element','upload','resourcesInfoApi', //选择归属课程 并且根据选择的课程查询章节 form.on('select(select_courseInfoIds)', function (obj) { - Lib.getCourseInfo($("select[name='courseInfoId_1']"),obj.value); + let sourceType = $("select[name='courseInfoId_0']").find('option:selected').attr("status"); + let courseInfoType = 2; + Lib.getCourseInfo($("select[name='courseInfoId_1']"),obj.value,courseInfoType,sourceType); + $("select[name='courseInfoId_2']").empty(); + layui.form.render(); }); //选择归属课程 并且根据选择的课程查询章节 form.on('select(select_courseInfoIds_1)', function (obj) { - Lib.getCourseInfo($("select[name='courseInfoId_2']"),obj.value); + let sourceType = $("select[name='courseInfoId_0']").find('option:selected').attr("status"); + let courseInfoType = 3; + Lib.getCourseInfo($("select[name='courseInfoId_2']"),obj.value,courseInfoType,sourceType); }); //选择链接、图文 form.on('select(select_courseInfoIds_3)',function (obj) { diff --git a/web/src/main/resources/static/js/jlw/resourcesInfo/index.js b/web/src/main/resources/static/js/jlw/resourcesInfo/index.js index 5d849f71..3d915ffa 100644 --- a/web/src/main/resources/static/js/jlw/resourcesInfo/index.js +++ b/web/src/main/resources/static/js/jlw/resourcesInfo/index.js @@ -6,18 +6,7 @@ layui.define(['form', 'laydate', 'table'], function (exports) { courseInfoMap = {},//课程map zjMap = {},//章节map selectMap = {},//已经生成过select的map - courseLabelTypes = Common.getAjax("/jlw/courseInfo/getTreeByCourseLabelTypes.json", { - courseLabelTypes: "应用课程类,考证课程类,理论课程类", - rankLimit: 3 - }).data, - /*courseLabelTypes = function (val,sourceType) { - var data = Common.getAjax("/jlw/courseInfo/getChapterSystemOAndUniversities.json", { - courseInfoParentId: val, - sourceType:sourceType, - courseInfoType: 3 - }).data - return data; - },//获取课程数据*/ + htmY = '' + htmO + '' + ""; + //console.log($("#isUser").val()) + }else { + selectList+= htmL + '' + htmO + '' + ""; + } + + function selectedHandler(val,val1) { + return val == val1 ? 'selected = "selected"' : ''; + } + /*$.each(courseLabelTypes, function (key, value) { courseInfoMap[value.courseInfoId] = {courseInfoName: value.courseInfoName, children: value.children}; $.each(value.children, function (k, v) { zjMap[v.courseInfoId] = {courseInfoName: v.courseInfoName, children: v.children}; }); - }); + });*/ + var view = { init: function () { @@ -118,28 +117,6 @@ layui.define(['form', 'laydate', 'table'], function (exports) { field: 'courseInfoParentParentName', title: '归属课程', templet: function (d) { - var selectList = ""; - //console.log($("#isUser").val()) - }else { - selectList+= htmL + '' + htmO + '' + ""; - } return selectList; //一级 } }, @@ -150,19 +127,19 @@ layui.define(['form', 'laydate', 'table'], function (exports) { templet: function (d) { var htm = ""; - console.log(h,'h') + selectMap[d.courseInfoParentParentId] = h + ""; return h; } else { - return selectMap[d.courseInfoParentId]; - console.log(selectMap) + return selectMap[d.courseInfoParentParentId]; } } else { return htm + ""; //二级 @@ -174,21 +151,25 @@ layui.define(['form', 'laydate', 'table'], function (exports) { field: 'courseInfoName', title: '归属小节', align: "center", width: 200, templet: function (d) { var htm = ""; + selectMap[d.courseInfoParentId] = h + ""; return h; } else { - return selectMap[d.courseInfoId]; + return selectMap[d.courseInfoParentId]; } + } else { return htm + ""; //三级 } + } }, { @@ -372,12 +353,18 @@ layui.define(['form', 'laydate', 'table'], function (exports) { //选择归属课程 并且根据选择的课程查询章节 resourcesQuestionIdsIsNotNull:查询题目不为空的章节 form.on('select(select_courseInfoIds)', function (obj) { - Lib.getCourseInfo($("select[name='courseInfoId_2']"), obj.value, 1); + let sourceType = $("select[name='courseInfoId_0']").find('option:selected').attr("status"); + let courseInfoType = 2;//courseInfoType(2 章节,3 节) + Lib.getCourseInfo($("select[name='courseInfoId_1']"), obj.value,courseInfoType,sourceType, 1); + $("select[name='courseInfoId_2']").empty(); + layui.form.render(); }); //选择归属课程 并且根据选择的课程查询章节 form.on('select(select_courseInfoIds_Node)', function (obj) { - Lib.getCourseInfo($("select[name='courseInfoId_3']"), obj.value); + let sourceType = $("select[name='courseInfoId_0']").find('option:selected').attr("status"); + let courseInfoType = 3;//courseInfoType(2 章节,3 节) + Lib.getCourseInfo($("select[name='courseInfoId_2']"), obj.value,courseInfoType,sourceType); }); //选择归属课程 并且根据选择的课程查询章节 form.on('select(select_courseId)', function (obj) { @@ -417,9 +404,22 @@ layui.define(['form', 'laydate', 'table'], function (exports) { $(this).parents("td").next().next().find("select").empty(); $(this).parents("td").next().next().find("select").append(""); if (!$.isEmpty(obj.value)) { - $.each(courseInfoMap[obj.value].children, function (key, v) { - this_.append(""); - }); + if(!$.isEmpty(courseInfoMap[obj.value])){ + $.each(courseInfoMap[obj.value], function (key, v) { + this_.append(""); + }); + }else { + let sourceType = $(obj.elem).find("option:selected").attr("status"); + var courseInfoChildtList = childCourseList(obj.value,2,sourceType); + if (!$.isEmpty(courseInfoChildtList)) { + courseInfoMap[obj.value] = courseInfoChildtList; + $.each(courseInfoChildtList, function (key, v) { + this_.append(""); + }); + } + selectMap[obj.value] = this_.html(); + } + } form.render(); }); @@ -430,9 +430,23 @@ layui.define(['form', 'laydate', 'table'], function (exports) { this_.empty(); this_.append(""); if (!$.isEmpty(obj.value)) { - $.each(zjMap[obj.value].children, function (key, v) { - this_.append(""); - }); + if(!$.isEmpty(zjMap[obj.value])){ + $.each(zjMap[obj.value], function (key, v) { + this_.append(""); + }); + }else{ + let sourceType = $(obj.elem).parents("td").prevAll('td').find("option:selected").attr("status");; + var courseInfoChildtChildList = childCourseList(obj.value,3,sourceType); + if (!$.isEmpty(courseInfoChildtChildList)) { + zjMap[obj.value] = courseInfoChildtChildList; + $.each(courseInfoChildtChildList, function (key, v) { + this_.append(""); + }); + } + selectMap[obj.value] = this_.html(); + } + + } form.render(); }); diff --git a/web/src/main/resources/static/js/jlw/resourcesQuestion/add.js b/web/src/main/resources/static/js/jlw/resourcesQuestion/add.js index ec724e2b..82c2a879 100644 --- a/web/src/main/resources/static/js/jlw/resourcesQuestion/add.js +++ b/web/src/main/resources/static/js/jlw/resourcesQuestion/add.js @@ -150,7 +150,9 @@ layui.define([ 'form', 'laydate', 'table','resourcesQuestionApi',"layedit"], fun //选择归属课程 并且根据选择的课程查询章节 form.on('select(select_courseInfoIds)', function (obj) { - Lib.getCourseInfo($("select[name='courseInfoId_1']"),obj.value); + let sourceType = $("select[name='courseInfoId_0']").find('option:selected').attr("status"); + let courseInfoType = 2;//courseInfoType(2 章节,3 节) + Lib.getCourseInfo($("select[name='courseInfoId_1']"),obj.value,courseInfoType,sourceType); }); exports('add',view); diff --git a/web/src/main/resources/static/js/jlw/resourcesQuestion/index.js b/web/src/main/resources/static/js/jlw/resourcesQuestion/index.js index 7e377e8d..4cf22f4a 100644 --- a/web/src/main/resources/static/js/jlw/resourcesQuestion/index.js +++ b/web/src/main/resources/static/js/jlw/resourcesQuestion/index.js @@ -249,12 +249,18 @@ layui.define(['form', 'laydate', 'table'], function (exports) { //选择归属课程 并且根据选择的课程查询章节 resourcesQuestionIdsIsNotNull:查询题目不为空的章节 form.on('select(select_courseInfoIds)', function (obj) { - Lib.getCourseInfo($("select[name='courseInfoId_1']"), obj.value, 1); + let sourceType = $("select[name='courseInfoId_0']").find('option:selected').attr("status"); + let courseInfoType = 2;//courseInfoType(2 章节,3 节) + Lib.getCourseInfo($("select[name='courseInfoId_1']"),obj.value,courseInfoType,sourceType,1); + $("select[name='courseInfoId_2']").empty(); + layui.form.render(); }); //选择归属课程 并且根据选择的课程查询章节 form.on('select(select_courseInfoIds_)', function (obj) { - Lib.getCourseInfo($("select[name='courseInfoId_2']"), obj.value); + let sourceType = $("select[name='courseInfoId_0']").find('option:selected').attr("status"); + let courseInfoType = 3; + Lib.getCourseInfo($("select[name='courseInfoId_2']"), obj.value,courseInfoType,sourceType); }); exports('index', view); diff --git a/web/src/main/resources/static/js/jlw/resourcesTraining/add.js b/web/src/main/resources/static/js/jlw/resourcesTraining/add.js index df6d7951..4367184c 100644 --- a/web/src/main/resources/static/js/jlw/resourcesTraining/add.js +++ b/web/src/main/resources/static/js/jlw/resourcesTraining/add.js @@ -82,7 +82,9 @@ layui.define([ 'form', 'laydate', 'table','laytpl','resourcesTrainingApi'], func //选择归属课程 并且根据选择的课程查询章节 form.on('select(select_courseInfoIds)', function (obj) { - Lib.getCourseInfo($("select[name='courseInfoId_1']"),obj.value); + let sourceType = $("select[name='courseInfoId_0']").find('option:selected').attr("status"); + let courseInfoType = 2;//courseInfoType(2 章节,3 节) + Lib.getCourseInfo($("select[name='courseInfoId_1']"),obj.value,courseInfoType,sourceType); }); window.loadInfo = function (){ diff --git a/web/src/main/resources/static/js/jlw/resourcesTraining/index.js b/web/src/main/resources/static/js/jlw/resourcesTraining/index.js index 0370449e..ba06ed51 100644 --- a/web/src/main/resources/static/js/jlw/resourcesTraining/index.js +++ b/web/src/main/resources/static/js/jlw/resourcesTraining/index.js @@ -148,12 +148,18 @@ layui.define(['form', 'laydate', 'table'], function (exports) { }; //选择归属课程 并且根据选择的课程查询章节 resourcesQuestionIdsIsNotNull:查询题目不为空的章节 form.on('select(select_courseInfoIds)', function (obj) { - Lib.getCourseInfo($("select[name='courseInfoId_1']"), obj.value, 1); + let sourceType = $("select[name='courseInfoId_0']").find('option:selected').attr("status"); + let courseInfoType = 2;//courseInfoType(2 章节,3 节) + Lib.getCourseInfo($("select[name='courseInfoId_1']"), obj.value,courseInfoType,sourceType, 1); + $("select[name='courseInfoId_2']").empty(); + layui.form.render(); }); //选择归属课程 并且根据选择的课程查询章节 form.on('select(select_courseInfoIds_)', function (obj) { - Lib.getCourseInfo($("select[name='courseInfoId_2']"), obj.value); + let sourceType = $("select[name='courseInfoId_0']").find('option:selected').attr("status"); + let courseInfoType = 3;//courseInfoType(2 章节,3 节) + Lib.getCourseInfo($("select[name='courseInfoId_2']"), obj.value,courseInfoType,sourceType); }); exports('index', view); diff --git a/web/src/main/resources/templates/jlw/resourcesInfo/index.html b/web/src/main/resources/templates/jlw/resourcesInfo/index.html index 984af62a..8f0b96b4 100644 --- a/web/src/main/resources/templates/jlw/resourcesInfo/index.html +++ b/web/src/main/resources/templates/jlw/resourcesInfo/index.html @@ -53,10 +53,10 @@ - + - + @@ -65,7 +65,7 @@