123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148 |
- var mnu = "";
- //加载
- $(function () {
- mnu = $.SystemGeneral.getUrlParam("MNU");
- })
- //获取选中的数据
- function validSchedulingChoose() {
- var d = [];
- $.each($("#dgSchedulingList").cmsXDataTable("getSelections"), function (index) {
- d.push(this);
- });
- return d;
- }
-
- //添加时间安排
- function Scheduling_Add() {
- var schoolyearID = $("#SchoolyearID").combobox("getValue");
- var classroom = $("#ClassroomID").combogridX("getValue");
- if (classroom == nonSelect || classroom == "") {
- $.messager.alert('系统信息', "请先选择教室再添加时间安排。");
- } else {
- $.popupTopWindow('添加时间安排', CMS_SystemConfig.VirtualDirectoryPath + '/ClassroomExcessiveUse/SchedulingEdit?MNU=' + mnu + '&schoolyearID=' + schoolyearID + '&classroom=' + classroom, 600, 400, Scheduling_Add_Confirm);
- }
- }
- function Scheduling_Add_Confirm(scheduling) {
- if (!scheduling) return;
- var schedulingList = $("#dgSchedulingList").cmsXDataTable("getRows");
- if ($.grep(schedulingList, function (row, index) {
- if (scheduling.Weekday == row.Weekday && scheduling.CoursesTimeID == row.CoursesTimeID) {
- for (var i = 0; i < row.WeekNumList.length; i++) {
- if (scheduling.WeekNumList.contains(row.WeekNumList[i])) {
- return true;
- }
- }
- }
- return false;
- }).length == 0) {
- schedulingList.push({
- ClassroomExcessiveUseSchedulingID: Guid.NewGuid().ToString(),
- WeekNumList: scheduling.WeekNumList,
- Weekday: scheduling.Weekday,
- WeekdayDesc: scheduling.WeekdayDesc,
- CoursesTimeID: scheduling.CoursesTimeID,
- StartTimes: scheduling.StartTimes,
- EndTimes: scheduling.EndTimes,
- StartHour: scheduling.StartHour,
- StartMinute: scheduling.StartMinute,
- EndHour: scheduling.EndHour,
- EndMinute: scheduling.EndMinute,
- TimeDesc: scheduling.TimeDesc
- });
- $("#dgSchedulingList").cmsXDataTable("loadData", { rows: schedulingList, total: schedulingList.length });
- } else {
- $.messager.alert('系统信息', "请检查输入的时间安排,不要重复添加。");
- }
- }
- function Scheduling_Delete() {
- var d = validSchedulingChoose();
- var schedulingList = $("#dgSchedulingList").cmsXDataTable("getRows");
- var i, j;
- var len = schedulingList.length;
- for (i = len - 1; i >= 0; i--) {
- for (j = 0; j < d.length; j++) {
- if (schedulingList[i].ClassroomExcessiveUseSchedulingID == d[j].ClassroomExcessiveUseSchedulingID) {
- schedulingList.splice(i, 1);
- break;
- }
- }
- }
- $("#dgSchedulingList").cmsXDataTable("loadData", { rows: schedulingList, total: schedulingList.length });
- }
- function Scheduling_Edit(rowindex, rowdata) {
- $.popupTopWindow('添加时间安排', CMS_SystemConfig.VirtualDirectoryPath + '/ClassroomExcessiveUse/SchedulingEdit?MNU=' + mnu, 600, 300, Scheduling_Edit_Confirm, rowdata);
- }
- function Scheduling_Edit_Confirm(scheduling) {
- if (!scheduling) return;
- var schedulingList = $("#dgSchedulingList").cmsXDataTable("getRows");
- if ($.grep(schedulingList, function (row, index) {
- if (scheduling.Weekday == row.Weekday && scheduling.CoursesTimeID == row.CoursesTimeID && scheduling.ClassroomExcessiveUseSchedulingID != row.ClassroomExcessiveUseSchedulingID) {
- for (var i = 0; i < row.WeekNumList.length; i++) {
- if (scheduling.WeekNumList.contains(row.WeekNumList[i])) {
- return true;
- }
- }
- }
- return false;
- }).length == 0) {
- var curSchedulingList = $.grep(schedulingList, function (row, index) { return scheduling.ClassroomExcessiveUseSchedulingID == row.ClassroomExcessiveUseSchedulingID; });
- if (curSchedulingList.length == 0) return;
- var curScheduling = curSchedulingList[0];
- curScheduling.WeekNumList = scheduling.WeekNumList;
- curScheduling.Weekday = scheduling.Weekday;
- curScheduling.WeekdayDesc = scheduling.WeekdayDesc;
- curScheduling.CoursesTimeID = scheduling.CoursesTimeID;
- curScheduling.StartTimes = scheduling.StartTimes;
- curScheduling.EndTimes = scheduling.EndTimes;
- curScheduling.StartHour = scheduling.StartHour;
- curScheduling.StartMinute = scheduling.StartMinute;
- curScheduling.EndHour = scheduling.EndHour;
- curScheduling.EndMinute = scheduling.EndMinute;
- curScheduling.TimeDesc = scheduling.TimeDesc;
- $("#dgSchedulingList").cmsXDataTable("loadData", { rows: schedulingList, total: schedulingList.length });
- } else {
- $.messager.alert('系统信息', "请检查输入的时间安排,不要重复添加。");
- }
- }
- function ClassroomExcessiveUse_Save() {
- $(document.forms[0]).submit();
- }
- function popupClassroomReport(classroomID) {
- var schoolYearID = $("#SchoolyearID").combobox("getValue");
- var fullUrl = CMS_SystemConfig.ReportPagePath + "?ReportFolder=%2fEducationScheduling%2fClassroomSchedulingView&BuildingsInfoID_RAP=&ClassroomID_RAP=" + classroomID + "&SchoolyearID_RAP=" + schoolYearID;
- $.popupTopWindowOutsite('教室课表', fullUrl, 1024, 600);
- }
- function FormSuccess(data) {
- $('a').removeAttr('disabled', 'disabled');
- $('#loading').hide();
- if (data.IsSuccess) {
- $.messager.alert('系统信息', data.Message, null, function () {
- var dialogId = $.SystemGeneral.getUrlParam('WindowID');
- dialogId = (dialogId == null || dialogId == '') ? 'sysWindow' : dialogId;
- try {
- top.$('#' + dialogId).window('close');
- } catch (e) {
- }
- 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 {
- var classroomID = $("#ClassroomID").combogridX("getValue");
- var classroomName = $("#ClassroomID").combogridX("getText");
- var reportLink = "点击下列链接查看相关教室的课表:<br>";
- reportLink += '<a href="#this" onclick="javascript:popupClassroomReport(\'' + classroomID + '\');" style="color: #0000ff;">';
- reportLink += classroomName + "课表";
- reportLink += "</a> ";
- $.messager.alert("系统提示", data.Message + reportLink);
- }
- }
|