var mnu = ""; //加载 $(function () { mnu = $.SystemGeneral.getUrlParam("MNU"); }) //添加学生 function Student_Add() { var studentDistributeID = $("#studentDistributeID").val(); var GrademajorID = $("#GrademajorID").val(); $.popupTopWindow('添加学生', CMS_SystemConfig.VirtualDirectoryPath + '/Common/StudentSelect?FromMNU=' + mnu + '&studentDistributeID=' + studentDistributeID + '&GrademajorID=' + GrademajorID, 650, 480, AddStudent_Confirm); } //确定 function AddStudent_Confirm(studentList) { //var studentViewList = $("#dgStudentList").cmsXDataTable("getRows"); //studentViewList 原列表数据 //$.each(studentList, function () { // studentViewList.push(this); //}); //$("#dgStudentList").cmsXDataTable("loadData", { rows: studentViewList, total: studentViewList.length }); if (studentList == undefined) return; var dataList = [{ "Text": "请选择", "Value": -1 }]; var studentViewList = $("#dgStudentList").cmsXDataTable("getRows"); //studentViewList 原列表数据 $.each(studentList, function (index, value) { if ($.grep(studentViewList, function (row, index) { return value.UserID == studentViewList[index].UserID; }).length == 0) { studentViewList.push({ UserID: value.UserID, LoginID: value.LoginID, Name: value.Name, CourseCode: value.CourseCode, TeachingMaterialCode: value.TeachingMaterialCode, CreateUserName: value.CreateUserName, CreateTime: value.CreateTime, Remark: value.Remark }); } }); $("#dgStudentList").cmsXDataTable("loadData", { rows: studentViewList, total: studentViewList.length }); } function validChoose() { var d = []; $.each($("#dgStudentList").cmsXDataTable("getSelections"), function (index) { d.push(this); }); return d; } //删除 function Student_Delete() { var d = validChoose(); if (d == "") { $.messager.alert("系统提示", "请选择您要删除的信息。"); return; } var studentViewList = $("#dgStudentList").cmsXDataTable("getRows"); var i, j; var len = studentViewList.length; for (i = len - 1; i >= 0; i--) { for (j = 0; j < d.length; j++) { if (studentViewList[i].UserID == d[j].UserID) { studentViewList.splice(i, 1); break; } } } $("#dgStudentList").cmsXDataTable("loadData", { rows: studentViewList, total: studentViewList.length }); } function success(data) { $.messager.alert('系统信息', data.Message); if (data.IsSuccess) { top.$('#sysWindow').window('close'); var tab = top.$('#index_center_tabs').tabs('getSelected'); tab.panel('refresh'); } }