var mnu = ""; //加载 $(function () { mnu = $.SystemGeneral.getUrlParam("MNU"); }) //刷新 function reload() { $("#dgRetakePlanTaskList").cmsXDataTable("load", $.getDataGridParams("dgRetakePlanTaskList")); } //获取选中的数据 function validChoose() { var d = []; $.each($("#dgRetakePlanTaskList").cmsXDataTable("getSelections"), function (index) { d.push(this.RetakePlanID); }); return d; } //获取选中的数据(重修任务状态) function validChooseStatus() { var d = []; $.each($("#dgRetakePlanTaskList").cmsXDataTable("getSelections"), function (index) { d.push(this.RecordStatus); }); return d; } //重修任务分班 function RetakePlanTask_Separate() { var d = validChoose(); if (d.length == 0) { $.messager.alert("系统信息", "请选择要进行分班的信息。"); return; } if (d.length > 1) { $.messager.alert("系统信息", "只能选择单个记录进行分班。"); return; } var r = validChooseStatus(); if (r[0] != CancleStatus) { $.messager.alert("系统提示", "只能对未开放状态的信息进行分班。"); return; } var redirectTo = CMS_SystemConfig.VirtualDirectoryPath + "/RetakePlanTask/DivideIntoClassesEdit?RetakePlanID=" + d[0] + "&MNU=" + mnu; $.popupTopWindow('重修任务分班', redirectTo, 650, 280, null, null); } //修改 function RetakePlan_Update() { var d = validChoose(); if (d.length == 0) { $.messager.alert("系统信息", "请选择您要修改的信息。"); return; } if (d.length > 1) { $.messager.alert("系统信息", "只能选择单个记录进行修改。"); return; } var r = validChooseStatus(); if (r[0] != CancleStatus) { $.messager.alert("系统提示", "只能对未开放状态的信息进行修改。"); return; } var redirectTo = CMS_SystemConfig.VirtualDirectoryPath + "/RetakePlanTask/Edit?RetakePlanID=" + d[0] + '&MNU=' + mnu; $.popupTopWindow('重修任务修改', redirectTo, 750, 550, null, null); } //查看重修任务信息 function retakeDetail(rowindex, rowdata) { var redirectTo = CMS_SystemConfig.VirtualDirectoryPath + "/RetakePlanTask/Edit?RetakePlanID=" + rowdata.RetakePlanID + "&MNU=" + mnu + "&Status=" + rowdata.RecordStatus + "&Isdisplay=true"; $.popupTopWindow('重修任务信息', redirectTo, 750, 550, null, null); } //删除 function RetakePlan_Delete() { var retakePlanIDs = validChoose(); if (retakePlanIDs.length == 0) { $.messager.alert("系统提示", "请选择您要删除的信息。"); return; } var r = validChooseStatus(); for (var i = 0; i < r.length; i++) { if (r[i] != CancleStatus) { $.messager.alert("系统提示", "只能对未开放状态的信息进行删除。"); return; } } $.messager.confirm("系统提示", "您确定要删除选择的信息?", function (r) { if (r) { $.postWithLoading(CMS_SystemConfig.VirtualDirectoryPath + '/RetakePlanTask/IsExistsApplyStudentByRetakePlanID', { RetakePlanIDs: retakePlanIDs.join(',') }, function (data) { if (data.IsSuccess) { if (data.Data) { $.messager.defaults = { ok: "继续删除", cancel: "取消" }; $.messager.confirm("选择提示", "检测到要删除的信息中存在已报名重修的学生名单,是否继续删除?", function (r) { if (r) { DeleteRetakePlan(retakePlanIDs.join(',')); } else { return; } }); $.messager.defaults = { ok: "确定", cancel: "取消" }; } else { DeleteRetakePlan(retakePlanIDs.join(',')); } } else { $.messager.alert("系统提示", data.Message); } }); } }); } //确定删除重修计划 function DeleteRetakePlan(RetakePlanIDs) { $.postWithLoading(CMS_SystemConfig.VirtualDirectoryPath + '/RetakePlanTask/Delete', { RetakePlanIDs: RetakePlanIDs }, function (data) { $.messager.alert("系统提示", data.Message); if (data.IsSuccess) { $("#dgRetakePlanTaskList").cmsXDataTable('load'); } }); } //重修计划取消开放 function RetakePlan_Cancle() { var retakePlanIDs = validChoose(); if (retakePlanIDs.length == 0) { $.messager.alert("系统提示", "请选择您要取消开放的信息。"); return; } var r = validChooseStatus(); for (var i = 0; i < r.length; i++) { if (r[i] != OpenStatus) { $.messager.alert("系统提示", "只能对已开放状态的信息取消开放。"); return; } } $.messager.confirm("系统提示", "您确定要对选择的信息进行取消开放?", function (r) { if (r) { $.postWithLoading(CMS_SystemConfig.VirtualDirectoryPath + '/RetakePlanTask/IsExistsApplyStudentByRetakePlanID', { RetakePlanIDs: retakePlanIDs.join(',') }, function (data) { if (data.IsSuccess) { if (data.Data) { $.messager.defaults = { ok: "继续取消", cancel: "放弃" }; $.messager.confirm("选择提示", "检测到要取消开放的信息中存在已报名重修的学生名单,如果继续取消,则将对报名名单进行取消报名,是否继续取消?", function (r) { if (r) { CancleRetakePlan(retakePlanIDs.join(',')); } else { return; } }); $.messager.defaults = { ok: "确定", cancel: "取消" }; } else { CancleRetakePlan(retakePlanIDs.join(',')); } } else { $.messager.alert("系统提示", data.Message); } }); } }); } //确定重修计划取消开放 function CancleRetakePlan(RetakePlanIDs) { $.postWithLoading(CMS_SystemConfig.VirtualDirectoryPath + '/RetakePlanTask/CancleOpen', { RetakePlanIDs: RetakePlanIDs }, function (data) { $.messager.alert("系统提示", data.Message); if (data.IsSuccess) { $("#dgRetakePlanTaskList").cmsXDataTable('load'); } }); } //重修计划开放 function RetakePlan_Open() { var RetakePlanIDs = validChoose(); if (RetakePlanIDs.length == 0) { $.messager.alert("系统提示", "请选择您要开放的信息。"); return; } var r = validChooseStatus(); for (var i = 0; i < r.length; i++) { if (r[i] != CancleStatus) { $.messager.alert("系统提示", "只能对未开放状态的信息开放。"); return; } } $.messager.confirm("系统提示", "您确定要对选择的信息进行开放?", function (r) { if (r) { $.postWithLoading(CMS_SystemConfig.VirtualDirectoryPath + '/RetakePlanTask/Open', { RetakePlanIDs: RetakePlanIDs.join(',') }, function (data) { if (data.IsSuccess) { $("#dgRetakePlanTaskList").cmsXDataTable('load'); } $.messager.alert("系统提示", data.Message); }); } }); } //重修计划名单 function studentDetail(rowindex, rowdata) { var redirectTo = CMS_SystemConfig.VirtualDirectoryPath + "/RetakePlanTask/StudentDetail?RetakePlanID=" + rowdata.RetakePlanID + "&MNU=" + mnu + "&Status=" + rowdata.RecordStatus; $.popupTopWindow('重修计划名单', redirectTo, 900, 540, reload); } //列颜色设置为红色 function SetRedtColumn(index, row, value) { return " " + value + ""; } //Excel导出 function RetakePlan_Export() { $("#formQuery").submit(); } //联动查询 function queryCourseCollege(data) { var collegeID = $("#CollegeDropdown").combogridX("getValue"); var departmentID = $("#DepartmentComboGrid").combogridX("getValue"); var jsonString = "({'QueryParamsDatas':'CollegeDropdown|*|" + collegeID + "|@|"; jsonString += "DepartmentComboGrid|*|" + departmentID + "|@|'})"; $("#DepartmentComboGrid").combogridX("reload", eval(jsonString)); reload(); }