var url = CMS_SystemConfig.VirtualDirectoryPath + "/TeachingMaterialPool/Edit"; var mnu = ""; //加载 $(function () { mnu = $.SystemGeneral.getUrlParam("MNU"); }) //function validChooseCoursematerial() { // var d = []; // $.each($("#dgCoursematerialList").cmsXDataTable("getSelections"), function (index) { // d.push(this.CoursematerialID); // }); // return d; //} //新增 function TeachingMaterialPool_Add() { var redirectTo = url + '?MNU=' + mnu; $.popupTopWindow('教材信息新增', redirectTo, 750, 450, null, null); } function reload() { $("#dgTeachingMaterialPoolList").cmsXDataTable("load", $.getDataGridParams("dgTeachingMaterialPoolList")); } //获取选中的数据 function validChoose() { var d = []; $.each($("#dgTeachingMaterialPoolList").cmsXDataTable("getSelections"), function (index) { d.push(this.TeachingMaterialPoolID); }); return d; } function TeachingMaterialPool_Save() { alert("保存"); } //点击列表更新 function edit(rowindex, rowdata) { var redirectTo = url + "?teachingMaterialPoolID=" + rowdata.TeachingMaterialPoolID + "&MNU=" + mnu + "&isView=1"; $.popupTopWindow("教材基本信息详情", redirectTo, 750, 450, null, null); } //修改按钮 function TeachingMaterialPool_Update() { var d = validChoose(); if (d.length == 0) { $.messager.alert("系统提示", "请选择您要修改的教材信息。"); return; } if (d.length > 1) { $.messager.alert("系统提示", "只能选择单个记录进行修改。"); return; } var redirectTo = url + "?teachingMaterialPoolID=" + d + "&MNU=" + mnu; $.popupTopWindow("教材基本信息修改", redirectTo, 750, 450, null, null); } //删除 function TeachingMaterialPool_Delete() { var d = validChoose().join(','); if (d == "") { $.messager.alert("系统提示", "请选择您要删除的教材信息!"); return; } $.messager.confirm("系统提示", "您确定要删除该教材信息?", function (r) { if (r) { $.post(CMS_SystemConfig.VirtualDirectoryPath + '/TeachingMaterialPool/Delete', { teachingMaterialPoolIDs: d }, function (data) { if (data == "删除成功") { $.messager.alert("系统提示", "删除成功!"); $("#dgTeachingMaterialPoolList").cmsXDataTable('load'); } else { $.messager.alert("系统提示", data); } }); } }); } //导入 function TeachingMaterialPool_Import() { var redirectTo = CMS_SystemConfig.VirtualDirectoryPath + '/TeachingMaterialPool/Import?MNU=' + mnu; $.popupTopWindow('教材信息导入', redirectTo, 400, 300, null, null); } function TeachingMaterialPool_Export() { $("#formQuery").submit(); } function QueryPublishDropdownList(data) { reload(); } function QueryCourseDropdownList(data) { reload(); } function QueryLateDropdownList(data) { reload(); } //教材类型 function QueryTeachingMaterialTypeDropdownList() { reload(); } function QueryTeachingMaterialDropdownList() { reload(); } function Coursematerial_Add() { $.popupTopWindow('课程信息', CMS_SystemConfig.VirtualDirectoryPath + '/Common/CoursematerialSelect', 700, 400, CoursematerialSelect_Close); } function CoursematerialSelect_Close(coursematerialList) { if (!coursematerialList) return; if (coursematerialList.length == 0) return; var coursematerialViewList = $("#dgCoursematerialList").cmsXDataTable("getRows"); $.each(coursematerialList, function (index, value) { if ($.grep(coursematerialViewList, function (row, index) { return value.CoursematerialID == row.CoursematerialID; }).length == 0) { coursematerialViewList.push({ CoursematerialID: value.CoursematerialID, ClassGroupingID: value.ClassGroupingID, CourseCode: value.CourseCode, CourseName: value.CourseName, Abbreviation: value.Abbreviation, EnglishName: value.EnglishName, StandardName: value.StandardName, CourseEdition: value.CourseEdition, CourseSynopsis: value.CourseSynopsis, CourseReserve: value.CourseReserve, IsEnable: value.IsEnable, IsEnableName: value.IsEnableName, CourseLevelID: value.CourseLevelID, CourseLevelName: value.CourseLevelName, CourseScienceID: value.CourseScienceID, CourseScienceName: value.CourseScienceName, CreateUserID: value.CreateUserID, CreateTime: value.CreateTime, Remarks: value.Remarks }); } }); $("#dgCoursematerialList").cmsXDataTable("loadData", { rows: coursematerialViewList, total: coursematerialViewList.length }); } //获取选中的数据 function validChooseCoursematerial() { var d = []; $.each($("#dgCoursematerialList").cmsXDataTable("getSelections"), function (index) { d.push(this.CoursematerialID); }); return d; } function Coursematerial_Remove() { var d = validChooseCoursematerial(); var coursematerialViewList = $("#dgCoursematerialList").cmsXDataTable("getRows"); var i, j; var len = coursematerialViewList.length; for (i = len - 1; i >= 0; i--) { for (j = 0; j < d.length; j++) { if (coursematerialViewList[i].CoursematerialID == d[j].toString()) {//修改删除判断 coursematerialViewList.splice(i, 1); break; } } } $("#dgCoursematerialList").cmsXDataTable("loadData", { rows: coursematerialViewList, total: coursematerialViewList.length }); } //勾选按钮 function checkBox() { var jsonString = "({'QueryParamsDatas':'IsCheck|*|" + document.getElementById("isCheck").checked + "|@|'})"; reload(); }