|
|
|
@ -1,48 +1,61 @@
|
|
|
|
|
layui.define([ 'form', 'laydate', 'table' ,'laytpl'], function(exports) {
|
|
|
|
|
layui.define(['form', 'laydate', 'table', 'laytpl'], function (exports) {
|
|
|
|
|
var form = layui.form;
|
|
|
|
|
var laydate = layui.laydate;
|
|
|
|
|
var table = layui.table;
|
|
|
|
|
var laytpl = layui.laytpl;
|
|
|
|
|
var teacherOpenCourseScheduleSessionTable = null;
|
|
|
|
|
var view ={
|
|
|
|
|
init:function(){
|
|
|
|
|
var view = {
|
|
|
|
|
init: function () {
|
|
|
|
|
var that = this
|
|
|
|
|
this.initTable();
|
|
|
|
|
this.initSearchForm();
|
|
|
|
|
this.initToolBar();
|
|
|
|
|
window.dataReload = function(){
|
|
|
|
|
Lib.doSearchForm($("#searchForm"),teacherOpenCourseScheduleSessionTable)
|
|
|
|
|
window.dataReload = function () {
|
|
|
|
|
Lib.doSearchForm($("#searchForm"), teacherOpenCourseScheduleSessionTable)
|
|
|
|
|
that.initToolBar();
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
initTable:function(){
|
|
|
|
|
var sx_ = localStorage.getItem("teacherOpenCourseScheduleSessionTable_field_"+Common.userInfoId); //筛选值显示、隐藏缓存
|
|
|
|
|
if($.isEmpty(sx_)){sx_ = {};}else {sx_ = JSON.parse(sx_);}
|
|
|
|
|
initTable: function () {
|
|
|
|
|
var sx_ = localStorage.getItem("teacherOpenCourseScheduleSessionTable_field_" + Common.userInfoId); //筛选值显示、隐藏缓存
|
|
|
|
|
if ($.isEmpty(sx_)) {
|
|
|
|
|
sx_ = {};
|
|
|
|
|
} else {
|
|
|
|
|
sx_ = JSON.parse(sx_);
|
|
|
|
|
}
|
|
|
|
|
teacherOpenCourseScheduleSessionTable = table.render({
|
|
|
|
|
elem : '#teacherOpenCourseScheduleSessionTable',
|
|
|
|
|
height : Lib.getTableHeight(1),
|
|
|
|
|
elem: '#teacherOpenCourseScheduleSessionTable',
|
|
|
|
|
height: Lib.getTableHeight(1),
|
|
|
|
|
cellMinWidth: 100,
|
|
|
|
|
method : 'post',
|
|
|
|
|
method: 'post',
|
|
|
|
|
// url : Common.ctxPath + '/jlw/teacherOpenCourseScheduleSession/list.json' // 数据接口
|
|
|
|
|
url : Common.ctxPath + '/jlw/teacherOpenCourseScheduleSession/listGroup.json' // 数据接口
|
|
|
|
|
,page : Lib.tablePage // 开启分页
|
|
|
|
|
url: Common.ctxPath + '/jlw/teacherOpenCourseScheduleSession/listGroup.json' // 数据接口
|
|
|
|
|
, page: Lib.tablePage // 开启分页
|
|
|
|
|
/*,toolbar: '#toolbar_teacherOpenCourseScheduleSession' //自定义头部左侧工具栏
|
|
|
|
|
,defaultToolbar: ['filter', 'print', 'exports'] //头部右侧工具栏*/
|
|
|
|
|
,limit : 10,
|
|
|
|
|
cols : [ [ // 表头
|
|
|
|
|
, limit: 10,
|
|
|
|
|
cols: [[ // 表头
|
|
|
|
|
{
|
|
|
|
|
field: 'scheduleSessionTitle',
|
|
|
|
|
title: '排课标题',
|
|
|
|
|
align: "center",
|
|
|
|
|
hideField: false,
|
|
|
|
|
hide:$.isEmpty(sx_['scheduleSessionTitle'])?false:sx_['scheduleSessionTitle'],
|
|
|
|
|
hide: $.isEmpty(sx_['scheduleSessionTitle']) ? false : sx_['scheduleSessionTitle'],
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
field: 'teacherOpenCourseIdText',
|
|
|
|
|
title: '开课名称',
|
|
|
|
|
align: "center",
|
|
|
|
|
hideField: false,
|
|
|
|
|
hide:$.isEmpty(sx_['teacherOpenCourseIdText'])?false:sx_['teacherOpenCourseIdText'],
|
|
|
|
|
hide: $.isEmpty(sx_['teacherOpenCourseIdText']) ? false : sx_['teacherOpenCourseIdText'],
|
|
|
|
|
templet: function (d) {
|
|
|
|
|
var value;
|
|
|
|
|
if ($.isEmpty(d.teacherOpenCourseIdText)) {
|
|
|
|
|
value = d.courseInfoIdText;
|
|
|
|
|
}else {
|
|
|
|
|
value = d.teacherOpenCourseIdText;
|
|
|
|
|
}
|
|
|
|
|
return value;
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
field: 'teacherIdText',
|
|
|
|
@ -68,7 +81,7 @@ layui.define([ 'form', 'laydate', 'table' ,'laytpl'], function(exports) {
|
|
|
|
|
align: "center",
|
|
|
|
|
hideField: false,
|
|
|
|
|
hide: $.isEmpty(sx_['look']) ? false : sx_['look'],
|
|
|
|
|
templet:function (d) {
|
|
|
|
|
templet: function (d) {
|
|
|
|
|
return "<a class='layui-table-link' lay-event='look'>查看</a>"
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
@ -101,13 +114,18 @@ layui.define([ 'form', 'laydate', 'table' ,'laytpl'], function(exports) {
|
|
|
|
|
align: "center",
|
|
|
|
|
hideField: false,
|
|
|
|
|
hide: $.isEmpty(sx_['teacherOpenCourseScheduleSessionStatusText']) ? false : sx_['teacherOpenCourseScheduleSessionStatusText'],
|
|
|
|
|
templet:function (d) {
|
|
|
|
|
templet: function (d) {
|
|
|
|
|
var css = d.teacherOpenCourseScheduleSessionStatus == 2 ? "textType2" : 'textType';
|
|
|
|
|
return '<span class="' + css + '">' +d.teacherOpenCourseScheduleSessionStatusText + '</span>'
|
|
|
|
|
return '<span class="' + css + '">' + d.teacherOpenCourseScheduleSessionStatusText + '</span>'
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
field : 'userId',title : '操作',align:"center",width:200,fixed:'right', templet: function (d) {
|
|
|
|
|
field: 'userId',
|
|
|
|
|
title: '操作',
|
|
|
|
|
align: "center",
|
|
|
|
|
width: 200,
|
|
|
|
|
fixed: 'right',
|
|
|
|
|
templet: function (d) {
|
|
|
|
|
var htm = '<a class="layui-table-link" lay-event="edit">编辑</a>';
|
|
|
|
|
htm += '<a class="layui-table-link" lay-event="enable">启用</a>';
|
|
|
|
|
htm += '<a class="layui-table-link" lay-event="disable">禁用</a>';
|
|
|
|
@ -115,26 +133,26 @@ layui.define([ 'form', 'laydate', 'table' ,'laytpl'], function(exports) {
|
|
|
|
|
return htm;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
] ]
|
|
|
|
|
]]
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
table.on('checkbox(teacherOpenCourseScheduleSessionTable)', function(obj){
|
|
|
|
|
table.on('checkbox(teacherOpenCourseScheduleSessionTable)', function (obj) {
|
|
|
|
|
var teacherOpenCourseScheduleSession = obj.data;
|
|
|
|
|
if(obj.checked){
|
|
|
|
|
if (obj.checked) {
|
|
|
|
|
//按钮逻辑Lib.buttonEnable()
|
|
|
|
|
}else{
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
initSearchForm:function(){
|
|
|
|
|
initSearchForm: function () {
|
|
|
|
|
//Lib.initSearchForm( $("#searchForm"),teacherOpenCourseScheduleSessionTable,form);
|
|
|
|
|
var btn = $("#searchFormSearch");
|
|
|
|
|
btn.on('click', function () {
|
|
|
|
|
var data = $("#searchForm").serializeJson();
|
|
|
|
|
data.courseType = $("#searchForm select[name='teacherOpenCourseId']").find("option:selected").attr("status")||"";
|
|
|
|
|
data.courseType = $("#searchForm select[name='teacherOpenCourseId']").find("option:selected").attr("status") || "";
|
|
|
|
|
console.log(data.courseType)
|
|
|
|
|
teacherOpenCourseScheduleSessionTable.reload({
|
|
|
|
|
where: data,
|
|
|
|
@ -145,22 +163,22 @@ layui.define([ 'form', 'laydate', 'table' ,'laytpl'], function(exports) {
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
initToolBar:function(){
|
|
|
|
|
initToolBar: function () {
|
|
|
|
|
toolbar = {
|
|
|
|
|
add: function () {
|
|
|
|
|
var url = "/jlw/teacherOpenCourseScheduleSession/add.do";
|
|
|
|
|
Common.openDlg(url,"排课管理>新增排课");
|
|
|
|
|
Common.openDlg(url, "排课管理>新增排课");
|
|
|
|
|
},
|
|
|
|
|
edit: function () {
|
|
|
|
|
var data = Common.getOneFromTable(table,"teacherOpenCourseScheduleSessionTable");
|
|
|
|
|
if(data==null){
|
|
|
|
|
return ;
|
|
|
|
|
var data = Common.getOneFromTable(table, "teacherOpenCourseScheduleSessionTable");
|
|
|
|
|
if (data == null) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
var url = "/jlw/teacherOpenCourseScheduleSession/add.do?teacherOpenCourseScheduleSessionId="+data.teacherOpenCourseScheduleSessionId;
|
|
|
|
|
Common.openDlg(url,"排课管理>编辑排课");
|
|
|
|
|
var url = "/jlw/teacherOpenCourseScheduleSession/add.do?teacherOpenCourseScheduleSessionId=" + data.teacherOpenCourseScheduleSessionId;
|
|
|
|
|
Common.openDlg(url, "排课管理>编辑排课");
|
|
|
|
|
},
|
|
|
|
|
del: function () {
|
|
|
|
|
layui.use(['del'], function(){
|
|
|
|
|
layui.use(['del'], function () {
|
|
|
|
|
var delView = layui.del
|
|
|
|
|
delView.delBatch();
|
|
|
|
|
});
|
|
|
|
@ -176,7 +194,7 @@ layui.define([ 'form', 'laydate', 'table' ,'laytpl'], function(exports) {
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
//触发事件
|
|
|
|
|
$('.ext-toolbar').on('click', function() {
|
|
|
|
|
$('.ext-toolbar').on('click', function () {
|
|
|
|
|
var type = $(this).data('type');
|
|
|
|
|
toolbar[type] ? toolbar[type].call(this) : '';
|
|
|
|
|
});
|
|
|
|
@ -184,28 +202,31 @@ layui.define([ 'form', 'laydate', 'table' ,'laytpl'], function(exports) {
|
|
|
|
|
}, initTableTool: table.on('tool(teacherOpenCourseScheduleSessionTable)', function (obj) {
|
|
|
|
|
var data = obj.data;
|
|
|
|
|
if (obj.event === 'edit') {
|
|
|
|
|
var url = "/jlw/teacherOpenCourseScheduleSession/add.do?teacherOpenCourseScheduleSessionId="+data.teacherOpenCourseScheduleSessionId;
|
|
|
|
|
Common.openDlg(url,"排课管理>编辑排课");
|
|
|
|
|
}else if(obj.event === "del"){
|
|
|
|
|
var url = "/jlw/teacherOpenCourseScheduleSession/add.do?teacherOpenCourseScheduleSessionId=" + data.teacherOpenCourseScheduleSessionId;
|
|
|
|
|
Common.openDlg(url, "排课管理>编辑排课");
|
|
|
|
|
} else if (obj.event === "del") {
|
|
|
|
|
layer.confirm('是否确定删除该信息?', function (index) {
|
|
|
|
|
var ret = Common.postAjax("/jlw/teacherOpenCourseScheduleSession/delete.json",{ids:data.teacherOpenCourseScheduleSessionId});
|
|
|
|
|
layer.msg(ret.code == 0?"删除成功!":ret.msg, {
|
|
|
|
|
var ret = Common.postAjax("/jlw/teacherOpenCourseScheduleSession/delete.json", {ids: data.teacherOpenCourseScheduleSessionId});
|
|
|
|
|
layer.msg(ret.code == 0 ? "删除成功!" : ret.msg, {
|
|
|
|
|
offset: ['50%'],
|
|
|
|
|
icon: ret.code == 0?1:2,
|
|
|
|
|
icon: ret.code == 0 ? 1 : 2,
|
|
|
|
|
time: 1500 //2秒关闭(如果不配置,默认是3秒)
|
|
|
|
|
},function (){
|
|
|
|
|
if(ret.code == 0){
|
|
|
|
|
}, function () {
|
|
|
|
|
if (ret.code == 0) {
|
|
|
|
|
Lib.tableRefresh();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
}else if(obj.event == 'look'){
|
|
|
|
|
} else if (obj.event == 'look') {
|
|
|
|
|
lookInfoDate(data);
|
|
|
|
|
} else if (obj.event == "enable") {
|
|
|
|
|
layer.confirm('是否确定启用该信息?', function (index) {
|
|
|
|
|
|
|
|
|
|
var ret = Common.postAjax("/jlw/teacherOpenCourseScheduleSession/edit.json",
|
|
|
|
|
{teacherOpenCourseScheduleSessionId: data.teacherOpenCourseScheduleSessionId,teacherOpenCourseScheduleSessionStatus:1});
|
|
|
|
|
{
|
|
|
|
|
teacherOpenCourseScheduleSessionId: data.teacherOpenCourseScheduleSessionId,
|
|
|
|
|
teacherOpenCourseScheduleSessionStatus: 1
|
|
|
|
|
});
|
|
|
|
|
layer.msg(ret.code == 0 ? "启用成功!" : ret.msg, {
|
|
|
|
|
offset: ['50%'],
|
|
|
|
|
icon: ret.code == 0 ? 1 : 2,
|
|
|
|
@ -219,7 +240,10 @@ layui.define([ 'form', 'laydate', 'table' ,'laytpl'], function(exports) {
|
|
|
|
|
} else if (obj.event == "disable") {
|
|
|
|
|
layer.confirm('是否确定禁用该信息?', function (index) {
|
|
|
|
|
var ret = Common.postAjax("/jlw/teacherOpenCourseScheduleSession/edit.json",
|
|
|
|
|
{teacherOpenCourseScheduleSessionId: data.teacherOpenCourseScheduleSessionId,teacherOpenCourseScheduleSessionStatus:2});
|
|
|
|
|
{
|
|
|
|
|
teacherOpenCourseScheduleSessionId: data.teacherOpenCourseScheduleSessionId,
|
|
|
|
|
teacherOpenCourseScheduleSessionStatus: 2
|
|
|
|
|
});
|
|
|
|
|
layer.msg(ret.code == 0 ? "禁用成功!" : ret.msg, {
|
|
|
|
|
offset: ['50%'],
|
|
|
|
|
icon: ret.code == 0 ? 1 : 2,
|
|
|
|
@ -233,24 +257,26 @@ layui.define([ 'form', 'laydate', 'table' ,'laytpl'], function(exports) {
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
};
|
|
|
|
|
exports('index',view);
|
|
|
|
|
exports('index', view);
|
|
|
|
|
|
|
|
|
|
function lookInfoDate(data) {
|
|
|
|
|
layer.open({
|
|
|
|
|
type: 1,
|
|
|
|
|
title: '查看',
|
|
|
|
|
btnAlign: 'c',
|
|
|
|
|
closeBtn:true,
|
|
|
|
|
shadeClose:true,
|
|
|
|
|
closeBtn: true,
|
|
|
|
|
shadeClose: true,
|
|
|
|
|
area: ['750px', '250px'],
|
|
|
|
|
content: '<div id="lookInfoDate_view"></div>',
|
|
|
|
|
success: function (layero, index) {
|
|
|
|
|
var getTpl = lookInfoDate_demo.innerHTML
|
|
|
|
|
,view = document.getElementById('lookInfoDate_view');
|
|
|
|
|
laytpl(getTpl).render(data, function(html){
|
|
|
|
|
, view = document.getElementById('lookInfoDate_view');
|
|
|
|
|
laytpl(getTpl).render(data, function (html) {
|
|
|
|
|
view.innerHTML = html;
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
yes: function (index) {},
|
|
|
|
|
yes: function (index) {
|
|
|
|
|
},
|
|
|
|
|
btn2: function (index, layero) {
|
|
|
|
|
layer.close(index);
|
|
|
|
|
}
|
|
|
|
|