var examinationPlanID; var isChanged = false; 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 setFormChanged() { isChanged = true; } //成教页面,处理考试时间的快速选择 function setDateTime() { var timeSegmentValue = eval("(" + $("#ddlTimeSegment").combobox('getValue') + ")"); if (timeSegmentValue != "-1") { $("#ExaminationDate").val(timeSegmentValue.ExaminationDateString); $("#StartTime").val(timeSegmentValue.StartTimeString + ":00"); $("#EndTime").val(timeSegmentValue.EndTimeString + ":00"); } } function ExaminationPlan_Save() { if ($("#ExaminationDate").val() == "") { $.messager.alert('系统信息', "考试日期必须填写。"); return; } if ($("#StartTime").val() == "") { $.messager.alert('系统信息', "开始时间必须填写。"); return; } if ($("#EndTime").val() == "") { $.messager.alert('系统信息', "结束时间必须填写。"); return; } 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; } $(document.forms[0]).submit(); } function ExaminationPlan_Save_Complete(data) { $('a').removeAttr('disabled', 'disabled'); $('#loading').hide(); if (!isFromAddButton && !isFromEditButton) { $.messager.alert('系统信息', data.Message, null, function () { if (data.IsSuccess) { var dialogId = $.SystemGeneral.getUrlParam('WindowID'); dialogId = (dialogId == null || dialogId == '') ? 'sysWindow' : dialogId; top.$('#' + dialogId).window('close'); var tab = top.$('#index_center_tabs').tabs('getSelected'); var $iframe = tab.panel('body').find("iframe"); if ($iframe[0].contentWindow.reload) $iframe[0].contentWindow.reload(); } }); } else { if (!data.IsSuccess) { $.messager.alert('系统信息', data.Message); } else { if (isFromAddButton) { $.popupTopWindow('新增考场', CMS_SystemConfig.VirtualDirectoryPath + '/ExaminationPlan/ClassroomLayout?MNU=' + mnu + '&ExaminationPlanID=' + examinationPlanID, 800, 600, ExaminationPlan_ClassroomAdd_Confirm); isFromAddButton = false; } else if (isFromEditButton) { $.popupTopWindow('编辑考场', CMS_SystemConfig.VirtualDirectoryPath + '/ExaminationPlan/ClassroomLayout?MNU=' + mnu + '&ExaminationPlanID=' + examinationPlanID + '&ExaminationRoomLayoutID=' + rowData.ExaminationRoomLayoutID, 800, 600, ExaminationPlan_ClassroomAdd_Confirm); } } } } function checkModify() { if (isChanged) { return true; } if ($("ExaminationDate").val() == "") { return true; } if ($("StartTime").val() == "") { return true; } if ($("EndTime").val() == "") { return true; } return false; } function ExaminationPlan_ClassroomAdd() { if (!$(document.forms[0]).valid()) return; isFromAddButton = true; ExaminationPlan_Save(); // if (checkModify()) { // isFromAddButton = true; // ExaminationPlan_Save(); // } else { // $.popupTopWindow('新增考场', CMS_SystemConfig.VirtualDirectoryPath + '/ExaminationPlan/ClassroomLayout?MNU=' + mnu + '&ExaminationPlanID=' + examinationPlanID, 800, 600, ExaminationPlan_ClassroomAdd_Confirm); // } } function edit(rowIndex, rowData) { if (!$(document.forms[0]).valid()) return; if (checkModify()) { $.messager.confirm("系统提示", saveConfirmMsg, function (r) { if (r) { isFromEditButton = true; ExaminationPlan_Save(); } }); } else { $.popupTopWindow('编辑考场', CMS_SystemConfig.VirtualDirectoryPath + '/ExaminationPlan/ClassroomLayout?MNU=' + mnu + '&ExaminationPlanID=' + examinationPlanID + '&ExaminationRoomLayoutID=' + rowData.ExaminationRoomLayoutID, 800, 600, ExaminationPlan_ClassroomAdd_Confirm); } } function reload() { $("#dgExaminationRoomLayoutList").cmsXDataTable("load", $.getDataGridParams("dgExaminationRoomLayoutList")); } function ExaminationPlan_ClassroomAdd_Confirm(roomList) { window.location.reload(); } //获取选中的数据 function validChoose() { var d = []; $.each($("#dgExaminationRoomLayoutList").cmsXDataTable("getSelections"), function (index) { d.push(this.ExaminationRoomLayoutID); }); return d; } function ExaminationPlan_ClassroomDelete() { var d = validChoose(); if (d.length == 0) { $.messager.alert("系统提示", "请选择您要删除的考场信息!!"); return; } $.messager.confirm("系统提示", "您确定要删除该考场信息?", function (r) { if (r) { $.post(CMS_SystemConfig.VirtualDirectoryPath + '/ExaminationPlan/ExaminationClassroomLayoutDelete', { examinationRoomLayoutIDs: d.join(',') }, function (data) { $.messager.alert("系统提示", data.Message); if (data.IsSuccess) { $("#dgExaminationRoomLayoutList").cmsXDataTable('load'); } }); } }); }