TeachersOrder.js 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. var url = CMS_SystemConfig.VirtualDirectoryPath + "/TeachersOrder/Add";
  2. var EditUrl = CMS_SystemConfig.VirtualDirectoryPath + "/TeachersOrder/Edit";
  3. var ViewUrl = CMS_SystemConfig.VirtualDirectoryPath + "/TeachersOrder/DetailList";
  4. var mnu = "";
  5. //加载
  6. $(function () {
  7. mnu = $.SystemGeneral.getUrlParam("MNU");
  8. })
  9. //新增
  10. function TeachersOrder_Add() {
  11. var redirectTo = url + '?MNU=' + mnu;
  12. $.popupTopWindow('征订申请', redirectTo, 850, 600, null, null);
  13. }
  14. function reload() {
  15. $("#dgTeachersOrderList").cmsXDataTable("load", $.getDataGridParams("dgTeachersOrderList"));
  16. }
  17. //获取选中的数据
  18. function validChoose() {
  19. var d = [];
  20. $.each($("#dgTeachersOrderList").cmsXDataTable("getSelections"), function (index) {
  21. d.push(this.TeachersOrderID);
  22. });
  23. return d;
  24. }
  25. //获取选中的数据ID、多个
  26. function validChooseID() {
  27. $("#hid_ApprovalStatusName").val("");
  28. var d = [];
  29. var s = [];
  30. $.each($("#dgTeachersOrderList").cmsXDataTable("getSelections"), function (index) {
  31. d.push(this.TeachersOrderID);
  32. s.push(this.ApprovalStatusName);
  33. });
  34. $("#hid_ApprovalStatusName").val(s.join(','));
  35. return d;
  36. }
  37. //点击查看审核流程步骤
  38. function TeachersOrderDetail(rowindex, rowdata) {
  39. var redirectTo = ViewUrl + '?TeachersOrderID=' + rowdata.TeachersOrderID + '&MNU=' + mnu;
  40. $.popupTopWindow('教师征订明细', redirectTo, 800, 600, null, null);
  41. }
  42. //修改按钮
  43. function TeachersOrder_Update() {
  44. var d = validChoose();
  45. if (d.length == 0) {
  46. $.messager.alert("系统提示", "请选择您要修改的教材信息。");
  47. return;
  48. }
  49. if (d.length > 1) {
  50. $.messager.alert("系统提示", "只能选择单个记录进行修改。");
  51. return;
  52. }
  53. var redirectTo = EditUrl + '?TeachersOrderID=' + d + '&MNU=' + mnu;
  54. $.popupTopWindow('教师征订信息', redirectTo, 750, 330, null, null);
  55. }
  56. //提交申请
  57. function TeachersOrder_Submit() {
  58. var d = validChooseID().join(',');
  59. var state = $("#hid_ApprovalStatusName").val();
  60. if (d.length == 0) {
  61. $.messager.alert("系统提示", "请选择您要提交申请征订信息。");
  62. return;
  63. }
  64. for (var i = 0; i < state.split(',').length; i++) {
  65. if (state.split(',')[i] != "") {
  66. //取消申请或者结束流程
  67. if (state.split(',')[i] == "已通过") {
  68. $.messager.alert("系统提示", "抱歉,您提交申请中存已存审批状态为“已通过”的申请单,请重新选择提交!");
  69. return;
  70. }
  71. }
  72. }
  73. $.postWithLoading(CMS_SystemConfig.VirtualDirectoryPath + '/TeachersOrder/SubmitTeachersOrder', { TeachersOrderIDs: d }, function (data) {
  74. if (data == "成功") {
  75. $.messager.alert("系统提示", "征订申请提交成功!");
  76. $("#dgTeachersOrderList").cmsXDataTable('load');
  77. } else {
  78. $.messager.alert("系统提示", data);
  79. }
  80. });
  81. }
  82. //删除
  83. function TeachersOrder_Delete() {
  84. var d = validChooseID().join(',');
  85. if (d == "") {
  86. $.messager.alert("系统提示", "请选择您要删除的征订信息!");
  87. return;
  88. }
  89. $.messager.confirm("系统提示", "您确定要删除该征订信息?", function (r) {
  90. if (r) {
  91. $.postWithLoading(CMS_SystemConfig.VirtualDirectoryPath + '/TeachersOrder/Delete', { TeachersOrderIDs: d }, function (data) {
  92. if (data == "删除成功") {
  93. $.messager.alert("系统提示", "删除成功!");
  94. $("#dgTeachersOrderList").cmsXDataTable('load');
  95. } else {
  96. $.messager.alert("系统提示", data);
  97. }
  98. });
  99. }
  100. });
  101. }
  102. function TeachersOrder_Export() {
  103. $("#ExcelType").val(1);//普通导出
  104. $("#formQuery").submit();
  105. }
  106. //教师征订汇总导出
  107. function TeachersOrder_Aggregate_Export() {
  108. $("#ExcelType").val(2);//预订汇总导出
  109. $("#formQuery").submit();
  110. }
  111. function QueryPublishDropdownList(data) {
  112. reload();
  113. }
  114. function QueryCourseDropdownList(data) {
  115. reload();
  116. }
  117. function QuerySchoolYearDropdownList(data) {
  118. reload();
  119. }
  120. function QueryCollegeDropdownList(data) {
  121. reload();
  122. }
  123. function QueryStatusDropdownList(data) {
  124. reload();
  125. }