var url = CMS_SystemConfig.VirtualDirectoryPath + "/FreeSelectionCourseApply/Edit"; var mnu = ""; //加载 $(function () { mnu = $.SystemGeneral.getUrlParam("MNU"); }) //弹出新增信息页面 function FreeSelectionCourseApply_Add() { redirectTo = CMS_SystemConfig.VirtualDirectoryPath + "/FreeSelectionCourseApply/Edit?MNU=" + mnu; $.popupTopWindow("开课申请新增", redirectTo, 750, 550, null, null); } function reload() { $("#dgFreeSelectionCourseApplyList").cmsXDataTable("load", $.getDataGridParams("dgFreeSelectionCourseApplyList")); } //获取选中的数据 function validChoose() { var d = []; var status = []; $.each($("#dgFreeSelectionCourseApplyList").cmsXDataTable("getSelections"), function (index) { d.push(this.FreeSelectionCouseApplyID); status.push(this.ApprovalStatus); }); $("#hid_ApprovalStatus").val(status.join(',')); return d; } //弹出信息修改页面 function edit(rowindex, rowdata) { redirectTo = url + "?freeSelectionCourseApplyID=" + rowdata.FreeSelectionCouseApplyID + "&MNU=" + mnu; $.popupTopWindow("开课申请修改", redirectTo, 750, 550, null, null); } //弹出明细信息页面 function Details(rowindex, rowdata) { redirectTo = CMS_SystemConfig.VirtualDirectoryPath + "/FreeSelectionCourseApply/Details?MNU=" + mnu + "&freeSelectionCourseApplyID=" + rowdata.FreeSelectionCouseApplyID + "&MNU=" + mnu; $.popupTopWindow("开课申请信息", redirectTo, 750, 550, null, null); } //修改按钮 function FreeSelectionCourseApply_Update() { var d = validChoose(); if (d.length == 0) { $.messager.alert("系统信息", "请选择您要修改的信息。"); return; } if (d.length > 1) { $.messager.alert("系统信息", "只能选择单个记录进行修改。"); return; } redirectTo = url + "?freeSelectionCourseApplyID=" + d + "&MNU=" + mnu; $.popupTopWindow("开课申请修改", redirectTo, 800, 600, null, null); } //删除 function FreeSelectionCourseApply_Cancel() { var d = validChoose().join(','); var status = $("#hid_ApprovalStatus").val(); if (d == "") { $.messager.alert("系统信息", "请选择您要删除的信息。"); return; } for (var i = 0; i < status.split(',').length; i++) { if (status.split(',')[i] != "") { if (status.split(',')[i] != "1" && status.split(',')[i] != "5") { $.messager.alert("系统信息", "系统提示,只能对未提交和已退回状态的信息进行删除。"); return; } } } $.messager.confirm("系统提示", "您确定要删除选择的信息?", function (r) { if (r) { $.postWithLoading(CMS_SystemConfig.VirtualDirectoryPath + '/FreeSelectionCourseApply/Delete', { freeSelectionCourseApplyIDs: d }, function (data) { if (data == "删除成功!") { $.messager.alert("系统提示", data); $("#dgFreeSelectionCourseApplyList").cmsXDataTable('load'); } else { $.messager.alert("系统提示", data); } }); } }); } //提交 function FreeSelectionCourseApply_Submit() { var d = validChoose().join(','); var status = $("#hid_ApprovalStatus").val(); if (d == "") { $.messager.alert("系统信息", "请选择您要提交的信息。"); return; } for (var i = 0; i < status.split(',').length; i++) { if (status.split(',')[i] != "") { //取消申请或者结束流程 if (status.split(',')[i] == "4") { $.messager.alert("系统提示", "抱歉,您提交申请中存已存审批状态为“已结束”的申请单,请重新选择提交。"); return; } } } $.postWithLoading(CMS_SystemConfig.VirtualDirectoryPath + '/FreeSelectionCourseApply/SubmitFreeSelectionCourseApply', { freeSelectionCourseApplyIDs: d }, function (data) { if (data == "提交成功!") { $.messager.alert("系统提示", data); $("#dgFreeSelectionCourseApplyList").cmsXDataTable('load'); } else { $.messager.alert("系统提示", data); } }); } //Excel导出 function FreeSelectionCourseApply_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 + '/FreeSelectionCourseApply/TeacherEdit?FreeSelectionCourseApplyID=' + rowdata.FreeSelectionCouseApplyID + '&MNU=' + mnu, 560, 480, AddTeachers_Confirm, rowdata); } //确定添加教师 function AddTeachers_Confirm(data) { reload(); }