123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165 |
- 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');
- }
- });
- }
- });
- }
|