StudentChange.js 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. var url = CMS_SystemConfig.VirtualDirectoryPath + "/StudentChange/Edit";
  2. var mnu = "";
  3. //加载
  4. $(function () {
  5. mnu = $.SystemGeneral.getUrlParam("MNU");
  6. })
  7. //刷新
  8. function reload() {
  9. $("#dgStudentChangeList").cmsXDataTable("load", $.getDataGridParams("dgStudentChangeList"));
  10. }
  11. //获取选中的数据All
  12. function validChooseAll() {
  13. var d = [];
  14. $.each($("#dgStudentChangeList").cmsXDataTable("getSelections"), function (index) {
  15. d.push(this);
  16. });
  17. return d;
  18. }
  19. //获取选中的数据
  20. function validChoose() {
  21. var d = [];
  22. $.each($("#dgStudentChangeList").cmsXDataTable("getSelections"), function (index) {
  23. d.push(this.StudentChangeID);
  24. });
  25. return d;
  26. }
  27. //查看明细
  28. function edit(rowindex, rowdata) {
  29. var redirectTo = url + "?studentChangeID=" + rowdata.StudentChangeID + "&MNU=" + mnu + "&type=detail";
  30. $.popupTopWindow('异动申请信息', redirectTo, 720, 550, null, null);
  31. }
  32. //申请
  33. function StudentChange_Add() {
  34. var redirectTo = url + "?MNU=" + mnu + "&isEnable=" + CMS_SystemConfig.StudentChangeIsEnabled;;
  35. $.popupTopWindow('异动申请新增', redirectTo, 720, 550, null, null);
  36. }
  37. //修改
  38. function StudentChange_Edit() {
  39. var d = validChoose();
  40. if (d.length == 0) {
  41. $.messager.alert("系统信息", "请选择您要修改的信息。");
  42. return;
  43. }
  44. if (d.length > 1) {
  45. $.messager.alert("系统信息", "只能选择单个记录进行修改。");
  46. return;
  47. }
  48. var id = validChooseAll();
  49. if ($.grep(id, function (v, i) { return !(v.ApprovalStatus == startStatusID || v.ApprovalStatus == sendBackStatusID); }).length > 0) {
  50. $.messager.alert("系统提示", "只能对未提交、已退回状态的信息进行修改。");
  51. return;
  52. }
  53. var redirectTo = url + "?studentChangeID=" + d + "&MNU=" + mnu + "&isEnable=" + CMS_SystemConfig.StudentChangeIsEnabled;
  54. $.popupTopWindow('异动申请修改', redirectTo, 720, 550, null, null);
  55. }
  56. //删除
  57. function StudentChange_Delete() {
  58. var d = validChoose().join(',');
  59. if (d == "") {
  60. $.messager.alert("系统提示", "请选择您要删除的信息。");
  61. return;
  62. }
  63. var id = validChooseAll();
  64. if ($.grep(id, function (v, i) { return !(v.ApprovalStatus == startStatusID || v.ApprovalStatus == sendBackStatusID); }).length > 0) {
  65. $.messager.alert("系统提示", "只能对未提交、已退回状态的信息进行删除。");
  66. return;
  67. }
  68. $.messager.confirm("系统提示", "您确定要删除选择的信息?", function (r) {
  69. if (r) {
  70. $.postWithLoading(CMS_SystemConfig.VirtualDirectoryPath + '/StudentChange/Delete', { studentChangeIDs: d }, function (data) {
  71. if (data.IsSuccess) {
  72. $.messager.alert("系统提示", data.Message);
  73. $("#dgStudentChangeList").cmsXDataTable('load');
  74. } else {
  75. $.messager.alert("系统提示", data.Message);
  76. }
  77. });
  78. }
  79. });
  80. }
  81. //提交
  82. function StudentChange_Submit() {
  83. var d = validChoose().join(',');
  84. if (d.length == 0) {
  85. $.messager.alert("系统提示", "请选择您要提交的信息。");
  86. return;
  87. }
  88. var id = validChooseAll();
  89. if ($.grep(id, function (v, i) { return !(v.ApprovalStatus == startStatusID || v.ApprovalStatus == sendBackStatusID); }).length > 0) {
  90. $.messager.alert("系统提示", "只能对未提交、已退回状态的信息进行提交。");
  91. return;
  92. }
  93. $.messager.confirm("系统提示", "您确定要对选择的信息进行提交?", function (r) {
  94. if (r) {
  95. $.postWithLoading(CMS_SystemConfig.VirtualDirectoryPath + '/StudentChange/Submit', { studentChangeIDs: d }, function (data) {
  96. if (data.IsSuccess == true) {
  97. $.messager.alert("系统提示", data.Message);
  98. $("#dgStudentChangeList").cmsXDataTable('load');
  99. } else {
  100. $.messager.alert("系统提示", data.Message);
  101. }
  102. });
  103. }
  104. });
  105. }
  106. //申请表打印
  107. function StudentChange_Report() {
  108. }
  109. //设置列颜色为红色
  110. function SetRedColumn(index, row, value) {
  111. return " <span style=\"color: red;\">" + value + "</span>";
  112. }
  113. //导出Excel
  114. function StudentChange_Export() {
  115. $("#formQuery").submit();
  116. }