课程绑定、分类管理

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

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

@ -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 (d.courseLabelType == '应用课程类') {
copyHtml = $($('#select_resourcesApplicationIds').html());
if(!$.isEmpty(d.resourcesApplicationIds)){
copyHtml.find("option[value="+d.resourcesApplicationIds.split(',')[0]+"]").attr("selected", true);
}
return copyHtml.html();
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
}
},
{
@ -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 = '<option value="">请选择</option>';
var htm_application ='<option value="">请选择</option>';
var index = $(this).parents("tr").data("index");
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 == "考证课程类"){
htm+='<option value="考砸辅导">考砸辅导</option>';
htm+='<option value="考证辅导" selected>考证辅导</option>';
htm_application+='<option value="考证辅导" selected>考证辅导</option>';
table.cache['resourcesApplicationCourseTable'][index].courseLabelType = '考证课程类';
}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').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 =' <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').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 = {
var param = {};
if(data.courseLabelType == '应用课程类'){
param = {
courseInfoId: data.courseInfoId,
courseLabelType:data.courseLabelType,
courseLabelType:'应用课程类',
courseLabelId:data.courseLabelId,
resourcesApplicationIds:data.resourcesApplicationIds,
};
var ret = Common.postAjax("/jlw/courseInfo/edit.json", param);
}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,

@ -71,12 +71,12 @@
<!--#if(user.get().isAdmin){ -->
<div class="layui-colla-item">
<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">
{{# layui.each(d.yykcl, function(index, item){ }}
<div class="layui-form-item" courseLabelId="{{item.courseLabelId}}">
<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 ==
'FACULTY_ADD' && ${user.get().isUniAdmin!false})){ }}
<i class="layui-icon classEdit">&#xe642;</i>
@ -99,12 +99,12 @@
</div>
<div class="layui-colla-item">
<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">
{{# layui.each(d.kzkcl, function(index, item){ }}
<div class="layui-form-item" courseLabelId="{{item.courseLabelId}}">
<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})){ }}
<i class="layui-icon classEdit">&#xe642;</i>
<i class="layui-icon classDel">&#xe640;</i>

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

Loading…
Cancel
Save