var url = CMS_SystemConfig.VirtualDirectoryPath + "/Coursematerial/Edit"; var mnu = ""; //加载 $(function () { mnu = $.SystemGeneral.getUrlParam("MNU"); }) //刷新 function reload() { $("#dgCoursematerialList").cmsXDataTable("load", $.getDataGridParams("dgCoursematerialList")); } //获取选中的数据 function validChoose() { var d = []; $.each($("#dgCoursematerialList").cmsXDataTable("getSelections"), function (index) { d.push(this.CoursematerialID); }); return d; } //新增 function Coursematerial_Add() { var d = validChoose(); if (d.length > 0) { $.popupTopWindow('课程信息复制新增', CMS_SystemConfig.VirtualDirectoryPath + '/Coursematerial/CopyAdd?coursematerialID=' + d[0] + '&MNU=' + mnu, 700, 420, null, null); } else { var redirectTo = url + "?MNU=" + mnu; $.popupTopWindow('课程信息新增', redirectTo, 700, 420, null, null); } } //修改 function Coursematerial_Edit() { var d = validChoose(); if (d == "") { $.messager.alert("系统提示", "请选择您要修改的信息。"); return; } if (d.length > 1) { $.messager.alert("系统提示", "只能选择单个记录进行修改。"); return; } var redirectTo = url + "?coursematerialID=" + d + "&MNU=" + mnu + "&type=edit"; $.popupTopWindow('课程信息修改', redirectTo, 700, 420, null, null); } //明细查看 function edit(rowindex, rowdata) { var redirectTo = url + "?coursematerialID=" + rowdata.CoursematerialID + "&MNU=" + mnu + "&type=detail"; $.popupTopWindow('课程信息明细', redirectTo, 700, 420, 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 Coursematerial_Delete() { var d = validChoose().join(','); if (d == "") { $.messager.alert("系统提示", "请选择您要删除的信息。"); return; } $.messager.confirm("系统提示", "您确定要删除选择的信息?", function (r) { if (r) { $.postWithLoading(CMS_SystemConfig.VirtualDirectoryPath + '/Coursematerial/Delete', { coursematerialIDs: d }, function (data) { if (data.IsSuccess) { $.messager.alert("系统提示", data.Message); $("#dgCoursematerialList").cmsXDataTable('load'); } else { $.messager.alert("系统提示", data.Message); } }); } }); } //设置列颜色为红色 function SetRedColumn(index, row, value) { return " " + value + ""; } //设置相应的行颜色为红色 function SetRedGrid(rowIndex, rowData) { if (rowData.IsEnable != true) { return "color: red;"; } else { return ""; } } //Excel导出 function Coursematerial_Export() { $("#formQuery").submit(); } //Excel导入 function Coursematerial_Import() { var redirectTo = CMS_SystemConfig.VirtualDirectoryPath + '/Coursematerial/Import?MNU=' + mnu; $.popupTopWindow('课程信息导入', redirectTo, 420, 300, reload); }