添加课程列表

beetlsql3-dev
姚丹ab 2 years ago
parent 74b8bda947
commit ab13ab8185

@ -85,6 +85,20 @@ public class CourseInfoController{
return view;
}
/**
*@author
*@data 2023/02/09
*
*/
@GetMapping(MODEL + "/indexList.do")
@Function("courseInfo.query")
@ResponseBody
public ModelAndView indexList() {
ModelAndView view = new ModelAndView("/jlw/courseInfo/indexList.html") ;
view.addObject("search", CourseInfoQuery.class.getName());
return view;
}
@GetMapping(MODEL + "/edit.do")
@Function("courseInfo.edit")
@ResponseBody

@ -0,0 +1,181 @@
<!--#layout("/common/layout.html",{"jsBase":"/js/jlw/courseInfo/"}){ -->
<style>
/* 分页确定按钮*/
.layui-laypage-btn{
color: white!important;
}
.layui-table a {
margin-right: 10px;
}
</style>
<layui:searchForm formId="searchForm" searchList="" condition="${search}">
</layui:searchForm>
<table id="courseInfoTable" lay-filter="courseInfoTable"></table>
<!--#} -->
<script>
layui.use(['form', 'laydate', 'table'], function(){
var form = layui.form;
var laydate = layui.laydate;
var table = layui.table;
var courseInfoTable = null;
var view ={
init:function(){
this.initTable();
this.initSearchForm();
this.initToolBar();
window.dataReload = function(){
Lib.doSearchForm($("#searchForm"),courseInfoTable)
}
},
initTable:function(){
courseInfoTable = table.render({
elem : '#courseInfoTable',
height : Lib.getTableHeight(),
cellMinWidth: 100,
method : 'post',
even:true,
size:"lg",
url : Common.ctxPath + '/jlw/courseInfo/courseInfoList.json' // 数据接口
,where:{courseLabelType:'理论课程类',courseInfoStatus:"1"}
,page : Lib.tablePage // 开启分页
,limit : 10,
cols : [ [ // 表头
{
field : 'courseInfoName',
title : '课程名称',align:"center"
},
{
field : 'courseLabelType',
title : '课程类别',align:"center" //类型(1课程 2章 3节)
},
{
field : 'courseLabelName',
title : '课程标签',align:"center"
},
{
field : 'userName',
title : '创建人',align:"center"
},
{
field : 'addTime',
title : '创建时间',align:"center"
}/*,
{
field : 'courseInfoStatus',title : '状态',align:"center", templet: function (d) {
if(d.courseInfoStatus == 1){
return "<span style='color:#73a2f8; '>启用</span>";
}else if(d.courseInfoStatus == 2){
return "<span style='color: red;'>禁用</span>";
}else {
return "-";
}
}
}*/
] ]
});
table.on('checkbox(courseInfoTable)', function(obj){
var courseInfo = obj.data;
if(obj.checked){
//按钮逻辑Lib.buttonEnable()
}else{
}
})
},
initSearchForm:function(){
//Lib.initSearchForm( $("#searchForm"),courseInfoTable,form);
var btn = $("#searchFormSearch");
btn.on('click', function () {
var data = $("#searchForm").serializeJson();
data.courseLabelType ='理论课程类';
data.courseInfoStatus =1;
//courseLabelType:'1',courseInfoStatus:"1"
courseInfoTable.reload({
where: data,
page: {
curr: 1
}
});
});
},
initToolBar:function(){
toolbar = {
add : function() { // 获取选中数据
var url = "/jlw/courseInfo/add.do";
Common.openDlg(url,"");
},
refresh: function () {//刷新
searchForm.reset();
Lib.doSearchForm($("#searchForm"), courseInfoTable, 1);
},
search:function () {
Lib.doSearchForm($("#searchForm"), courseInfoTable, 1);
}
};
$('.ext-toolbar').on('click', function() {
var type = $(this).data('type');
toolbar[type] ? toolbar[type].call(this) : '';
});
}, initTableTool: table.on('tool(courseInfoTable)', function (obj) {
var data = obj.data;
if (obj.event === 'edit') {
var url = "/jlw/courseInfo/add.do?courseInfoId="+data.courseInfoId;
Common.openDlg(url,"");
}else if(obj.event === "del"){
layer.confirm('是否确定删除该课程?', function (index) { //courseInfoStatus:状态(1启用 2禁用 3删除)
var ret = Common.postAjax("/jlw/courseInfo/delete.json", {ids: data.courseInfoId});
layer.msg(ret.code == 0 ? "删除成功!" : ret.msg, {
offset: ['50%'],
icon: ret.code == 0 ? 1 : 2,
time: 1500 //2秒关闭如果不配置默认是3秒
}, function () {
if (ret.code == 0) {
Lib.tableRefresh();
}
});
});
}else if(obj.event === "courseConfigure"){ //跳转至课程配置
if(data.courseInfoStatus == 1){
Common.info("课程配置时,请先禁用课程。配置完成后再启用课程")
return;
}
var url = "/jlw/courseInfo/courseConfigureNew.do?courseInfoId="+data.courseInfoId;
Common.openDlg(url,"");
}else if(obj.event === "editStatus"){ //启用
var param = {
courseInfoId:data.courseInfoId,
courseInfoStatus:data.courseInfoStatus == 1?2:1 //状态(1启用 2禁用 3删除)
}
editCourseInfoStatus(param);
}
})
}
//修改状态
function editCourseInfoStatus(param){
layer.confirm('是否确定<span style=\'color: red;\'> '+(param.courseInfoStatus == 1?"启用":"禁用")+' </span>该课程?', function (index) {
layer.close(index);
var ret = Common.postAjax("/jlw/courseInfo/edit.json",param);
layer.msg(ret.code == 0?"操作成功!":ret.msg, {
offset: ['50%'],
icon: ret.code == 0?1:2,
shade:0.3,
time: 1500 //2秒关闭如果不配置默认是3秒
},function (){
if(ret.code == 0){
Lib.tableRefresh();
}
});
});
}
view.init();
});
</script>
Loading…
Cancel
Save