var url = CMS_SystemConfig.VirtualDirectoryPath + "/SpecialtyPlan/Edit"; var mnu = ""; //加载 $(function () { mnu = $.SystemGeneral.getUrlParam("MNU"); }) //刷新 function reload() { $("#dgSpecialtyPlanList").cmsXDataTable("load", $.getDataGridParams("dgSpecialtyPlanList")); } //获取选中的数据 function validChoose() { var d = []; $.each($("#dgSpecialtyPlanList").cmsXDataTable("getSelections"), function (index) { d.push(this.SpecialtyPlanID); }); return d; } //获取选中的数据All function validChooseAll() { var d = []; $.each($("#dgSpecialtyPlanList").cmsXDataTable("getSelections"), function (index) { d.push(this); }); return d; } //新增 function SpecialtyPlan_Add() { var d = validChoose(); if (d.length > 0) { $.popupTopWindow('专业计划复制新增', CMS_SystemConfig.VirtualDirectoryPath + '/SpecialtyPlan/CopyAdd?specialtyPlanID=' + d[0] + '&MNU=' + mnu, 685, 540, null, null); } else { //var redirectTo = url + "?MNU=" + mnu; //$.popupTopWindow('专业计划新增', redirectTo, 685, 540, null, null); //采用以下方式申请 var redirectTo = CMS_SystemConfig.VirtualDirectoryPath + "/SpecialtyPlan/SpecialtyPlanBatchAdd" + "?MNU=" + mnu; $.popupTopWindow('专业计划新增', redirectTo, 1200, 540, reload, null); } } //修改 function SpecialtyPlan_Edit() { var d = validChoose(); if (d.length == 0) { $.messager.alert("系统信息", "请选择您要修改的信息。"); return; } if (d.length > 1) { $.messager.alert("系统信息", "只能选择单个记录进行修改。"); return; } var redirectTo = url + "?specialtyPlanID=" + d + "&MNU=" + mnu + "&type=edit"; $.popupTopWindow('专业计划修改', redirectTo, 685, 540, null, null); } //查看明细 function edit(rowindex, rowdata) { var redirectTo = url + "?specialtyPlanID=" + rowdata.SpecialtyPlanID + "&MNU=" + mnu + "&type=detail"; $.popupTopWindow('专业计划信息', redirectTo, 685, 540, null, null); } //专业计划范围明细 function editPlanRange(rowindex, rowdata) { var redirectTo = CMS_SystemConfig.VirtualDirectoryPath + "/SpecialtyPlan/PlanRangeList?specialtyPlanID=" + rowdata.SpecialtyPlanID + "&MNU=" + mnu; $.popupTopWindow('专业计划范围明细', redirectTo, 800, 540, null, null); } //专业计划人数明细 function editPlanStudent(rowindex, rowdata) { var redirectTo = CMS_SystemConfig.VirtualDirectoryPath + "/SpecialtyPlan/PlanStudentList?specialtyPlanID=" + rowdata.SpecialtyPlanID + "&MNU=" + mnu; $.popupTopWindow('专业计划人数明细', redirectTo, 800, 540, null, null); } //删除 function SpecialtyPlan_Delete() { var id = validChoose().join(','); if (id == "") { $.messager.alert("系统提示", "请选择您要删除的信息。"); return; } $.messager.confirm("系统提示", "您确定要删除选择的信息?", function (r) { if (r) { $.postWithLoading(CMS_SystemConfig.VirtualDirectoryPath + '/SpecialtyPlan/Delete', { specialtyPlanIDs: id }, function (data) { if (data.IsSuccess) { $.messager.alert("系统提示", data.Message); $("#dgSpecialtyPlanList").cmsXDataTable('load'); } else { $.messager.alert("系统提示", data.Message); } }); } }); } //计划执行 function SpecialtyPlan_Execute() { var id = validChoose().join(','); if (id.length == 0) { $.messager.alert("系统提示", "请选择您要执行的信息。"); return; } $.messager.confirm("系统提示", "您确定要对选择的信息进行执行?", function (r) { if (r) { $.postWithLoading(CMS_SystemConfig.VirtualDirectoryPath + '/SpecialtyPlan/SpecialtyPlanExecute', { specialtyPlanIDs: id }, function (data) { if (data.IsSuccess == true) { $.messager.alert("系统提示", data.Message); $("#dgSpecialtyPlanList").cmsXDataTable('load'); } else { $.messager.alert("系统提示", data.Message); } }); } }); } //获取列表字段查询对应比较符 function GetDynamicCondition() { var attribute = eval('(' + $("[name='Attribute']").val() + ')').Value; var conditionString = $("[name='Condition']").val(); var value = $("[name='Condition']").parent().parent().next().find("[name^=" + attribute + "]").val(); value = $.trim(value); var sql = ""; if (conditionString == "=" || conditionString == ">" || conditionString == "<" || conditionString == "<>") { sql = "#" + attribute + conditionString + value; } else if (conditionString == "左") { sql = "#" + attribute + " like '" + value + "%'"; } else if (conditionString == "右") { sql = "#" + attribute + " like '%" + value + "'"; } else if (conditionString == "中") { sql = "#" + attribute + " like '%" + value + "%'"; } return sql; } //专业计划统计报表 function SpecialtyPlan_Report() { var d = []; var SchoolyearID = $("#SchoolyearDropdown").combobox("getValue"); var CampusID = $("#CampusDropdown").combogridX("getValue"); var CollegeID = $("#CollegeDropdown").combogridX("getValue"); var Year = $("#DictionarySchoolyear").combogridX("getValue"); var StandardID = $("#DictionaryStandard").combogridX("getValue"); var EducationID = $("#DictionaryEducation").combogridX("getValue"); var LearningformID = $("#DictionaryLearningform").combogridX("getValue"); var LearnSystem = $("#DictionaryLearnSystem").combogridX("getValue"); var GrademajorID = $("#GrademajorComboGrid").combogridX("getValue"); var CoursematerialID = $("#CourseComboGrid").combogridX("getValue"); var TeachingModeID = $("#DictionaryTeachingMode").combogridX("getValue"); var HandleModeID = $("#DictionaryHandleMode").combogridX("getValue"); //获取自定义查询的当前字段 var sql = GetDynamicCondition(); var redirectTo = CMS_SystemConfig.VirtualDirectoryPath + '/SpecialtyPlan/Report?MNU=' + mnu; var id = d.join(","); $.postWithLoading(CMS_SystemConfig.VirtualDirectoryPath + '/SpecialtyPlan/CreateIDTempTable', { SpecialtyPlans: id }, function (data) { redirectTo = redirectTo + "&SchoolyearID=" + SchoolyearID + "&CollegeID=" + CollegeID + "&StandardID=" + StandardID + "&Year=" + Year + "&EducationID=" + EducationID + "&LearningformID=" + LearningformID + "&LearnSystem=" + LearnSystem + "&ConditionString=" + sql + "&GrademajorID=" + GrademajorID + "&TempTableName=" + data; var windowDiv = $.popupTopWindow('专业计划统计', redirectTo, 800, 540, null, null); windowDiv.panel({ onBeforeClose: function () { if (windowDiv.find('iframe')[0].contentWindow.isWindowCanClose) { var table = windowDiv.find('iframe')[0].contentWindow.TempTableName; $.postWithLoading(CMS_SystemConfig.VirtualDirectoryPath + '/SpecialtyPlan/DeleteTempTable', { TempTableName: table }, function (data) { windowDiv.close(); return true; }); } return true; } }); }); } //专业复制 function SpecialtyPlan_SpecialtyCopy() { var redirectTo = CMS_SystemConfig.VirtualDirectoryPath + "/SpecialtyPlan/SpecialtyCopyList?MNU=" + mnu; $.popupTopWindow('专业复制', redirectTo, 1000, 200, null, null); } //年级复制 function SpecialtyPlan_GradeCopy() { var redirectTo = CMS_SystemConfig.VirtualDirectoryPath + "/SpecialtyPlan/GradeCopyList?MNU=" + mnu; $.popupTopWindow('年级复制', redirectTo, 1000, 200, null, null); } //Excel导入 function SpecialtyPlan_Import() { var redirectTo = CMS_SystemConfig.VirtualDirectoryPath + '/SpecialtyPlan/Import?MNU=' + mnu; $.popupTopWindow('专业计划信息导入', redirectTo, 420, 300, reload); } //设置列颜色为红色 function SetRedColumn(index, row, value) { return " " + value + ""; } //设置相应的行颜色为红色 function SetRedGrid(rowIndex, rowData) { if (rowData.PlanStatus == notExecute) { return "color: red;"; } else { return ""; } } //Excel导出 function SpecialtyPlan_Export() { $("#formQuery").submit(); } //联动查询 function queryCampus(data) { var campusID = $("#CampusDropdown").combogridX("getValue"); if (campusID != nonSelect) { var jsonString = "({'QueryParamsDatas':'CampusDropdown|*|" + campusID + "|@|'})"; $("#CollegeDropdown").combogridX("reload", eval(jsonString)); } else { $("#CollegeDropdown").combogridX("reload"); } queryClass(); } function queryCollege(data) { var campusID = $("#CampusDropdown").combogridX("getValue"); var collegeID = $("#CollegeDropdown").combogridX("getValue"); var jsonString = "({'QueryParamsDatas':'CampusDropdown|*|" + campusID + "|@|"; jsonString += "CollegeDropdown|*|" + collegeID + "|@|'})"; $("#CollegeDropdown").combogridX("reload", eval(jsonString)); $("#DictionaryStandard").combogridX("reload", eval(jsonString)); queryClass(); } function querySchoolyear(data) { queryClass(); } function queryStandard(data) { queryClass(); } function queryGrademajor(data) { queryClass(); } function queryClass() { var jsonString = ""; var parameterString = ""; var campusID = $("#CampusDropdown").combogridX("getValue"); var collegeID = $("#CollegeDropdown").combogridX("getValue"); var schoolYearID = $("#DictionarySchoolyear").combogridX("getValue"); //combobox var standardID = $("#DictionaryStandard").combogridX("getValue"); var educationID = $("#DictionaryEducation").combogridX("getValue"); var learningFormID = $("#DictionaryLearningform").combogridX("getValue"); if (campusID != nonSelect) parameterString += "CampusDropdown|*|" + campusID + "|@|"; if (collegeID != nonSelect) parameterString += "CollegeDropdown|*|" + collegeID + "|@|"; if (schoolYearID != nonSelect) parameterString += "DictionaryGrade|*|" + schoolYearID + "|@|"; if (standardID != nonSelect) parameterString += "DictionaryStandard|*|" + standardID + "|@|"; if (educationID != nonSelect) parameterString += "DictionaryEducation|*|" + educationID + "|@|"; if (learningFormID != nonSelect) parameterString += "DictionaryLearningform|*|" + learningFormID + "|@|"; if (parameterString != "") { jsonString = "({'QueryParamsDatas':'" + parameterString + "'})"; $("#DictionaryStandard").combogridX("reload", eval(jsonString)); $("#GrademajorComboGrid").combogridX("reload", eval(jsonString)); } else { $("#DictionaryStandard").combogridX("reload"); $("#GrademajorComboGrid").combogridX("reload"); } reload(); }