var url = CMS_SystemConfig.VirtualDirectoryPath + "/SpecialtyClassSetting/Edit"; var mnu = ""; //加载 $(function () { mnu = $.SystemGeneral.getUrlParam("MNU"); }) //刷新 function reload() { $("#dgSpecialtyClassSettingList").cmsXDataTable("load", $.getDataGridParams("dgSpecialtyClassSettingList")); } //获取选中的数据 function validChoose() { var d = []; $.each($("#dgSpecialtyClassSettingList").cmsXDataTable("getSelections"), function (index) { d.push(this.SpecialtyClassSettingID); }); return d; } //新增 function SpecialtyClassSetting_Add() { //var d = validChoose(); //if (d.length > 0) { // $.popupTopWindow('专业分班复制新增', CMS_SystemConfig.VirtualDirectoryPath + '/SpecialtyClassSetting/CopyAdd?specialtyClassSettingID=' + d[0] + '&MNU=' + mnu, 600, 300, null, null); //} else { // var redirectTo = url + "?MNU=" + mnu; // $.popupTopWindow('专业分班新增', redirectTo, 600, 300, null, null); //} //采用以下方式进行新增 var redirectTo = CMS_SystemConfig.VirtualDirectoryPath + "/SpecialtyClassSetting/SpecialtyClassSettingBatchAdd" + "?MNU=" + mnu; $.popupTopWindow('专业分班新增', redirectTo, 750, 500, reload, null); } //修改按钮 function SpecialtyClassSetting_Update() { var d = validChoose(); if (d == "") { $.messager.alert("系统提示", "请选择您要修改的信息。"); return; } if (d.length > 1) { $.messager.alert("系统提示", "只能选择单个记录进行修改。"); return; } var redirectTo = url + "?specialtyClassSettingID=" + d + "&MNU=" + mnu + "&type=edit"; $.popupTopWindow('专业分班修改', redirectTo, 600, 300, null, null); } //查看 function edit(rowindex, rowdata) { var redirectTo = url + "?specialtyClassSettingID=" + rowdata.SpecialtyClassSettingID + "&MNU=" + mnu + "&type=detail"; $.popupTopWindow('专业分班信息', redirectTo, 600, 300, null, null); } //批量修改(重写) SystemBatchModifyControl.OnSubmit = function () { //计划招生人数 if (document.getElementById("PlanRecruitStudentCountNumberBox_div").style.display != "none") { var planRecruitStudentCount = $("#PlanRecruitStudentCount_NumberBox").val(); if (planRecruitStudentCount == null || planRecruitStudentCount == "") { $.messager.alert("系统提示", "请输入计划招生人数。"); return false; } //非负的整数(/^\d+$/) var reg = /^\d+$/; if (!reg.test(planRecruitStudentCount)) { $.messager.alert("系统提示", "请输入非负整数。"); return false; } var d = validChoose().join(','); if (d == "") { return; } if (parseInt(planRecruitStudentCount) >= 0) { $.messager.confirm("系统提示", "您确定要批量修改选择的信息吗?", function (r) { if (r) { $.postWithLoading(CMS_SystemConfig.VirtualDirectoryPath + '/SpecialtyClassSetting/BatchModifyControl', { specialtyClassSettingIDs: d, planRecruitStudentCount: planRecruitStudentCount, classArrangeStudentCount: classArrangeStudentCount, classMaxStudentCount: classMaxStudentCount }, function (data) { if (data.IsSuccess) { $.messager.alert("系统提示", data.Message); reload(); } }); } }); return true; } } else if (document.getElementById("ClassArrangeStudentCountNumberBox_div").style.display != "none") { //每班预招人数 var classArrangeStudentCount = $("#ClassArrangeStudentCount_NumberBox").val(); if (classArrangeStudentCount == null || classArrangeStudentCount == "") { $.messager.alert("系统提示", "请输入每班预招人数。"); return false; } //非负的整数(/^\d+$/) var reg = /^\d+$/; if (!reg.test(classArrangeStudentCount)) { $.messager.alert("系统提示", "请输入非负整数。"); return false; } var d = validChoose().join(','); if (d == "") { return; } if (parseInt(classArrangeStudentCount) >= 0) { $.messager.confirm("系统提示", "您确定要批量修改选择的信息吗?", function (r) { if (r) { $.postWithLoading(CMS_SystemConfig.VirtualDirectoryPath + '/SpecialtyClassSetting/BatchModifyControl', { specialtyClassSettingIDs: d, planRecruitStudentCount: planRecruitStudentCount, classArrangeStudentCount: classArrangeStudentCount, classMaxStudentCount: classMaxStudentCount }, function (data) { if (data.IsSuccess) { $.messager.alert("系统提示", data.Message); reload(); } }); } }); return true; } } else if (document.getElementById("ClassMaxStudentCountNumberBox_div").style.display != "none") { //每班最大人数 var classMaxStudentCount = $("#ClassMaxStudentCount_NumberBox").val(); if (classMaxStudentCount == null || classMaxStudentCount == "") { $.messager.alert("系统提示", "请输入每班最大人数。"); return false; } //非负的整数(/^\d+$/) var reg = /^\d+$/; if (!reg.test(classMaxStudentCount)) { $.messager.alert("系统提示", "请输入非负整数。"); return false; } var d = validChoose().join(','); if (d == "") { return; } if (parseInt(classMaxStudentCount) >= 0) { $.messager.confirm("系统提示", "您确定要批量修改选择的信息吗?", function (r) { if (r) { $.postWithLoading(CMS_SystemConfig.VirtualDirectoryPath + '/SpecialtyClassSetting/BatchModifyControl', { specialtyClassSettingIDs: d, planRecruitStudentCount: planRecruitStudentCount, classArrangeStudentCount: classArrangeStudentCount, classMaxStudentCount: classMaxStudentCount }, function (data) { if (data.IsSuccess) { $.messager.alert("系统提示", data.Message); reload(); } }); } }); return true; } } } //删除 function SpecialtyClassSetting_Delete() { var d = validChoose().join(','); if (d == "") { $.messager.alert("系统提示", "请选择您要删除的信息。"); return; } $.messager.confirm("系统提示", "您确定要删除选择的信息?", function (r) { if (r) { $.postWithLoading(CMS_SystemConfig.VirtualDirectoryPath + '/SpecialtyClassSetting/Delete', { specialtyClassSettingIDs: d }, function (data) { if (data.IsSuccess) { $.messager.alert("系统提示", data.Message); $("#dgSpecialtyClassSettingList").cmsXDataTable('load'); } else { $.messager.alert("系统提示", data.Message); } }); } }); } //设置列颜色为红色 function SetRedColumn(index, row, value) { return " " + value + ""; } //Excel导出 function SpecialtyClassSetting_Export() { $("#formQuery").submit(); } //联动 function queryStandard(data) { reload(); } function queryEducation(data) { reload(); } function queryLearningform(data) { reload(); }