var url = CMS_SystemConfig.VirtualDirectoryPath + "/AdultEducationMissionClass/Edit"; var mnu = ""; //加载 $(function () { mnu = $.SystemGeneral.getUrlParam("MNU"); }) function reload() { $("#dgEducationMissionClassList").cmsXDataTable("load", $.getDataGridParams("dgEducationMissionClassList")); } //获取选中的数据 function validChoose() { var d = []; $.each($("#dgEducationMissionClassList").cmsXDataTable("getSelections"), function (index) { d.push(this.EducationMissionClassID); }); return d; } function collegeIDChoose() { var d = []; $.each($("#dgEducationMissionClassList").cmsXDataTable("getSelections"), function (index) { d.push(this.ClassmajorCollegeID); }); return d; } function SchoolyearIDChoose() { var d = []; $.each($("#dgEducationMissionClassList").cmsXDataTable("getSelections"), function (index) { d.push(this.SchoolyearID); }); return d; } //获取选中的数据 function validChooseObj() { var d = []; $.each($("#dgEducationMissionClassList").cmsXDataTable("getSelections"), function (index) { d.push(this); }); return d; } //获取选中的数据 function OrderNovalidChoose() { var d = []; $.each($("#dgEducationMissionClassList").cmsXDataTable("getSelections"), function (index) { d.push(this.OrderNo); }); return d; } //获取选中的状态 function ApprovalStatusvalidChoose() { var d = []; $.each($("#dgEducationMissionClassList").cmsXDataTable("getSelections"), function (index) { d.push(this.ApprovalStatus); }); return d; } //获取选中的教室类型 function ClassroomTypeNamevalidChoose() { var d = []; $.each($("#dgEducationMissionClassList").cmsXDataTable("getSelections"), function (index) { d.push(this.ClassroomTypeName); }); return d; } //排课分班 function EducationMissionClass_Separate() { var d = validChooseObj(); var dstate = ApprovalStatusvalidChoose().join(','); if (d.length == 0) { $.messager.alert("系统提示", "请选择教学任务进行分班!"); return; } if (d.length > 1) { $.messager.alert("系统提示", "只能选择单个记录进行分班设置!"); return; } for (var i = 0; i < dstate.split(',').length; i++) { if (dstate.split(',')[i] == scheduled) { $.messager.alert("系统提示", "您选择的排课分班存在状态已排课数据!"); return; } if (dstate.split(',')[i] == submitted) { $.messager.alert("系统提示", "您选择的排课分班存在状态已提交数据!"); return; } } var redirectTo = CMS_SystemConfig.VirtualDirectoryPath + "/EducationMissionClass/DivideIntoClassesEdit?educationMissionClassID=" + d[0].EducationMissionClassID + "&MNU=" + mnu; $.popupTopWindow('分班设置', redirectTo, 800, 250, null, null); } function EducationMissionClass_Arrange() { var d = validChooseObj(); if (d.length == 0) { $.messager.alert("系统提示", "请选择教学任务!"); return; } if (d.length > 1) { $.messager.alert("系统提示", "只能选择单个记录进行教学安排设置!"); return; } var redirectTo = url + "?educationMissionClassID=" + d[0].EducationMissionClassID + "&MNU=" + mnu; $.popupTopWindow('教学安排设置', redirectTo, 800, 600, null, null); } function EducationMissionClass_Delete() { var d = $.map(validChooseObj(), function (x) { return x.EducationMissionClassID; }).join(','); var state = ApprovalStatusvalidChoose().join(','); var classroomTypeName = ClassroomTypeNamevalidChoose().join(','); if (d.length == 0) { $.messager.alert("系统提示", "请选择您要删除的任务班!"); return; } for (var i = 0; i < state.split(',').length; i++) { if (state.split(',')[i] == submitted) { $.messager.alert("系统提示", "您选择的任务班存在状态已提交数据!"); return; } } for (var i = 0; i < state.split(',').length; i++) { if (state.split(',')[i] == scheduled) { $.messager.alert("系统提示", "您选择的任务班存在已排课数据!"); return; } } $.messager.confirm("系统提示", "您确定要删除该任务班?", function (r) { if (r) { $.postWithLoading(CMS_SystemConfig.VirtualDirectoryPath + '/AdultEducationMissionClass/Delete', { educationMissionClassIDs: d }, function (data) { if (data.IsSuccess) { $.messager.alert("系统提示", "删除成功!"); reload(); } else { $.messager.alert("系统提示", data.Message); } }); } }); } //提交 function EducationMissionClass_Submit() { var d = $.map(validChooseObj(), function (x) { return x.EducationMissionClassID; }).join(','); var state = ApprovalStatusvalidChoose().join(','); var classroomTypeName = ClassroomTypeNamevalidChoose().join(','); var collegeID = collegeIDChoose().join(','); var SchoolyearID = SchoolyearIDChoose().join(','); if (d.length == 0) { $.messager.alert("系统提示", "请选择您要提交的任务班!"); return; } for (var i = 0; i < classroomTypeName.split(',').length; i++) { if (classroomTypeName.split(',')[i] == "") { $.messager.alert("系统提示", "您选择的教学任务班存在教室类型为空数据,请检查!"); return; } } for (var i = 0; i < state.split(',').length; i++) { if (state.split(',')[i] == submitted) { $.messager.alert("系统提示", "您选择的任务班存在状态已提交数据!"); return; } } $.postWithLoading(CMS_SystemConfig.VirtualDirectoryPath + '/EducationMissionClass/Verification', { collegeIDs: collegeID, SchoolyearIDs: SchoolyearID }, function (data) { if (data == "成功") { $.postWithLoading(CMS_SystemConfig.VirtualDirectoryPath + '/AdultEducationMissionClass/EducationMissionClassUpdate', { educationMissionClassIDs: d }, function (data) { if (data == "成功") { $.messager.alert("系统提示", "提交成功!"); reload(); } else { $.messager.alert("系统提示", data); } }); } else { $.messager.alert("系统提示", data); } }); } //撤销提交 function EducationMissionClass_UnSubmit() { var d = $.map(validChooseObj(), function (x) { return x.EducationMissionClassID; }).join(','); var state = ApprovalStatusvalidChoose().join(','); if (d.length == 0) { $.messager.alert("系统提示", "请选择您要撤销提交的任务班!"); return; } for (var i = 0; i < state.split(',').length; i++) { if (state.split(',')[i] != submitted) { $.messager.alert("系统提示", "只能撤销已提交状态的数据!"); return; } } $.messager.confirm("系统提示", "您确定要撤销提交该任务班?", function (r) { if (r) { $.postWithLoading(CMS_SystemConfig.VirtualDirectoryPath + '/AdultEducationMissionClass/UnSubmit', { educationMissionClassIDs: d }, function (data) { $.messager.alert("系统提示", data); if (data == "撤销成功。") { reload(); } }); } }); } //排课班级 function SchedulingClassEdit(rowindex, rowdata) { var redirectTo = CMS_SystemConfig.VirtualDirectoryPath + "/AdultEducationMissionClass/EducationSchedulingClassList?educationMissionClassID=" + rowdata.EducationMissionClassID + "&MNU=" + mnu; $.popupTopWindow('排课班信息', redirectTo, 800, 600, null, null); } //学生总数 function SchedulingClassStudentEdit(rowindex, rowdata) { var redirectTo = CMS_SystemConfig.VirtualDirectoryPath + "/EducationMissionClass/EducationSchedulingClassCountStudentList?educationMissionClassID=" + rowdata.EducationMissionClassID + "&MNU=" + mnu + "&ApprovalStatusName=" + rowdata.ApprovalStatusName; $.popupTopWindow('学生信息', redirectTo, 800, 350, CloseStudentEdit); } function CloseStudentEdit() { reload(); } function AddStudent_Confirm(studentList) { alert("这边"); } //合班 function EducationMissionClass_Conjunction() { var educationMissionClassList = validChooseObj(); var d = $.map(educationMissionClassList, function (x) { return x.EducationMissionClassID; }); if (d.length < 2) { $.messager.alert("系统提示", "请至少选择两个以上的任务班进行合并。"); return; } for (var i = 0; i < educationMissionClassList.length; i++) { if (educationMissionClassList[i].ApprovalStatus != notSubmitted) { $.messager.alert("系统提示", "只有未提交的教学任务才能进行合班。"); return; } } var courseID = educationMissionClassList[0].CoursematerialID; var schoolyearID = educationMissionClassList[0].SchoolyearID; var teachModeID = educationMissionClassList[0].TeachingModeID; var errorList = $.grep(educationMissionClassList, function (x) { return x.CoursematerialID != courseID || x.SchoolyearID != schoolyearID || x.TeachingModeID != teachModeID }); if (errorList.length > 0) { $.messager.alert("系统提示", "只有同一学年学期上相同课程,授课方式也一致的任务班才可以进行合班。"); return; } var redirectTo = CMS_SystemConfig.VirtualDirectoryPath + "/EducationMissionClass/EducationMissionClassConjunctionList?MNU=" + mnu; $.popupTopWindow('合班信息', redirectTo, 900, 300, reload, d); } //导出Excel function EducationMissionClass_Excel() { $("#formQuery").submit(); } function QuerySchoolyearDropdownList(data) { reload(); } function QueryComboGridList(data) { reload(); } function QueryComboGridCollegeList(data) { reload(); } function QueryComboGridCampusList(data) { reload(); } function QueryApprovalStatusDropdownList(data) { reload(); } function SelectCollegeComboGrid(data) { CMSFunction.ComboGrid.SetValue($("#GrademajorComboGrid"), "", ""); //清空原有年级专业旧记录 var Year = $("#DictionaryGrade").combobox("getValue"); if (data != null || Year != "-1") { var jsonString = "({'QueryParamsDatas':'CollegeDropdown|*|" + data.CollegeID + "|@|DictionaryGrade|*|" + Year + "|@|'})"; $("#GrademajorComboGrid").combogridX("reload", eval(jsonString)); } reload(); } function SelectDictionaryGrade(data) { CMSFunction.ComboGrid.SetValue($("#GrademajorComboGrid"), "", ""); var collegeID = $("#ComboGridCollege").combogridX("getValue"); if (data.Value != "-1" || data != null) { var jsonString = "({'QueryParamsDatas':'CollegeDropdown|*|" + collegeID + "|@|DictionaryGrade|*|" + data.Value + "|@|'})"; $("#GrademajorComboGrid").combogridX("reload", eval(jsonString)); } reload(); } //点名 function EducationMissionClass_RollCall() { var educationMissionClassIDs = validChoose().join(','); educationMissionClassIDs = (educationMissionClassIDs == "-1" || educationMissionClassIDs == "") ? "=" : "=" + educationMissionClassIDs; var attribute = $("[name='Attribute']").val(); var attributeObj = eval('(' + attribute + ')'); var conditionString = $("[name='Condition']").val(); var value = SystemQueryControl.GetValue(); var condition = '@DynamicAttribute:' + attributeObj.Value + '|@DynamicCondition:' + conditionString + '|@DynamicValue:' + value; var schoolYearID = $("[comboname='SchoolyearDropdownList']").combobox("getValue"); schoolYearID = (schoolYearID == "-1" || schoolYearID == "") ? "=" : "=" + schoolYearID; var collegeID = $("[comboname='ComboGridCollege']").combogridX("getValue"); collegeID = (collegeID == "-1" || collegeID == "") ? "=" : "=" + collegeID; var year = $("[comboname='DictionaryGrade']").combobox("getValue"); year = (year == "-1" || year == "") ? "=" : "=" + year; var grademajorID = $("[comboname='GrademajorComboGrid']").combogridX("getValue"); grademajorID = (grademajorID == "-1" || grademajorID == "") ? "=" : "=" + grademajorID; var coursematerialID = $("[comboname='CoursematerialComboGrid']").combogridX("getValue"); coursematerialID = (coursematerialID == "-1" || coursematerialID == "") ? "=" : "=" + coursematerialID; var teachingMethod = $('[comboname="DictionaryTeachingMode"]').combobox("getValue"); teachingMethod = (teachingMethod == "-1" || teachingMethod == "") ? "=" : "=" + teachingMethod; var approvalStatus = $('[comboname="ApprovalStatusDropdownList"]').combobox("getValue"); approvalStatus = (approvalStatus == "-1" || approvalStatus == "") ? "=" : "=" + approvalStatus; var reportUrl = CMS_SystemConfig.ReportPagePath + "?ReportFolder=%2fEducationManage%2fStudentRollCallReport&condition_RAP=" + condition + "&schoolyearID_RAP" + schoolYearID + "&collegeID_RAP" + collegeID + "&year_RAP" + year + "&grademajorID_RAP" + grademajorID + "&coursematerialID_RAP" + coursematerialID + "&teachingMethod_RAP" + teachingMethod + "&educationMissionClassIDs_RAP" + educationMissionClassIDs + "&approvalStatus_RAP" + approvalStatus $.popupTopWindowOutsite('点名册', reportUrl, 900, 700); } SystemBatchModifyControl.OnSubmit = function () { var state = ApprovalStatusvalidChoose().join(','); for (var i = 0; i < state.split(',').length; i++) { if (state.split(',')[i] == scheduled) { $.messager.alert("系统提示", "您选择的教学任务班包含已排课状态!"); return false; } } } function EducationMissionClass_BatchUpdate() { var d = validChoose().join(','); if (d == "") { $.messager.alert("系统提示", "请选择您要修改的教学任务。"); return; } var redirectTo = CMS_SystemConfig.VirtualDirectoryPath + '/AdultEducationMissionClass/BatchUpdate?educationMissionClassStr=+' + d + '&MNU=' + mnu; $.popupTopWindow('批量修改课时类别', redirectTo, 450, 200, null, null); } //联动查询 function queryStandard(data) { queryClass(); } function queryCollege(data) { queryClass(); } function queryClass() { var jsonString = ""; var parameterString = ""; var campusID = $("#CampusDropdown").combogridX("getValue"); var collegeID = $("#CollegeDropdown").combogridX("getValue"); var educationID = $("#DictionaryEducation").combobox("getValue"); var schoolYearID = $("#SchoolyearDictionaryDropDown").combobox("getValue"); var standardID = $("#StandardDictionaryDropDown").combogridX("getValue"); var LearnSystem = $("#DictionaryLearnSystem").combogridX("getValue"); var learningFormID = $("#LearningformDictionaryDropDown").combobox("getValue"); //if (campusID != nonSelect) parameterString += "CampusDropdown|*|" + campusID + "|@|"; //if (collegeID != nonSelect) parameterString += "CollegeDropdown|*|" + collegeID + "|@|"; if (educationID != nonSelect) parameterString += "DictionaryEducation|*|" + educationID + "|@|"; if (schoolYearID != nonSelect) parameterString += "DictionaryGrade|*|" + schoolYearID + "|@|"; if (standardID != nonSelect) parameterString += "DictionaryStandard|*|" + standardID + "|@|"; if (learningFormID != nonSelect) parameterString += "DictionaryLearningform|*|" + learningFormID + "|@|"; if (LearnSystem != nonSelect) parameterString += "DictionaryLearnSystem|*|" + LearnSystem + "|@|"; if (parameterString != "") { jsonString = "({'QueryParamsDatas':'" + parameterString + "'})"; $("#ClassmajorDropdown").combogridX("reload", eval(jsonString)); $("#StandardDictionaryDropDown").combogridX("reload", eval(jsonString)); } else { $("#ClassmajorDropdown").combogridX("reload"); $("#StandardDictionaryDropDown").combogridX("reload"); } reload(); }