课程绑定、分类管理

beetlsql3-dev
姚丹ab 2 years ago
parent c820a655cc
commit cfeb5ecab4

@ -39,7 +39,7 @@
$(document).ready(function () { }).keydown( $(document).ready(function () { }).keydown(
   function (e) {    function (e) {
    if (e.which === 27) {     if (e.which === 27) {
Common.openConfirm("是否放弃治疗回到主页?",function(){ Common.openConfirm("是否回到主页?",function(){
layer.closeAll(); layer.closeAll();
}) })
           

@ -61,12 +61,29 @@ layui.define(['form', 'laydate', 'table'], function (exports) {
align: "center", align: "center",
templet: function (d) { templet: function (d) {
// html字符串转对象深拷贝操作相当于每行copy一个下拉框进行回显选中操作 // 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 = '<select lay-filter="select_resourcesApplicationIds" name="resourcesApplicationIds">\n' +
' <option value="">请选择</option>\n' +
' <option value="考证辅导" selected>考证辅导</option>\n' +
' </select>\n';
return copyHtml
}else if (d.courseLabelType == '理论课程类') {
copyHtml =' <select lay-filter="select_resourcesApplicationIds" name="resourcesApplicationIds">\n' +
' <option value="">请选择</option>\n' +
' <option value="课程中心" selected>课程中心</option>\n' +
' </select>';
} }
return copyHtml.html(); return copyHtml
} }
}, },
{ {
@ -75,7 +92,7 @@ layui.define(['form', 'laydate', 'table'], function (exports) {
align: "center", align: "center",
templet: function (d) { templet: function (d) {
var htm = ''; var htm = '';
// htm += '<a class="layui-table-link" lay-event="binding">绑定</a>'; // htm += '<a class="layui-table-link" lay-event="binding">绑定</a>';
htm += '<input type="checkbox" name="" lay-filter="binding" checked title="绑定">'; htm += '<input type="checkbox" name="" lay-filter="binding" checked title="绑定">';
htm += '<a class="layui-table-link" style="padding-left: 15px" lay-event="edit">编辑</a>'; htm += '<a class="layui-table-link" style="padding-left: 15px" lay-event="edit">编辑</a>';
return htm; return htm;
@ -159,6 +176,8 @@ layui.define(['form', 'laydate', 'table'], function (exports) {
courseLabelId:data.courseLabelId, courseLabelId:data.courseLabelId,
resourcesApplicationIds:data.resourcesApplicationIds, resourcesApplicationIds:data.resourcesApplicationIds,
}; };
console.log(param)
return;
var ret = Common.postAjax("/jlw/courseInfo/edit.json", param); var ret = Common.postAjax("/jlw/courseInfo/edit.json", param);
layer.msg(ret.code == 0 ? "绑定成功!" : ret.msg, { layer.msg(ret.code == 0 ? "绑定成功!" : ret.msg, {
offset: ['50%'], offset: ['50%'],
@ -204,25 +223,32 @@ layui.define(['form', 'laydate', 'table'], function (exports) {
form.on('select(select_courseLabelType)', function (obj) { form.on('select(select_courseLabelType)', function (obj) {
if(!$.isEmpty(obj.value)){ if(!$.isEmpty(obj.value)){
var htm = '<option value="">请选择</option>'; var htm = '<option value="">请选择</option>';
var htm_application ='<option value="">请选择</option>';
var index = $(this).parents("tr").data("index");
if(obj.value == '应用课程类'){ if(obj.value == '应用课程类'){
htm+='<option value="应用中心">应用中心</option>'; htm+='<option value="应用中心" selected>应用中心</option>';
htm_application = $($('#select_resourcesApplicationIds').html());
table.cache['resourcesApplicationCourseTable'][index].courseLabelType = '应用课程类';
}else if(obj.value == "考证课程类"){ }else if(obj.value == "考证课程类"){
htm+='<option value="考砸辅导">考砸辅导</option>'; htm+='<option value="考证辅导" selected>考证辅导</option>';
htm_application+='<option value="考证辅导" selected>考证辅导</option>';
table.cache['resourcesApplicationCourseTable'][index].courseLabelType = '考证课程类';
}else if(obj.value == "理论课程类"){ }else if(obj.value == "理论课程类"){
htm+='<option value="课程中心">课程中心</option>'; htm+='<option value="课程中心" selected>课程中心</option>';
htm_application+='<option value="课程中心" selected>课程中心</option>';
table.cache['resourcesApplicationCourseTable'][index].courseLabelType = '理论课程类';
} }
$(this).parents("td").siblings('td').eq(1).find('select').empty(); $(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(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); updateBindingBtnStatus(this);
form.render(); form.render();
}else { }else {
var htm =' <option value="">请选择</option>\n' +
' <option value="考证辅导">考证辅导</option>\n' +
' <option value="课程中心">课程中心</option>\n' +
' <option value="应用中心">应用中心</option>'
$(this).parents("td").siblings('td').eq(1).find('select').empty(); $(this).parents("td").siblings('td').eq(1).find('select').empty();
$(this).parents("td").siblings('td').eq(1).find('select').append(htm);
form.render(); form.render();
} }
}); });
@ -243,13 +269,20 @@ layui.define(['form', 'laydate', 'table'], function (exports) {
var index = $(this).parents("tr").data("index"); var index = $(this).parents("tr").data("index");
layer.confirm('是否确定绑定?', function (i) { layer.confirm('是否确定绑定?', function (i) {
var data = table.cache['resourcesApplicationCourseTable'][index]; var data = table.cache['resourcesApplicationCourseTable'][index];
var param = { var param = {};
courseInfoId: data.courseInfoId, if(data.courseLabelType == '应用课程类'){
courseLabelType:data.courseLabelType, param = {
courseLabelId:data.courseLabelId, courseInfoId: data.courseInfoId,
resourcesApplicationIds:data.resourcesApplicationIds, courseLabelType:'应用课程类',
}; courseLabelId:data.courseLabelId,
var ret = Common.postAjax("/jlw/courseInfo/edit.json", param); 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, { layer.msg(ret.code == 0 ? "绑定成功!" : ret.msg, {
offset: ['50%'], offset: ['50%'],
icon: ret.code == 0 ? 1 : 2, icon: ret.code == 0 ? 1 : 2,

@ -71,12 +71,12 @@
<!--#if(user.get().isAdmin){ --> <!--#if(user.get().isAdmin){ -->
<div class="layui-colla-item"> <div class="layui-colla-item">
<h2 class="layui-colla-title">应用课程类</h2> <h2 class="layui-colla-title">应用课程类</h2>
<div class="layui-colla-content layui-show"> <div class="layui-colla-content " style="display: none !important">
<div class="layui-row" id="yykcl"> <div class="layui-row" id="yykcl">
{{# layui.each(d.yykcl, function(index, item){ }} {{# layui.each(d.yykcl, function(index, item){ }}
<div class="layui-form-item" courseLabelId="{{item.courseLabelId}}"> <div class="layui-form-item" courseLabelId="{{item.courseLabelId}}">
<label class="layui-form-label">{{item.courseLabelName}}</label> <label class="layui-form-label">{{item.courseLabelName}}</label>
<div class="layui-input-block" style="line-height: 36px;"> <div class="layui-input-block" style="line-height: 36px;display: none">
{{# if((item.addType == 'ADMIN_ADD' && ${user.get().isAdmin!false}) || (item.addType == {{# if((item.addType == 'ADMIN_ADD' && ${user.get().isAdmin!false}) || (item.addType ==
'FACULTY_ADD' && ${user.get().isUniAdmin!false})){ }} 'FACULTY_ADD' && ${user.get().isUniAdmin!false})){ }}
<i class="layui-icon classEdit">&#xe642;</i> <i class="layui-icon classEdit">&#xe642;</i>
@ -87,24 +87,24 @@
{{# }); }} {{# }); }}
</div> </div>
<div class="layui-row" style="margin-top: 10px;"> <div class="layui-row" style="margin-top: 10px;">
<span index="0" class="addLabel"> <span index="0" class="addLabel">
<button type="button" <button type="button"
class="layui-btn layui-btn-radius layui-btn-xs layui-btn-primary btn_radius"> class="layui-btn layui-btn-radius layui-btn-xs layui-btn-primary btn_radius">
<i class="layui-icon">&#xe624;</i> <i class="layui-icon">&#xe624;</i>
</button> </button>
<span>分类</span> <span>分类</span>
</span> </span>
</div> </div>
</div> </div>
</div> </div>
<div class="layui-colla-item"> <div class="layui-colla-item">
<h2 class="layui-colla-title">考证课程类</h2> <h2 class="layui-colla-title">考证课程类</h2>
<div class="layui-colla-content"> <div class="layui-colla-content" style="display: none !important">
<div class="layui-row" id="kzkcl"> <div class="layui-row" id="kzkcl">
{{# layui.each(d.kzkcl, function(index, item){ }} {{# layui.each(d.kzkcl, function(index, item){ }}
<div class="layui-form-item" courseLabelId="{{item.courseLabelId}}"> <div class="layui-form-item" courseLabelId="{{item.courseLabelId}}">
<label class="layui-form-label">{{item.courseLabelName}}</label> <label class="layui-form-label">{{item.courseLabelName}}</label>
<div class="layui-input-block" style="line-height: 36px;"> <div class="layui-input-block" style="line-height: 36px;display: none" >
{{# if((item.addType == 'ADMIN_ADD' && ${user.get().isAdmin!false})){ }} {{# if((item.addType == 'ADMIN_ADD' && ${user.get().isAdmin!false})){ }}
<i class="layui-icon classEdit">&#xe642;</i> <i class="layui-icon classEdit">&#xe642;</i>
<i class="layui-icon classDel">&#xe640;</i> <i class="layui-icon classDel">&#xe640;</i>
@ -114,13 +114,13 @@
{{# }); }} {{# }); }}
</div> </div>
<div class="layui-row" style="margin-top: 10px;"> <div class="layui-row" style="margin-top: 10px;">
<span index="1" class="addLabel"> <span index="1" class="addLabel">
<button type="button" <button type="button"
class="layui-btn layui-btn-radius layui-btn-xs layui-btn-primary btn_radius"> class="layui-btn layui-btn-radius layui-btn-xs layui-btn-primary btn_radius">
<i class="layui-icon">&#xe624;</i> <i class="layui-icon">&#xe624;</i>
</button> </button>
<span style="color:#73a2f8;">分类</span> <span style="color:#73a2f8;">分类</span>
</span> </span>
</div> </div>
</div> </div>
</div> </div>

@ -47,9 +47,13 @@
<script type="text/html" id="select_courseLabelIdSelect"> <script type="text/html" id="select_courseLabelIdSelect">
<select lay-filter="select_courseLabelId" name="courseLabelId"> <select lay-filter="select_courseLabelId" name="courseLabelId">
<option value="">请选择</option> <option value="">请选择</option>
<option value="考证辅导">考证辅导</option> {{# if(d.courseLabelType == '应用课程类'){ }}
<option value="课程中心">课程中心</option> <option value="应用中心" selected>应用中心</option>
<option value="应用中心">应用中心</option> {{# }else if(d.courseLabelType == '考证课程类'){ }}
<option value="考证辅导" selected>考证辅导</option>
{{# }else if(d.courseLabelType == '理论课程类'){ }}
<option value="课程中心" selected>课程中心</option>
{{# } }}
</select> </select>
</script> </script>

Loading…
Cancel
Save