Coursematerial.js 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. var url = CMS_SystemConfig.VirtualDirectoryPath + "/Coursematerial/Edit";
  2. var mnu = "";
  3. //加载
  4. $(function () {
  5. mnu = $.SystemGeneral.getUrlParam("MNU");
  6. })
  7. //刷新
  8. function reload() {
  9. $("#dgCoursematerialList").cmsXDataTable("load", $.getDataGridParams("dgCoursematerialList"));
  10. }
  11. //获取选中的数据
  12. function validChoose() {
  13. var d = [];
  14. $.each($("#dgCoursematerialList").cmsXDataTable("getSelections"), function (index) {
  15. d.push(this.CoursematerialID);
  16. });
  17. return d;
  18. }
  19. //新增
  20. function Coursematerial_Add() {
  21. var d = validChoose();
  22. if (d.length > 0) {
  23. $.popupTopWindow('课程信息复制新增', CMS_SystemConfig.VirtualDirectoryPath + '/Coursematerial/CopyAdd?coursematerialID=' + d[0] + '&MNU=' + mnu, 700, 420, null, null);
  24. } else {
  25. var redirectTo = url + "?MNU=" + mnu;
  26. $.popupTopWindow('课程信息新增', redirectTo, 700, 420, null, null);
  27. }
  28. }
  29. //修改
  30. function Coursematerial_Edit() {
  31. var d = validChoose();
  32. if (d == "") {
  33. $.messager.alert("系统提示", "请选择您要修改的信息。");
  34. return;
  35. }
  36. if (d.length > 1) {
  37. $.messager.alert("系统提示", "只能选择单个记录进行修改。");
  38. return;
  39. }
  40. var redirectTo = url + "?coursematerialID=" + d + "&MNU=" + mnu + "&type=edit";
  41. $.popupTopWindow('课程信息修改', redirectTo, 700, 420, null, null);
  42. }
  43. //明细查看
  44. function edit(rowindex, rowdata) {
  45. var redirectTo = url + "?coursematerialID=" + rowdata.CoursematerialID + "&MNU=" + mnu + "&type=detail";
  46. $.popupTopWindow('课程信息明细', redirectTo, 700, 420, null, null);
  47. }
  48. //课程信息对应的上课类型明细
  49. function editClassGrouping(rowindex, rowdata) {
  50. var redirectTo = CMS_SystemConfig.VirtualDirectoryPath + "/TeachType/Edit?classGroupingID=" + rowdata.ClassGroupingID + "&MNU=" + mnu + "&type=detail";
  51. $.popupTopWindow('上课类型明细', redirectTo, 720, 480, null, null);
  52. }
  53. //删除
  54. function Coursematerial_Delete() {
  55. var d = validChoose().join(',');
  56. if (d == "") {
  57. $.messager.alert("系统提示", "请选择您要删除的信息。");
  58. return;
  59. }
  60. $.messager.confirm("系统提示", "您确定要删除选择的信息?", function (r) {
  61. if (r) {
  62. $.postWithLoading(CMS_SystemConfig.VirtualDirectoryPath + '/Coursematerial/Delete', { coursematerialIDs: d }, function (data) {
  63. if (data.IsSuccess) {
  64. $.messager.alert("系统提示", data.Message);
  65. $("#dgCoursematerialList").cmsXDataTable('load');
  66. } else {
  67. $.messager.alert("系统提示", data.Message);
  68. }
  69. });
  70. }
  71. });
  72. }
  73. //设置列颜色为红色
  74. function SetRedColumn(index, row, value) {
  75. return " <span style=\"color: red;\">" + value + "</span>";
  76. }
  77. //设置相应的行颜色为红色
  78. function SetRedGrid(rowIndex, rowData) {
  79. if (rowData.IsEnable != true) {
  80. return "color: red;";
  81. } else {
  82. return "";
  83. }
  84. }
  85. //Excel导出
  86. function Coursematerial_Export() {
  87. $("#formQuery").submit();
  88. }
  89. //Excel导入
  90. function Coursematerial_Import() {
  91. var redirectTo = CMS_SystemConfig.VirtualDirectoryPath + '/Coursematerial/Import?MNU=' + mnu;
  92. $.popupTopWindow('课程信息导入', redirectTo, 420, 300, reload);
  93. }