|
|
|
@ -14,20 +14,22 @@ layui.define(['form', 'laydate', 'table', 'xmSelect', 'teacherOpenCourseSchedule
|
|
|
|
|
var classData = Common.getAjax('/jlw/schoolClass/getValues.json').data;//上课班级多选框data
|
|
|
|
|
|
|
|
|
|
// 是否多个教室
|
|
|
|
|
var isMultipleSessionClass = function() {
|
|
|
|
|
var isMultipleSessionClass = function () {
|
|
|
|
|
return $("#addForm input:radio[name='teacherOpenCourseScheduleSessionClassIsMultiple']:checked").val()
|
|
|
|
|
};
|
|
|
|
|
var currentTableCache = function() {return table.cache['kkJieciTable']};
|
|
|
|
|
var currentTableCache = function () {
|
|
|
|
|
return table.cache['kkJieciTable']
|
|
|
|
|
};
|
|
|
|
|
var xmSeValue = $("#demo1").data('value');
|
|
|
|
|
var xmSeInitValue = [];
|
|
|
|
|
if(!$.isEmpty(xmSeValue)){
|
|
|
|
|
if(xmSeValue.toString().indexOf(",")>=0){
|
|
|
|
|
if (!$.isEmpty(xmSeValue)) {
|
|
|
|
|
if (xmSeValue.toString().indexOf(",") >= 0) {
|
|
|
|
|
xmSeValue.split(',').forEach(function (value) {
|
|
|
|
|
xmSeInitValue.push(parseInt(value))
|
|
|
|
|
});
|
|
|
|
|
}else {
|
|
|
|
|
} else {
|
|
|
|
|
xmSeInitValue.push(xmSeValue)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
/*班级下拉多选*/
|
|
|
|
|
var demo1 = xmSelect.render({
|
|
|
|
@ -43,9 +45,9 @@ layui.define(['form', 'laydate', 'table', 'xmSelect', 'teacherOpenCourseSchedule
|
|
|
|
|
|
|
|
|
|
/*反显开课星期*/
|
|
|
|
|
var weekDetail = $('#weekDetail').data('value');
|
|
|
|
|
if(!$.isEmpty(weekDetail)){
|
|
|
|
|
if (!$.isEmpty(weekDetail)) {
|
|
|
|
|
weekDetail.split(',').forEach(function (value) {
|
|
|
|
|
$("input:checkbox[value='"+value+"']").attr('checked','true');
|
|
|
|
|
$("input:checkbox[value='" + value + "']").attr('checked', 'true');
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
kkJieciTableData = Common.getAjax('/jlw/teacherOpenCourseScheduleSessionTag/getValues.json').data;//开课节次数据表格
|
|
|
|
@ -55,16 +57,16 @@ layui.define(['form', 'laydate', 'table', 'xmSelect', 'teacherOpenCourseSchedule
|
|
|
|
|
});
|
|
|
|
|
var kkJieciTableValue = $('#kkJieciTable').data('value');
|
|
|
|
|
if (!$.isEmpty(kkJieciTableValue)) {
|
|
|
|
|
if(Object.keys(kkJieciTableValue).length >1){
|
|
|
|
|
$("#moreRoom").attr('checked','true');
|
|
|
|
|
}else {
|
|
|
|
|
$("#oneRoom").attr('checked','true');
|
|
|
|
|
if (Object.keys(kkJieciTableValue).length > 1) {
|
|
|
|
|
$("#moreRoom").attr('checked', 'true');
|
|
|
|
|
} else {
|
|
|
|
|
$("#oneRoom").attr('checked', 'true');
|
|
|
|
|
}
|
|
|
|
|
var data = Object.values(kkJieciTableValue);
|
|
|
|
|
kkJieciTableData.forEach(function (item,index){
|
|
|
|
|
data.forEach(function (t,i) {
|
|
|
|
|
t.forEach(function (e,key) {
|
|
|
|
|
if(item.teacherOpenCourseScheduleSessionTagName == e.teacherOpenCourseScheduleSessionTagName){
|
|
|
|
|
kkJieciTableData.forEach(function (item, index) {
|
|
|
|
|
data.forEach(function (t, i) {
|
|
|
|
|
t.forEach(function (e, key) {
|
|
|
|
|
if (item.teacherOpenCourseScheduleSessionTagName == e.teacherOpenCourseScheduleSessionTagName) {
|
|
|
|
|
item.teacherOpenCourseScheduleSessionTagStartTime = e.teacherOpenCourseScheduleSessionTagStartTime;
|
|
|
|
|
item.teacherOpenCourseScheduleSessionTagEndTime = e.teacherOpenCourseScheduleSessionTagEndTime;
|
|
|
|
|
item.teacherOpenCourseScheduleSessionClassId = Object.keys(kkJieciTableValue)[i]
|
|
|
|
@ -73,11 +75,11 @@ layui.define(['form', 'laydate', 'table', 'xmSelect', 'teacherOpenCourseSchedule
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
if(Object.keys(kkJieciTableValue).length === 0){
|
|
|
|
|
if (Object.keys(kkJieciTableValue).length === 0) {
|
|
|
|
|
merge(kkJieciTableData)
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
$("#oneRoom").attr('checked','true');
|
|
|
|
|
} else {
|
|
|
|
|
$("#oneRoom").attr('checked', 'true');
|
|
|
|
|
}
|
|
|
|
|
form.render();//刷新表单
|
|
|
|
|
|
|
|
|
@ -88,9 +90,9 @@ layui.define(['form', 'laydate', 'table', 'xmSelect', 'teacherOpenCourseSchedule
|
|
|
|
|
cellMinWidth: 100,*/
|
|
|
|
|
method: 'get',
|
|
|
|
|
data: kkJieciTableData
|
|
|
|
|
,limit: 10000,
|
|
|
|
|
, limit: 10000,
|
|
|
|
|
page: false
|
|
|
|
|
,size:"lg"
|
|
|
|
|
, size: "lg"
|
|
|
|
|
|
|
|
|
|
, cols: [[
|
|
|
|
|
{
|
|
|
|
@ -134,7 +136,7 @@ layui.define(['form', 'laydate', 'table', 'xmSelect', 'teacherOpenCourseSchedule
|
|
|
|
|
, type: 'date'
|
|
|
|
|
, calendar: true//显示节假日
|
|
|
|
|
, trigger: 'click'
|
|
|
|
|
,value: $('#teacherOpenCourseScheduleSessionStartDate').val() //必须遵循format参数设定的格式
|
|
|
|
|
, value: $('#teacherOpenCourseScheduleSessionStartDate').val() //必须遵循format参数设定的格式
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
/*合并列*/
|
|
|
|
@ -160,9 +162,9 @@ layui.define(['form', 'laydate', 'table', 'xmSelect', 'teacherOpenCourseSchedule
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
form.on('select(select_teacherId)', function (obj) {
|
|
|
|
|
classData = Common.getAjax('/jlw/schoolClass/getValues.json',{teacherId: obj.value}).data;//上课班级多选框data
|
|
|
|
|
classData = Common.getAjax('/jlw/schoolClass/getValues.json', {teacherId: obj.value}).data;//上课班级多选框data
|
|
|
|
|
demo1.update({
|
|
|
|
|
data:classData
|
|
|
|
|
data: classData
|
|
|
|
|
})
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
@ -195,17 +197,17 @@ layui.define(['form', 'laydate', 'table', 'xmSelect', 'teacherOpenCourseSchedule
|
|
|
|
|
// item.teacherOpenCourseScheduleSessionClassId = obj.value;
|
|
|
|
|
// });
|
|
|
|
|
// }
|
|
|
|
|
if(isMultipleSessionClass() === 'false') {//指定教室
|
|
|
|
|
if (isMultipleSessionClass() === 'false') {//指定教室
|
|
|
|
|
currentTableCache().forEach(function (item, index) {
|
|
|
|
|
item.teacherOpenCourseScheduleSessionClassId = obj.value;
|
|
|
|
|
if($.isEmpty(obj.value)){
|
|
|
|
|
item.teacherOpenCourseScheduleSessionClassId =''
|
|
|
|
|
if ($.isEmpty(obj.value)) {
|
|
|
|
|
item.teacherOpenCourseScheduleSessionClassId = ''
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}else {
|
|
|
|
|
} else {
|
|
|
|
|
currentTableCache()[$(this).parents("tr").data("index")].teacherOpenCourseScheduleSessionClassId = obj.value;
|
|
|
|
|
if($.isEmpty(obj.value)){
|
|
|
|
|
currentTableCache()[$(this).parents("tr").data("index")].teacherOpenCourseScheduleSessionClassId =''
|
|
|
|
|
if ($.isEmpty(obj.value)) {
|
|
|
|
|
currentTableCache()[$(this).parents("tr").data("index")].teacherOpenCourseScheduleSessionClassId = ''
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
@ -375,34 +377,40 @@ layui.define(['form', 'laydate', 'table', 'xmSelect', 'teacherOpenCourseSchedule
|
|
|
|
|
var time = hours + ":" + minutes;
|
|
|
|
|
return time
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var view = {
|
|
|
|
|
init:function(){
|
|
|
|
|
Lib.initGenrealForm($("#addForm"),form);
|
|
|
|
|
init: function () {
|
|
|
|
|
Lib.initGenrealForm($("#addForm"), form);
|
|
|
|
|
this.initSubmit();
|
|
|
|
|
},
|
|
|
|
|
initSubmit:function(){
|
|
|
|
|
$("#addButton").click(function(){
|
|
|
|
|
initSubmit: function () {
|
|
|
|
|
$("#addButton").click(function () {
|
|
|
|
|
var teacherOpenCourseScheduleSessionId = $("#addForm input[name='teacherOpenCourseScheduleSessionId']").val();
|
|
|
|
|
var scheduleSessionTitle = $("#addForm input[name='scheduleSessionTitle']").val();
|
|
|
|
|
var courseInfoId =$("#addForm select[name='courseInfoId_1']").val();
|
|
|
|
|
/*var courseInfoId =$("#addForm select[name='courseInfoId_1']").val();*/
|
|
|
|
|
var teacherOpenCourseId = $("#addForm select[name='teacherOpenCourseId']").val();
|
|
|
|
|
var teacherId = $("#addForm select[name='teacherId']").val();
|
|
|
|
|
var schoolClassIds = demo1.getValue('value').join(",");
|
|
|
|
|
var teacherOpenCourseScheduleSessionClassIsMultiple = $("#addForm input:radio[name='teacherOpenCourseScheduleSessionClassIsMultiple']:checked").val();
|
|
|
|
|
// 构建后台所需要的开课节次List数据
|
|
|
|
|
var sessionTagListMap = {};
|
|
|
|
|
//课程来源:0:教师开课课程,1:授权课程
|
|
|
|
|
var courseType = $("#addForm select[name='teacherOpenCourseId']").find("option:selected").attr("status");
|
|
|
|
|
|
|
|
|
|
currentTableCache().forEach(item => {
|
|
|
|
|
var sessionClassId = item.teacherOpenCourseScheduleSessionClassId;
|
|
|
|
|
var data = table.checkStatus('kkJieciTable').data;
|
|
|
|
|
if((item.LAY_CHECKED != true&&data.length > 0)||!sessionClassId) { return;}
|
|
|
|
|
if(sessionTagListMap.hasOwnProperty(sessionClassId)) {
|
|
|
|
|
if ((item.LAY_CHECKED != true && data.length > 0) || !sessionClassId) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (sessionTagListMap.hasOwnProperty(sessionClassId)) {
|
|
|
|
|
sessionTagListMap[sessionClassId].push(item)
|
|
|
|
|
}else {
|
|
|
|
|
} else {
|
|
|
|
|
(sessionTagListMap[sessionClassId] = []).push(item)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
var teacherOpenCourseScheduleSessionStartDate = $("#addForm input[name='teacherOpenCourseScheduleSessionStartDate']").val();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var teacherOpenCourseScheduleSessionStartDate = $("#addForm input[name='teacherOpenCourseScheduleSessionStartDate']").val();
|
|
|
|
|
var teacherOpenCourseScheduleSessionWeekNum = $("#addForm input[name='teacherOpenCourseScheduleSessionWeekNum']").val();
|
|
|
|
|
var teacherOpenCourseScheduleSessionOpenOnHolidays = $("#addForm input:radio[name='teacherOpenCourseScheduleSessionOpenOnHolidays']:checked").val();
|
|
|
|
@ -414,14 +422,16 @@ layui.define(['form', 'laydate', 'table', 'xmSelect', 'teacherOpenCourseSchedule
|
|
|
|
|
layer.msg('排课标题未填写!!', {icon: 5});
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
console.log($.isEmpty(teacherOpenCourseId))
|
|
|
|
|
if ($.isEmpty(teacherOpenCourseId)) {
|
|
|
|
|
layer.msg('开课未选!!', {icon: 5});
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if ($.isEmpty(courseInfoId)) {
|
|
|
|
|
|
|
|
|
|
/*if ($.isEmpty(courseInfoId)) {
|
|
|
|
|
layer.msg('课程未选!!', {icon: 5});
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}*/
|
|
|
|
|
|
|
|
|
|
if ($.isEmpty(teacherId)) {
|
|
|
|
|
layer.msg('上课教师未选!!', {icon: 5});
|
|
|
|
@ -456,15 +466,12 @@ layui.define(['form', 'laydate', 'table', 'xmSelect', 'teacherOpenCourseSchedule
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
layer.load(0, {
|
|
|
|
|
shadeClose: false,
|
|
|
|
|
shade: [0.5]
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
var param = {
|
|
|
|
|
scheduleSessionTitle: scheduleSessionTitle,
|
|
|
|
|
teacherOpenCourseScheduleSessionId: teacherOpenCourseScheduleSessionId,
|
|
|
|
|
teacherOpenCourseId: teacherOpenCourseId,
|
|
|
|
|
courseInfoId:courseInfoId,
|
|
|
|
|
courseType: courseType,
|
|
|
|
|
teacherId: teacherId,
|
|
|
|
|
schoolClassIdPlural: schoolClassIds,
|
|
|
|
|
teacherOpenCourseScheduleSessionClassIsMultiple: teacherOpenCourseScheduleSessionClassIsMultiple,
|
|
|
|
@ -474,12 +481,14 @@ layui.define(['form', 'laydate', 'table', 'xmSelect', 'teacherOpenCourseSchedule
|
|
|
|
|
openOnHolidays: teacherOpenCourseScheduleSessionOpenOnHolidays,
|
|
|
|
|
weekDetail: teacherOpenCourseScheduleSessionTagWeek,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
var url = "/jlw/teacherOpenCourseScheduleSession/addSession.json";
|
|
|
|
|
if(!$.isEmpty(teacherOpenCourseScheduleSessionId)){
|
|
|
|
|
if (!$.isEmpty(teacherOpenCourseScheduleSessionId)) {
|
|
|
|
|
url = "/jlw/teacherOpenCourseScheduleSession/editSession.json";
|
|
|
|
|
}
|
|
|
|
|
setTimeout(function(){
|
|
|
|
|
var ret = Common.postJSON(url,JSON.stringify(param));
|
|
|
|
|
layer.load(0, {shadeClose: false, shade: [0.5]});
|
|
|
|
|
setTimeout(function () {
|
|
|
|
|
var ret = Common.postJSON(url, JSON.stringify(param));
|
|
|
|
|
layer.closeAll();
|
|
|
|
|
layer.msg(ret.code == 0 ? "保存成功!" : ret.msg, {
|
|
|
|
|
offset: ['50%'],
|
|
|
|
@ -492,14 +501,14 @@ layui.define(['form', 'laydate', 'table', 'xmSelect', 'teacherOpenCourseSchedule
|
|
|
|
|
Lib.closeFrame();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
},100);
|
|
|
|
|
}, 100);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
$("#addButton-cancel").click(function(){
|
|
|
|
|
$("#addButton-cancel").click(function () {
|
|
|
|
|
Lib.closeFrame();
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
exports('add',view);
|
|
|
|
|
exports('add', view);
|
|
|
|
|
});
|
|
|
|
|