StudentEncourage.js 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289
  1. var url = CMS_SystemConfig.VirtualDirectoryPath + "/StudentEncourage/Edit";
  2. var mnu = "";
  3. //加载
  4. $(function () {
  5. mnu = $.SystemGeneral.getUrlParam("MNU");
  6. })
  7. //刷新
  8. function reload() {
  9. $("#dgStudentEncourageList").cmsXDataTable("load", $.getDataGridParams("dgStudentEncourageList"));
  10. }
  11. //获取选中的数据All
  12. function validChooseAll() {
  13. var d = [];
  14. $.each($("#dgStudentEncourageList").cmsXDataTable("getSelections"), function (index) {
  15. d.push(this);
  16. });
  17. return d;
  18. }
  19. //获取选中的数据
  20. function validChoose() {
  21. var d = [];
  22. $.each($("#dgStudentEncourageList").cmsXDataTable("getSelections"), function (index) {
  23. d.push(this.StudentEncourageID);
  24. });
  25. return d;
  26. }
  27. //获取选中的状态
  28. function validChooseStatus() {
  29. var d = [];
  30. $.each($("#dgStudentEncourageList").cmsXDataTable("getSelections"), function (index) {
  31. d.push(this.ApprovalStatus);
  32. });
  33. return d;
  34. }
  35. //查看
  36. function edit(rowindex, rowdata) {
  37. var redirectTo = CMS_SystemConfig.VirtualDirectoryPath + "/StudentEncourage/Edit?studentEncourageID=" + rowdata.StudentEncourageID + "&MNU=" + mnu + "&type=detail";
  38. $.popupTopWindow('学生奖励信息', redirectTo, 620, 385, null, null);
  39. }
  40. //新增
  41. function StudentEncourage_Add() {
  42. var d = validChoose();
  43. if (d.length > 0) {
  44. $.popupTopWindow('学生奖励复制新增', CMS_SystemConfig.VirtualDirectoryPath + '/StudentEncourage/CopyAdd?studentEncourageID=' + d[0] + '&MNU=' + mnu, 620, 385, null, null);
  45. } else {
  46. var redirectTo = url + "?MNU=" + mnu;
  47. $.popupTopWindow('学生奖励新增', redirectTo, 620, 385, null, null);
  48. }
  49. }
  50. //修改
  51. function StudentEncourage_Edit() {
  52. var d = validChoose();
  53. if (d == "") {
  54. $.messager.alert("系统提示", "请选择您要修改的信息。");
  55. return;
  56. }
  57. if (d.length > 1) {
  58. $.messager.alert("系统提示", "只能选择单个记录进行修改。");
  59. return;
  60. }
  61. var id = validChooseAll();
  62. if ($.grep(id, function (v, i) { return !(v.ApprovalStatus == startStatusID || v.ApprovalStatus == sendBackStatusID); }).length > 0) {
  63. $.messager.alert("系统提示", "只能对未提交、已退回状态的信息进行修改。");
  64. return;
  65. }
  66. var redirectTo = url + "?studentEncourageID=" + d + "&MNU=" + mnu + "&type=edit";
  67. $.popupTopWindow('学生奖励修改', redirectTo, 620, 385, null, null);
  68. }
  69. //批量修改
  70. SystemBatchModifyControl.OnSubmit = function () {
  71. var status = validChooseStatus().join(',');
  72. for (var i = 0; i < status.split(',').length; i++) {
  73. if (!(status.split(',')[i] == startStatusID || status.split(',')[i] == sendBackStatusID)) {
  74. $.messager.alert("系统提示", "只能对未提交、已退回状态的信息进行修改。");
  75. return false;
  76. }
  77. }
  78. }
  79. //删除
  80. function StudentEncourage_Delete() {
  81. var d = validChoose().join(',');
  82. if (d == "") {
  83. $.messager.alert("系统提示", "请选择您要删除的信息。");
  84. return;
  85. }
  86. $.messager.confirm("系统提示", "您确定要删除选择的信息?", function (r) {
  87. if (r) {
  88. $.postWithLoading(CMS_SystemConfig.VirtualDirectoryPath + '/StudentEncourage/Delete', { studentEncourageIDs: d }, function (data) {
  89. if (data.IsSuccess) {
  90. $.messager.alert("系统提示", data.Message);
  91. $("#dgStudentEncourageList").cmsXDataTable('load');
  92. } else {
  93. $.messager.alert("系统提示", data.Message);
  94. }
  95. });
  96. }
  97. });
  98. }
  99. //提交
  100. function StudentEncourage_Submit() {
  101. var d = validChoose().join(',');
  102. if (d.length == 0) {
  103. $.messager.alert("系统提示", "请选择您要提交的信息。");
  104. return;
  105. }
  106. var id = validChooseAll();
  107. if ($.grep(id, function (v, i) { return !(v.ApprovalStatus == startStatusID || v.ApprovalStatus == sendBackStatusID); }).length > 0) {
  108. $.messager.alert("系统提示", "只能对未提交、已退回状态的信息进行提交。");
  109. return;
  110. }
  111. $.messager.confirm("系统提示", "您确定要对选择的信息进行提交?", function (r) {
  112. if (r) {
  113. $.postWithLoading(CMS_SystemConfig.VirtualDirectoryPath + '/StudentEncourage/Submit', { studentEncourageIDs: d }, function (data) {
  114. if (data.IsSuccess == true) {
  115. $.messager.alert("系统提示", data.Message);
  116. $("#dgStudentEncourageList").cmsXDataTable('load');
  117. } else {
  118. $.messager.alert("系统提示", data.Message);
  119. }
  120. });
  121. }
  122. });
  123. }
  124. //审核
  125. function StudentEncourage_Approve() {
  126. var d = validChooseAll();
  127. if (d.length == 0) {
  128. $.messager.alert("系统提示", "请选择您要审核的信息。");
  129. return;
  130. }
  131. if ($.grep(d, function (v, i) { return (v.ApprovalStatus == startStatusID || v.ApprovalStatus == sendBackStatusID || v.ApprovalStatus == passNoEndStatusID || v.ApprovalStatus == endStatusID); }).length > 0) {
  132. $.messager.alert("系统提示", "只能对待审核的信息进行审核。");
  133. return;
  134. }
  135. var status = d[0].ApprovalStatus;
  136. if ($.grep(d, function (v, i) { return v.ApprovalStatus != status; }).length > 0) {
  137. $.messager.alert("系统提示", "只能对相同状态的待审核的信息进行批量审核。");
  138. return;
  139. }
  140. var studentEncourageIDs = validChoose();
  141. if (studentEncourageIDs.length > 1) {
  142. //批量审核
  143. var approveID = studentEncourageIDs[0];
  144. $.popupTopWindow('审核信息', CMS_SystemConfig.VirtualDirectoryPath + '/Common/ApproveHandler?TableName=EM_StudentEncourage&FormID=' + approveID,
  145. 400, 300, StudentEncourage_ApproveConfirm);
  146. }
  147. else {
  148. var studentEncourageID = studentEncourageIDs;
  149. //单个审核
  150. var redirectTo = CMS_SystemConfig.VirtualDirectoryPath + "/StudentEncourage/Approve?MNU=" + mnu + "&studentEncourageID=" + studentEncourageID;
  151. $.popupTopWindow('学生奖励审核', redirectTo, 620, 450, null, null);
  152. }
  153. }
  154. //确定(审核)
  155. function StudentEncourage_ApproveConfirm(action) {
  156. if (!action) {
  157. return;
  158. }
  159. if (action.ActionID == "") {
  160. return;
  161. }
  162. var approveIDs = validChoose().join(',');
  163. $.postWithLoading(CMS_SystemConfig.VirtualDirectoryPath + "/StudentEncourage/ApproveConfirm", { studentEncourageIDs: approveIDs, actionID: action.Action, comment: action.Comment },
  164. function (data) {
  165. if (data.IsSuccess) {
  166. reload();
  167. }
  168. $.messager.alert("系统提示", data.Message);
  169. }, 'json');
  170. }
  171. //撤销
  172. function StudentEncourage_Cancel() {
  173. var d = validChooseAll();
  174. if (d.length == 0) {
  175. $.messager.alert("系统提示", "请选择您要撤销的信息。");
  176. return;
  177. }
  178. if ($.grep(d, function (v, i) { return v.ApprovalStatus != passNoEndStatusID; }).length > 0) {
  179. $.messager.alert("系统提示", "只能对审核通过的信息进行撤销。");
  180. return;
  181. }
  182. var studentEncourageIDs = validChoose();
  183. if (studentEncourageIDs.length > 1) {
  184. //批量撤销
  185. var approveID = studentEncourageIDs[0];
  186. $.popupTopWindow('撤销信息', CMS_SystemConfig.VirtualDirectoryPath + '/Common/ApproveHandler?TableName=EM_StudentEncourage&FormID=' + approveID,
  187. 400, 300, StudentEncourage_CancelConfirm);
  188. }
  189. else {
  190. var studentEncourageID = studentEncourageIDs;
  191. //单个撤销
  192. var redirectTo = CMS_SystemConfig.VirtualDirectoryPath + "/StudentEncourage/Cancel?MNU=" + mnu + "&studentEncourageID=" + studentEncourageID;
  193. $.popupTopWindow('学生奖励撤销', redirectTo, 620, 450, null, null);
  194. }
  195. }
  196. //确定(撤销)
  197. function StudentEncourage_CancelConfirm(action) {
  198. if (!action) {
  199. return;
  200. }
  201. if (action.ActionID == "") {
  202. return;
  203. }
  204. var approveIDs = validChoose().join(',');
  205. $.postWithLoading(CMS_SystemConfig.VirtualDirectoryPath + "/StudentEncourage/CancelConfirm", { studentEncourageIDs: approveIDs, actionID: action.Action, comment: action.Comment },
  206. function (data) {
  207. if (data.IsSuccess) {
  208. reload();
  209. }
  210. $.messager.alert("系统提示", data.Message);
  211. }, 'json');
  212. }
  213. //Excel导出
  214. function StudentEncourage_Export() {
  215. $("#formQuery").submit();
  216. }
  217. //联动查询
  218. function queryCampus(data) {
  219. var campusID = $("#CampusDropdown").combogridX("getValue");
  220. var jsonString = "({'QueryParamsDatas':'CampusDropdown|*|" + campusID + "|@|'})";
  221. $("#CollegeDropdown").combogridX("reload", eval(jsonString));
  222. queryClass();
  223. }
  224. function queryCollege(data) {
  225. var campusID = $("#CampusDropdown").combogridX("getValue");
  226. var collegeID = $("#CollegeDropdown").combogridX("getValue");
  227. var jsonString = "({'QueryParamsDatas':'CampusDropdown|*|" + campusID + "|@|";
  228. jsonString += "CollegeDropdown|*|" + collegeID + "|@|'})";
  229. $("#CollegeDropdown").combogridX("reload", eval(jsonString));
  230. $("#DictionaryStandard").combogridX("reload", eval(jsonString));
  231. queryClass();
  232. }
  233. function queryGrade(data) {
  234. queryClass();
  235. }
  236. function queryStandard(data) {
  237. queryClass();
  238. }
  239. function queryLearnSystem(data) {
  240. queryClass();
  241. }
  242. function queryClass() {
  243. var jsonString = "";
  244. var parameterString = "";
  245. var campusID = $("#CampusDropdown").combogridX("getValue");
  246. var collegeID = $("#CollegeDropdown").combogridX("getValue");
  247. var gradeID = $("#DictionaryGrade").combogridX("getValue");
  248. var standardID = $("#DictionaryStandard").combogridX("getValue");
  249. var educationID = $("#DictionaryEducation").combogridX("getValue");
  250. var learningformID = $("#DictionaryLearningform").combogridX("getValue");
  251. var learnSystem = $("#DictionaryLearnSystem").combogridX("getValue");
  252. if (campusID != nonSelect) parameterString += "CampusDropdown|*|" + campusID + "|@|";
  253. if (collegeID != nonSelect) parameterString += "CollegeDropdown|*|" + collegeID + "|@|";
  254. if (gradeID != nonSelect) parameterString += "DictionaryGrade|*|" + gradeID + "|@|";
  255. if (standardID != nonSelect) parameterString += "DictionaryStandard|*|" + standardID + "|@|";
  256. if (educationID != nonSelect) parameterString += "DictionaryEducation|*|" + educationID + "|@|";
  257. if (learningformID != nonSelect) parameterString += "DictionaryLearningform|*|" + learningformID + "|@|";
  258. if (learnSystem != nonSelect) parameterString += "DictionaryLearnSystem|*|" + learnSystem + "|@|";
  259. if (parameterString != "") {
  260. jsonString = "({'QueryParamsDatas':'" + parameterString + "'})";
  261. $("#DictionaryStandard").combogridX("reload", eval(jsonString));
  262. }
  263. else {
  264. $("#DictionaryStandard").combogridX("reload");
  265. }
  266. reload();
  267. }