ChangeApply.js 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265
  1. var url = CMS_SystemConfig.VirtualDirectoryPath + "/ChangeApply/Edit";
  2. var mnu = "";
  3. //加载
  4. $(function () {
  5. mnu = $.SystemGeneral.getUrlParam("MNU");
  6. })
  7. //刷新
  8. function reload() {
  9. $("#dgChangeApplyList").cmsXDataTable("load", $.getDataGridParams("dgChangeApplyList"));
  10. }
  11. //获取选中的数据All
  12. function validChooseAll() {
  13. var d = [];
  14. $.each($("#dgChangeApplyList").cmsXDataTable("getSelections"), function (index) {
  15. d.push(this);
  16. });
  17. return d;
  18. }
  19. //获取选中的数据
  20. function validChoose() {
  21. var d = [];
  22. $.each($("#dgChangeApplyList").cmsXDataTable("getSelections"), function (index) {
  23. d.push(this.StudentChangeID);
  24. });
  25. return d;
  26. }
  27. //申请
  28. function ChangeApply_Add() {
  29. var d = validChoose();
  30. if (d.length > 0) {
  31. $.popupTopWindow('异动申请复制新增', CMS_SystemConfig.VirtualDirectoryPath + '/ChangeApply/CopyAdd?studentChangeID=' + d[0] + '&MNU=' + mnu, 720, 550, null, null);
  32. }
  33. else {
  34. var redirectTo = url + "?MNU=" + mnu + "&isEnable=" + CMS_SystemConfig.StudentChangeIsEnabled;
  35. $.popupTopWindow('异动申请新增', redirectTo, 720, 550, null, null);
  36. }
  37. }
  38. //修改
  39. function ChangeApply_Edit() {
  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 id = validChooseAll();
  50. if ($.grep(id, function (v, i) { return v.ApprovalStatus != startStatusID && v.ApprovalStatus != backpointStatusID; }).length > 0) {
  51. $.messager.alert("系统提示", "无法对此状态的信息进行修改。");
  52. return;
  53. }
  54. var redirectTo = url + "?studentChangeID=" + d + "&MNU=" + mnu + "&isEnable=" + CMS_SystemConfig.StudentChangeIsEnabled;
  55. $.popupTopWindow('异动申请修改', redirectTo, 720, 550, null, null);
  56. }
  57. //查看明细
  58. function edit(rowindex, rowdata) {
  59. var redirectTo = url + "?studentChangeID=" + rowdata.StudentChangeID + "&MNU=" + mnu + "&type=detail";
  60. $.popupTopWindow('异动申请信息', redirectTo, 720, 550, null, null);
  61. }
  62. //删除
  63. function ChangeApply_Delete() {
  64. var d = validChoose().join(',');
  65. if (d == "") {
  66. $.messager.alert("系统提示", "请选择您要删除的信息。");
  67. return;
  68. }
  69. var id = validChooseAll();
  70. if ($.grep(id, function (v, i) { return v.ApprovalStatus != startStatusID && v.ApprovalStatus != backpointStatusID; }).length > 0) {
  71. $.messager.alert("系统提示", "数据有误,无法对选择的信息进行删除,请核查。");
  72. return;
  73. }
  74. $.messager.confirm("系统提示", "您确定要删除选择的信息?", function (r) {
  75. if (r) {
  76. $.postWithLoading(CMS_SystemConfig.VirtualDirectoryPath + '/ChangeApply/Delete', { studentChangeIDs: d }, function (data) {
  77. if (data.IsSuccess) {
  78. $.messager.alert("系统提示", data.Message);
  79. $("#dgChangeApplyList").cmsXDataTable('load');
  80. } else {
  81. $.messager.alert("系统提示", data.Message);
  82. }
  83. });
  84. }
  85. });
  86. }
  87. //提交
  88. function ChangeApply_Submit() {
  89. var d = validChoose().join(',');
  90. if (d.length == 0) {
  91. $.messager.alert("系统提示", "请选择您要提交的信息。");
  92. return;
  93. }
  94. var id = validChooseAll();
  95. if ($.grep(id, function (v, i) { return v.ApprovalStatus != startStatusID && v.ApprovalStatus != backpointStatusID; }).length > 0) {
  96. $.messager.alert("系统提示", "数据有误,无法对选择的信息进行提交,请核查。");
  97. return;
  98. }
  99. $.messager.confirm("系统提示", "您确定要对选择的信息进行提交?", function (r) {
  100. if (r) {
  101. $.postWithLoading(CMS_SystemConfig.VirtualDirectoryPath + '/ChangeApply/ChangeApplySubmit', { studentChangeIDs: d }, function (data) {
  102. if (data.IsSuccess == true) {
  103. $.messager.alert("系统提示", data.Message);
  104. $("#dgChangeApplyList").cmsXDataTable('load');
  105. } else {
  106. $.messager.alert("系统提示", data.Message);
  107. }
  108. });
  109. }
  110. });
  111. }
  112. //获取列表字段查询对应比较符
  113. function GetDynamicConditionString() {
  114. var conditionString = "";
  115. var attribute = eval('(' + $("[name='Attribute']").val() + ')').Value;
  116. var condition = $("[name='Condition']").val();
  117. var value = $.trim($("[name='Condition']").parent().parent().next().find("[name^=" + attribute + "]").val());
  118. if (document.getElementsByName(attribute + "_QueryDictionaryDropDownList")[0] != null) {
  119. if (value == "-1") {
  120. conditionString = "";
  121. } else {
  122. conditionString = "WHERE " + attribute + "=" + value;
  123. }
  124. } else {
  125. if (value != "") {
  126. if (condition == "左") {
  127. conditionString = "WHERE " + attribute + " LIKE '" + value + "%'";
  128. } else if (condition == "右") {
  129. conditionString = "WHERE " + attribute + " LIKE '%" + value + "'";
  130. } else if (condition == "中") {
  131. conditionString = "WHERE " + attribute + " LIKE '%" + value + "%'";
  132. } else {
  133. conditionString = "WHERE " + attribute + condition + "'" + value + "'";
  134. }
  135. } else {
  136. conditionString = "";
  137. }
  138. }
  139. return conditionString;
  140. }
  141. //申请表打印
  142. function ChangeApply_Report() {
  143. var campusID = $("#CampusDropdown").combogridX("getValue");
  144. var collegeID = $("#CollegeDropdown").combogridX("getValue");
  145. var gradeID = $("#DictionaryGrade").combogridX("getValue");
  146. var standardID = $("#DictionaryStandard").combogridX("getValue");
  147. var educationID = $("#DictionaryEducation").combogridX("getValue");
  148. var learningformID = $("#DictionaryLearningform").combogridX("getValue");
  149. var learnSystem = $("#DictionaryLearnSystem").combogridX("getValue");
  150. var classmajorID = $("#ClassmajorComboGrid").combogridX("getValue");
  151. var schoolyearID = $("#SchoolyearDropdown").combobox("getValue");
  152. var changeTypeID = $("#DictionaryChangeType").combobox("getValue");
  153. var inSchoolStatus = $("#DictionaryInschoolStatus").combobox("getValue");
  154. var approvalStatus = $("#DictionaryApprovalStatus").combobox("getValue");
  155. var studentChangeIDs = validChoose().join(',');
  156. var conditionString = GetDynamicConditionString();
  157. var redirectTo = CMS_SystemConfig.VirtualDirectoryPath + '/ChangeApply/ApplyReport?MNU=' + mnu;
  158. var studentChangeApplyReportName = $(CMS_SystemConfig.GetConfig()).find("configuration>reportServer>customReportName[name='StudentChangeApplyReport']").attr("customName");
  159. $.popupTopWindow('异动申请报表', redirectTo, 720, 550, null, {
  160. CampusID: campusID,
  161. CollegeID: collegeID,
  162. GradeID: gradeID,
  163. StandardID: standardID,
  164. EducationID: educationID,
  165. LearningformID: learningformID,
  166. LearnSystem: learnSystem,
  167. ClassmajorID: classmajorID,
  168. SchoolyearID: schoolyearID,
  169. ChangeTypeID: changeTypeID,
  170. InSchoolStatus: inSchoolStatus,
  171. ApprovalStatus: approvalStatus,
  172. StudentChangeIDs: studentChangeIDs,
  173. ConditionString: conditionString,
  174. StudentChangeApplyReportName: studentChangeApplyReportName
  175. });
  176. }
  177. //设置列颜色为红色
  178. function SetRedColumn(index, row, value) {
  179. return " <span style=\"color: red;\">" + value + "</span>";
  180. }
  181. //Excel导出
  182. function ChangeApply_Export() {
  183. $("#formQuery").submit();
  184. }
  185. //联动查询
  186. function queryCampus(data) {
  187. var campusID = $("#CampusDropdown").combogridX("getValue");
  188. var jsonString = "({'QueryParamsDatas':'CampusDropdown|*|" + campusID + "|@|'})";
  189. $("#CollegeDropdown").combogridX("reload", eval(jsonString));
  190. queryClass();
  191. }
  192. function queryCollege(data) {
  193. var campusID = $("#CampusDropdown").combogridX("getValue");
  194. var collegeID = $("#CollegeDropdown").combogridX("getValue");
  195. var jsonString = "({'QueryParamsDatas':'CampusDropdown|*|" + campusID + "|@|";
  196. jsonString += "CollegeDropdown|*|" + collegeID + "|@|'})";
  197. $("#CollegeDropdown").combogridX("reload", eval(jsonString));
  198. $("#DictionaryStandard").combogridX("reload", eval(jsonString));
  199. queryClass();
  200. }
  201. function queryGrade(data) {
  202. queryClass();
  203. }
  204. function queryStandard(data) {
  205. queryClass();
  206. }
  207. function queryLearnSystem(data) {
  208. queryClass();
  209. }
  210. function queryGrademajor(data) {
  211. queryClass();
  212. }
  213. function queryClass() {
  214. var jsonString = "";
  215. var parameterString = "";
  216. var campusID = $("#CampusDropdown").combogridX("getValue");
  217. var collegeID = $("#CollegeDropdown").combogridX("getValue");
  218. var gradeID = $("#DictionaryGrade").combogridX("getValue");
  219. var standardID = $("#DictionaryStandard").combogridX("getValue");
  220. var educationID = $("#DictionaryEducation").combogridX("getValue");
  221. var learningformID = $("#DictionaryLearningform").combogridX("getValue");
  222. var learnSystem = $("#DictionaryLearnSystem").combogridX("getValue");
  223. //var grademajorID = $("#GrademajorComboGrid").combogridX("getValue");
  224. if (campusID != nonSelect) parameterString += "CampusDropdown|*|" + campusID + "|@|";
  225. if (collegeID != nonSelect) parameterString += "CollegeDropdown|*|" + collegeID + "|@|";
  226. if (gradeID != nonSelect) parameterString += "DictionaryGrade|*|" + gradeID + "|@|";
  227. if (standardID != nonSelect) parameterString += "DictionaryStandard|*|" + standardID + "|@|";
  228. if (educationID != nonSelect) parameterString += "DictionaryEducation|*|" + educationID + "|@|";
  229. if (learningformID != nonSelect) parameterString += "DictionaryLearningform|*|" + learningformID + "|@|";
  230. if (learnSystem != nonSelect) parameterString += "DictionaryLearnSystem|*|" + learnSystem + "|@|";
  231. //if (grademajorID != nonSelect) parameterString += "GrademajorComboGrid|*|" + grademajorID + "|@|";
  232. if (parameterString != "") {
  233. jsonString = "({'QueryParamsDatas':'" + parameterString + "'})";
  234. $("#DictionaryStandard").combogridX("reload", eval(jsonString));
  235. //$("#GrademajorComboGrid").combogridX("reload", eval(jsonString));
  236. $("#ClassmajorComboGrid").combogridX("reload", eval(jsonString));
  237. }
  238. else {
  239. $("#DictionaryStandard").combogridX("reload");
  240. //$("#GrademajorComboGrid").combogridX("reload");
  241. $("#ClassmajorComboGrid").combogridX("reload");
  242. }
  243. reload();
  244. }