From caf5cc9dacff0b170fabdf1c133f8275142f6828 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A7=9A=E4=B8=B9ab?= <1421553879@qq.com> Date: Sun, 16 Oct 2022 23:00:15 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E8=B5=84=E6=BA=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/ibeetl/jlw/web/HandsOnController.java | 7 +- .../resources/static/js/jlw/handsOn/index.js | 4 +- .../js/jlw/handsOnSimulationTasks/add.js | 4 +- .../js/jlw/resourcesApplication/index.js | 6 +- .../js/jlw/resourcesApplicationCourse/add.js | 19 +- .../jlw/resourcesApplicationCourse/index.js | 52 +-- .../static/js/jlw/resourcesInfo/index.js | 306 ++++++++++-------- .../resources/templates/jlw/handsOn/add.html | 91 ++++-- .../templates/jlw/handsOn/index.html | 5 +- .../jlw/resourcesApplication/index.html | 31 +- .../jlw/resourcesApplicationCourse/add.html | 6 +- .../templates/jlw/resourcesInfo/index.html | 80 +++-- 12 files changed, 370 insertions(+), 241 deletions(-) diff --git a/web/src/main/java/com/ibeetl/jlw/web/HandsOnController.java b/web/src/main/java/com/ibeetl/jlw/web/HandsOnController.java index f3bd8731..ab9c6a59 100644 --- a/web/src/main/java/com/ibeetl/jlw/web/HandsOnController.java +++ b/web/src/main/java/com/ibeetl/jlw/web/HandsOnController.java @@ -103,9 +103,13 @@ public class HandsOnController{ return view; } + /** + *@author 姚丹 + *@data 2022/10/16 + */ @GetMapping(MODEL + "/add.do") @Function("handsOn.add") - public ModelAndView add(Long handsOnId) { + public ModelAndView add(Long handsOnId,String sign) { ModelAndView view = new ModelAndView("/jlw/handsOn/add.html"); if(null != handsOnId){ HandsOn handsOn = handsOnService.queryById(handsOnId); @@ -122,6 +126,7 @@ public class HandsOnController{ view.addObject("twoChildNode", ""); view.addObject("handsOnSimulationTasks", ""); } + view.addObject("sign", sign); return view; } 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 f3aa1407..72038a0a 100644 --- a/web/src/main/resources/static/js/jlw/handsOn/index.js +++ b/web/src/main/resources/static/js/jlw/handsOn/index.js @@ -151,8 +151,8 @@ layui.define(['form', 'laydate', 'table'], function (exports) { } }); }); - } else if (obj.event === "addTask") { - var url = "/jlw/handsOnSimulationTasks/add.do?bussiness_id=" + data.handsOnId; + } else if (obj.event === "addTask") {//添加任务 + var url = "/jlw/handsOn/add.do?handsOnId=" + data.handsOnId+'&sign=1'; Common.openDlg(url, "课程实训案例管理>新增课程实训案例>添加实训任务"); }else if (obj.event === "up") { upDrown(1,data.handsOnId); diff --git a/web/src/main/resources/static/js/jlw/handsOnSimulationTasks/add.js b/web/src/main/resources/static/js/jlw/handsOnSimulationTasks/add.js index a8af0129..028e97c1 100644 --- a/web/src/main/resources/static/js/jlw/handsOnSimulationTasks/add.js +++ b/web/src/main/resources/static/js/jlw/handsOnSimulationTasks/add.js @@ -50,13 +50,13 @@ layui.define([ 'form', 'laydate', 'table','element','handsOnSimulationTasksApi', if(!$.isEmpty(taskId)){ handsOnSimulationTasksApi.updateHandsOnSimulationTasks($('#addForm'),function(){ // parent.window.dataReload(); - Common.info("更新成功"); + Common.success("更新成功"); Lib.closeFrame(); }); }else{ handsOnSimulationTasksApi.addHandsOnSimulationTasks($('#addForm'),function(){ // parent.window.dataReload(); - Common.info("添加成功"); + Common.success("添加成功"); Lib.closeFrame(); }); } diff --git a/web/src/main/resources/static/js/jlw/resourcesApplication/index.js b/web/src/main/resources/static/js/jlw/resourcesApplication/index.js index 442405e9..8d7af066 100644 --- a/web/src/main/resources/static/js/jlw/resourcesApplication/index.js +++ b/web/src/main/resources/static/js/jlw/resourcesApplication/index.js @@ -44,11 +44,11 @@ layui.define([ 'form', 'laydate', 'table' ], function(exports) { title : '应用链接',align:"center" },{ field : 'linkSecretKey', - title : '链接秘钥',align:"center" + title : '应用秘钥',align:"center" },{ field : 'userId',title : '操作',align:"center", width:150,templet: function (d) { - var htm = ''; - htm += ''; + var htm = '编辑'; + htm += '删除'; return htm; } } diff --git a/web/src/main/resources/static/js/jlw/resourcesApplicationCourse/add.js b/web/src/main/resources/static/js/jlw/resourcesApplicationCourse/add.js index 343380f6..3d973c67 100644 --- a/web/src/main/resources/static/js/jlw/resourcesApplicationCourse/add.js +++ b/web/src/main/resources/static/js/jlw/resourcesApplicationCourse/add.js @@ -10,11 +10,20 @@ layui.define([ 'form', 'laydate', 'table','resourcesApplicationCourseApi'], func initSubmit:function(){ $("#addButton").click(function(){ form.on('submit(form)', function(){ - resourcesApplicationCourseApi.addResourcesApplicationCourse($('#addForm'),function(){ - parent.window.dataReload(); - Common.info("添加成功"); - Lib.closeFrame(); - }); + var resourcesApplicationCourseId = $("#addForm input[name='resourcesApplicationCourseId']").val(); + if(!$.isEmpty(resourcesApplicationCourseId)){ + resourcesApplicationCourseApi.updateResourcesApplicationCourse($('#addForm'),function(){ + parent.window.dataReload(); + Common.info("更新成功"); + Lib.closeFrame(); + }); + }else { + resourcesApplicationCourseApi.addResourcesApplicationCourse($('#addForm'),function(){ + parent.window.dataReload(); + Common.info("添加成功"); + Lib.closeFrame(); + }); + } }); }); diff --git a/web/src/main/resources/static/js/jlw/resourcesApplicationCourse/index.js b/web/src/main/resources/static/js/jlw/resourcesApplicationCourse/index.js index da755d6f..41edbb47 100644 --- a/web/src/main/resources/static/js/jlw/resourcesApplicationCourse/index.js +++ b/web/src/main/resources/static/js/jlw/resourcesApplicationCourse/index.js @@ -3,8 +3,8 @@ layui.define(['form', 'laydate', 'table'], function (exports) { var laydate = layui.laydate; var table = layui.table; var resourcesApplicationCourseTable = null; - - var selectList = "", //绑定模块 resourcesApplication = Common.getAjax("/jlw/resourcesApplication/getValues.json", {applicationOneLevelRelation: "实务课程类"}).data,//获取应用 courseLabelData = Common.getAjax("/jlw/courseLabel/getValues.json", {courseLabelStatus: 1}).data; /*$.each(resourcesApplication,function (key,value){ @@ -35,13 +35,13 @@ layui.define(['form', 'laydate', 'table'], function (exports) { type : 'checkbox', fixed:'left', },*/ - /*{ + /* { - field: 'resourcesApplicationCourseId', - title: 'ID', - fixed: 'left', - width: 60, - },*/ + field: 'resourcesApplicationCourseId', + title: 'ID', + fixed: 'left', + width: 60 + },*/ { field: 'courseInfoIdText', align: "center", @@ -49,21 +49,21 @@ layui.define(['form', 'laydate', 'table'], function (exports) { }, { - field: 'courseLabelId', + field: 'courseLabelType', title: '课程类别', align: "center", templet: function (d) { var courseLabelType = ""; $.each(courseLabelData, function (key, value) { - if(value.courseLabelId == d.courseLabelId){ + if (value.courseLabelId == d.courseLabelType) { courseLabelType = value.courseLabelName; } }); var html = ""; return html; } @@ -185,6 +185,7 @@ layui.define(['form', 'laydate', 'table'], function (exports) { }) }; form.on('select(courseLabelType)', function (data) { + selectCourseLabelType = data.value; resourcesApplication = Common.getAjax("/jlw/resourcesApplication/getValues.json", {applicationOneLevelRelation: data.value}).data; //获取课程数据 var this_ = $(this).parents("td").next().next().find("select"); this_.empty(); @@ -199,13 +200,24 @@ layui.define(['form', 'laydate', 'table'], function (exports) { } form.render(); }); - form.on('select(resourcesApplicationId)', function (data) { - console.log("data->>>>>>>>>>>>>>>>", data); - var selectElem = $(data.elem); - var tdElem = selectElem.closest('td'); - var trElem = tdElem.closest('tr'); - var tableView = trElem.closest('.layui-table-view'); - table.cache[tableView.attr('lay-id')][trElem.data('index')][tdElem.data('field')] = data.value; + form.on('select(select_yingYong_1)', function (data) { + var resourcesApplicationId = data.value; + var resourcesApplicationCourseId = table.cache['resourcesApplicationCourseTable'][$(this).parents("tr").attr("data-index")].resourcesApplicationCourseId; + if (!$.isEmpty(resourcesApplicationCourseId)) { + var param = { + resourcesApplicationCourseId: resourcesApplicationCourseId, + resourcesApplicationId: resourcesApplicationId, + }; + if(!$.isEmpty(selectCourseLabelType)){ + param.courseLabelType = selectCourseLabelType; + } + var ret = Common.postAjax("/jlw/resourcesApplicationCourse/edit.json", param); + layer.msg(ret.code == 0 ? "绑定成功!" : ret.msg, { + offset: ['50%'], + icon: ret.code == 0 ? 1 : 2, + time: 1000 //2秒关闭(如果不配置,默认是3秒) + }); + } }); form.on('select(undefinedYD)', function (data) { console.log("data->>>>>>>>>>>>>>>>", data); 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 57f1d473..3708ffa1 100644 --- a/web/src/main/resources/static/js/jlw/resourcesInfo/index.js +++ b/web/src/main/resources/static/js/jlw/resourcesInfo/index.js @@ -1,159 +1,174 @@ -layui.define([ 'form', 'laydate', 'table' ], function(exports) { +layui.define(['form', 'laydate', 'table'], function (exports) { var form = layui.form, - laydate = layui.laydate, - table = layui.table, - resourcesInfoTable = null, - courseInfoMap = {},//课程map - zjMap = {},//章节map - selectMap = {},//已经生成过select的map - selectList = "", + courseLabelTypes = Common.getAjax("/jlw/courseInfo/getTreeByCourseLabelTypes.json", { + courseLabelTypes: "实务课程类", + rankLimit: 3 + }).data; //获取课程数据 + $.each(courseLabelTypes, function (key, value) { + selectList += ''; + courseInfoMap[value.courseInfoId] = {courseInfoName: value.courseInfoName, children: value.children}; + $.each(value.children, function (k, v) { + zjMap[v.courseInfoId] = {courseInfoName: v.courseInfoName, children: v.children}; }); }); selectList += ""; - var view ={ - init:function(){ + var view = { + init: function () { this.initTable(); this.initSearchForm(); this.initToolBar(); - window.dataReload = function(){ - Lib.doSearchForm($("#searchForm"),resourcesInfoTable); + window.dataReload = function () { + Lib.doSearchForm($("#searchForm"), resourcesInfoTable); } }, - initTable:function(){ + initTable: function () { resourcesInfoTable = table.render({ - elem : '#resourcesInfoTable', - height : Lib.getTableHeight(), + elem: '#resourcesInfoTable', + height: Lib.getTableHeight(), cellMinWidth: 100, - method : 'post', - even:true, - size:"lg", - url : Common.ctxPath + '/jlw/resourcesInfo/list.json' // 数据接口 - ,page : Lib.tablePage // 开启分页 - ,limit : 10, - cols : [ [ // 表头 + method: 'post', + even: true, + size: "lg", + url: Common.ctxPath + '/jlw/resourcesInfo/list.json' // 数据接口 + , page: Lib.tablePage // 开启分页 + , limit: 10, + cols: [[ // 表头 { - type : 'checkbox' + type: 'checkbox' }, - { - field : 'resourcesInfoName', title : '资源名称',align:"center",style:"text-align: left;" - }, - { - field : 'courseInfoParentParentName', title : '归属课程',align:"center",width:200, templet: function (d) { - return selectList; //一级 - } - }, - { - field : 'courseInfoParentName', title : '归属章节',align:"center",width:200, templet: function (d) { - var htm = ""; + if (!$.isEmpty(d.courseInfoParentId)) { + if ($.isEmpty(selectMap[d.courseInfoParentId])) { + var h = htm; + if (!$.isEmpty(courseInfoMap[d.courseInfoParentParentId])) { + $.each(courseInfoMap[d.courseInfoParentParentId].children, function (key, v) { + h += ""; + }); + } + selectMap[d.courseInfoParentId] = h + ""; + return h; + } else { + return selectMap[d.courseInfoParentId]; } - selectMap[d.courseInfoParentId] = h + ""; - return h; - }else { - return selectMap[d.courseInfoParentId]; + } else { + return htm + ""; //二级 } - }else { - return htm + ""; //二级 } - } - }, - { + }, + { - field : 'courseInfoName', title : '归属小节',align:"center",width:200, templet: function (d) { - var htm = ""; + if (!$.isEmpty(d.courseInfoId)) { + if ($.isEmpty(selectMap[d.courseInfoId])) { + var h = htm; + if (!$.isEmpty(zjMap[d.courseInfoParentId])) { + $.each(zjMap[d.courseInfoParentId].children, function (key, v) { + h += ""; + }); + } + selectMap[d.courseInfoId] = h + ""; + return h; + } else { + return selectMap[d.courseInfoId]; } - selectMap[d.courseInfoId] = h + ""; - return h; - }else { - return selectMap[d.courseInfoId]; + } else { + return htm + ""; //三级 } - }else { - return htm + ""; //三级 } - } - }, - { - field : 'resourcesInfoType', width:150,title : '资源类型',align:"center",templet:function (d){//(1视频 2课件 3附件) - return d.resourcesInfoType == 1?"视频":d.resourcesInfoType == 2?"课件":d.resourcesInfoType == 3?"附件":'-'; + }, + { + field: 'unfinishedYD', width: 150, title: '上传院校', align: "center" + }, + { + field: 'resourcesInfoType', width: 150, title: '资源类型', align: "center", templet: function (d) {//(1视频 2课件 3附件) + var text= d.resourcesInfoType == 1 ? "视频" : d.resourcesInfoType == 2 ? "课件" : d.resourcesInfoType == 3 ? "附件" : '-'; + return '' + text + ''; + } + }, + { + field: 'userId', title: '操作', width: 180, align: "center", templet: function (d) { + var htm = '编辑'; + htm += '' + (d.resourcesInfoType == 3 ? '下载' : '预览') + ''; + htm += '删除'; + return htm; + } } - }, - { - field : 'userId',title : '操作', width:180,align:"center", templet: function (d) { - var htm = ''; - htm += ''; - htm += ''; - return htm; - } + ]], done: function (res, curr, count) { + $.each(res.data, function (k, v) { + $("div[lay-id='resourcesInfoTable'] tbody tr:eq(" + k + ")").find("select:eq(0)").val(v.courseInfoParentParentId); + $("div[lay-id='resourcesInfoTable'] tbody tr:eq(" + k + ")").find("select:eq(1)").val(v.courseInfoParentId); + $("div[lay-id='resourcesInfoTable'] tbody tr:eq(" + k + ")").find("select:eq(2)").val(v.courseInfoId); + }); + form.render(); + $.each($("td[data-field='courseInfoName']"), function (k, v) { + $(this).find("input").val($(this).find("input").context.dataset.content); + }); } - ] ],done: function (res, curr, count) { - $.each(res.data,function (k,v){ - $("div[lay-id='resourcesInfoTable'] tbody tr:eq("+k+")").find("select:eq(0)").val(v.courseInfoParentParentId); - $("div[lay-id='resourcesInfoTable'] tbody tr:eq("+k+")").find("select:eq(1)").val(v.courseInfoParentId); - $("div[lay-id='resourcesInfoTable'] tbody tr:eq("+k+")").find("select:eq(2)").val(v.courseInfoId); }); - form.render(); - $.each($("td[data-field='courseInfoName']"),function (k,v){ - $(this).find("input").val($(this).find("input").context.dataset.content); - }); - } - }); - table.on('checkbox(resourcesInfoTable)', function(obj){ + table.on('checkbox(resourcesInfoTable)', function (obj) { var resourcesInfo = obj.data; - if(obj.checked){ + if (obj.checked) { //按钮逻辑Lib.buttonEnable() - }else{ + } else { } }) }, - initSearchForm:function(){ - Lib.initSearchForm( $("#searchForm"),resourcesInfoTable,form); + initSearchForm: function () { + Lib.initSearchForm($("#searchForm"), resourcesInfoTable, form); }, - initToolBar:function(){ + initToolBar: function () { toolbar = { - add : function() { // 获取选中数据 + add: function () { // 获取选中数据 var url = "/jlw/resourcesInfo/add.do"; - Common.openDlg(url,"资源管理/新增资源"); + Common.openDlg(url, "资源管理/新增资源"); }, refresh: function () {//刷新 searchForm.reset(); Lib.doSearchForm($("#searchForm"), resourcesInfoTable, 1); }, - search:function () { + search: function () { Lib.doSearchForm($("#searchForm"), resourcesInfoTable, 1); }, - allDel:function () {//批量删除 + allDel: function () {//批量删除 var checkStatus = table.checkStatus('resourcesInfoTable') - ,data = checkStatus.data,ids=""; - for(var i = 0;i请选择"); this_1.empty(); this_1.append(""); - if(!$.isEmpty(obj.value)){ - $.each(courseInfoMap[obj.value].children,function (key,v){ + if (!$.isEmpty(obj.value)) { + $.each(courseInfoMap[obj.value].children, function (key, v) { this_.append(""); }); } @@ -273,8 +300,8 @@ layui.define([ 'form', 'laydate', 'table' ], function(exports) { var this_ = $("#bindingCourseInfo_dialog select[name='courseInfoId']"); this_.empty(); this_.append(""); - if(!$.isEmpty(obj.value)){ - $.each(zjMap[obj.value].children,function (key,v){ + if (!$.isEmpty(obj.value)) { + $.each(zjMap[obj.value].children, function (key, v) { this_.append(""); }); } @@ -289,8 +316,8 @@ 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){ + if (!$.isEmpty(obj.value)) { + $.each(courseInfoMap[obj.value].children, function (key, v) { this_.append(""); }); } @@ -302,8 +329,8 @@ layui.define([ 'form', 'laydate', 'table' ], function(exports) { var this_ = $(this).parents("td").next().find("select"); this_.empty(); this_.append(""); - if(!$.isEmpty(obj.value)){ - $.each(zjMap[obj.value].children,function (key,v){ + if (!$.isEmpty(obj.value)) { + $.each(zjMap[obj.value].children, function (key, v) { this_.append(""); }); } @@ -312,11 +339,14 @@ layui.define([ 'form', 'laydate', 'table' ], function(exports) { //选择归属课程 并且根据选择的课程查询章节 form.on('select(select_courseInfoIds_2)', function (obj) { - var r = $(this).parents("td").find("input").context.innerHTML.replace(/ /g,""); + var r = $(this).parents("td").find("input").context.innerHTML.replace(/ /g, ""); $(this).parents("td").find("input").val(r); var resourcesInfoId = table.cache['resourcesInfoTable'][$(this).parents("tr").attr("data-index")].resourcesInfoId; - if(!$.isEmpty(resourcesInfoId)){ - var ret = Common.postAjax("/jlw/resourcesInfo/edit.json",{resourcesInfoId:resourcesInfoId,courseInfoId:obj.value}); + if (!$.isEmpty(resourcesInfoId)) { + var ret = Common.postAjax("/jlw/resourcesInfo/edit.json", { + resourcesInfoId: resourcesInfoId, + courseInfoId: obj.value + }); layer.msg(ret.code == 0 ? "绑定成功!" : ret.msg, { offset: ['50%'], icon: ret.code == 0 ? 1 : 2, @@ -325,6 +355,6 @@ layui.define([ 'form', 'laydate', 'table' ], function(exports) { } }); - exports('index',view); + exports('index', view); }); \ No newline at end of file diff --git a/web/src/main/resources/templates/jlw/handsOn/add.html b/web/src/main/resources/templates/jlw/handsOn/add.html index 666f6ce0..712085f6 100644 --- a/web/src/main/resources/templates/jlw/handsOn/add.html +++ b/web/src/main/resources/templates/jlw/handsOn/add.html @@ -2,47 +2,63 @@ - +
-
+ + +
- +
-
+
- + +
-
+
- +
-
+
@@ -119,7 +136,8 @@ style="color: #73a2f8;">完成 - + @@ -134,10 +152,14 @@
+
- -
- +
+ +
+ +
@@ -163,14 +185,20 @@ ${item.taskOrder} ${item.taskTitle} - ${item.taskType == '1'?'观看视频':item.taskType == '2'?'观看PPT': item.taskType == '3'?'理论测评':item.taskType == '4'?'实训操作步骤':item.taskType == '5'?'报告撰写':'其他'} + ${item.taskType == '1'?'观看视频':item.taskType == '2'?'观看PPT': item.taskType == + '3'?'理论测评':item.taskType == '4'?'实训操作步骤':item.taskType == '5'?'报告撰写':'其他'} + ${item.taskScore} - 编辑 删除 + 编辑 删除 + - 暂无实训任务... + + 暂无实训任务... + @@ -182,19 +210,18 @@
- - -
- + + + + -
\ No newline at end of file diff --git a/web/src/main/resources/templates/jlw/handsOn/index.html b/web/src/main/resources/templates/jlw/handsOn/index.html index 19a08174..eba1e00a 100644 --- a/web/src/main/resources/templates/jlw/handsOn/index.html +++ b/web/src/main/resources/templates/jlw/handsOn/index.html @@ -36,8 +36,9 @@
- - +
diff --git a/web/src/main/resources/templates/jlw/resourcesApplication/index.html b/web/src/main/resources/templates/jlw/resourcesApplication/index.html index e44e311c..8fb644c7 100644 --- a/web/src/main/resources/templates/jlw/resourcesApplication/index.html +++ b/web/src/main/resources/templates/jlw/resourcesApplication/index.html @@ -1,30 +1,35 @@
- 搜索 - 新增 - 批量删除 - 刷新 + + 新增 + + 批量删除 + + 刷新 +
diff --git a/web/src/main/resources/templates/jlw/resourcesApplicationCourse/add.html b/web/src/main/resources/templates/jlw/resourcesApplicationCourse/add.html index aec9fa52..07310586 100644 --- a/web/src/main/resources/templates/jlw/resourcesApplicationCourse/add.html +++ b/web/src/main/resources/templates/jlw/resourcesApplicationCourse/add.html @@ -34,7 +34,7 @@
- @@ -50,7 +50,7 @@
- @@ -70,7 +70,7 @@
+ value=${resourcesApplicationCourse.resourcesApplicationCourseId}>