123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224 |
- var examinationPlanID;
- var isFromAddButton = false;
- var isFromEditButton = false;
- var saveConfirmMsg = "由于考试计划信息对考室安排和监考老师的安排有决定性作用,因此需要先提交考试计划信息后方能继续操作,是否确定提交?";
- var mnu;
- $(function () {
- mnu = $.SystemGeneral.getUrlParam("MNU");
- examinationPlanID = $.SystemGeneral.getUrlParam("ExaminationPlanID");
- WdatePicker({ el: $("#StartTime"), hmsMenuCfg: { H: [1, 2], m: [30, 2], s: [30, 4]} });
- WdatePicker({ el: $("#EndTime"), hmsMenuCfg: { H: [1, 2], m: [30, 2], s: [30, 4]} });
- });
- function buildingSelected() {
- if (checkDateTime()) {
- queryClassroom();
- }
- }
- function queryClassroom() {
- try {
- var buildingsInfoID = $("#BuildingsInfoID").combogridX("getValue");
- var date = $("#ExaminationDate").val();
- var stime = $("#StartTime").val();
- var etime = $("#EndTime").val();
- if ($dp) {
- if ($(this).attr("name") == "ExaminationDate") {
- date = $dp.cal.getNewDateStr();
- } else if ($(this).attr("name") == "StartTime") {
- stime = $dp.cal.getNewDateStr();
- } else if ($(this).attr("name") == "EndTime") {
- etime = $dp.cal.getNewDateStr();
- }
- }
- var studentViewList = $("#dgStudent").cmsXDataTable("getRows");
- $("#ClassroomID").combogridX("reload", CMS_SystemConfig.VirtualDirectoryPath + "/ExaminationRoomSetting/AvailableListGdss?examinationPlanID="
- + examinationPlanID + "&buildingsInfoID=" + buildingsInfoID + "&examinationDate=" + date + "&startTime=" + stime + "&endTime=" + etime
- + "&studentCount=" + studentViewList.length);
- }
- catch (e) {
- }
- }
- function checkDateTime() {
- if ($("#ExaminationDate").val() == "") {
- $.messager.alert('系统信息', "考试日期必须填写。");
- return false;
- }
- if ($("#StartTime").val() == "") {
- $.messager.alert('系统信息', "开始时间必须填写。");
- return false;
- }
- if ($("#EndTime").val() == "") {
- $.messager.alert('系统信息', "结束时间必须填写。");
- return false;
- }
- var date = $("#ExaminationDate").val();
- date = date.replace(/-/g, "/");
- var stime = date + " " + $("#StartTime").val();
- var etime = date + " " + $("#EndTime").val();
- stime = new Date(stime);
- etime = new Date(etime);
- if (stime > etime) {
- $.messager.alert("系统提示", "开始时间不能大于结束时间");
- return false;
- }
- return true;
- }
- function ExaminationPlan_Save() {
- //var model = model;
- var buildingsInfoID = $("#BuildingsInfoID").combogridX("getValue");
- var classroomID = $("#ClassroomID").combogridX("getValue");
- var date = $("#ExaminationDate").val();
- var stime = $("#StartTime").val();
- var etime = $("#EndTime").val();
- if (classroomID == "" || classroomID == nonSelect || date == "" || stime == "" || etime == "") {
- $.messager.alert("系统提示", "请先填写或选择必填信息。");
- return false;
- }
- var teacherUserID = [];
- $.each($("#dgRoomTeacher").cmsXDataTable("getRows"), function (index) {
- teacherUserID.push(this.UserID);
- });
- var teacherUserIDs = teacherUserID.join(',');
- var studentUserID = [];
- $.each($("#dgStudent").cmsXDataTable("getRows"), function (index) {
- studentUserID.push(this.UserID);
- });
- var studentUserIDs = studentUserID.join(',')
- var examinationStudentList = $("#dgStudent").cmsXDataTable("getRows");
- if ($dp) {
- if ($(this).attr("name") == "ExaminationDate") {
- date = $dp.cal.getNewDateStr();
- } else if ($(this).attr("name") == "StartTime") {
- stime = $dp.cal.getNewDateStr();
- } else if ($(this).attr("name") == "EndTime") {
- etime = $dp.cal.getNewDateStr();
- }
- }
- $.postWithLoading(CMS_SystemConfig.VirtualDirectoryPath + '/ExaminationPlan/CheckBeforeSave', { examinationPlanID: examinationPlanID, buildingsInfoID: buildingsInfoID, classroomID: classroomID, date: date, starttime: stime, endtime: etime, teacherIDs: teacherUserIDs, studentIDs: studentUserIDs }, function (data) {
- if (data.IsSuccess) {
- $.messager.confirm("系统提示", "存在学生与排课冲突,冲突信息查看链接<a style='color:red' href='" + data.Message + "'>冲突数据.xls</a>,并判断是否强行排考?", function (r) {
- if (r) {
- $(document.forms[0]).attr("action", CMS_SystemConfig.VirtualDirectoryPath + '/ExaminationPlan/GdssSaveNotStudent');
- $(document.forms[0]).submit();
- } else {
- return;
- }
- });
- } else {
- $(document.forms[0]).submit();
- }
- });
- }
- //获取选中的数据
- function validChoose() {
- var d = [];
- $.each($("#dgRoomTeacher").cmsXDataTable("getSelections"), function (index) {
- d.push(this.UserID);
- });
- return d;
- }
- function ExaminationPlan_TeacherAdd() {
- if (!checkDateTime()) {
- return;
- }
- var date = $("#ExaminationDate").val();
- var stime = $("#StartTime").val();
- var etime = $("#EndTime").val();
- var schoolyearID = $("[name='SchoolyearID']").val();
- var classroomID = $("#ClassroomID").combogridX("getValue");
- if (classroomID == "" || classroomID == nonSelect) {
- $.messager.alert("系统提示", "请先选择考场再选择监考老师。");
- return;
- }
- $.popupTopWindow('新增监考老师', CMS_SystemConfig.VirtualDirectoryPath + '/ExaminationTeacher/ExaminationTeacherSelectGdss?schoolyearID='
- + schoolyearID + '&classroomID=' + classroomID + '&examinationDate=' + date + '&startTime=' + stime + '&endTime=' + etime, 800, 600,
- ExaminationPlan_TeacherAdd_Confirm);
- }
- function ExaminationPlan_TeacherAdd_Confirm(teacherList) {
- if (!teacherList) return;
- var examinationTeacherList = $("#dgRoomTeacher").cmsXDataTable("getRows");
- $.each(teacherList, function () {
- var curUserID = this.UserID;
- if ($.grep(examinationTeacherList, function (x) { return x.UserID == curUserID }).length == 0) {
- examinationTeacherList.push(this);
- }
- });
- $("#dgRoomTeacher").cmsXDataTable("loadData", { rows: examinationTeacherList, total: examinationTeacherList.length });
- }
- function ExaminationPlan_TeacherDelete() {
- var d = validChoose();
- var teacherViewList = $("#dgRoomTeacher").cmsXDataTable("getRows");
- var i, j;
- var len = teacherViewList.length;
- for (i = len - 1; i >= 0; i--) {
- for (j = 0; j < d.length; j++) {
- if (teacherViewList[i].UserID == d[j]) {
- teacherViewList.splice(i, 1);
- break;
- }
- }
- }
- $("#dgRoomTeacher").cmsXDataTable("loadData", { rows: teacherViewList, total: teacherViewList.length });
- }
- function validChooseStudent() {
- var d = [];
- $.each($("#dgStudent").cmsXDataTable("getSelections"), function (index) {
- d.push(this.UserID);
- });
- return d;
- }
- function ExaminationPlan_StudentAdd() {
- var curStudentCount = $("#dgStudent").cmsXDataTable("getRows").length;
- var studentOrderType = $("#StudentOrderType").combobox('getValue');
- $.popupTopWindow('添加学生', CMS_SystemConfig.VirtualDirectoryPath + '/ExaminationPlan/GdssStudentSelect?MNU=' + mnu + '&examinationPlanID=' + examinationPlanID, 800, 600, ExaminationPlan_StudentAdd_Confirm);
- }
- function ExaminationPlan_StudentAdd_Confirm(studentList) {
- if (!studentList) return;
- var studentViewList = $("#dgStudent").cmsXDataTable("getRows");
- var addedStudentViewList = $.map(
- $.grep(studentList, function (x) { return $.grep(studentViewList, function (y) { return y.UserID == x.UserID; }).length == 0; }),
- function (x) {
- return {
- UserID: x.UserID,
- LoginID: x.LoginID,
- UserName: x.UserName
- };
- });
- var addedStudentIDs = $.map(addedStudentViewList, function (x) { return x.UserID; }).join(',');
- var newStudentViewList = addedStudentViewList.concat(studentViewList);
- $("#dgStudent").cmsXDataTable("loadData", { rows: newStudentViewList, total: newStudentViewList.length });
- queryClassroom();
- }
- function ExaminationPlan_StudentDelete() {
- var d = validChooseStudent();
- var studentViewList = $("#dgStudent").cmsXDataTable("getRows");
- var i, j;
- var len = studentViewList.length;
- for (i = len - 1; i >= 0; i--) {
- for (j = 0; j < d.length; j++) {
- if (studentViewList[i].UserID == d[j]) {
- studentViewList.splice(i, 1);
- break;
- }
- }
- }
- $("#dgStudent").cmsXDataTable("loadData", { rows: studentViewList, total: studentViewList.length });
- }
|