|
|
|
@ -29,7 +29,7 @@ layui.define(['form', 'laydate', 'table', 'xmSelect', 'teacherOpenCourseSchedule
|
|
|
|
|
if ($.isEmpty(teacherOpenCourseScheduleSessionId)) {
|
|
|
|
|
kkJieciTableData = Common.getAjax('/jlw/teacherOpenCourseScheduleSessionTag/getValues.json').data;//开课节次数据表格
|
|
|
|
|
kkJieciTableData.forEach(function (item, index) {
|
|
|
|
|
item.teacherOpenCourseScheduleSessionClassName = '';
|
|
|
|
|
item.teacherOpenCourseScheduleSessionClassId = '';
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -65,7 +65,7 @@ layui.define(['form', 'laydate', 'table', 'xmSelect', 'teacherOpenCourseSchedule
|
|
|
|
|
edit: 'text'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
field: 'teacherOpenCourseScheduleSessionClassName',
|
|
|
|
|
field: 'teacherOpenCourseScheduleSessionClassId',
|
|
|
|
|
title: '上课教室',
|
|
|
|
|
width: 200,
|
|
|
|
|
align: "center",
|
|
|
|
@ -73,8 +73,8 @@ layui.define(['form', 'laydate', 'table', 'xmSelect', 'teacherOpenCourseSchedule
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
]], done: function (res, curr, count) {
|
|
|
|
|
var value = $("input[name=classRoomType]:checked").val();
|
|
|
|
|
if (value == 1) {
|
|
|
|
|
var value = $("input[name=teacherOpenCourseScheduleSessionClassIsMultiple]:checked").val();
|
|
|
|
|
if (value == 'false') {
|
|
|
|
|
merge(res);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -95,7 +95,7 @@ layui.define(['form', 'laydate', 'table', 'xmSelect', 'teacherOpenCourseSchedule
|
|
|
|
|
var data = res.data;
|
|
|
|
|
var mergeIndex = 0; //定位需要添加合并属性的行数
|
|
|
|
|
var mark = 1; //每次需要合并的行数
|
|
|
|
|
var columsName = ['teacherOpenCourseScheduleSessionClassName']; //合并列名称
|
|
|
|
|
var columsName = ['teacherOpenCourseScheduleSessionClassId']; //合并列名称
|
|
|
|
|
var columsIndex = [4]; //合并列索引值
|
|
|
|
|
|
|
|
|
|
for (var k = 0; k < columsName.length; k++) { //循环所有要合并的列
|
|
|
|
@ -122,10 +122,7 @@ layui.define(['form', 'laydate', 'table', 'xmSelect', 'teacherOpenCourseSchedule
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/*上课教室radio点击事件*/
|
|
|
|
|
form.on('radio(classRoomType)', function (data) {
|
|
|
|
|
table.reload('kkJieciTable');
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*重置点击事件*/
|
|
|
|
|
$("#resetClick").click(function () {
|
|
|
|
@ -133,12 +130,29 @@ layui.define(['form', 'laydate', 'table', 'xmSelect', 'teacherOpenCourseSchedule
|
|
|
|
|
kkJieciTableData = [];
|
|
|
|
|
kkJieciTableData = Common.getAjax('/jlw/teacherOpenCourseScheduleSessionTag/getValues.json').data;//开课节次数据表格
|
|
|
|
|
kkJieciTableData.forEach(function (item, index) {
|
|
|
|
|
item.teacherOpenCourseScheduleSessionClassName = '';
|
|
|
|
|
item.teacherOpenCourseScheduleSessionClassId = '';
|
|
|
|
|
});
|
|
|
|
|
table.reload('kkJieciTable', {data: kkJieciTableData});
|
|
|
|
|
layer.closeAll();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
/*上课教室radio点击事件*/
|
|
|
|
|
form.on('radio(shagnke)', function (data) {
|
|
|
|
|
kkJieciTableData.forEach(function (item, index) {
|
|
|
|
|
item.teacherOpenCourseScheduleSessionClassId = '';
|
|
|
|
|
});
|
|
|
|
|
table.reload('kkJieciTable');
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
form.on('select(select_)', function (obj) {
|
|
|
|
|
table.cache['kkJieciTable'][$(this).parents("tr").data("index")].teacherOpenCourseScheduleSessionClassId = obj.value;
|
|
|
|
|
var teacherOpenCourseScheduleSessionClassIsMultiple = $("#addForm input:radio[name='teacherOpenCourseScheduleSessionClassIsMultiple']:checked").val();
|
|
|
|
|
if (teacherOpenCourseScheduleSessionClassIsMultiple == 'false') {
|
|
|
|
|
kkJieciTableData.forEach(function (item, index) {
|
|
|
|
|
item.teacherOpenCourseScheduleSessionClassId = obj.value;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
//设置时间弹窗
|
|
|
|
|
$("#setTime").click(function () {
|
|
|
|
|
layer.open({
|
|
|
|
@ -191,7 +205,6 @@ layui.define(['form', 'laydate', 'table', 'xmSelect', 'teacherOpenCourseSchedule
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
yes: function (index, layero) {
|
|
|
|
|
layer.load();
|
|
|
|
|
var startTime = $("#teacherOpenCourseScheduleSessionTagStartTime").val();
|
|
|
|
|
var endTime = $("#teacherOpenCourseScheduleSessionTagEndTime").val();
|
|
|
|
|
var mine = Number($("input[name=teacherOpenCourseScheduleSessionTagDuration]").val());
|
|
|
|
@ -199,10 +212,12 @@ layui.define(['form', 'laydate', 'table', 'xmSelect', 'teacherOpenCourseSchedule
|
|
|
|
|
Common.info("请选择上课时间或下课时间!!");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
layer.load();
|
|
|
|
|
var hours = Number(startTime.split(":")[0]);
|
|
|
|
|
var minutes = Number(startTime.split(":")[1]);
|
|
|
|
|
var break1 = 10;//课间休息10分钟
|
|
|
|
|
kkJieciTableData.forEach(function (item, index) {
|
|
|
|
|
item.teacherOpenCourseScheduleSessionTagDuration = mine;
|
|
|
|
|
if (index < 2 || index == 3) {
|
|
|
|
|
item.teacherOpenCourseScheduleSessionTagStartTime = getTime(hours, minutes, mine * index + break1 * index);
|
|
|
|
|
item.teacherOpenCourseScheduleSessionTagEndTime = getTime(hours, minutes, mine * (index + 1) + break1 * index);
|
|
|
|
@ -310,48 +325,81 @@ layui.define(['form', 'laydate', 'table', 'xmSelect', 'teacherOpenCourseSchedule
|
|
|
|
|
},
|
|
|
|
|
initSubmit:function(){
|
|
|
|
|
$("#addButton").click(function(){
|
|
|
|
|
var teacherOpenCourseScheduleSessionId = $("#addForm input[name='teacherOpenCourseScheduleSessionId']").val();
|
|
|
|
|
var teacherOpenCourseScheduleSessionId = $("#addForm input[name='teacherOpenCourseScheduleSessionId']").val();
|
|
|
|
|
var teacherOpenCourseId = $("#addForm select[name='teacherOpenCourseId']").val();
|
|
|
|
|
var teacherId = $("#addForm select[name='teacherId']").val();
|
|
|
|
|
var schoolClassIds = demo1.getValue('value').join(",");
|
|
|
|
|
var classRoomType = $("#addForm input:radio[name='classRoomType']").val();
|
|
|
|
|
var teacherOpenCourseScheduleSessionClassIsMultiple = $("#addForm input:radio[name='teacherOpenCourseScheduleSessionClassIsMultiple']:checked").val();
|
|
|
|
|
if(sessionTagList.length<=0){
|
|
|
|
|
sessionTagList = kkJieciTableData;
|
|
|
|
|
}
|
|
|
|
|
var teacherOpenCourseScheduleSessionDayTime = $("#addForm input[name='teacherOpenCourseScheduleSessionDayTime']").val();
|
|
|
|
|
var teacherOpenCourseScheduleSessionWeekNum = $("#addForm input[name='teacherOpenCourseScheduleSessionWeekNum']").val();
|
|
|
|
|
var teacherOpenCourseScheduleSessionOpenOnHolidays = $("#addForm input:radio[name='teacherOpenCourseScheduleSessionOpenOnHolidays']").val();
|
|
|
|
|
var teacherOpenCourseScheduleSessionTagWeek = '';
|
|
|
|
|
var teacherOpenCourseScheduleSessionOpenOnHolidays = $("#addForm input:radio[name='teacherOpenCourseScheduleSessionOpenOnHolidays']:checked").val();
|
|
|
|
|
var teacherOpenCourseScheduleSessionTagWeek = [];
|
|
|
|
|
$("#addForm input[name='teacherOpenCourseScheduleSessionTagWeek']:checked").each(function (i, v) {
|
|
|
|
|
teacherOpenCourseScheduleSessionTagWeek += $("#addForm input[name='teacherOpenCourseScheduleSessionTagWeek']").val() + ','
|
|
|
|
|
teacherOpenCourseScheduleSessionTagWeek.push($(this).val());//teacherOpenCourseScheduleSessionTagWeek
|
|
|
|
|
});
|
|
|
|
|
if ($.isEmpty(teacherOpenCourseId)) {
|
|
|
|
|
layer.msg('开课课程必选', {icon: 5});
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if ($.isEmpty(teacherId)) {
|
|
|
|
|
layer.msg('上课教师必选', {icon: 5});
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if ($.isEmpty(schoolClassIds)) {
|
|
|
|
|
layer.msg('上课班级必选', {icon: 5});
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if ($.isEmpty(sessionTagList)) {
|
|
|
|
|
layer.msg('开课节次必选', {icon: 5});
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if ($.isEmpty(teacherOpenCourseScheduleSessionDayTime)) {
|
|
|
|
|
layer.msg('开课开始时间必填', {icon: 5});
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if ($.isEmpty(teacherOpenCourseScheduleSessionWeekNum)) {
|
|
|
|
|
layer.msg('开课周次必填', {icon: 5});
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if ($.isEmpty(sessionTagList)) {
|
|
|
|
|
layer.msg('节假日是否排课必选', {icon: 5});
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if ($.isEmpty(teacherOpenCourseScheduleSessionTagWeek)) {
|
|
|
|
|
layer.msg('开课星期必选', {icon: 5});
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
var param = {
|
|
|
|
|
teacherOpenCourseScheduleSessionId: teacherOpenCourseScheduleSessionId,
|
|
|
|
|
teacherOpenCourseId: teacherOpenCourseId,
|
|
|
|
|
teacherId: teacherId,
|
|
|
|
|
schoolClassIds: schoolClassIds,
|
|
|
|
|
classRoomType: classRoomType,
|
|
|
|
|
schoolClassIdPlural: schoolClassIds,
|
|
|
|
|
teacherOpenCourseScheduleSessionClassIsMultiple: teacherOpenCourseScheduleSessionClassIsMultiple,
|
|
|
|
|
sessionTagList: sessionTagList,
|
|
|
|
|
teacherOpenCourseScheduleSessionTagDuration:teacherOpenCourseScheduleSessionTagDuration,//课时时长
|
|
|
|
|
teacherOpenCourseScheduleSessionTagWeek: teacherOpenCourseScheduleSessionTagWeek.slice(0, -1),
|
|
|
|
|
startTime: teacherOpenCourseScheduleSessionDayTime,
|
|
|
|
|
weekNum: teacherOpenCourseScheduleSessionWeekNum,
|
|
|
|
|
openOnHolidays: teacherOpenCourseScheduleSessionOpenOnHolidays,
|
|
|
|
|
weekDetail: teacherOpenCourseScheduleSessionTagWeek,
|
|
|
|
|
};
|
|
|
|
|
var url = "/jlw/teacherOpenCourseScheduleSession/addSession.json";
|
|
|
|
|
if(!$.isEmpty(teacherOpenCourseScheduleSessionId)){
|
|
|
|
|
url = "/jlw/teacherOpenCourseScheduleSession/editSession.json";
|
|
|
|
|
}
|
|
|
|
|
console.log($("#addForm").serializeJson())
|
|
|
|
|
console.log(param)
|
|
|
|
|
return;
|
|
|
|
|
if(!$.isEmpty(teacherOpenCourseScheduleSessionId)){
|
|
|
|
|
teacherOpenCourseScheduleSessionApi.updateTeacherOpenCourseScheduleSession($('#addForm'),function(){
|
|
|
|
|
parent.window.dataReload();
|
|
|
|
|
Common.info("更新成功");
|
|
|
|
|
Lib.closeFrame();
|
|
|
|
|
});
|
|
|
|
|
}else{
|
|
|
|
|
teacherOpenCourseScheduleSessionApi.addTeacherOpenCourseScheduleSession($('#addForm'),function(){
|
|
|
|
|
parent.window.dataReload();
|
|
|
|
|
Common.info("添加成功");
|
|
|
|
|
Lib.closeFrame();
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var ret = Common.postAjax(url,param);
|
|
|
|
|
layer.msg(ret.code == 0 ? "保存成功!" : ret.msg, {
|
|
|
|
|
offset: ['50%'],
|
|
|
|
|
icon: ret.code == 0 ? 1 : 2,
|
|
|
|
|
time: 1500 //2秒关闭(如果不配置,默认是3秒)
|
|
|
|
|
}, function () {
|
|
|
|
|
layer.closeAll("loading");
|
|
|
|
|
if (ret.code == 0) {
|
|
|
|
|
parent.Lib.tableRefresh();
|
|
|
|
|
Lib.closeFrame();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|