From cfeb5ecab4f4a4eca9705f1b8735082b730b5ed1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A7=9A=E4=B8=B9ab?= <1421553879@qq.com> Date: Wed, 19 Apr 2023 01:30:15 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E7=BB=91=E5=AE=9A=E3=80=81?= =?UTF-8?q?=E5=88=86=E7=B1=BB=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../resources/templates/common/layout.html | 2 +- .../jlw/resourcesApplicationCourse/index.js | 73 ++++++++++++++----- .../templates/jlw/courseLabel/index.html | 36 ++++----- .../jlw/resourcesApplicationCourse/index.html | 10 ++- 4 files changed, 79 insertions(+), 42 deletions(-) diff --git a/admin-core/src/main/resources/templates/common/layout.html b/admin-core/src/main/resources/templates/common/layout.html index 9ebb75a3..4645ba22 100644 --- a/admin-core/src/main/resources/templates/common/layout.html +++ b/admin-core/src/main/resources/templates/common/layout.html @@ -39,7 +39,7 @@ $(document).ready(function () { }).keydown( function (e) { if (e.which === 27) { - Common.openConfirm("是否放弃治疗回到主页?",function(){ + Common.openConfirm("是否回到主页?",function(){ layer.closeAll(); }) 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 17518b5f..4cfb1905 100644 --- a/web/src/main/resources/static/js/jlw/resourcesApplicationCourse/index.js +++ b/web/src/main/resources/static/js/jlw/resourcesApplicationCourse/index.js @@ -61,12 +61,29 @@ layui.define(['form', 'laydate', 'table'], function (exports) { align: "center", templet: function (d) { // html字符串转对象,深拷贝操作,相当于每行copy一个下拉框进行回显选中操作 - var copyHtml = $($('#select_resourcesApplicationIds').html()) + var copyHtml = ''; // 兼容之前的一对多关系 - if(!$.isEmpty(d.resourcesApplicationIds)){ - copyHtml.find("option[value="+d.resourcesApplicationIds.split(',')[0]+"]").attr("selected", true); + + if (d.courseLabelType == '应用课程类') { + copyHtml = $($('#select_resourcesApplicationIds').html()); + if(!$.isEmpty(d.resourcesApplicationIds)){ + copyHtml.find("option[value="+d.resourcesApplicationIds.split(',')[0]+"]").attr("selected", true); + } + copyHtml = copyHtml.html(); + }else if (d.courseLabelType == '考证课程类') { + copyHtml = '\n'; + return copyHtml + }else if (d.courseLabelType == '理论课程类') { + copyHtml =' '; + } - return copyHtml.html(); + return copyHtml } }, { @@ -75,7 +92,7 @@ layui.define(['form', 'laydate', 'table'], function (exports) { align: "center", templet: function (d) { var htm = ''; - // htm += '绑定'; + // htm += '绑定'; htm += ''; htm += '编辑'; return htm; @@ -159,6 +176,8 @@ layui.define(['form', 'laydate', 'table'], function (exports) { courseLabelId:data.courseLabelId, resourcesApplicationIds:data.resourcesApplicationIds, }; + console.log(param) + return; var ret = Common.postAjax("/jlw/courseInfo/edit.json", param); layer.msg(ret.code == 0 ? "绑定成功!" : ret.msg, { offset: ['50%'], @@ -204,25 +223,32 @@ layui.define(['form', 'laydate', 'table'], function (exports) { form.on('select(select_courseLabelType)', function (obj) { if(!$.isEmpty(obj.value)){ var htm = ''; + var htm_application =''; + var index = $(this).parents("tr").data("index"); + if(obj.value == '应用课程类'){ - htm+=''; + htm+=''; + htm_application = $($('#select_resourcesApplicationIds').html()); + table.cache['resourcesApplicationCourseTable'][index].courseLabelType = '应用课程类'; }else if(obj.value == "考证课程类"){ - htm+=''; + htm+=''; + htm_application+=''; + table.cache['resourcesApplicationCourseTable'][index].courseLabelType = '考证课程类'; }else if(obj.value == "理论课程类"){ - htm+=''; + htm+=''; + htm_application+=''; + table.cache['resourcesApplicationCourseTable'][index].courseLabelType = '理论课程类'; } $(this).parents("td").siblings('td').eq(1).find('select').empty(); $(this).parents("td").siblings('td').eq(1).find('select').append(htm); + $(this).parents("td").siblings('td').eq(2).find('select').empty(); + $(this).parents("td").siblings('td').eq(2).find('select').append(htm_application); updateBindingBtnStatus(this); form.render(); }else { - var htm =' \n' + - ' \n' + - ' \n' + - ' ' $(this).parents("td").siblings('td').eq(1).find('select').empty(); - $(this).parents("td").siblings('td').eq(1).find('select').append(htm); + form.render(); } }); @@ -243,13 +269,20 @@ layui.define(['form', 'laydate', 'table'], function (exports) { var index = $(this).parents("tr").data("index"); layer.confirm('是否确定绑定?', function (i) { var data = table.cache['resourcesApplicationCourseTable'][index]; - var param = { - courseInfoId: data.courseInfoId, - courseLabelType:data.courseLabelType, - courseLabelId:data.courseLabelId, - resourcesApplicationIds:data.resourcesApplicationIds, - }; - var ret = Common.postAjax("/jlw/courseInfo/edit.json", param); + var param = {}; + if(data.courseLabelType == '应用课程类'){ + param = { + courseInfoId: data.courseInfoId, + courseLabelType:'应用课程类', + courseLabelId:data.courseLabelId, + resourcesApplicationIds:data.resourcesApplicationIds, + }; + }else if(data.courseLabelType == '理论课程类'){ + param = {courseInfoId: data.courseInfoId,courseLabelType:'理论课程类'}; + }else if(data.courseLabelType == '考证课程类') { + param = {courseInfoId: data.courseInfoId, courseLabelType: '考证课程类'}; + } + var ret = Common.postAjax("/jlw/courseInfo/courseBind.json", param); layer.msg(ret.code == 0 ? "绑定成功!" : ret.msg, { offset: ['50%'], icon: ret.code == 0 ? 1 : 2, diff --git a/web/src/main/resources/templates/jlw/courseLabel/index.html b/web/src/main/resources/templates/jlw/courseLabel/index.html index e1788bf0..aad4efcb 100644 --- a/web/src/main/resources/templates/jlw/courseLabel/index.html +++ b/web/src/main/resources/templates/jlw/courseLabel/index.html @@ -71,12 +71,12 @@