AdultSpecialtyPlan.js 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246
  1. var url = CMS_SystemConfig.VirtualDirectoryPath + "/AdultSpecialtyPlan/Edit";
  2. var mnu = "";
  3. //加载
  4. $(function () {
  5. mnu = $.SystemGeneral.getUrlParam("MNU");
  6. })
  7. //刷新
  8. function reload() {
  9. $("#dgAdultSpecialtyPlanList").cmsXDataTable("load", $.getDataGridParams("dgAdultSpecialtyPlanList"));
  10. }
  11. //获取选中的数据
  12. function validChoose() {
  13. var d = [];
  14. $.each($("#dgAdultSpecialtyPlanList").cmsXDataTable("getSelections"), function (index) {
  15. d.push(this.SpecialtyPlanID);
  16. });
  17. return d;
  18. }
  19. //获取选中的数据All
  20. function validChooseAll() {
  21. var d = [];
  22. $.each($("#dgAdultSpecialtyPlanList").cmsXDataTable("getSelections"), function (index) {
  23. d.push(this);
  24. });
  25. return d;
  26. }
  27. //新增
  28. function AdultSpecialtyPlan_Add() {
  29. var d = validChoose();
  30. if (d.length > 0) {
  31. $.popupTopWindow('专业计划复制新增', CMS_SystemConfig.VirtualDirectoryPath + '/AdultSpecialtyPlan/CopyAdd?specialtyPlanID=' + d[0] + '&MNU=' + mnu, 685, 540, null, null);
  32. } else {
  33. //var redirectTo = url + "?MNU=" + mnu;
  34. //$.popupTopWindow('专业计划新增', redirectTo, 685, 540, null, null);
  35. //采用以下方式新增
  36. var redirectTo = CMS_SystemConfig.VirtualDirectoryPath + "/AdultSpecialtyPlan/SpecialtyPlanBatchAdd" + "?MNU=" + mnu;
  37. $.popupTopWindow('专业计划新增', redirectTo, 1200, 540, reload, null);
  38. }
  39. }
  40. //修改
  41. function AdultSpecialtyPlan_Edit() {
  42. var d = validChoose();
  43. if (d.length == 0) {
  44. $.messager.alert("系统信息", "请选择您要修改的信息。");
  45. return;
  46. }
  47. if (d.length > 1) {
  48. $.messager.alert("系统信息", "只能选择单个记录进行修改。");
  49. return;
  50. }
  51. var redirectTo = url + "?specialtyPlanID=" + d + "&MNU=" + mnu + "&type=edit";
  52. $.popupTopWindow('专业计划修改', redirectTo, 685, 540, null, null);
  53. }
  54. //查看明细
  55. function edit(rowindex, rowdata) {
  56. var redirectTo = url + "?specialtyPlanID=" + rowdata.SpecialtyPlanID + "&MNU=" + mnu + "&type=detail";
  57. $.popupTopWindow('专业计划信息', redirectTo, 685, 540, null, null);
  58. }
  59. //专业计划范围明细
  60. function editPlanRange(rowindex, rowdata) {
  61. var redirectTo = CMS_SystemConfig.VirtualDirectoryPath + "/AdultSpecialtyPlan/PlanRangeList?specialtyPlanID=" + rowdata.SpecialtyPlanID + "&MNU=" + mnu;
  62. $.popupTopWindow('专业计划范围明细', redirectTo, 800, 540, null, null);
  63. }
  64. //专业计划人数明细
  65. function editPlanStudent(rowindex, rowdata) {
  66. var redirectTo = CMS_SystemConfig.VirtualDirectoryPath + "/AdultSpecialtyPlan/PlanStudentList?specialtyPlanID=" + rowdata.SpecialtyPlanID + "&MNU=" + mnu;
  67. $.popupTopWindow('专业计划人数明细', redirectTo, 800, 540, null, null);
  68. }
  69. //删除
  70. function AdultSpecialtyPlan_Delete() {
  71. var id = validChoose().join(',');
  72. if (id == "") {
  73. $.messager.alert("系统提示", "请选择您要删除的信息。");
  74. return;
  75. }
  76. $.messager.confirm("系统提示", "您确定要删除选择的信息?", function (r) {
  77. if (r) {
  78. $.postWithLoading(CMS_SystemConfig.VirtualDirectoryPath + '/AdultSpecialtyPlan/Delete', { specialtyPlanIDs: id }, function (data) {
  79. if (data.IsSuccess) {
  80. $.messager.alert("系统提示", data.Message);
  81. $("#dgAdultSpecialtyPlanList").cmsXDataTable('load');
  82. } else {
  83. $.messager.alert("系统提示", data.Message);
  84. }
  85. });
  86. }
  87. });
  88. }
  89. //计划执行
  90. function AdultSpecialtyPlan_Execute() {
  91. var id = validChoose().join(',');
  92. if (id.length == 0) {
  93. $.messager.alert("系统提示", "请选择您要执行的信息。");
  94. return;
  95. }
  96. $.messager.confirm("系统提示", "您确定要对选择的信息进行执行?", function (r) {
  97. if (r) {
  98. $.postWithLoading(CMS_SystemConfig.VirtualDirectoryPath + '/AdultSpecialtyPlan/SpecialtyPlanExecute', { specialtyPlanIDs: id }, function (data) {
  99. if (data.IsSuccess == true) {
  100. $.messager.alert("系统提示", data.Message);
  101. $("#dgAdultSpecialtyPlanList").cmsXDataTable('load');
  102. } else {
  103. $.messager.alert("系统提示", data.Message);
  104. }
  105. });
  106. }
  107. });
  108. }
  109. //获取列表字段查询对应比较符
  110. function GetDynamicCondition() {
  111. var attribute = eval('(' + $("[name='Attribute']").val() + ')').Value;
  112. var conditionString = $("[name='Condition']").val();
  113. var value = $("[name='Condition']").parent().parent().next().find("[name^=" + attribute + "]").val();
  114. value = $.trim(value);
  115. var sql = "";
  116. if (conditionString == "=" || conditionString == ">" || conditionString == "<" || conditionString == "<>") {
  117. sql = "#" + attribute + conditionString + value;
  118. } else if (conditionString == "左") {
  119. sql = "#" + attribute + " like '" + value + "%'";
  120. } else if (conditionString == "右") {
  121. sql = "#" + attribute + " like '%" + value + "'";
  122. } else if (conditionString == "中") {
  123. sql = "#" + attribute + " like '%" + value + "%'";
  124. }
  125. return sql;
  126. }
  127. //专业计划统计报表
  128. function AdultSpecialtyPlan_Report() {
  129. var d = [];
  130. var SchoolyearID = $("#SchoolyearDropdown").combobox("getValue");
  131. var CollegeID = $("#CollegeDropdown").combogridX("getValue");
  132. var Year = $("#DictionarySchoolyear").combogridX("getValue");
  133. var StandardID = $("#DictionaryStandard").combogridX("getValue");
  134. var EducationID = $("#DictionaryEducation").combogridX("getValue");
  135. var LearningformID = $("#DictionaryLearningform").combogridX("getValue");
  136. var LearnSystem = $("#DictionaryLearnSystem").combogridX("getValue");
  137. //获取自定义查询的当前字段
  138. var sql = GetDynamicCondition();
  139. var redirectTo = CMS_SystemConfig.VirtualDirectoryPath + '/AdultSpecialtyPlan/Report?MNU=' + mnu;
  140. var id = d.join(",");
  141. $.postWithLoading(CMS_SystemConfig.VirtualDirectoryPath + '/AdultSpecialtyPlan/CreateIDTempTable', { SpecialtyPlans: id }, function (data) {
  142. redirectTo = redirectTo + "&SchoolyearID=" + SchoolyearID + "&CollegeID=" + CollegeID + "&StandardID="
  143. + StandardID + "&Year=" + Year + "&EducationID=" + EducationID + "&LearningformID="
  144. + LearningformID + "&LearnSystem=" + LearnSystem + "&ConditionString="
  145. + sql + "&TempTableName=" + data;
  146. var windowDiv = $.popupTopWindow('专业计划统计', redirectTo, 800, 540, null, null);
  147. windowDiv.panel({
  148. onBeforeClose: function () {
  149. if (windowDiv.find('iframe')[0].contentWindow.isWindowCanClose) {
  150. var table = windowDiv.find('iframe')[0].contentWindow.TempTableName;
  151. $.postWithLoading(CMS_SystemConfig.VirtualDirectoryPath + '/AdultSpecialtyPlan/DeleteTempTable', { TempTableName: table }, function (data) {
  152. windowDiv.close();
  153. return true;
  154. });
  155. }
  156. return true;
  157. }
  158. });
  159. });
  160. }
  161. //专业复制
  162. function AdultSpecialtyPlan_SpecialtyCopy() {
  163. var redirectTo = CMS_SystemConfig.VirtualDirectoryPath + "/AdultSpecialtyPlan/SpecialtyCopyList?MNU=" + mnu;
  164. $.popupTopWindow('专业计划专业复制', redirectTo, 1000, 200, null, null);
  165. }
  166. //Excel导入
  167. function AdultSpecialtyPlan_Import() {
  168. var redirectTo = CMS_SystemConfig.VirtualDirectoryPath + '/AdultSpecialtyPlan/Import?MNU=' + mnu;
  169. $.popupTopWindow('专业计划信息导入', redirectTo, 420, 300, reload);
  170. }
  171. //设置列颜色为红色
  172. function SetRedColumn(index, row, value) {
  173. return " <span style=\"color: red;\">" + value + "</span>";
  174. }
  175. //设置相应的行颜色为红色
  176. function SetRedGrid(rowIndex, rowData) {
  177. if (rowData.PlanStatus == notExecute) {
  178. return "color: red;";
  179. } else {
  180. return "";
  181. }
  182. }
  183. //Excel导出
  184. function AdultSpecialtyPlan_Export() {
  185. $("#formQuery").submit();
  186. }
  187. //联动查询
  188. function queryCollege() {
  189. var collegeID = $("#CollegeDropdown").combogridX("getValue");
  190. if (collegeID != nonSelect) {
  191. var jsonString = "({'QueryParamsDatas':'CollegeDropdown|*|" + collegeID + "|@|'})";
  192. $("#DepartmentDropdown").combogridX("reload", eval(jsonString));
  193. }
  194. else {
  195. $("#DepartmentDropdown").combogridX("reload");
  196. }
  197. queryClass();
  198. }
  199. function queryStandard(data) {
  200. queryClass();
  201. }
  202. function queryClass() {
  203. var jsonString = "";
  204. var parameterString = "";
  205. var schoolYearID = $("#DictionarySchoolyear").combogridX("getValue"); //combobox
  206. var standardID = $("#DictionaryStandard").combogridX("getValue");
  207. var educationID = $("#DictionaryEducation").combogridX("getValue");
  208. var learningFormID = $("#DictionaryLearningform").combogridX("getValue");
  209. if (schoolYearID != nonSelect) parameterString += "DictionaryGrade|*|" + schoolYearID + "|@|";
  210. if (standardID != nonSelect) parameterString += "DictionaryStandard|*|" + standardID + "|@|";
  211. if (educationID != nonSelect) parameterString += "DictionaryEducation|*|" + educationID + "|@|";
  212. if (learningFormID != nonSelect) parameterString += "DictionaryLearningform|*|" + learningFormID + "|@|";
  213. if (parameterString != "") {
  214. jsonString = "({'QueryParamsDatas':'" + parameterString + "'})";
  215. $("#DictionaryStandard").combogridX("reload", eval(jsonString));
  216. }
  217. else {
  218. $("#DictionaryStandard").combogridX("reload");
  219. }
  220. reload();
  221. }