SpecialtyPlan.js 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280
  1. var url = CMS_SystemConfig.VirtualDirectoryPath + "/SpecialtyPlan/Edit";
  2. var mnu = "";
  3. //加载
  4. $(function () {
  5. mnu = $.SystemGeneral.getUrlParam("MNU");
  6. })
  7. //刷新
  8. function reload() {
  9. $("#dgSpecialtyPlanList").cmsXDataTable("load", $.getDataGridParams("dgSpecialtyPlanList"));
  10. }
  11. //获取选中的数据
  12. function validChoose() {
  13. var d = [];
  14. $.each($("#dgSpecialtyPlanList").cmsXDataTable("getSelections"), function (index) {
  15. d.push(this.SpecialtyPlanID);
  16. });
  17. return d;
  18. }
  19. //获取选中的数据All
  20. function validChooseAll() {
  21. var d = [];
  22. $.each($("#dgSpecialtyPlanList").cmsXDataTable("getSelections"), function (index) {
  23. d.push(this);
  24. });
  25. return d;
  26. }
  27. //新增
  28. function SpecialtyPlan_Add() {
  29. var d = validChoose();
  30. if (d.length > 0) {
  31. $.popupTopWindow('专业计划复制新增', CMS_SystemConfig.VirtualDirectoryPath + '/SpecialtyPlan/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 + "/SpecialtyPlan/SpecialtyPlanBatchAdd" + "?MNU=" + mnu;
  37. $.popupTopWindow('专业计划新增', redirectTo, 1200, 540, reload, null);
  38. }
  39. }
  40. //修改
  41. function SpecialtyPlan_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 + "/SpecialtyPlan/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 + "/SpecialtyPlan/PlanStudentList?specialtyPlanID=" + rowdata.SpecialtyPlanID + "&MNU=" + mnu;
  67. $.popupTopWindow('专业计划人数明细', redirectTo, 800, 540, null, null);
  68. }
  69. //删除
  70. function SpecialtyPlan_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 + '/SpecialtyPlan/Delete', { specialtyPlanIDs: id }, function (data) {
  79. if (data.IsSuccess) {
  80. $.messager.alert("系统提示", data.Message);
  81. $("#dgSpecialtyPlanList").cmsXDataTable('load');
  82. } else {
  83. $.messager.alert("系统提示", data.Message);
  84. }
  85. });
  86. }
  87. });
  88. }
  89. //计划执行
  90. function SpecialtyPlan_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 + '/SpecialtyPlan/SpecialtyPlanExecute', { specialtyPlanIDs: id }, function (data) {
  99. if (data.IsSuccess == true) {
  100. $.messager.alert("系统提示", data.Message);
  101. $("#dgSpecialtyPlanList").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 SpecialtyPlan_Report() {
  129. var d = [];
  130. var SchoolyearID = $("#SchoolyearDropdown").combobox("getValue");
  131. var CampusID = $("#CampusDropdown").combogridX("getValue");
  132. var CollegeID = $("#CollegeDropdown").combogridX("getValue");
  133. var Year = $("#DictionarySchoolyear").combogridX("getValue");
  134. var StandardID = $("#DictionaryStandard").combogridX("getValue");
  135. var EducationID = $("#DictionaryEducation").combogridX("getValue");
  136. var LearningformID = $("#DictionaryLearningform").combogridX("getValue");
  137. var LearnSystem = $("#DictionaryLearnSystem").combogridX("getValue");
  138. var GrademajorID = $("#GrademajorComboGrid").combogridX("getValue");
  139. var CoursematerialID = $("#CourseComboGrid").combogridX("getValue");
  140. var TeachingModeID = $("#DictionaryTeachingMode").combogridX("getValue");
  141. var HandleModeID = $("#DictionaryHandleMode").combogridX("getValue");
  142. //获取自定义查询的当前字段
  143. var sql = GetDynamicCondition();
  144. var redirectTo = CMS_SystemConfig.VirtualDirectoryPath + '/SpecialtyPlan/Report?MNU=' + mnu;
  145. var id = d.join(",");
  146. $.postWithLoading(CMS_SystemConfig.VirtualDirectoryPath + '/SpecialtyPlan/CreateIDTempTable', { SpecialtyPlans: id }, function (data) {
  147. redirectTo = redirectTo + "&SchoolyearID=" + SchoolyearID + "&CollegeID=" + CollegeID + "&StandardID="
  148. + StandardID + "&Year=" + Year + "&EducationID=" + EducationID + "&LearningformID="
  149. + LearningformID + "&LearnSystem=" + LearnSystem + "&ConditionString="
  150. + sql + "&GrademajorID=" + GrademajorID
  151. + "&TempTableName=" + data;
  152. var windowDiv = $.popupTopWindow('专业计划统计', redirectTo, 800, 540, null, null);
  153. windowDiv.panel({
  154. onBeforeClose: function () {
  155. if (windowDiv.find('iframe')[0].contentWindow.isWindowCanClose) {
  156. var table = windowDiv.find('iframe')[0].contentWindow.TempTableName;
  157. $.postWithLoading(CMS_SystemConfig.VirtualDirectoryPath + '/SpecialtyPlan/DeleteTempTable', { TempTableName: table }, function (data) {
  158. windowDiv.close();
  159. return true;
  160. });
  161. }
  162. return true;
  163. }
  164. });
  165. });
  166. }
  167. //专业复制
  168. function SpecialtyPlan_SpecialtyCopy() {
  169. var redirectTo = CMS_SystemConfig.VirtualDirectoryPath + "/SpecialtyPlan/SpecialtyCopyList?MNU=" + mnu;
  170. $.popupTopWindow('专业复制', redirectTo, 1000, 200, null, null);
  171. }
  172. //年级复制
  173. function SpecialtyPlan_GradeCopy() {
  174. var redirectTo = CMS_SystemConfig.VirtualDirectoryPath + "/SpecialtyPlan/GradeCopyList?MNU=" + mnu;
  175. $.popupTopWindow('年级复制', redirectTo, 1000, 200, null, null);
  176. }
  177. //Excel导入
  178. function SpecialtyPlan_Import() {
  179. var redirectTo = CMS_SystemConfig.VirtualDirectoryPath + '/SpecialtyPlan/Import?MNU=' + mnu;
  180. $.popupTopWindow('专业计划信息导入', redirectTo, 420, 300, reload);
  181. }
  182. //设置列颜色为红色
  183. function SetRedColumn(index, row, value) {
  184. return " <span style=\"color: red;\">" + value + "</span>";
  185. }
  186. //设置相应的行颜色为红色
  187. function SetRedGrid(rowIndex, rowData) {
  188. if (rowData.PlanStatus == notExecute) {
  189. return "color: red;";
  190. } else {
  191. return "";
  192. }
  193. }
  194. //Excel导出
  195. function SpecialtyPlan_Export() {
  196. $("#formQuery").submit();
  197. }
  198. //联动查询
  199. function queryCampus(data) {
  200. var campusID = $("#CampusDropdown").combogridX("getValue");
  201. if (campusID != nonSelect) {
  202. var jsonString = "({'QueryParamsDatas':'CampusDropdown|*|" + campusID + "|@|'})";
  203. $("#CollegeDropdown").combogridX("reload", eval(jsonString));
  204. }
  205. else {
  206. $("#CollegeDropdown").combogridX("reload");
  207. }
  208. queryClass();
  209. }
  210. function queryCollege(data) {
  211. var campusID = $("#CampusDropdown").combogridX("getValue");
  212. var collegeID = $("#CollegeDropdown").combogridX("getValue");
  213. var jsonString = "({'QueryParamsDatas':'CampusDropdown|*|" + campusID + "|@|";
  214. jsonString += "CollegeDropdown|*|" + collegeID + "|@|'})";
  215. $("#CollegeDropdown").combogridX("reload", eval(jsonString));
  216. $("#DictionaryStandard").combogridX("reload", eval(jsonString));
  217. queryClass();
  218. }
  219. function querySchoolyear(data) {
  220. queryClass();
  221. }
  222. function queryStandard(data) {
  223. queryClass();
  224. }
  225. function queryGrademajor(data) {
  226. queryClass();
  227. }
  228. function queryClass() {
  229. var jsonString = "";
  230. var parameterString = "";
  231. var campusID = $("#CampusDropdown").combogridX("getValue");
  232. var collegeID = $("#CollegeDropdown").combogridX("getValue");
  233. var schoolYearID = $("#DictionarySchoolyear").combogridX("getValue"); //combobox
  234. var standardID = $("#DictionaryStandard").combogridX("getValue");
  235. var educationID = $("#DictionaryEducation").combogridX("getValue");
  236. var learningFormID = $("#DictionaryLearningform").combogridX("getValue");
  237. if (campusID != nonSelect) parameterString += "CampusDropdown|*|" + campusID + "|@|";
  238. if (collegeID != nonSelect) parameterString += "CollegeDropdown|*|" + collegeID + "|@|";
  239. if (schoolYearID != nonSelect) parameterString += "DictionaryGrade|*|" + schoolYearID + "|@|";
  240. if (standardID != nonSelect) parameterString += "DictionaryStandard|*|" + standardID + "|@|";
  241. if (educationID != nonSelect) parameterString += "DictionaryEducation|*|" + educationID + "|@|";
  242. if (learningFormID != nonSelect) parameterString += "DictionaryLearningform|*|" + learningFormID + "|@|";
  243. if (parameterString != "") {
  244. jsonString = "({'QueryParamsDatas':'" + parameterString + "'})";
  245. $("#DictionaryStandard").combogridX("reload", eval(jsonString));
  246. $("#GrademajorComboGrid").combogridX("reload", eval(jsonString));
  247. }
  248. else {
  249. $("#DictionaryStandard").combogridX("reload");
  250. $("#GrademajorComboGrid").combogridX("reload");
  251. }
  252. reload();
  253. }