diff --git a/web/src/main/resources/static/js/jlw/handsOn/del.js b/web/src/main/resources/static/js/jlw/handsOn/del.js index d84c5f4d..8f458b07 100644 --- a/web/src/main/resources/static/js/jlw/handsOn/del.js +++ b/web/src/main/resources/static/js/jlw/handsOn/del.js @@ -9,7 +9,7 @@ layui.define(['table', 'handsOnApi'], function(exports) { if(data==null){ return ; } - Common.openConfirm("确认要删除这些HandsOn?",function(){ + Common.openConfirm("确认要删除这些课程实训案例吗?",function(){ var ids =Common.concatBatchId(data,"handsOnId"); handsOnApi.del(ids,function(){ Common.info("删除成功"); diff --git a/web/src/main/resources/static/js/jlw/handsOn/index.js b/web/src/main/resources/static/js/jlw/handsOn/index.js index 87857dc5..b2037c0c 100644 --- a/web/src/main/resources/static/js/jlw/handsOn/index.js +++ b/web/src/main/resources/static/js/jlw/handsOn/index.js @@ -87,9 +87,9 @@ layui.define(['form', 'laydate', 'table'], function (exports) { width: 260, templet: function (d) { var css = isAdmin? "" : "display: none;"; - var htm = ''; - if(d.dataType == 'ADMIN_ADD'){ - htm += '
上架' + var htm = '
'; + if(d.dataType == 'ADMIN_ADD'&&isAdmin){ + htm += '上架' + '下架'; } @@ -107,13 +107,42 @@ layui.define(['form', 'laydate', 'table'], function (exports) { }); table.on('checkbox(handsOnTable)', function (obj) { -/*课程实操上方的上架和下架做功能全选*/ var handsOn = obj.data; + var btnDrown = $("#table-button-drown"); + var btnUp = $("#table-button-up" ); + var btnDell = $("#table-button-allDel" ); if (obj.checked) { - //按钮逻辑Lib.buttonEnable() - console.log(handsOn) + if(isAdmin && handsOn.dataType == "FACULTY_ADD"){ + btnDrown.addClass("button-disabled"); + btnUp.addClass("button-disabled"); + btnDell.addClass("button-disabled"); + Common.info("只能 '删除、上/下架' 系统内置的课程实训案例"); + } + if(!isAdmin&& handsOn.dataType == "ADMIN_ADD"){ + btnDell.addClass("button-disabled"); + Common.info("只能 '删除' 院校添加的课程实训案例"); + } } else { - + var isFalse = true; + var data = Common.getMoreDataFromTable(table, "handsOnTable"); + if(!$.isEmpty(data)){ + data.forEach(function (value, index) { + if(isAdmin && value.dataType == "FACULTY_ADD"){ + isFalse = false; + }else if(!isAdmin && value.dataType === "ADMIN_ADD"){ + isFalse = false; + } + }) + } + if(isFalse){ + if(isAdmin){ + btnDrown.removeClass("button-disabled"); + btnUp.removeClass("button-disabled"); + btnDell.removeClass("button-disabled"); + }else { + btnDell.removeClass("button-disabled"); + } + } } }) }, @@ -138,20 +167,81 @@ layui.define(['form', 'laydate', 'table'], function (exports) { view.initToolBar() }, allDel: function () { + var data = Common.getMoreDataFromTable(table, "handsOnTable"); + var isFalse = true; + if(!$.isEmpty(data)){ + data.forEach(function (value, index) { + if(isAdmin && value.dataType == "FACULTY_ADD"){ + Common.info("只能 '删除' 系统内置的课程实训案例") + isFalse = false; + return; + } + if(!isAdmin && value.dataType === "ADMIN_ADD"){ + Common.info("只能 '删除'院校添加的课程实训案例") + isFalse = false; + return; + } + }) + } layui.use(['del'], function () { var delView = layui.del; - delView.delBatch(); + if(isFalse && isAdmin) { + delView.delBatch(); + } }); + if(isFalse && !isAdmin){ + Common.openConfirm("确认要删除这些教师开课-课程实操?",function(){ + var ids = Common.concatBatchId(data,"handsOnId"); + Common.post("/jlw/teacherOpenCourseHandsOn/delete.json",{"ids":ids},function(){ + Common.info("删除成功"); + dataReload(); + }) + }) + } }, up: function () { var data = Common.getMoreDataFromTable(table, "handsOnTable"); - var ids = Common.concatBatchId(data, "handsOnId"); - upDrown(1, ids); + var isFalse = true; + if(!isEmpty(data) || data.length > 0){ + data.forEach(function (value, index) { + if(isAdmin && value.dataType == "FACULTY_ADD"){ + Common.info("只能上架系统内置的课程实训案例") + isFalse = false; + return; + } + if(!isAdmin && value.dataType === "ADMIN_ADD"){ + Common.info("只能 '删除'院校添加的课程实训案例") + isFalse = false; + return; + } + }) + } + if(isFalse){ + var ids = Common.concatBatchId(data, "handsOnId"); + upDrown(1, ids); + } }, drown: function () { var data = Common.getMoreDataFromTable(table, "handsOnTable"); - var ids = Common.concatBatchId(data, "handsOnId"); - upDrown(0, ids); + var isFalse = true; + if(!$.isEmpty(data)){ + data.forEach(function (value, index) { + if(isAdmin && value.dataType == "FACULTY_ADD"){ + Common.info("只能下架架系统内置的课程实训案例") + isFalse = false; + return; + } + if(!isAdmin && value.dataType === "ADMIN_ADD"){ + Common.info("只能 '删除'院校添加的课程实训案例") + isFalse = false; + return; + } + }) + } + if(isFalse){ + var ids = Common.concatBatchId(data, "handsOnId"); + upDrown(0, ids); + } } } //触发事件 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 8a760318..622e39b9 100644 --- a/web/src/main/resources/static/js/jlw/resourcesInfo/index.js +++ b/web/src/main/resources/static/js/jlw/resourcesInfo/index.js @@ -34,20 +34,18 @@ layui.define(['form', 'laydate', 'table'], function (exports) { courseInfoParentId: courseInfoId, courseInfoType:courseInfoType, sourceType:sourceType - }).data;//获取课程数据 + }).data;//获取课程章节数据 return data } currentAuthCourseInfoDetails.forEach(function(e,i){ - if(e.sourceType == 2 && isAdmin){ - if(e.courseLabelType == '考证课程类'){ - textualResearchCourseList.push(e); - }else if(e.courseLabelType == '理论课程类'){ - theoryCourseList.push(e); - }else if(e.courseLabelType == '应用课程类'){ - applicationCourseList.push(e); - } - }else if(e.sourceType == 1&&!isAdmin){ + if(e.courseLabelType == '考证课程类'){ + textualResearchCourseList.push(e); + }else if(e.courseLabelType == '理论课程类'){ + theoryCourseList.push(e); + }else if(e.courseLabelType == '应用课程类'){ + applicationCourseList.push(e); + }else if (e.courseLabelType == '院校'){ openCourseList.push(e) } }); @@ -72,7 +70,7 @@ layui.define(['form', 'laydate', 'table'], function (exports) { selectList += htmY + '' + htmK + '' + htmL + '' + ""; //console.log($("#isUser").val()) }else { - selectList+= htmO + '' + ""; + selectList+= htmL + '' + htmO + '' + ""; } /*$.each(courseLabelTypes, function (key, value) { @@ -108,12 +106,8 @@ layui.define(['form', 'laydate', 'table'], function (exports) { type: 'checkbox' }, { - field: 'resourcesInfoName', title: '资源名称', align: "center", style: "text-align: left;", - templet:function (d) { - var htm = '
'+d.resourcesInfoName+'
'; - return htm; - - } + field: 'resourcesInfoName', title: '资源名称', align: "center", + style: "text-align: left;overflow: hidden;text-overflow:ellipsis;", }, { field: 'courseInfoParentParentName', @@ -122,13 +116,14 @@ layui.define(['form', 'laydate', 'table'], function (exports) { if((d.sourceType == 1 && !isAdmin)||(d.sourceType == 2 && isAdmin)){ return selectList; //一级 }else { - var htm = '
'+d.courseInfoParentParentName||""+'
'; + var htm = '
'+d.courseInfoParentParentName||""+'
'; return htm; } } },{ field: 'courseInfoParentName', title: '归属章节', + style: "text-align: left;", align: "center", templet: function (d) { if((d.sourceType == 1 && !isAdmin)||(d.sourceType == 2 && isAdmin)){ @@ -152,16 +147,17 @@ layui.define(['form', 'laydate', 'table'], function (exports) { return htm + ""; //二级 } }else{ - var value = ''; + var value = '
'; if(!$.isEmpty(d.courseInfoParentParentId)){ - value = d.courseInfoParentName||""; + value += d.courseInfoParentName||""; } + value += "
" return value; } } }, { - field: 'courseInfoName', title: '归属小节', align: "center", width: 200, templet: function (d) { + field: 'courseInfoName', title: '归属小节', align: "center", width: 200, style: "text-align: left;", templet: function (d) { if((d.sourceType == 1 && !isAdmin)||(d.sourceType == 2 && isAdmin)){ var htm = ""; //三级 } }else{ - var value = ''; + var value = '
'; if(!$.isEmpty(d.courseInfoParentParentId)){ - value = d.courseInfoName||""; + value += d.courseInfoName||""; } + value += "
" return value; } } diff --git a/web/src/main/resources/templates/jlw/handsOn/add.html b/web/src/main/resources/templates/jlw/handsOn/add.html index 5ec0d7a3..2166eba7 100644 --- a/web/src/main/resources/templates/jlw/handsOn/add.html +++ b/web/src/main/resources/templates/jlw/handsOn/add.html @@ -48,7 +48,7 @@ - + @@ -225,6 +225,7 @@
+ diff --git a/web/src/main/resources/templates/jlw/handsOn/index.html b/web/src/main/resources/templates/jlw/handsOn/index.html index fcfceccc..9bd1faec 100644 --- a/web/src/main/resources/templates/jlw/handsOn/index.html +++ b/web/src/main/resources/templates/jlw/handsOn/index.html @@ -1,4 +1,5 @@ +