ExecutablePlan.js 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292
  1. var url = CMS_SystemConfig.VirtualDirectoryPath + "/ExecutablePlan/Edit";
  2. var mnu = "";
  3. //加载
  4. $(function () {
  5. mnu = $.SystemGeneral.getUrlParam("MNU");
  6. })
  7. //刷新
  8. function reload() {
  9. $("#dgExecutablePlanList").cmsXDataTable("load", $.getDataGridParams("dgExecutablePlanList"));
  10. }
  11. //获取选中的数据
  12. function validChoose() {
  13. var d = [];
  14. $.each($("#dgExecutablePlanList").cmsXDataTable("getSelections"), function (index) {
  15. d.push(this.ExecutablePlanID);
  16. });
  17. return d;
  18. }
  19. //获取选中的数据PlanType
  20. function validChoosePlanType() {
  21. var d = [];
  22. $.each($("#dgExecutablePlanList").cmsXDataTable("getSelections"), function (index) {
  23. d.push(this.PlanTypeID);
  24. });
  25. return d;
  26. }
  27. //获取选中的数据All
  28. function validChooseAll() {
  29. var d = [];
  30. $.each($("#dgExecutablePlanList").cmsXDataTable("getSelections"), function (index) {
  31. d.push(this);
  32. });
  33. return d;
  34. }
  35. //计划生成
  36. function ExecutablePlan_Create() {
  37. var redirectTo = CMS_SystemConfig.VirtualDirectoryPath + "/ExecutablePlan/ExecutablePlanBatchAdd" + "?MNU=" + mnu;
  38. $.popupTopWindow('执行计划生成', redirectTo, 1200, 540, reload, null);
  39. }
  40. //新增
  41. function ExecutablePlan_Add() {
  42. var d = validChoose();
  43. if (d.length > 0) {
  44. $.popupTopWindow('执行计划复制新增', CMS_SystemConfig.VirtualDirectoryPath + '/ExecutablePlan/CopyAdd?executablePlanID=' + d[0] + '&MNU=' + mnu, 685, 545, null, null);
  45. } else {
  46. var redirectTo = url + "?MNU=" + mnu;
  47. $.popupTopWindow('执行计划新增', redirectTo, 685, 545, null, null);
  48. }
  49. }
  50. //修改
  51. function ExecutablePlan_Edit() {
  52. var d = validChoose();
  53. if (d.length == 0) {
  54. $.messager.alert("系统信息", "请选择您要修改的信息。");
  55. return;
  56. }
  57. if (d.length > 1) {
  58. $.messager.alert("系统信息", "只能选择单个记录进行修改。");
  59. return;
  60. }
  61. //计划类型
  62. var planTypeID = validChoosePlanType();
  63. if (planTypeID == outside) {
  64. var redirectTo = url + "?executablePlanID=" + d + "&MNU=" + mnu + "&type=edit&planType=outside";
  65. }
  66. else {
  67. var redirectTo = url + "?executablePlanID=" + d + "&MNU=" + mnu + "&type=edit";
  68. }
  69. $.popupTopWindow('执行计划修改', redirectTo, 685, 545, null, null);
  70. }
  71. //查看明细
  72. function edit(rowindex, rowdata) {
  73. var redirectTo = url + "?executablePlanID=" + rowdata.ExecutablePlanID + "&MNU=" + mnu + "&type=detail";
  74. $.popupTopWindow('执行计划信息', redirectTo, 685, 545, null, null);
  75. }
  76. //课程信息对应的上课类型明细
  77. function editClassGrouping(rowindex, rowdata) {
  78. var redirectTo = CMS_SystemConfig.VirtualDirectoryPath + "/TeachType/Edit?classGroupingID=" + rowdata.ClassGroupingID + "&MNU=" + mnu + "&type=detail";
  79. $.popupTopWindow('上课类型明细', redirectTo, 720, 480, null, null);
  80. }
  81. //执行计划范围明细
  82. function editPlanRange(rowindex, rowdata) {
  83. var redirectTo = CMS_SystemConfig.VirtualDirectoryPath + "/ExecutablePlan/PlanRangeList?executablePlanID=" + rowdata.ExecutablePlanID + "&MNU=" + mnu;
  84. $.popupTopWindow('执行计划范围明细', redirectTo, 800, 540, null, null);
  85. }
  86. //执行计划人数明细
  87. function editPlanStudent(rowindex, rowdata) {
  88. var redirectTo = CMS_SystemConfig.VirtualDirectoryPath + "/ExecutablePlan/PlanStudentList?executablePlanID=" + rowdata.ExecutablePlanID + "&MNU=" + mnu;
  89. $.popupTopWindow('执行计划人数明细', redirectTo, 800, 540, null, null);
  90. }
  91. //删除
  92. function ExecutablePlan_Delete() {
  93. var id = validChoose().join(',');
  94. if (id == "") {
  95. $.messager.alert("系统提示", "请选择您要删除的信息。");
  96. return;
  97. }
  98. var d = validChooseAll();
  99. if ($.grep(d, function (v, i) { return v.RecordStatus != notSubmitStatus; }).length > 0) {
  100. $.messager.alert("系统提示", "只能对未提交状态的信息进行删除。");
  101. return;
  102. }
  103. $.messager.confirm("系统提示", "您确定要删除选择的信息?", function (r) {
  104. if (r) {
  105. $.postWithLoading(CMS_SystemConfig.VirtualDirectoryPath + '/ExecutablePlan/Delete', { executablePlanIDs: id }, function (data) {
  106. if (data.IsSuccess) {
  107. $.messager.alert("系统提示", data.Message);
  108. $("#dgExecutablePlanList").cmsXDataTable('load');
  109. } else {
  110. $.messager.alert("系统提示", data.Message);
  111. }
  112. });
  113. }
  114. });
  115. }
  116. //提交
  117. function ExecutablePlan_Submit() {
  118. var id = validChoose().join(',');
  119. if (id.length == 0) {
  120. $.messager.alert("系统提示", "请选择您要执行的信息。");
  121. return;
  122. }
  123. $.messager.confirm("系统提示", "您确定要对选择的信息进行提交?", function (r) {
  124. if (r) {
  125. $.postWithLoading(CMS_SystemConfig.VirtualDirectoryPath + '/ExecutablePlan/ExecutablePlanSubmit', { executablePlanIDs: id }, function (data) {
  126. if (data.IsSuccess == true) {
  127. $.messager.alert("系统提示", data.Message);
  128. $("#dgExecutablePlanList").cmsXDataTable('load');
  129. } else {
  130. $.messager.alert("系统提示", data.Message);
  131. }
  132. });
  133. }
  134. });
  135. }
  136. //获取列表字段查询对应比较符
  137. function GetDynamicCondition() {
  138. var attribute = eval('(' + $("[name='Attribute']").val() + ')').Value;
  139. var conditionString = $("[name='Condition']").val();
  140. var value = $("[name='Condition']").parent().parent().next().find("[name^=" + attribute + "]").val();
  141. value = $.trim(value);
  142. var sql = "";
  143. if (conditionString == "=" || conditionString == ">" || conditionString == "<" || conditionString == "<>") {
  144. sql = "#" + attribute + conditionString + value;
  145. } else if (conditionString == "左") {
  146. sql = "#" + attribute + " like '" + value + "%'";
  147. } else if (conditionString == "右") {
  148. sql = "#" + attribute + " like '%" + value + "'";
  149. } else if (conditionString == "中") {
  150. sql = "#" + attribute + " like '%" + value + "%'";
  151. }
  152. return sql;
  153. }
  154. //执行计划统计报表
  155. function ExecutablePlan_Report() {
  156. var d = [];
  157. var SchoolyearID = $("#SchoolyearDropdown").combobox("getValue");
  158. var CampusID = $("#CampusDropdown").combogridX("getValue");
  159. var CollegeID = $("#CollegeDropdown").combogridX("getValue");
  160. var Year = $("#DictionarySchoolyear").combogridX("getValue");
  161. var StandardID = $("#DictionaryStandard").combogridX("getValue");
  162. var EducationID = $("#DictionaryEducation").combogridX("getValue");
  163. var LearningformID = $("#DictionaryLearningform").combogridX("getValue");
  164. var LearnSystem = $("#DictionaryLearnSystem").combogridX("getValue");
  165. var GrademajorID = $("#GrademajorComboGrid").combogridX("getValue");
  166. var CoursematerialID = $("#CourseComboGrid").combogridX("getValue");
  167. var TeachingModeID = $("#DictionaryTeachingMode").combogridX("getValue");
  168. var HandleModeID = $("#DictionaryHandleMode").combogridX("getValue");
  169. //获取自定义查询的当前字段
  170. var sql = GetDynamicCondition();
  171. var redirectTo = CMS_SystemConfig.VirtualDirectoryPath + '/ExecutablePlan/Report?MNU=' + mnu;
  172. var id = d.join(",");
  173. $.postWithLoading(CMS_SystemConfig.VirtualDirectoryPath + '/ExecutablePlan/CreateIDTempTable', { executablePlanIDs: id }, function (data) {
  174. redirectTo = redirectTo + "&SchoolyearID=" + SchoolyearID + "&CollegeID=" + CollegeID + "&StandardID="
  175. + StandardID + "&Year=" + Year + "&EducationID=" + EducationID + "&LearningformID="
  176. + LearningformID + "&LearnSystem=" + LearnSystem + "&ConditionString="
  177. + sql + "&GrademajorID=" + GrademajorID
  178. + "&TempTableName=" + data;
  179. var windowDiv = $.popupTopWindow('执行计划统计', redirectTo, 800, 540, null, null);
  180. windowDiv.panel({
  181. onBeforeClose: function () {
  182. if (windowDiv.find('iframe')[0].contentWindow.isWindowCanClose) {
  183. var table = windowDiv.find('iframe')[0].contentWindow.TempTableName;
  184. $.postWithLoading(CMS_SystemConfig.VirtualDirectoryPath + '/ExecutablePlan/DeleteTempTable', { TempTableName: table }, function (data) {
  185. windowDiv.close();
  186. return true;
  187. });
  188. }
  189. return true;
  190. }
  191. });
  192. });
  193. }
  194. //设置列颜色为红色
  195. function SetRedColumn(index, row, value) {
  196. return " <span style=\"color: red;\">" + value + "</span>";
  197. }
  198. //设置相应的行颜色为红色
  199. function SetRedGrid(rowIndex, rowData) {
  200. if (rowData.PlanTypeID == outside) {
  201. return "color: red;";
  202. } else {
  203. return "";
  204. }
  205. }
  206. //Excel导出
  207. function ExecutablePlan_Export() {
  208. $("#formQuery").submit();
  209. }
  210. //联动查询
  211. function queryCampus(data) {
  212. var campusID = $("#CampusDropdown").combogridX("getValue");
  213. if (campusID != nonSelect) {
  214. var jsonString = "({'QueryParamsDatas':'CampusDropdown|*|" + campusID + "|@|'})";
  215. $("#CollegeDropdown").combogridX("reload", eval(jsonString));
  216. }
  217. else {
  218. $("#CollegeDropdown").combogridX("reload");
  219. }
  220. queryClass();
  221. }
  222. function queryCollege(data) {
  223. var campusID = $("#CampusDropdown").combogridX("getValue");
  224. var collegeID = $("#CollegeDropdown").combogridX("getValue");
  225. var jsonString = "({'QueryParamsDatas':'CampusDropdown|*|" + campusID + "|@|";
  226. jsonString += "CollegeDropdown|*|" + collegeID + "|@|'})";
  227. $("#CollegeDropdown").combogridX("reload", eval(jsonString));
  228. $("#DictionaryStandard").combogridX("reload", eval(jsonString));
  229. queryClass();
  230. }
  231. function querySchoolyear(data) {
  232. queryClass();
  233. }
  234. function queryStandard(data) {
  235. queryClass();
  236. }
  237. function queryGrademajor(data) {
  238. queryClass();
  239. }
  240. function queryClass() {
  241. var jsonString = "";
  242. var parameterString = "";
  243. var campusID = $("#CampusDropdown").combogridX("getValue");
  244. var collegeID = $("#CollegeDropdown").combogridX("getValue");
  245. var schoolYearID = $("#DictionarySchoolyear").combogridX("getValue"); //combobox
  246. var standardID = $("#DictionaryStandard").combogridX("getValue");
  247. var educationID = $("#DictionaryEducation").combogridX("getValue");
  248. var learningFormID = $("#DictionaryLearningform").combogridX("getValue");
  249. if (campusID != nonSelect) parameterString += "CampusDropdown|*|" + campusID + "|@|";
  250. if (collegeID != nonSelect) parameterString += "CollegeDropdown|*|" + collegeID + "|@|";
  251. if (schoolYearID != nonSelect) parameterString += "DictionaryGrade|*|" + schoolYearID + "|@|";
  252. if (standardID != nonSelect) parameterString += "DictionaryStandard|*|" + standardID + "|@|";
  253. if (educationID != nonSelect) parameterString += "DictionaryEducation|*|" + educationID + "|@|";
  254. if (learningFormID != nonSelect) parameterString += "DictionaryLearningform|*|" + learningFormID + "|@|";
  255. if (parameterString != "") {
  256. jsonString = "({'QueryParamsDatas':'" + parameterString + "'})";
  257. $("#DictionaryStandard").combogridX("reload", eval(jsonString));
  258. $("#GrademajorComboGrid").combogridX("reload", eval(jsonString));
  259. }
  260. else {
  261. $("#DictionaryStandard").combogridX("reload");
  262. $("#GrademajorComboGrid").combogridX("reload");
  263. }
  264. reload();
  265. }