From 9e51013be2f7151481671667363d84366d0124b0 Mon Sep 17 00:00:00 2001 From: Mlxa0324 Date: Tue, 18 Oct 2022 16:47:57 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E7=BC=96=E8=BE=91=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../resources/static/js/jlw/courseInfo/add.js | 72 +++++++++---------- .../jlw/resourcesApplicationCourse/index.js | 3 +- .../templates/jlw/courseInfo/add.html | 2 +- 3 files changed, 39 insertions(+), 38 deletions(-) diff --git a/web/src/main/resources/static/js/jlw/courseInfo/add.js b/web/src/main/resources/static/js/jlw/courseInfo/add.js index 782eb79c..69fa2982 100644 --- a/web/src/main/resources/static/js/jlw/courseInfo/add.js +++ b/web/src/main/resources/static/js/jlw/courseInfo/add.js @@ -5,42 +5,42 @@ layui.define([ 'form', 'laydate', 'table','courseInfoApi'], function(exports) { var transfer = layui.transfer; var resourcesApplicationIds = $("input[name='resourcesApplicationIds']").val(); - if(!$.isEmpty(resourcesApplicationIds)){ - resourcesApplicationIds = resourcesApplicationIds.split(","); - } - var ret = Common.getAjax("/jlw/resourcesApplication/getValues.json"); - if(ret.code == 0){ - //显示搜索框 - transfer.render({ - elem: '#transfer' - ,data: ret.data - ,width:"400" - ,title: ['未选应用', '已选应用'] - ,showSearch: true - ,id: 'key123' //定义唯一索引 - ,parseData: function(res){ - return { - "value": res.resourcesApplicationId //数据值 - ,"title": res.applicationName //数据标题 - } - } - ,value:resourcesApplicationIds - ,onchange: function(data, index){ - var ids = ""; - $.each(transfer.getData("key123"),function (key,v){ - console.log(v.value); - ids += v.value; - if(key < transfer.getData("key123").length - 1){ - ids += ","; - } - }); - $("input[name='resourcesApplicationIds']").val(ids); - } - - }); - }else { - layer.msg(ret.msg); - } + // if(!$.isEmpty(resourcesApplicationIds)){ + // resourcesApplicationIds = resourcesApplicationIds.split(","); + // } + // var ret = Common.getAjax("/jlw/resourcesApplication/getValues.json"); + // if(ret.code == 0){ + // //显示搜索框 + // transfer.render({ + // elem: '#transfer' + // ,data: ret.data + // ,width:"400" + // ,title: ['未选应用', '已选应用'] + // ,showSearch: true + // ,id: 'key123' //定义唯一索引 + // ,parseData: function(res){ + // return { + // "value": res.resourcesApplicationId //数据值 + // ,"title": res.applicationName //数据标题 + // } + // } + // ,value:resourcesApplicationIds + // ,onchange: function(data, index){ + // var ids = ""; + // $.each(transfer.getData("key123"),function (key,v){ + // console.log(v.value); + // ids += v.value; + // if(key < transfer.getData("key123").length - 1){ + // ids += ","; + // } + // }); + // $("input[name='resourcesApplicationIds']").val(ids); + // } + // + // }); + // }else { + // layer.msg(ret.msg); + // } var view = { init:function(){ 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 0cb64fe4..e527b236 100644 --- a/web/src/main/resources/static/js/jlw/resourcesApplicationCourse/index.js +++ b/web/src/main/resources/static/js/jlw/resourcesApplicationCourse/index.js @@ -62,7 +62,8 @@ layui.define(['form', 'laydate', 'table'], function (exports) { templet: function (d) { // html字符串转对象,深拷贝操作,相当于每行copy一个下拉框进行回显选中操作 var copyHtml = $($('#select_resourcesApplicationIds').html()) - copyHtml.find("option[value="+d.resourcesApplicationIds+"]").attr("selected", true); + // 兼容之前的一对多关系 + copyHtml.find("option[value="+d.resourcesApplicationIds.split(',')[0]+"]").attr("selected", true); return copyHtml.html(); } }, diff --git a/web/src/main/resources/templates/jlw/courseInfo/add.html b/web/src/main/resources/templates/jlw/courseInfo/add.html index 638d1811..9e73418a 100644 --- a/web/src/main/resources/templates/jlw/courseInfo/add.html +++ b/web/src/main/resources/templates/jlw/courseInfo/add.html @@ -92,7 +92,7 @@
- +