课程绑定

beetlsql3-dev
姚丹ab 2 years ago
parent 1c553d71a8
commit 0c9f0335f6

@ -4702,12 +4702,12 @@ CREATE TABLE `course_label` (
-- ---------------------------- -- ----------------------------
-- Records of course_label -- Records of course_label
-- ---------------------------- -- ----------------------------
INSERT INTO `course_label` VALUES (1, '实务课程类', '大数据基础', 1, NULL, NULL); INSERT INTO `course_label` VALUES (1, '应用课程类', '大数据基础', 1, NULL, NULL);
INSERT INTO `course_label` VALUES (2, '实务课程类', '金融大数据', 1, NULL, NULL); INSERT INTO `course_label` VALUES (2, '应用课程类', '金融大数据', 1, NULL, NULL);
INSERT INTO `course_label` VALUES (3, '实务课程类', '财会大数据', 1, NULL, NULL); INSERT INTO `course_label` VALUES (3, '应用课程类', '财会大数据', 1, NULL, NULL);
INSERT INTO `course_label` VALUES (4, '实务课程类', '商业大数据', 1, NULL, NULL); INSERT INTO `course_label` VALUES (4, '应用课程类', '商业大数据', 1, NULL, NULL);
INSERT INTO `course_label` VALUES (5, '实务课程类', '营销大数据 ', 1, NULL, NULL); INSERT INTO `course_label` VALUES (5, '应用课程类', '营销大数据 ', 1, NULL, NULL);
INSERT INTO `course_label` VALUES (6, '实务课程类', '未命名', 2, NULL, NULL); INSERT INTO `course_label` VALUES (6, '应用课程类', '未命名', 2, NULL, NULL);
INSERT INTO `course_label` VALUES (7, '考证课程类', '未命名', 2, NULL, NULL); INSERT INTO `course_label` VALUES (7, '考证课程类', '未命名', 2, NULL, NULL);
INSERT INTO `course_label` VALUES (8, '理论课程类', '传统金融', 1, NULL, NULL); INSERT INTO `course_label` VALUES (8, '理论课程类', '传统金融', 1, NULL, NULL);
INSERT INTO `course_label` VALUES (9, '理论课程类', '金融风险', 1, NULL, NULL); INSERT INTO `course_label` VALUES (9, '理论课程类', '金融风险', 1, NULL, NULL);
@ -27057,11 +27057,11 @@ CREATE TABLE `resources_application` (
-- ---------------------------- -- ----------------------------
-- Records of resources_application -- Records of resources_application
-- ---------------------------- -- ----------------------------
INSERT INTO `resources_application` VALUES (1, '大数据基础 子应用', 'http://tzcjbd.sztzjy.com/server/?resourcesApplicationId=1', '实务课程类', '1', NULL, '', '', '', '', '<p>大数据基础 子应用</p>\n', '<p>大数据基础 子应用</p>\n', NULL, NULL, '大数据基础 子应用', '大数据基础 子应用'); INSERT INTO `resources_application` VALUES (1, '大数据基础 子应用', 'http://tzcjbd.sztzjy.com/server/?resourcesApplicationId=1', '应用课程类', '1', NULL, '', '', '', '', '<p>大数据基础 子应用</p>\n', '<p>大数据基础 子应用</p>\n', NULL, NULL, '大数据基础 子应用', '大数据基础 子应用');
INSERT INTO `resources_application` VALUES (2, '金融财经大数据分析实验平台', 'http://tzcjbd.sztzjy.com/server/?resourcesApplicationId=2', '实务课程类', '2', NULL, NULL, NULL, NULL, NULL, '<p>金融大数据 子应用</p>\n', '<p>金融大数据 子应用</p>\n', NULL, NULL, '金融大数据 子应用', '金融大数据 子应用'); INSERT INTO `resources_application` VALUES (2, '金融财经大数据分析实验平台', 'http://tzcjbd.sztzjy.com/server/?resourcesApplicationId=2', '应用课程类', '2', NULL, NULL, NULL, NULL, NULL, '<p>金融大数据 子应用</p>\n', '<p>金融大数据 子应用</p>\n', NULL, NULL, '金融大数据 子应用', '金融大数据 子应用');
INSERT INTO `resources_application` VALUES (3, '财会大数据 子应用', 'http://tzcjbd.sztzjy.com/server/?resourcesApplicationId=3', '实务课程类', '3', NULL, NULL, NULL, NULL, NULL, '<p>财会大数据 子应用</p>\r\n', '<p>财会大数据 子应用</p>\r\n', NULL, NULL, '财会大数据 子应用', '财会大数据 子应用'); INSERT INTO `resources_application` VALUES (3, '财会大数据 子应用', 'http://tzcjbd.sztzjy.com/server/?resourcesApplicationId=3', '应用课程类', '3', NULL, NULL, NULL, NULL, NULL, '<p>财会大数据 子应用</p>\r\n', '<p>财会大数据 子应用</p>\r\n', NULL, NULL, '财会大数据 子应用', '财会大数据 子应用');
INSERT INTO `resources_application` VALUES (4, '商业大数据 子应用', 'http://tzcjbd.sztzjy.com/server/?resourcesApplicationId=4', '实务课程类', '4', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); INSERT INTO `resources_application` VALUES (4, '商业大数据 子应用', 'http://tzcjbd.sztzjy.com/server/?resourcesApplicationId=4', '应用课程类', '4', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO `resources_application` VALUES (5, '营销大数据 子应用', 'http://tzcjbd.sztzjy.com/server/?resourcesApplicationId=5', '实务课程类', '5', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); INSERT INTO `resources_application` VALUES (5, '营销大数据 子应用', 'http://tzcjbd.sztzjy.com/server/?resourcesApplicationId=5', '应用课程类', '5', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
drop table if exists resources_application_course; drop table if exists resources_application_course;

@ -149,7 +149,7 @@ public class CourseInfoController{
if(null != courseInfoQuery.getCourseLabelId()){ if(null != courseInfoQuery.getCourseLabelId()){
CourseLabel courseLabel = courseLabelService.queryById(courseInfoQuery.getCourseLabelId()); CourseLabel courseLabel = courseLabelService.queryById(courseInfoQuery.getCourseLabelId());
if(null != courseLabel && courseLabel.getCourseLabelType().contains("实务课程类") && if(null != courseLabel && courseLabel.getCourseLabelType().contains("应用课程类") &&
null == courseInfoQuery.getCourseInfoParentId() && StringUtils.isBlank(courseInfoQuery.getResourcesApplicationIds())){ null == courseInfoQuery.getCourseInfoParentId() && StringUtils.isBlank(courseInfoQuery.getResourcesApplicationIds())){
return JsonResult.failMessage("请选择课程归属的应用"); return JsonResult.failMessage("请选择课程归属的应用");
} }

@ -343,7 +343,7 @@ public class ResourcesQuestionController{
CourseInfoQuery courseInfoQuery = new CourseInfoQuery(); CourseInfoQuery courseInfoQuery = new CourseInfoQuery();
courseInfoQuery.setCourseLabelStatus(1); courseInfoQuery.setCourseLabelStatus(1);
courseInfoQuery.setCourseLabelTypes("实务课程类"); courseInfoQuery.setCourseLabelTypes("应用课程类");
courseInfoQuery.setCourseInfoType(1); courseInfoQuery.setCourseInfoType(1);
courseInfoQuery.setCourseInfoStatus(1); courseInfoQuery.setCourseInfoStatus(1);

@ -1397,7 +1397,7 @@ public class StudentController{
if( null == student ){ if( null == student ){
return JsonResult.failMessage("请登录后再操作"); return JsonResult.failMessage("请登录后再操作");
} }
List<CourseInfo>list = courseInfoService.getListByCourseLabelTypes("实务课程类"); List<CourseInfo>list = courseInfoService.getListByCourseLabelTypes("应用课程类");
return JsonResult.success(list); return JsonResult.success(list);
} }
@ -1815,7 +1815,7 @@ public class StudentController{
if( null == student ){ if( null == student ){
return JsonResult.failMessage("请登录后再操作"); return JsonResult.failMessage("请登录后再操作");
} }
List<CourseInfo>list = courseInfoService.getListByCourseLabelTypes("实务课程类"); List<CourseInfo>list = courseInfoService.getListByCourseLabelTypes("应用课程类");
return JsonResult.success(list); return JsonResult.success(list);
} }

@ -1143,7 +1143,7 @@ public class TeacherController{
@GetMapping(MODEL + "/getCourseResourcesList.json") @GetMapping(MODEL + "/getCourseResourcesList.json")
@ResponseBody @ResponseBody
public JsonResult getCourseResourcesList(){ public JsonResult getCourseResourcesList(){
List<CourseInfo>list = courseInfoService.getListByCourseLabelTypes("实务课程类"); List<CourseInfo>list = courseInfoService.getListByCourseLabelTypes("应用课程类");
return JsonResult.success(list); return JsonResult.success(list);
} }

@ -14,11 +14,11 @@ public class ResourcesApplicationCourseQuery extends PageParam {
@NotNull(message = "ID不能为空", groups =ValidateConfig.UPDATE.class) @NotNull(message = "ID不能为空", groups =ValidateConfig.UPDATE.class)
@Query(name = "ID", display = false) @Query(name = "ID", display = false)
private Long resourcesApplicationCourseId; private Long resourcesApplicationCourseId;
@Query(name = "应用管理ID", display = true,type=Query.TYPE_DICT,dict="resources_application.application_name.1=1") @Query(name = "应用管理ID", display = false,type=Query.TYPE_DICT,dict="resources_application.application_name.1=1")
private Long resourcesApplicationId; private Long resourcesApplicationId;
@Query(name = "课程配置ID", display = true,type=Query.TYPE_DICT,dict="course_info.course_info_name.course_info_status=1") @Query(name = "课程配置ID", display = false,type=Query.TYPE_DICT,dict="course_info.course_info_name.course_info_status=1")
private Long courseInfoId; private Long courseInfoId;
@Query(name = "标签ID", display = true,type=Query.TYPE_DICT,dict="course_label.course_label_name.course_label_status=1") @Query(name = "标签ID", display = false,type=Query.TYPE_DICT,dict="course_label.course_label_name.course_label_status=1")
private Long courseLabelId; private Long courseLabelId;
private String resourcesApplicationCourseIdPlural; private String resourcesApplicationCourseIdPlural;

@ -1366,13 +1366,13 @@ layui.define([ 'form', 'laydate', 'table','element','upload','competitionApi','t
//客观题选择 //客观题选择
function kgt_select(){ function kgt_select(){
var ret = Common.getAjax("/jlw/resourcesQuestion/getTreeByCourseLabelTypes.json",{courseLabelTypes:"实务课程类",competitionId:$("input[name='competitionId']").val(),ct1QuestionIds:$("input[name='ct1QuestionIds']").val() || '-1'}); var ret = Common.getAjax("/jlw/resourcesQuestion/getTreeByCourseLabelTypes.json",{courseLabelTypes:"应用课程类",competitionId:$("input[name='competitionId']").val(),ct1QuestionIds:$("input[name='ct1QuestionIds']").val() || '-1'});
openTiMu(1,ret); openTiMu(1,ret);
} }
//竞赛案例设置 //竞赛案例设置
function jsal_select(){ function jsal_select(){
var ret = Common.getAjax("/jlw/resourcesCompetition/getTreeByCourseLabelTypes.json",{courseLabelTypes:"实务课程类",competitionId:$("input[name='competitionId']").val(),ct2QuestionIds:$("input[name='ct2QuestionIds']").val() || '-1'}); var ret = Common.getAjax("/jlw/resourcesCompetition/getTreeByCourseLabelTypes.json",{courseLabelTypes:"应用课程类",competitionId:$("input[name='competitionId']").val(),ct2QuestionIds:$("input[name='ct2QuestionIds']").val() || '-1'});
openTiMu(2,ret); openTiMu(2,ret);
} }

@ -282,17 +282,17 @@ layui.define([ 'form', 'laydate', 'table','laytpl','examApi'], function(exports)
} }
function kgt_select(){ function kgt_select(){
var ret = Common.getAjax("/jlw/resourcesQuestion/getTreeByCourseLabelTypes.json",{courseLabelTypes:"实务课程类",examId:$("input[name='examId']").val(),et1QuestionIds:$("input[name='et1QuestionIds']").val() || '-1'}); var ret = Common.getAjax("/jlw/resourcesQuestion/getTreeByCourseLabelTypes.json",{courseLabelTypes:"应用课程类",examId:$("input[name='examId']").val(),et1QuestionIds:$("input[name='et1QuestionIds']").val() || '-1'});
openTiMu(1,ret); openTiMu(1,ret);
} }
function jsal_select(){ function jsal_select(){
var ret = Common.getAjax("/jlw/resourcesCompetition/getTreeByCourseLabelTypes.json",{courseLabelTypes:"实务课程类",examId:$("input[name='examId']").val(),et2QuestionIds:$("input[name='et2QuestionIds']").val() || '-1'}); var ret = Common.getAjax("/jlw/resourcesCompetition/getTreeByCourseLabelTypes.json",{courseLabelTypes:"应用课程类",examId:$("input[name='examId']").val(),et2QuestionIds:$("input[name='et2QuestionIds']").val() || '-1'});
openTiMu(2,ret); openTiMu(2,ret);
} }
function sxal_select(){ function sxal_select(){
var ret = Common.getAjax("/jlw/resourcesTraining/getTreeByCourseLabelTypes.json",{courseLabelTypes:"实务课程类",examId:$("input[name='examId']").val(),et3QuestionIds:$("input[name='et3QuestionIds']").val() || '-1'}); var ret = Common.getAjax("/jlw/resourcesTraining/getTreeByCourseLabelTypes.json",{courseLabelTypes:"应用课程类",examId:$("input[name='examId']").val(),et3QuestionIds:$("input[name='et3QuestionIds']").val() || '-1'});
openTiMu(3,ret); openTiMu(3,ret);
} }

@ -5,7 +5,7 @@ layui.define(['form', 'laydate', 'table'], function (exports) {
var resourcesApplicationCourseTable = null; var resourcesApplicationCourseTable = null;
var selectCourseLabelType = "";//选择课程类型值 var selectCourseLabelType = "";//选择课程类型值
var selectList = "<select lay-filter='select_'><option value=''>请选择</option>", //绑定模块 var selectList = "<select lay-filter='select_'><option value=''>请选择</option>", //绑定模块
resourcesApplication = Common.getAjax("/jlw/resourcesApplication/getValues.json", {applicationOneLevelRelation: "实务课程类"}).data,//获取应用 resourcesApplication = Common.getAjax("/jlw/resourcesApplication/getValues.json", {applicationOneLevelRelation: "应用课程类"}).data,//获取应用
courseLabelData = Common.getAjax("/jlw/courseLabel/getValues.json", {courseLabelStatus: 1}).data; courseLabelData = Common.getAjax("/jlw/courseLabel/getValues.json", {courseLabelStatus: 1}).data;
/*$.each(resourcesApplication,function (key,value){ /*$.each(resourcesApplication,function (key,value){
selectList += '<option value="'+value.resourcesApplicationId+'">'+value.applicationName+'</option>'; selectList += '<option value="'+value.resourcesApplicationId+'">'+value.applicationName+'</option>';
@ -53,18 +53,24 @@ layui.define(['form', 'laydate', 'table'], function (exports) {
title: '课程类别', title: '课程类别',
align: "center", align: "center",
templet: function (d) { templet: function (d) {
var courseLabelType = ""; var html = '<select class="yyy" name="courseLabelType" lay-filter="courseLabelType"><option value="">请选择</option>';
var yykcl = '<optgroup label="应用课程类">';
var kzkcl = '<optgroup label="考证课程类">';
var llkcl = '<optgroup label="理论课程类">';
$.each(courseLabelData, function (key, value) { $.each(courseLabelData, function (key, value) {
if (value.courseLabelId == d.courseLabelId) { var selected = selected = value.courseLabelId == d.courseLabelId?"selected":"";
courseLabelType = value.courseLabelName; if (value.courseLabelType == '应用课程类') {
yykcl += '<option value="' + value.courseLabelId + '" '+selected+'>' + value.courseLabelName + '</option>';
} else if (value.courseLabelType == '考证课程类') {
kzkcl += '<option value="' + value.courseLabelId + '" '+selected+'>' + value.courseLabelName + '</option>';
} else if (value.courseLabelType == '理论课程类') {
llkcl += '<option value="' + value.courseLabelId + '" '+selected+'>' + value.courseLabelName + '</option>';
} }
}); });
var html = "<select name='courseLabelType' lay-filter='courseLabelType'>\n" + yykcl+= '</optgroup>';
" <option value='' >请选择</option>\n" + kzkcl+= '</optgroup>';
" <option value='实务课程类'" + (courseLabelType == '实务课程类' ? 'selected' : '') + ">" + "实务课程类</option>\n" + llkcl+= '</optgroup>';
" <option value='考证课程类' " + (courseLabelType == '考证课程类' ? 'selected' : '') + ">" + "考证课程类</option>\n" + html +=yykcl+kzkcl+llkcl+'</select>';
" <option value='理论课程类' " + (courseLabelType == '理论课程类' ? 'selected' : '') + ">" + "理论课程类</option>\n" +
" </select>";
return html; return html;
} }
}, },
@ -104,7 +110,9 @@ layui.define(['form', 'laydate', 'table'], function (exports) {
} }
} }
]] ]]
/* ,done: function (res, curr, count) {
}*/
}); });
table.on('checkbox(resourcesApplicationCourseTable)', function (obj) { table.on('checkbox(resourcesApplicationCourseTable)', function (obj) {
@ -170,7 +178,8 @@ layui.define(['form', 'laydate', 'table'], function (exports) {
}); });
} else if (obj.event === "binding") { } else if (obj.event === "binding") {
layer.confirm('是否确定绑定?', function (index) { layer.confirm('是否确定绑定?', function (index) {
var ret = Common.postAjax("/jlw/xxx/xx.json", {ids: data.resourcesApplicationCourseId}); var param = obj.data;
var ret = Common.postAjax("/jlw/resourcesApplicationCourse/edit.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,
@ -184,33 +193,45 @@ layui.define(['form', 'laydate', 'table'], function (exports) {
} }
}) })
}; };
form.on('select(courseLabelType)', function (data) { form.on('select(courseLabelType)', function (obj) {
selectCourseLabelType = data.value; selectCourseLabelType = obj.value;
resourcesApplication = Common.getAjax("/jlw/resourcesApplication/getValues.json", {applicationOneLevelRelation: data.value}).data; //获取课程数据 resourcesApplication = Common.getAjax("/jlw/resourcesApplication/getValues.json", {applicationSecondLevelRelation: obj.value}).data; //获取课程数据
var this_ = $(this).parents("td").next().next().find("select"); var this_ = $(this).parents("td").next().next().find("select");
this_.empty(); this_.empty();
this_.append("<option value=''>请选择</option>"); this_.append("<option value=''>请选择</option>");
$(this).parents("td").next().next().find("select").empty(); $(this).parents("td").next().next().find("select").empty();
$(this).parents("td").next().next().find("select").append("<option value=''>请选择</option>"); $(this).parents("td").next().next().find("select").append("<option value=''>请选择</option>");
if (!$.isEmpty(data.value)) { if (!$.isEmpty(obj.value)) {
$.each(resourcesApplication, function (key, v) { $.each(resourcesApplication, function (key, v) {
this_.append("<option value='" + v.resourcesApplicationId + "'>" + v.applicationName + "</option>"); this_.append("<option value='" + v.resourcesApplicationId + "'>" + v.applicationName + "</option>");
}); });
} }
var courseLabelId = obj.value;
var resourcesApplicationCourseId = table.cache['resourcesApplicationCourseTable'][$(this).parents("tr").attr("data-index")].resourcesApplicationCourseId;
if (!$.isEmpty(resourcesApplicationCourseId)) {
var param = {
resourcesApplicationCourseId: resourcesApplicationCourseId,
courseLabelId: courseLabelId,
};
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.render(); form.render();
}); });
form.on('select(select_yingYong_1)', function (data) { form.on('select(select_yingYong_1)', function (obj) {
var resourcesApplicationId = data.value; var resourcesApplicationId = obj.value;
var resourcesApplicationCourseId = table.cache['resourcesApplicationCourseTable'][$(this).parents("tr").attr("data-index")].resourcesApplicationCourseId; var resourcesApplicationCourseId = table.cache['resourcesApplicationCourseTable'][$(this).parents("tr").attr("data-index")].resourcesApplicationCourseId;
if (!$.isEmpty(resourcesApplicationCourseId)) { if (!$.isEmpty(resourcesApplicationCourseId)) {
var param = { var param = {
resourcesApplicationCourseId: resourcesApplicationCourseId, resourcesApplicationCourseId: resourcesApplicationCourseId,
resourcesApplicationId: resourcesApplicationId, resourcesApplicationId: resourcesApplicationId,
}; };
if(!$.isEmpty(selectCourseLabelType)){
param.courseLabelType = selectCourseLabelType;
}
var ret = Common.postAjax("/jlw/resourcesApplicationCourse/edit.json", param); var ret = Common.postAjax("/jlw/resourcesApplicationCourse/edit.json", param);
layer.msg(ret.code == 0 ? "绑定成功!" : ret.msg, { layer.msg(ret.code == 0 ? "绑定成功!" : ret.msg, {
offset: ['50%'], offset: ['50%'],
@ -219,13 +240,22 @@ layui.define(['form', 'laydate', 'table'], function (exports) {
}); });
} }
}); });
form.on('select(undefinedYD)', function (data) { form.on('select(select_)', function (obj) {
console.log("data->>>>>>>>>>>>>>>>", data); var id = obj.value;
var selectElem = $(data.elem); return;
var tdElem = selectElem.closest('td'); var resourcesApplicationCourseId = table.cache['resourcesApplicationCourseTable'][$(this).parents("tr").attr("data-index")].resourcesApplicationCourseId;
var trElem = tdElem.closest('tr'); if (!$.isEmpty(resourcesApplicationCourseId)) {
var tableView = trElem.closest('.layui-table-view'); var param = {
table.cache[tableView.attr('lay-id')][trElem.data('index')][tdElem.data('field')] = data.value; resourcesApplicationCourseId: resourcesApplicationCourseId,
id: id,
};
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秒
});
}
}); });
exports('index', view); exports('index', view);

@ -8,7 +8,7 @@ layui.define(['form', 'laydate', 'table'], function (exports) {
selectMap = {},//已经生成过select的map selectMap = {},//已经生成过select的map
selectList = "<select lay-filter='select_courseInfoIds'><option value=''>请选择</option>", selectList = "<select lay-filter='select_courseInfoIds'><option value=''>请选择</option>",
courseLabelTypes = Common.getAjax("/jlw/courseInfo/getTreeByCourseLabelTypes.json", { courseLabelTypes = Common.getAjax("/jlw/courseInfo/getTreeByCourseLabelTypes.json", {
courseLabelTypes: "实务课程类", courseLabelTypes: "应用课程类",
rankLimit: 3 rankLimit: 3
}).data; //获取课程数据 }).data; //获取课程数据
$.each(courseLabelTypes, function (key, value) { $.each(courseLabelTypes, function (key, value) {

@ -50,10 +50,10 @@
<div class="layui-inline"> <div class="layui-inline">
<label class="layui-form-label"><span class="req">*</span>课程类别:</label> <label class="layui-form-label"><span class="req">*</span>课程类别:</label>
<div class="layui-input-inline"> <div class="layui-input-inline">
<!-- '实务课程类','考证课程类','理论课程类';--> <!-- '应用课程类','考证课程类','理论课程类';-->
<select lay-filter="select_courseLabelType"> <select lay-filter="select_courseLabelType">
<option value="">请选择</option> <option value="">请选择</option>
<option value="实务课程类" ${courseInfo.courseLabelType =='实务课程类'?'selected':''}>实务课程类</option> <option value="应用课程类" ${courseInfo.courseLabelType =='应用课程类'?'selected':''}>应用课程类</option>
<option value="考证课程类" ${courseInfo.courseLabelType =='考证课程类'?'selected':''}>考证课程类</option> <option value="考证课程类" ${courseInfo.courseLabelType =='考证课程类'?'selected':''}>考证课程类</option>
<option value="理论课程类" ${courseInfo.courseLabelType =='理论课程类'?'selected':''}>理论课程类</option> <option value="理论课程类" ${courseInfo.courseLabelType =='理论课程类'?'selected':''}>理论课程类</option>
</select> </select>

@ -1120,7 +1120,7 @@
//加载编辑课程资源中的搜索树结构 //加载编辑课程资源中的搜索树结构
function getTreeByCourseLabel(){ function getTreeByCourseLabel(){
if(tag == 0){ if(tag == 0){
getTreeByCourseLabelTypes = Common.getAjax("/jlw/courseInfo/getTreeByCourseLabelTypes.json",{courseLabelTypes:"实务课程类"}).data; getTreeByCourseLabelTypes = Common.getAjax("/jlw/courseInfo/getTreeByCourseLabelTypes.json",{courseLabelTypes:"应用课程类"}).data;
tag = 1; tag = 1;
} }
var el = ""; var el = "";

@ -1,150 +1,173 @@
<!--#layout("/common/layout.html",{"jsBase":"/js/jlw/courseLabel/"}){ --> <!--#layout("/common/layout.html",{"jsBase":"/js/jlw/courseLabel/"}){ -->
<style> <style>
.btn_radius,.btn_radius:hover{ .btn_radius, .btn_radius:hover {
padding: 0 2px;margin-right: 5px;margin-bottom:5px;color: #73a2f8!important;border-color: #73a2f8!important; padding: 0 2px;
margin-right: 5px;
margin-bottom: 5px;
color: #73a2f8 !important;
border-color: #73a2f8 !important;
} }
.addLabel{
color:#73a2f8;cursor: pointer; .addLabel {
color: #73a2f8;
cursor: pointer;
} }
.layui-form-item{
.layui-form-item {
margin-bottom: 0; margin-bottom: 0;
} }
.layui-form-item label{
.layui-form-item label {
width: 150px; width: 150px;
line-height: 20px; line-height: 20px;
height: 25px; height: 25px;
text-align: left !important;padding: 9px 0 !important; text-align: left !important;
padding: 9px 0 !important;
} }
.layui-input-block{
.layui-input-block {
margin-left: 180px; margin-left: 180px;
} }
.classDel,.classEdit{
cursor: pointer;font-size: 20px; .classDel, .classEdit {
cursor: pointer;
font-size: 20px;
} }
.classDel{
color: red;margin-left: 10px; .classDel {
color: red;
margin-left: 10px;
} }
.classEdit{
.classEdit {
color: #73a2f8; color: #73a2f8;
} }
.layui-colla-title{
background-color: inherit;font-size: 18px; .layui-colla-title {
background-color: inherit;
font-size: 18px;
} }
.layui-collapse,.layui-colla-content,.layui-colla-item{
.layui-collapse, .layui-colla-content, .layui-colla-item {
border: none; border: none;
} }
.layui-colla-content,.layui-colla-item{
.layui-colla-content, .layui-colla-item {
margin-left: 55px; margin-left: 55px;
font-size: 16px !important; font-size: 16px !important;
} }
#view .layui-colla-item h2{
#view .layui-colla-item h2 {
width: 200px; width: 200px;
} }
</style> </style>
<div class="layui-row"> <div class="layui-row">
<h2><i class="iconfont" style="font-size: 30px;float: left;padding: 0 20px;">&#xe635;</i>课程分类管理</h2> <h2><i class="iconfont" style="font-size: 30px;float: left;padding: 0 20px;">&#xe635;</i>课程分类管理</h2>
</div> </div>
<div class="layui-collapse" lay-accordion id="view" > <div class="layui-collapse" lay-accordion id="view">
</div> </div>
<script id="demo" type="text/html"> <script id="demo" type="text/html">
<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 layui-show">
<div class="layui-row" id="swkcl"> <div class="layui-row" id="yykcl">
{{# layui.each(d.swkcl, 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;">
<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>
</div> </div>
</div>
{{# }); }}
</div> </div>
<div class="layui-row" style="margin-top: 10px;"> {{# }); }}
</div>
<div class="layui-row" style="margin-top: 10px;">
<span index="0" class="addLabel"> <span index="0" class="addLabel">
<button type="button" class="layui-btn layui-btn-radius layui-btn-xs layui-btn-primary btn_radius"> <button type="button"
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 class="layui-colla-item"> </div>
<h2 class="layui-colla-title">考证课程类</h2> <div class="layui-colla-item">
<div class="layui-colla-content"> <h2 class="layui-colla-title">考证课程类</h2>
<div class="layui-row" id="kzkcl"> <div class="layui-colla-content">
{{# layui.each(d.kzkcl, function(index, item){ }} <div class="layui-row" id="kzkcl">
<div class="layui-form-item" courseLabelId="{{item.courseLabelId}}"> {{# layui.each(d.kzkcl, function(index, item){ }}
<label class="layui-form-label">{{item.courseLabelName}}</label> <div class="layui-form-item" courseLabelId="{{item.courseLabelId}}">
<div class="layui-input-block" style="line-height: 36px;"> <label class="layui-form-label">{{item.courseLabelName}}</label>
<i class="layui-icon classEdit">&#xe642;</i> <div class="layui-input-block" style="line-height: 36px;">
<i class="layui-icon classDel">&#xe640;</i> <i class="layui-icon classEdit">&#xe642;</i>
</div> <i class="layui-icon classDel">&#xe640;</i>
</div> </div>
{{# }); }}
</div> </div>
<div class="layui-row" style="margin-top: 10px;"> {{# }); }}
</div>
<div class="layui-row" style="margin-top: 10px;">
<span index="1" class="addLabel"> <span index="1" class="addLabel">
<button type="button" class="layui-btn layui-btn-radius layui-btn-xs layui-btn-primary btn_radius"> <button type="button"
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 class="layui-colla-item"> </div>
<h2 class="layui-colla-title">理论课程类</h2> <div class="layui-colla-item">
<div class="layui-colla-content"> <h2 class="layui-colla-title">理论课程类</h2>
<div class="layui-row" id="llkcl"> <div class="layui-colla-content">
{{# layui.each(d.llkcl, function(index, item){ }} <div class="layui-row" id="llkcl">
<div class="layui-form-item" courseLabelId="{{item.courseLabelId}}"> {{# layui.each(d.llkcl, function(index, item){ }}
<label class="layui-form-label">{{item.courseLabelName}}</label> <div class="layui-form-item" courseLabelId="{{item.courseLabelId}}">
<div class="layui-input-block" style="line-height: 36px;"> <label class="layui-form-label">{{item.courseLabelName}}</label>
<i class="layui-icon classEdit">&#xe642;</i> <div class="layui-input-block" style="line-height: 36px;">
<i class="layui-icon classDel">&#xe640;</i> <i class="layui-icon classEdit">&#xe642;</i>
</div> <i class="layui-icon classDel">&#xe640;</i>
</div> </div>
{{# }); }}
</div> </div>
<div class="layui-row" style="margin-top: 10px;"> {{# }); }}
</div>
<div class="layui-row" style="margin-top: 10px;">
<span index="2" class="addLabel"> <span index="2" class="addLabel">
<button type="button" class="layui-btn layui-btn-radius layui-btn-xs layui-btn-primary btn_radius"> <button type="button"
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>
</script> </div>
</script>
<!--#} --> <!--#} -->
<script> <script>
layui.use(['form','element','laytpl'], function(){ layui.use(['form', 'element', 'laytpl'], function () {
var element = layui.element,form = layui.form,laytpl = layui.laytpl; var element = layui.element, form = layui.form, laytpl = layui.laytpl;
var ret = Common.getAjax("/jlw/courseLabel/getValues.json",{courseLabelStatus:1}); var ret = Common.getAjax("/jlw/courseLabel/getValues.json", {courseLabelStatus: 1});
var swkcl = []; var yykcl = [];
var kzkcl = []; var kzkcl = [];
var llkcl = []; var llkcl = [];
if(ret.code == 0){ if (ret.code == 0) {
for (var i = 0;i< ret.data.length ;i++){ for (var i = 0; i < ret.data.length; i++) {
if(ret.data[i].courseLabelType == '实务课程类'){ if (ret.data[i].courseLabelType == '应用课程类') {
swkcl.push(ret.data[i]); yykcl.push(ret.data[i]);
}else if(ret.data[i].courseLabelType == '考证课程类'){ } else if (ret.data[i].courseLabelType == '考证课程类') {
kzkcl.push(ret.data[i]); kzkcl.push(ret.data[i]);
}else if(ret.data[i].courseLabelType == '理论课程类'){ } else if (ret.data[i].courseLabelType == '理论课程类') {
llkcl.push(ret.data[i]); llkcl.push(ret.data[i]);
}
} }
} }
} var getTpl = demo.innerHTML
var getTpl = demo.innerHTML , view = document.getElementById('view');
,view = document.getElementById('view'); laytpl(getTpl).render({yykcl: yykcl, kzkcl: kzkcl, llkcl: llkcl}, function (html) {
laytpl(getTpl).render({swkcl:swkcl,kzkcl:kzkcl,llkcl:llkcl}, function(html){
view.innerHTML = html; view.innerHTML = html;
$(".addLabel").click(addLabel); $(".addLabel").click(addLabel);
$(".classEdit").click(classEdit); $(".classEdit").click(classEdit);
@ -152,81 +175,90 @@ layui.use(['form','element','laytpl'], function(){
element.render(); element.render();
}); });
var courseLabelType = ['实务课程类','考证课程类','理论课程类']; var courseLabelType = ['应用课程类', '考证课程类', '理论课程类'];
//绑定添加分类按钮
function addLabel(){ //绑定添加分类按钮
var num = $(this).attr("index"); //0实务课程类 1:考证课程类 2:理论课程类 function addLabel() {
var id = num == 0?'#swkcl':num == 1?'#kzkcl':num == 2?'#llkcl':''; var num = $(this).attr("index"); //0应用课程类 1:考证课程类 2:理论课程类
var ret = Common.postAjax("/jlw/courseLabel/add.json",{courseLabelType:courseLabelType[num],courseLabelName:"未命名",courseLabelStatus:1}); var id = num == 0 ? '#yykcl' : num == 1 ? '#kzkcl' : num == 2 ? '#llkcl' : '';
if(ret.code == 0){ var ret = Common.postAjax("/jlw/courseLabel/add.json", {
var htm = '<div class="layui-form-item" courseLabelId="'+ret.data+'">\n' + courseLabelType: courseLabelType[num],
' <label class="layui-form-label">未命名</label>\n' + courseLabelName: "未命名",
' <div class="layui-input-block" style="line-height: 36px;">\n' + courseLabelStatus: 1
' <i class="layui-icon classEdit">&#xe642;</i>\n' + });
' <i class="layui-icon classDel">&#xe640;</i>\n' + if (ret.code == 0) {
' </div>\n' + var htm = '<div class="layui-form-item" courseLabelId="' + ret.data + '">\n' +
' </div>'; ' <label class="layui-form-label">未命名</label>\n' +
$(id).append(htm); ' <div class="layui-input-block" style="line-height: 36px;">\n' +
$(".classEdit").unbind(); ' <i class="layui-icon classEdit">&#xe642;</i>\n' +
$(".classDel").unbind(); ' <i class="layui-icon classDel">&#xe640;</i>\n' +
$(".classEdit").click(classEdit); ' </div>\n' +
$(".classDel").click(classDel); ' </div>';
}else { $(id).append(htm);
layer.msg(ret.msg); $(".classEdit").unbind();
$(".classDel").unbind();
$(".classEdit").click(classEdit);
$(".classDel").click(classDel);
} else {
layer.msg(ret.msg);
}
} }
}
//编辑相应的分类 //编辑相应的分类
function classEdit(){ function classEdit() {
var this_ = $(this); var this_ = $(this);
var p = $(this).parent().prev(); var p = $(this).parent().prev();
var text = p.text(); var text = p.text();
p.text(""); p.text("");
p.append('<input type="text" name="courseLabelName" placeholder="请输入标签名" class="layui-input" value="'+text+'" style="height: 25px;margin-left:-11px;margin-top: -4px;">'); p.append('<input type="text" name="courseLabelName" placeholder="请输入标签名" class="layui-input" value="' + text + '" style="height: 25px;margin-left:-11px;margin-top: -4px;">');
$("input[name='courseLabelName']").val("").focus().val(text); $("input[name='courseLabelName']").val("").focus().val(text);
$("input[name='courseLabelName']").blur(function (){ $("input[name='courseLabelName']").blur(function () {
var value = $(this).val(); var value = $(this).val();
var this_name = $(this); var this_name = $(this);
if(text != value){ if (text != value) {
var ret = Common.postAjax("/jlw/courseLabel/edit.json",{ var ret = Common.postAjax("/jlw/courseLabel/edit.json", {
courseLabelName:value,courseLabelId:this_.parents(".layui-form-item").attr("courseLabelId") courseLabelName: value, courseLabelId: this_.parents(".layui-form-item").attr("courseLabelId")
});
layer.msg(ret.code == 0 ? "修改成功!" : ret.msg, {
offset: ['50%'],
icon: ret.code == 0 ? 1 : 2,
time: 1000 //2秒关闭如果不配置默认是3秒
});
if (ret.code == 0) {
p.text(value);
p.show();
this_name.remove();
}
} else {
p.text(value);
p.show();
this_name.remove();
}
});
}
//删除相应的分类
function classDel() {
var this_ = $(this);
layer.confirm('是否确定删除该分类?', function (index) {
var ret = Common.postAjax("/jlw/courseLabel/edit.json", {
courseLabelId: this_.parents(".layui-form-item").attr("courseLabelId"),
courseLabelStatus: 2
}); });
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,
time: 1000 //2秒关闭如果不配置默认是3秒 time: 1000 //2秒关闭如果不配置默认是3秒
}, function () {
if (ret.code == 0) {
this_.parent().prev().text(value);
layer.close(index);
}
}); });
if (ret.code == 0) { this_.parents(".layui-form-item").remove();
p.text(value); layer.close(index);
p.show();
this_name.remove();
}
}else {
p.text(value);
p.show();
this_name.remove();
}
});
}
//删除相应的分类
function classDel(){
var this_ = $(this);
layer.confirm('是否确定删除该分类?', function (index) {
var ret = Common.postAjax("/jlw/courseLabel/edit.json",{courseLabelId:this_.parents(".layui-form-item").attr("courseLabelId"),courseLabelStatus:2});
layer.msg(ret.code == 0 ? "修改成功!" : ret.msg, {
offset: ['50%'],
icon: ret.code == 0 ? 1 : 2,
time: 1000 //2秒关闭如果不配置默认是3秒
}, function () {
if (ret.code == 0) {
this_.parent().prev().text(value);
layer.close(index);
}
}); });
this_.parents(".layui-form-item").remove(); }
layer.close(index); });
});
}
});
</script> </script>

@ -32,17 +32,28 @@
<div class="layui-row"> <div class="layui-row">
<div class="layui-form-item"> <div class="layui-form-item">
<label class="layui-form-label"><span class="req">*</span>课程类别:</label> <label class="layui-form-label"><span class="req">*</span>课程类别:</label>
<div class="layui-input-inline"> <div class="layui-input-inline" id="view">
<!-- '实务课程类','考证课程类','理论课程类';--> <!-- '应用课程类','考证课程类','理论课程类';-->
<select lay-filter="select_courseLabelType" name="courseLabelType"> <script id="demo" type="text/html">
<option value="">请选择</option> <select lay-filter="select_courseLabelType" name="courseLabelType">
<option value="实务课程类" ${resourcesApplicationCourse.courseLabelType=='实务课程类'?'selected':''}>实务课程类 <option value="">请选择</option>
</option> <optgroup label="应用课程类">
<option value="考证课程类" ${resourcesApplicationCourse.courseLabelType=='考证课程类'?'selected':''}>考证课程类 {{# layui.each(d.yykcl, function(index, item){ }}
</option> <option value="{{item.courseLabelId}}" {{item.courseLabelId == ${resourcesApplicationCourse.courseLabelId!}?'selected':''}}>{{item.courseLabelName}}</option>
<option value="理论课程类" ${resourcesApplicationCourse.courseLabelType=='理论课程类'?'selected':''}>理论课程类 {{# }); }}
</option> </optgroup>
</select> <optgroup label="考证课程类">
{{# layui.each(d.kzkcl, function(index, item){ }}
<option value="{{item.courseLabelId}}" {{item.courseLabelId == ${resourcesApplicationCourse.courseLabelId!}?'selected':''}}>{{item.courseLabelName}}</option>
{{# }); }}
</optgroup>
<optgroup label="理论课程类">
{{# layui.each(d.llkcl, function(index, item){ }}
<option value="{{item.courseLabelId}}" {{item.courseLabelId == ${resourcesApplicationCourse.courseLabelId!}?'selected':''}}>{{item.courseLabelName}}</option>
{{# }); }}
</optgroup>
</select>
</script>
</div> </div>
</div> </div>
</div> </div>
@ -52,7 +63,7 @@
<div class="layui-input-inline"> <div class="layui-input-inline">
<select > <select >
<option value="">请选择</option> <option value="">请选择</option>
<!--${resourcesApplicationCourse.courseLabelType =='实务课程类'?'selected':''}--> <!--${resourcesApplicationCourse.courseLabelType =='应用课程类'?'selected':''}-->
<option value="xxx">xxx</option> <option value="xxx">xxx</option>
<option value="ccc">ccc</option> <option value="ccc">ccc</option>
<option value="ddc">ddd</option> <option value="ddc">ddd</option>
@ -74,8 +85,35 @@
</form> </form>
<!--#} --> <!--#} -->
<script> <script>
layui.use(['add'], function () { layui.use(['add','form','laytpl'], function () {
var resourcesApplicationCourseAdd = layui.add var form = layui.form,
laytpl = layui.laytpl;
var resourcesApplicationCourseAdd = layui.add;
var ret = Common.getAjax("/jlw/courseLabel/getValues.json", {courseLabelStatus: 1});
var yykcl = [];
var kzkcl = [];
var llkcl = [];
if (ret.code == 0) {
for (var i = 0; i < ret.data.length; i++) {
if (ret.data[i].courseLabelType == '应用课程类') {
yykcl.push(ret.data[i]);
} else if (ret.data[i].courseLabelType == '考证课程类') {
kzkcl.push(ret.data[i]);
} else if (ret.data[i].courseLabelType == '理论课程类') {
llkcl.push(ret.data[i]);
}
}
}
var getTpl = demo.innerHTML
, view = document.getElementById('view');
laytpl(getTpl).render({yykcl: yykcl, kzkcl: kzkcl, llkcl: llkcl}, function (html) {
view.innerHTML = html;
/* $(".addLabel").click(addLabel);
$(".classEdit").click(classEdit);
$(".classDel").click(classDel);*/
form.render();
});
resourcesApplicationCourseAdd.init(); resourcesApplicationCourseAdd.init();
}); });
</script> </script>

@ -11,15 +11,18 @@
margin-left: -15px; margin-left: -15px;
margin-right: -15px; margin-right: -15px;
} }
.layui-form-select dl {
text-align: left;
}
</style> </style>
<layui:searchForm formId="searchForm" searchList="" condition="${search}"> <layui:searchForm formId="searchForm" searchList="" condition="${search}">
<!-- <div class="layui-inline">--> <div class="layui-inline">
<!-- <label class="layui-form-label">课程名称</label>--> <label class="layui-form-label">课程名称</label>
<!-- <div class="layui-input-inline">--> <div class="layui-input-inline">
<!-- <input type="text" name="courseInfoName" id="courseInfoName" autocomplete="off" placeholder="请输入检索条件" class="layui-input"--> <input type="text" name="courseInfoName" id="courseInfoName" autocomplete="off" placeholder="请输入检索条件" class="layui-input"
<!-- style="width: 200px;float: left;margin-right: 10px;">--> style="width: 200px;float: left;margin-right: 10px;">
<!-- </div>--> </div>
<!-- </div>--> </div>
</layui:searchForm> </layui:searchForm>
<script type="text/html" id="selectGxmc" > <script type="text/html" id="selectGxmc" >
<div class='layui-input-inline'> <div class='layui-input-inline'>

Loading…
Cancel
Save