var url = CMS_SystemConfig.VirtualDirectoryPath + "/ExecutableFreeSelectionCouse/Edit"; var mnu = ""; //加载 $(function () { mnu = $.SystemGeneral.getUrlParam("MNU"); }) //新增 function ExecutableFreeSelectionCouse_Add() { var d = validChoose(); if (d.length > 0) { $.popupTopWindow('任选设定复制新增', CMS_SystemConfig.VirtualDirectoryPath + '/ExecutableFreeSelectionCouse/CopyAdd?sourceExecutableFreeSelectionCouseID=' + d[0] + '&MNU=' + mnu, 750, 550, null, null); } else { $.popupTopWindow('任选设定新增', CMS_SystemConfig.VirtualDirectoryPath + '/ExecutableFreeSelectionCouse/Edit?MNU=' + mnu, 750, 550, null, null); } } function reload() { $("#dgExecutableFreeSelectionCouseList").cmsXDataTable("load", $.getDataGridParams("dgExecutableFreeSelectionCouseList")); } //获取选中的数据 function validChoose() { var d = []; var status = []; $.each($("#dgExecutableFreeSelectionCouseList").cmsXDataTable("getSelections"), function (index) { d.push(this.ExecutableFreeSelectionCouseID); }); return d; } function validChooseIsOpened() { var d = []; var status = []; $.each($("#dgExecutableFreeSelectionCouseList").cmsXDataTable("getSelections"), function (index) { d.push(this.IsOpened); }); return d; } function statusvalidChoose() { var d = []; $.each($("#dgExecutableFreeSelectionCouseList").cmsXDataTable("getSelections"), function (index) { d.push(this.RecordStatusCode); }); return d; } //点击列表更新 function edit(rowindex, rowdata) { $.popupTopWindow('任选设定信息', url + '?ExecutableFreeSelectionCouseID=' + rowdata.ExecutableFreeSelectionCouseID + '&MNU=' + mnu, 750, 550, null, null); } //详细信息 function Details(rowindex, rowdata) { $.popupTopWindow('任选设定信息', CMS_SystemConfig.VirtualDirectoryPath + '/ExecutableFreeSelectionCouse/Details?ExecutableFreeSelectionCouseID=' + rowdata.ExecutableFreeSelectionCouseID + '&MNU=' + mnu, 750, 550, null, null); } //修改按钮 function ExecutableFreeSelectionCouse_Update() { var d = validChoose(); var r = statusvalidChoose(); if (d.length == 0) { $.messager.alert("系统信息", "请选择您要修改的信息。"); return; } if (d.length > 1) { $.messager.alert("系统信息", "只能选择单个记录进行修改。"); return; } if (r[0] == CreatedStatus) { $.messager.alert("系统提示", "已开班状态的信息无法修改。"); return; } $.popupTopWindow('任选设定修改', url + '?ExecutableFreeSelectionCouseID=' + d[0] + '&MNU=' + mnu, 750, 550, null, null); } //开放 function ExecutableFreeSelectionCouse_Open() { var d = validChoose().join(','); if (d == "") { $.messager.alert("系统信息", "请选择您要开放的信息。"); return; } var status = statusvalidChoose(); for (var i = 0; i < status.length; i++) { if (status[i] != NotOpenStatus) { $.messager.alert("系统提示", "已开放状态的信息无法重复开放。"); return; } } $.messager.confirm("系统提示", "您确定要对选择的任选设定进行开放?", function (r) { if (r) { $.post(CMS_SystemConfig.VirtualDirectoryPath + '/ExecutableFreeSelectionCouse/Open', { ExecutableFreeSelectionCouseIDs: d }, function (data) { $.messager.alert("系统提示", data.Message); if (data.IsSuccess == true) { $("#dgExecutableFreeSelectionCouseList").cmsXDataTable('load'); } }); } }); } //取消开放 function ExecutableFreeSelectionCouse_Cancel() { var d = validChoose().join(','); if (d == "") { $.messager.alert("系统信息", "请选择您要取消的信息。"); return; } var status = statusvalidChoose(); for (var i = 0; i < status.length; i++) { if (status[i] != OpenedStatus) { $.messager.alert("系统提示", "只能对已开放状态的信息进行取消。"); return; } } $.messager.confirm("系统提示", "您确定要对选择的任选设定进行取消?", function (r) { if (r) { $.postWithLoading(CMS_SystemConfig.VirtualDirectoryPath + '/ExecutableFreeSelectionCouse/Cancel', { ExecutableFreeSelectionCouseIDs: d }, function (data) { if (data.IsSuccess == true) { $("#dgExecutableFreeSelectionCouseList").cmsXDataTable('load'); } $.messager.alert("系统提示", data.Message); }); } }); } //提交 function ExecutableFreeSelectionCouse_Submit() { var d = validChoose().join(","); var r = statusvalidChoose(); if (d == "") { $.messager.alert("系统提示", "请选择您要提交的信息。"); return; } $.messager.confirm("系统提示", "您确定要对选择的任选设定进行提交?", function (r) { if (r) { $.postWithLoading(CMS_SystemConfig.VirtualDirectoryPath + '/ExecutableFreeSelectionCouse/Submit', { executableFreeSelectionCouseIDs: d }, function (data) { if (data.IsSuccess == true) { $("#dgExecutableFreeSelectionCouseList").cmsXDataTable('load'); } $.messager.alert("系统提示", data.Message); }); } }); } //删除 function ExecutableFreeSelectionCouse_Delete() { var d = validChoose().join(','); var r = statusvalidChoose(); if (d == "") { $.messager.alert("系统信息", "请选择您要删除的信息。"); return; } for (var i = 0; i < r.length; i++) { if (r[i] == CreatedStatus) { $.messager.alert("系统提示", "已开班状态的信息无法删除。"); return; } } $.messager.confirm("系统提示", "您确定要删除选择的信息?", function (r) { if (r) { $.postWithLoading(CMS_SystemConfig.VirtualDirectoryPath + '/ExecutableFreeSelectionCouse/Delete', { ExecutableFreeSelectionCouseIDs: d }, function (data) { if (data.IsSuccess == true) { $("#dgExecutableFreeSelectionCouseList").cmsXDataTable('load'); } $.messager.alert("系统提示", data.Message); }); } }); } //Excel导出 function ExecutableFreeSelectionCouse_Export() { $("#formQuery").submit(); } //校区查询下拉 function QueryCampusComboGridList() { var campusID = $("#CampusDropdown").combogridX("getValue"); if (campusID != nonSelect) { var jsonString = "({'QueryParamsDatas':'CampusDropdown|*|" + campusID + "|@|'})"; $("#CollegeDropdown").combogridX("reload", eval(jsonString)); } reload(); } //院系所查询下拉 function QueryCollegeComboGridList() { var collegeID = $("#CollegeDropdown").combogridX("getValue"); if (collegeID != nonSelect) { var jsonString = "({'QueryParamsDatas':'CollegeDropdown|*|" + collegeID + "|@|'})"; $("#DepartmentDropdown").combogridX("reload", eval(jsonString)); } reload(); } //教研室查询下拉 function QueryDepartmentComboGridList() { reload(); } //弹出添加教师页面 function addTeachers(rowindex, rowdata) { $.popupTopWindow('添加教师', CMS_SystemConfig.VirtualDirectoryPath + '/ExecutableFreeSelectionCouse/TeacherEdit?ExecutableFreeSelectionCouseID=' + rowdata.ExecutableFreeSelectionCouseID + '&MNU=' + mnu, 560, 480, AddTeachers_Confirm, rowdata); } //确定添加教师 function AddTeachers_Confirm(data) { reload(); }