ExaminationSubject.js 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. var url = CMS_SystemConfig.VirtualDirectoryPath + "/ExaminationSubject/Edit";
  2. var mnu;
  3. $(function () {
  4. mnu = $.SystemGeneral.getUrlParam("MNU");
  5. });
  6. function ExaminationSubject_Export() {
  7. $(document.forms[0]).submit();
  8. }
  9. function ExaminationSubject_Add() {
  10. redirectTo = url + "?MNU=" + mnu;
  11. $.popupTopWindow("考试科目新增", redirectTo, 810, 350, null, null);
  12. }
  13. function reload() {
  14. $("#dgExaminationSubjectList").cmsXDataTable("load", $.getDataGridParams("dgExaminationSubjectList"));
  15. }
  16. //获取选中的数据
  17. function validChoose() {
  18. var d = [];
  19. $.each($("#dgExaminationSubjectList").cmsXDataTable("getSelections"), function (index) {
  20. d.push(this.ExaminationSubjectID);
  21. });
  22. return d;
  23. }
  24. function validChooseName() {
  25. var d = [];
  26. $.each($("#dgExaminationSubjectList").cmsXDataTable("getSelections"), function (index) {
  27. d.push(this.Name);
  28. });
  29. return d;
  30. }
  31. function validChooseExaminationTypeID() {
  32. var d = [];
  33. $.each($("#dgExaminationSubjectList").cmsXDataTable("getSelections"), function (index) {
  34. d.push(this.ExaminationTypeID);
  35. });
  36. return d;
  37. }
  38. function validChooseExaminationFormID() {
  39. var d = [];
  40. $.each($("#dgExaminationSubjectList").cmsXDataTable("getSelections"), function (index) {
  41. d.push(this.ExaminationFormID);
  42. });
  43. return d;
  44. }
  45. function validChooseSchoolyearID() {
  46. var d = [];
  47. $.each($("#dgExaminationSubjectList").cmsXDataTable("getSelections"), function (index) {
  48. d.push(this.SchoolyearID);
  49. });
  50. return d;
  51. }
  52. //批量修改执行前触发事件
  53. SystemBatchModifyControl.OnSubmit = function (a) {
  54. if (document.getElementById("ExaminationTypeIDDropdownList_div").style.display != "none") {
  55. var examinationFormID = validChooseExaminationFormID();
  56. var examinationFormIDs = validChooseExaminationFormID().join(",");
  57. var schoolyearIDs = validChooseSchoolyearID().join(",");
  58. var names = validChooseName().join(",");
  59. var examinationTypeIDs = "";
  60. for (var i = 0; i < examinationFormID.length; i++) {
  61. examinationTypeIDs += $("#ExaminationTypeID_DropdownList").combobox("getValue") + ",";
  62. }
  63. examinationTypeIDs = examinationTypeIDs.substr(0, examinationTypeIDs.length - 1);
  64. var bool = true;
  65. $.ajax({ url: CMS_SystemConfig.VirtualDirectoryPath + '/ExaminationSubject/Validation?examinationTypeIDs=' + examinationTypeIDs + '&examinationFormIDs=' + examinationFormIDs + '&schoolyearIDs=' + schoolyearIDs + '&names=' + encodeURI(names),
  66. type: "post", dataType: "json", async: false,
  67. success: function (data) {
  68. if (data.IsSuccess != true) {
  69. $.messager.alert("系统提示", data.Message);
  70. bool = false;
  71. }
  72. }
  73. });
  74. if (bool != true)
  75. return false;
  76. }
  77. else if (document.getElementById("ExaminationFormIDDictionaryDropDownList_div").style.display != "none") {
  78. var examinationFormID = validChooseExaminationFormID();
  79. var examinationTypeIDs = validChooseExaminationTypeID().join(",");
  80. var schoolyearIDs = validChooseSchoolyearID().join(",");
  81. var names = validChooseName().join(",");
  82. var examinationFormIDs = "";
  83. for (var i = 0; i < examinationFormID.length; i++) {
  84. examinationFormIDs += $("#ExaminationFormID_DictionaryDropDownList").combobox("getValue") + ",";
  85. }
  86. examinationFormIDs = examinationFormIDs.substr(0, examinationFormIDs.length - 1);
  87. var bool = true;
  88. $.ajax({ url: CMS_SystemConfig.VirtualDirectoryPath + '/ExaminationSubject/Validation?examinationTypeIDs=' + examinationTypeIDs + '&examinationFormIDs=' + examinationFormIDs + '&schoolyearIDs=' + schoolyearIDs + '&names=' + encodeURI(names),
  89. type: "post", dataType: "json", async: false,
  90. success: function (data) {
  91. if (data.IsSuccess != true) {
  92. $.messager.alert("系统提示", data.Message);
  93. bool = false;
  94. }
  95. }
  96. });
  97. if (bool != true)
  98. return false;
  99. }
  100. else if (document.getElementById("SchoolyearIDDropdownList_div").style.display != "none") {
  101. var examinationFormID = validChooseExaminationFormID();
  102. var examinationTypeIDs = validChooseExaminationTypeID().join(",");
  103. var examinationFormIDs = validChooseExaminationFormID().join(",");
  104. var names = validChooseName().join(",");
  105. var schoolyearIDs = "";
  106. for (var i = 0; i < examinationFormID.length; i++) {
  107. schoolyearIDs += $("#SchoolyearID_DropdownList").combobox("getValue") + ",";
  108. }
  109. schoolyearIDs = schoolyearIDs.substr(0, schoolyearIDs.length - 1);
  110. var bool = true;
  111. $.ajax({ url: CMS_SystemConfig.VirtualDirectoryPath + '/ExaminationSubject/Validation?examinationTypeIDs=' + examinationTypeIDs + '&examinationFormIDs=' + examinationFormIDs + '&schoolyearIDs=' + schoolyearIDs + '&names=' + encodeURI(names),
  112. type: "post", dataType: "json", async: false,
  113. success: function (data) {
  114. if (data.IsSuccess != true) {
  115. $.messager.alert("系统提示", data.Message);
  116. bool = false;
  117. }
  118. }
  119. });
  120. if (bool != true)
  121. return false;
  122. }
  123. }
  124. //点击列表更新
  125. function edit(rowindex, rowdata) {
  126. redirectTo = url + "?ExaminationSubjectID=" + rowdata.ExaminationSubjectID + "&MNU=" + mnu + "&isView=1";
  127. $.popupTopWindow("考试科目新增", redirectTo, 810, 350, null, null);
  128. }
  129. //修改按钮
  130. function ExaminationSubject_Update() {
  131. var d = validChoose();
  132. if (d.length == 0) {
  133. $.messager.alert("系统提示", "请选择您要修改的考试科目。");
  134. return;
  135. }
  136. if (d.length > 1) {
  137. $.messager.alert("系统提示", "只能选择单个记录进行修改。");
  138. return;
  139. }
  140. redirectTo = url + "?ExaminationSubjectID=" + d + "&MNU=" + mnu;
  141. $.popupTopWindow("考试科目新增", redirectTo, 810, 350, null, null);
  142. }
  143. //删除
  144. function ExaminationSubject_Delete() {
  145. var d = validChoose().join(',');
  146. if (d == "") {
  147. $.messager.alert("系统提示", "请选择您要删除的考试科目。");
  148. return;
  149. }
  150. $.messager.confirm("系统提示", "您确定要删除该考试科目?", function (r) {
  151. if (r) {
  152. $.post(CMS_SystemConfig.VirtualDirectoryPath + '/ExaminationSubject/Delete', { examinationSubjectIDs: d }, function (data) {
  153. if (data == "删除成功") {
  154. $.messager.alert("系统提示", "删除成功!");
  155. $("#dgExaminationSubjectList").cmsXDataTable('load');
  156. } else {
  157. $.messager.alert("系统提示", data);
  158. }
  159. });
  160. }
  161. });
  162. }