var url = CMS_SystemConfig.VirtualDirectoryPath + "/ExecutablePlan/Edit"; var mnu = ""; //加载 $(function () { mnu = $.SystemGeneral.getUrlParam("MNU"); }) //刷新 function reload() { $("#dgExecutablePlanList").cmsXDataTable("load", $.getDataGridParams("dgExecutablePlanList")); } //获取选中的数据 function validChoose() { var d = []; $.each($("#dgExecutablePlanList").cmsXDataTable("getSelections"), function (index) { d.push(this.ExecutablePlanID); }); return d; } //获取选中的数据PlanType function validChoosePlanType() { var d = []; $.each($("#dgExecutablePlanList").cmsXDataTable("getSelections"), function (index) { d.push(this.PlanTypeID); }); return d; } //获取选中的数据All function validChooseAll() { var d = []; $.each($("#dgExecutablePlanList").cmsXDataTable("getSelections"), function (index) { d.push(this); }); return d; } //计划生成 function ExecutablePlan_Create() { var redirectTo = CMS_SystemConfig.VirtualDirectoryPath + "/ExecutablePlan/ExecutablePlanBatchAdd" + "?MNU=" + mnu; $.popupTopWindow('执行计划生成', redirectTo, 1200, 540, reload, null); } //新增 function ExecutablePlan_Add() { var d = validChoose(); if (d.length > 0) { $.popupTopWindow('执行计划复制新增', CMS_SystemConfig.VirtualDirectoryPath + '/ExecutablePlan/CopyAdd?executablePlanID=' + d[0] + '&MNU=' + mnu, 685, 545, null, null); } else { var redirectTo = url + "?MNU=" + mnu; $.popupTopWindow('执行计划新增', redirectTo, 685, 545, null, null); } } //修改 function ExecutablePlan_Edit() { var d = validChoose(); if (d.length == 0) { $.messager.alert("系统信息", "请选择您要修改的信息。"); return; } if (d.length > 1) { $.messager.alert("系统信息", "只能选择单个记录进行修改。"); return; } //计划类型 var planTypeID = validChoosePlanType(); if (planTypeID == outside) { var redirectTo = url + "?executablePlanID=" + d + "&MNU=" + mnu + "&type=edit&planType=outside"; } else { var redirectTo = url + "?executablePlanID=" + d + "&MNU=" + mnu + "&type=edit"; } $.popupTopWindow('执行计划修改', redirectTo, 685, 545, null, null); } //查看明细 function edit(rowindex, rowdata) { var redirectTo = url + "?executablePlanID=" + rowdata.ExecutablePlanID + "&MNU=" + mnu + "&type=detail"; $.popupTopWindow('执行计划信息', redirectTo, 685, 545, null, null); } //课程信息对应的上课类型明细 function editClassGrouping(rowindex, rowdata) { var redirectTo = CMS_SystemConfig.VirtualDirectoryPath + "/TeachType/Edit?classGroupingID=" + rowdata.ClassGroupingID + "&MNU=" + mnu + "&type=detail"; $.popupTopWindow('上课类型明细', redirectTo, 720, 480, null, null); } //执行计划范围明细 function editPlanRange(rowindex, rowdata) { var redirectTo = CMS_SystemConfig.VirtualDirectoryPath + "/ExecutablePlan/PlanRangeList?executablePlanID=" + rowdata.ExecutablePlanID + "&MNU=" + mnu; $.popupTopWindow('执行计划范围明细', redirectTo, 800, 540, null, null); } //执行计划人数明细 function editPlanStudent(rowindex, rowdata) { var redirectTo = CMS_SystemConfig.VirtualDirectoryPath + "/ExecutablePlan/PlanStudentList?executablePlanID=" + rowdata.ExecutablePlanID + "&MNU=" + mnu; $.popupTopWindow('执行计划人数明细', redirectTo, 800, 540, null, null); } //删除 function ExecutablePlan_Delete() { var id = validChoose().join(','); if (id == "") { $.messager.alert("系统提示", "请选择您要删除的信息。"); return; } var d = validChooseAll(); if ($.grep(d, function (v, i) { return v.RecordStatus != notSubmitStatus; }).length > 0) { $.messager.alert("系统提示", "只能对未提交状态的信息进行删除。"); return; } $.messager.confirm("系统提示", "您确定要删除选择的信息?", function (r) { if (r) { $.postWithLoading(CMS_SystemConfig.VirtualDirectoryPath + '/ExecutablePlan/Delete', { executablePlanIDs: id }, function (data) { if (data.IsSuccess) { $.messager.alert("系统提示", data.Message); $("#dgExecutablePlanList").cmsXDataTable('load'); } else { $.messager.alert("系统提示", data.Message); } }); } }); } //提交 function ExecutablePlan_Submit() { var id = validChoose().join(','); if (id.length == 0) { $.messager.alert("系统提示", "请选择您要执行的信息。"); return; } $.messager.confirm("系统提示", "您确定要对选择的信息进行提交?", function (r) { if (r) { $.postWithLoading(CMS_SystemConfig.VirtualDirectoryPath + '/ExecutablePlan/ExecutablePlanSubmit', { executablePlanIDs: id }, function (data) { if (data.IsSuccess == true) { $.messager.alert("系统提示", data.Message); $("#dgExecutablePlanList").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 ExecutablePlan_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 + '/ExecutablePlan/Report?MNU=' + mnu; var id = d.join(","); $.postWithLoading(CMS_SystemConfig.VirtualDirectoryPath + '/ExecutablePlan/CreateIDTempTable', { executablePlanIDs: 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 + '/ExecutablePlan/DeleteTempTable', { TempTableName: table }, function (data) { windowDiv.close(); return true; }); } return true; } }); }); } //设置列颜色为红色 function SetRedColumn(index, row, value) { return " " + value + ""; } //设置相应的行颜色为红色 function SetRedGrid(rowIndex, rowData) { if (rowData.PlanTypeID == outside) { return "color: red;"; } else { return ""; } } //Excel导出 function ExecutablePlan_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(); }