|
|
|
@ -6,6 +6,8 @@ layui.define(['form', 'laydate', 'table', 'teachingManagementApi', 'table', 'xmS
|
|
|
|
|
var index = layui.index;
|
|
|
|
|
var xxTable = null;
|
|
|
|
|
var tableList = [];
|
|
|
|
|
var tableListMap = {}; //存选中的map
|
|
|
|
|
var delMap = {}; //刪除的Map 为啥map 因为避免重复
|
|
|
|
|
|
|
|
|
|
var universityFacultyId = $("#addForm select[name='universityFacultyInfo']").val();
|
|
|
|
|
|
|
|
|
@ -54,13 +56,18 @@ layui.define(['form', 'laydate', 'table', 'teachingManagementApi', 'table', 'xmS
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
for (var i in schoolClassInfo){
|
|
|
|
|
if ($.isEmpty(tableListMap[schoolClassInfo[i].classId])){
|
|
|
|
|
tableListMap[schoolClassInfo[i].classId] = schoolClassInfo[i]; //写入map
|
|
|
|
|
delete delMap[schoolClassInfo[i].classId];
|
|
|
|
|
tableList.push({
|
|
|
|
|
teacherName:teacherInfoName,//教师名称
|
|
|
|
|
teacherInfo:teacherInfo, //教师ID
|
|
|
|
|
teacherMergeClassThirdStatus:1, //1:正常 2:删除
|
|
|
|
|
schoolClassName:schoolClassInfo[i].className, //班级年级
|
|
|
|
|
schoolClassInfo:schoolClassInfo[i].classId,//班级ID
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
table.reload('xxTable', {
|
|
|
|
|
data:tableList
|
|
|
|
@ -104,7 +111,10 @@ layui.define(['form', 'laydate', 'table', 'teachingManagementApi', 'table', 'xmS
|
|
|
|
|
var rowIndex = $(obj.tr).attr("data-index");//获取行号0开始
|
|
|
|
|
var page = $(".layui-laypage-skip input").val();
|
|
|
|
|
var limit = $(".layui-laypage-limits select").val();
|
|
|
|
|
tableList.splice(Number(rowIndex) + Number((limit * page) - limit),1);
|
|
|
|
|
var delInfo = tableList.splice(Number(rowIndex) + Number((limit * page) - limit),1);
|
|
|
|
|
delMap[delInfo[0].schoolClassInfo] = delInfo[0]; //写入删除map中
|
|
|
|
|
delete tableListMap[delInfo[0].schoolClassInfo];
|
|
|
|
|
|
|
|
|
|
table.reload('xxTable', {
|
|
|
|
|
data:tableList
|
|
|
|
|
});
|
|
|
|
@ -122,13 +132,17 @@ layui.define(['form', 'laydate', 'table', 'teachingManagementApi', 'table', 'xmS
|
|
|
|
|
var teacherInfo = $("#teacherInfo").val();//获取当前多选选中的值
|
|
|
|
|
var teacherInfoName = $('#teacherInfo').find('option:selected').text();//获取当前多选选中的值
|
|
|
|
|
for (var i in schoolClassInfo){
|
|
|
|
|
if ($.isEmpty(tableListMap[schoolClassInfo[i].classId])){
|
|
|
|
|
tableListMap[schoolClassInfo[i].classId] = schoolClassInfo[i]; //写入map
|
|
|
|
|
tableList.push({
|
|
|
|
|
teacherName:teacherInfoName,//教师名称
|
|
|
|
|
teacherInfo:teacherInfo, //教师ID
|
|
|
|
|
teacherMergeClassThirdStatus:1, //1:正常 2:删除
|
|
|
|
|
schoolClassName:schoolClassInfo[i].className, //班级年级
|
|
|
|
|
schoolClassInfo:schoolClassInfo[i].classId,//班级ID
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
table.reload('xxTable', {
|
|
|
|
|
data:tableList
|
|
|
|
@ -152,9 +166,21 @@ layui.define(['form', 'laydate', 'table', 'teachingManagementApi', 'table', 'xmS
|
|
|
|
|
if(!$.isEmpty(teacherMergeClassThirdId)){
|
|
|
|
|
url = "/jlw/teachingManagement/edit.json";
|
|
|
|
|
}
|
|
|
|
|
layer.load(3);
|
|
|
|
|
setTimeout(function () {
|
|
|
|
|
var param = $("#addForm").serializeJson();
|
|
|
|
|
param.teacherBoundClass = JSON.stringify(tableList);
|
|
|
|
|
var list = [];
|
|
|
|
|
for (var key in delMap){ //删除的
|
|
|
|
|
delMap[key].teacherMergeClassThirdStatus = 2;
|
|
|
|
|
list.push(delMap[key]);
|
|
|
|
|
}
|
|
|
|
|
for (var key in tableListMap){ //添加的
|
|
|
|
|
tableListMap[key].teacherMergeClassThirdStatus = 1;
|
|
|
|
|
list.push(tableListMap[key]);
|
|
|
|
|
}
|
|
|
|
|
param.teacherBoundClass = JSON.stringify(list);
|
|
|
|
|
var ret = Common.postAjax(url,param);
|
|
|
|
|
layer.closeAll("loading");
|
|
|
|
|
layer.msg(ret.code == 0?"操作成功!":ret.msg, {
|
|
|
|
|
offset: ['50%'],
|
|
|
|
|
icon: ret.code == 0?1:2,
|
|
|
|
@ -166,7 +192,7 @@ layui.define(['form', 'laydate', 'table', 'teachingManagementApi', 'table', 'xmS
|
|
|
|
|
Lib.closeFrame();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
}, 200);
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|