TeachingMaterialPool.js 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. var url = CMS_SystemConfig.VirtualDirectoryPath + "/TeachingMaterialPool/Edit";
  2. var mnu = "";
  3. //加载
  4. $(function () {
  5. mnu = $.SystemGeneral.getUrlParam("MNU");
  6. })
  7. //function validChooseCoursematerial() {
  8. // var d = [];
  9. // $.each($("#dgCoursematerialList").cmsXDataTable("getSelections"), function (index) {
  10. // d.push(this.CoursematerialID);
  11. // });
  12. // return d;
  13. //}
  14. //新增
  15. function TeachingMaterialPool_Add() {
  16. var redirectTo = url + '?MNU=' + mnu;
  17. $.popupTopWindow('教材信息新增', redirectTo, 750, 450, null, null);
  18. }
  19. function reload() {
  20. $("#dgTeachingMaterialPoolList").cmsXDataTable("load", $.getDataGridParams("dgTeachingMaterialPoolList"));
  21. }
  22. //获取选中的数据
  23. function validChoose() {
  24. var d = [];
  25. $.each($("#dgTeachingMaterialPoolList").cmsXDataTable("getSelections"), function (index) {
  26. d.push(this.TeachingMaterialPoolID);
  27. });
  28. return d;
  29. }
  30. function TeachingMaterialPool_Save() {
  31. alert("保存");
  32. }
  33. //点击列表更新
  34. function edit(rowindex, rowdata) {
  35. var redirectTo = url + "?teachingMaterialPoolID=" + rowdata.TeachingMaterialPoolID + "&MNU=" + mnu + "&isView=1";
  36. $.popupTopWindow("教材基本信息详情", redirectTo, 750, 450, null, null);
  37. }
  38. //修改按钮
  39. function TeachingMaterialPool_Update() {
  40. var d = validChoose();
  41. if (d.length == 0) {
  42. $.messager.alert("系统提示", "请选择您要修改的教材信息。");
  43. return;
  44. }
  45. if (d.length > 1) {
  46. $.messager.alert("系统提示", "只能选择单个记录进行修改。");
  47. return;
  48. }
  49. var redirectTo = url + "?teachingMaterialPoolID=" + d + "&MNU=" + mnu;
  50. $.popupTopWindow("教材基本信息修改", redirectTo, 750, 450, null, null);
  51. }
  52. //删除
  53. function TeachingMaterialPool_Delete() {
  54. var d = validChoose().join(',');
  55. if (d == "") {
  56. $.messager.alert("系统提示", "请选择您要删除的教材信息!");
  57. return;
  58. }
  59. $.messager.confirm("系统提示", "您确定要删除该教材信息?", function (r) {
  60. if (r) {
  61. $.post(CMS_SystemConfig.VirtualDirectoryPath + '/TeachingMaterialPool/Delete', { teachingMaterialPoolIDs: d }, function (data) {
  62. if (data == "删除成功") {
  63. $.messager.alert("系统提示", "删除成功!");
  64. $("#dgTeachingMaterialPoolList").cmsXDataTable('load');
  65. } else {
  66. $.messager.alert("系统提示", data);
  67. }
  68. });
  69. }
  70. });
  71. }
  72. //导入
  73. function TeachingMaterialPool_Import() {
  74. var redirectTo = CMS_SystemConfig.VirtualDirectoryPath + '/TeachingMaterialPool/Import?MNU=' + mnu;
  75. $.popupTopWindow('教材信息导入', redirectTo, 400, 300, null, null);
  76. }
  77. function TeachingMaterialPool_Export() {
  78. $("#formQuery").submit();
  79. }
  80. function QueryPublishDropdownList(data) {
  81. reload();
  82. }
  83. function QueryCourseDropdownList(data) {
  84. reload();
  85. }
  86. function QueryLateDropdownList(data) {
  87. reload();
  88. }
  89. //教材类型
  90. function QueryTeachingMaterialTypeDropdownList() {
  91. reload();
  92. }
  93. function QueryTeachingMaterialDropdownList() {
  94. reload();
  95. }
  96. function Coursematerial_Add() {
  97. $.popupTopWindow('课程信息', CMS_SystemConfig.VirtualDirectoryPath + '/Common/CoursematerialSelect', 700, 400, CoursematerialSelect_Close);
  98. }
  99. function CoursematerialSelect_Close(coursematerialList) {
  100. if (!coursematerialList) return;
  101. if (coursematerialList.length == 0) return;
  102. var coursematerialViewList = $("#dgCoursematerialList").cmsXDataTable("getRows");
  103. $.each(coursematerialList, function (index, value) {
  104. if ($.grep(coursematerialViewList, function (row, index) { return value.CoursematerialID == row.CoursematerialID; }).length == 0) {
  105. coursematerialViewList.push({
  106. CoursematerialID: value.CoursematerialID,
  107. ClassGroupingID: value.ClassGroupingID,
  108. CourseCode: value.CourseCode,
  109. CourseName: value.CourseName,
  110. Abbreviation: value.Abbreviation,
  111. EnglishName: value.EnglishName,
  112. StandardName: value.StandardName,
  113. CourseEdition: value.CourseEdition,
  114. CourseSynopsis: value.CourseSynopsis,
  115. CourseReserve: value.CourseReserve,
  116. IsEnable: value.IsEnable,
  117. IsEnableName: value.IsEnableName,
  118. CourseLevelID: value.CourseLevelID,
  119. CourseLevelName: value.CourseLevelName,
  120. CourseScienceID: value.CourseScienceID,
  121. CourseScienceName: value.CourseScienceName,
  122. CreateUserID: value.CreateUserID,
  123. CreateTime: value.CreateTime,
  124. Remarks: value.Remarks
  125. });
  126. }
  127. });
  128. $("#dgCoursematerialList").cmsXDataTable("loadData", { rows: coursematerialViewList, total: coursematerialViewList.length });
  129. }
  130. //获取选中的数据
  131. function validChooseCoursematerial() {
  132. var d = [];
  133. $.each($("#dgCoursematerialList").cmsXDataTable("getSelections"), function (index) {
  134. d.push(this.CoursematerialID);
  135. });
  136. return d;
  137. }
  138. function Coursematerial_Remove() {
  139. var d = validChooseCoursematerial();
  140. var coursematerialViewList = $("#dgCoursematerialList").cmsXDataTable("getRows");
  141. var i, j;
  142. var len = coursematerialViewList.length;
  143. for (i = len - 1; i >= 0; i--) {
  144. for (j = 0; j < d.length; j++) {
  145. if (coursematerialViewList[i].CoursematerialID == d[j].toString()) {//修改删除判断
  146. coursematerialViewList.splice(i, 1);
  147. break;
  148. }
  149. }
  150. }
  151. $("#dgCoursematerialList").cmsXDataTable("loadData", { rows: coursematerialViewList, total: coursematerialViewList.length });
  152. }
  153. //勾选按钮
  154. function checkBox() {
  155. var jsonString = "({'QueryParamsDatas':'IsCheck|*|" + document.getElementById("isCheck").checked + "|@|'})";
  156. reload();
  157. }