AdultEducationMissionClass.js 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380
  1. var url = CMS_SystemConfig.VirtualDirectoryPath + "/AdultEducationMissionClass/Edit";
  2. var mnu = "";
  3. //加载
  4. $(function () {
  5. mnu = $.SystemGeneral.getUrlParam("MNU");
  6. })
  7. function reload() {
  8. $("#dgEducationMissionClassList").cmsXDataTable("load", $.getDataGridParams("dgEducationMissionClassList"));
  9. }
  10. //获取选中的数据
  11. function validChoose() {
  12. var d = [];
  13. $.each($("#dgEducationMissionClassList").cmsXDataTable("getSelections"), function (index) {
  14. d.push(this.EducationMissionClassID);
  15. });
  16. return d;
  17. }
  18. function collegeIDChoose() {
  19. var d = [];
  20. $.each($("#dgEducationMissionClassList").cmsXDataTable("getSelections"), function (index) {
  21. d.push(this.ClassmajorCollegeID);
  22. });
  23. return d;
  24. }
  25. function SchoolyearIDChoose() {
  26. var d = [];
  27. $.each($("#dgEducationMissionClassList").cmsXDataTable("getSelections"), function (index) {
  28. d.push(this.SchoolyearID);
  29. });
  30. return d;
  31. }
  32. //获取选中的数据
  33. function validChooseObj() {
  34. var d = [];
  35. $.each($("#dgEducationMissionClassList").cmsXDataTable("getSelections"), function (index) {
  36. d.push(this);
  37. });
  38. return d;
  39. }
  40. //获取选中的数据
  41. function OrderNovalidChoose() {
  42. var d = [];
  43. $.each($("#dgEducationMissionClassList").cmsXDataTable("getSelections"), function (index) {
  44. d.push(this.OrderNo);
  45. });
  46. return d;
  47. }
  48. //获取选中的状态
  49. function ApprovalStatusvalidChoose() {
  50. var d = [];
  51. $.each($("#dgEducationMissionClassList").cmsXDataTable("getSelections"), function (index) {
  52. d.push(this.ApprovalStatus);
  53. });
  54. return d;
  55. }
  56. //获取选中的教室类型
  57. function ClassroomTypeNamevalidChoose() {
  58. var d = [];
  59. $.each($("#dgEducationMissionClassList").cmsXDataTable("getSelections"), function (index) {
  60. d.push(this.ClassroomTypeName);
  61. });
  62. return d;
  63. }
  64. //排课分班
  65. function EducationMissionClass_Separate() {
  66. var d = validChooseObj();
  67. var dstate = ApprovalStatusvalidChoose().join(',');
  68. if (d.length == 0) {
  69. $.messager.alert("系统提示", "请选择教学任务进行分班!");
  70. return;
  71. }
  72. if (d.length > 1) {
  73. $.messager.alert("系统提示", "只能选择单个记录进行分班设置!");
  74. return;
  75. }
  76. for (var i = 0; i < dstate.split(',').length; i++) {
  77. if (dstate.split(',')[i] == scheduled) {
  78. $.messager.alert("系统提示", "您选择的排课分班存在状态已排课数据!");
  79. return;
  80. }
  81. if (dstate.split(',')[i] == submitted) {
  82. $.messager.alert("系统提示", "您选择的排课分班存在状态已提交数据!");
  83. return;
  84. }
  85. }
  86. var redirectTo = CMS_SystemConfig.VirtualDirectoryPath + "/EducationMissionClass/DivideIntoClassesEdit?educationMissionClassID=" + d[0].EducationMissionClassID + "&MNU=" + mnu;
  87. $.popupTopWindow('分班设置', redirectTo, 800, 250, null, null);
  88. }
  89. function EducationMissionClass_Arrange() {
  90. var d = validChooseObj();
  91. if (d.length == 0) {
  92. $.messager.alert("系统提示", "请选择教学任务!");
  93. return;
  94. }
  95. if (d.length > 1) {
  96. $.messager.alert("系统提示", "只能选择单个记录进行教学安排设置!");
  97. return;
  98. }
  99. var redirectTo = url + "?educationMissionClassID=" + d[0].EducationMissionClassID + "&MNU=" + mnu;
  100. $.popupTopWindow('教学安排设置', redirectTo, 800, 600, null, null);
  101. }
  102. function EducationMissionClass_Delete() {
  103. var d = $.map(validChooseObj(), function (x) { return x.EducationMissionClassID; }).join(',');
  104. var state = ApprovalStatusvalidChoose().join(',');
  105. var classroomTypeName = ClassroomTypeNamevalidChoose().join(',');
  106. if (d.length == 0) {
  107. $.messager.alert("系统提示", "请选择您要删除的任务班!");
  108. return;
  109. }
  110. for (var i = 0; i < state.split(',').length; i++) {
  111. if (state.split(',')[i] == submitted) {
  112. $.messager.alert("系统提示", "您选择的任务班存在状态已提交数据!");
  113. return;
  114. }
  115. }
  116. for (var i = 0; i < state.split(',').length; i++) {
  117. if (state.split(',')[i] == scheduled) {
  118. $.messager.alert("系统提示", "您选择的任务班存在已排课数据!");
  119. return;
  120. }
  121. }
  122. $.messager.confirm("系统提示", "您确定要删除该任务班?", function (r) {
  123. if (r) {
  124. $.postWithLoading(CMS_SystemConfig.VirtualDirectoryPath + '/AdultEducationMissionClass/Delete', { educationMissionClassIDs: d }, function (data) {
  125. if (data.IsSuccess) {
  126. $.messager.alert("系统提示", "删除成功!");
  127. reload();
  128. } else {
  129. $.messager.alert("系统提示", data.Message);
  130. }
  131. });
  132. }
  133. });
  134. }
  135. //提交
  136. function EducationMissionClass_Submit() {
  137. var d = $.map(validChooseObj(), function (x) { return x.EducationMissionClassID; }).join(',');
  138. var state = ApprovalStatusvalidChoose().join(',');
  139. var classroomTypeName = ClassroomTypeNamevalidChoose().join(',');
  140. var collegeID = collegeIDChoose().join(',');
  141. var SchoolyearID = SchoolyearIDChoose().join(',');
  142. if (d.length == 0) {
  143. $.messager.alert("系统提示", "请选择您要提交的任务班!");
  144. return;
  145. }
  146. for (var i = 0; i < classroomTypeName.split(',').length; i++) {
  147. if (classroomTypeName.split(',')[i] == "") {
  148. $.messager.alert("系统提示", "您选择的教学任务班存在教室类型为空数据,请检查!");
  149. return;
  150. }
  151. }
  152. for (var i = 0; i < state.split(',').length; i++) {
  153. if (state.split(',')[i] == submitted) {
  154. $.messager.alert("系统提示", "您选择的任务班存在状态已提交数据!");
  155. return;
  156. }
  157. }
  158. $.postWithLoading(CMS_SystemConfig.VirtualDirectoryPath + '/EducationMissionClass/Verification', { collegeIDs: collegeID, SchoolyearIDs: SchoolyearID }, function (data) {
  159. if (data == "成功") {
  160. $.postWithLoading(CMS_SystemConfig.VirtualDirectoryPath + '/AdultEducationMissionClass/EducationMissionClassUpdate', { educationMissionClassIDs: d }, function (data) {
  161. if (data == "成功") {
  162. $.messager.alert("系统提示", "提交成功!");
  163. reload();
  164. } else {
  165. $.messager.alert("系统提示", data);
  166. }
  167. });
  168. } else {
  169. $.messager.alert("系统提示", data);
  170. }
  171. });
  172. }
  173. //撤销提交
  174. function EducationMissionClass_UnSubmit() {
  175. var d = $.map(validChooseObj(), function (x) { return x.EducationMissionClassID; }).join(',');
  176. var state = ApprovalStatusvalidChoose().join(',');
  177. if (d.length == 0) {
  178. $.messager.alert("系统提示", "请选择您要撤销提交的任务班!");
  179. return;
  180. }
  181. for (var i = 0; i < state.split(',').length; i++) {
  182. if (state.split(',')[i] != submitted) {
  183. $.messager.alert("系统提示", "只能撤销已提交状态的数据!");
  184. return;
  185. }
  186. }
  187. $.messager.confirm("系统提示", "您确定要撤销提交该任务班?", function (r) {
  188. if (r) {
  189. $.postWithLoading(CMS_SystemConfig.VirtualDirectoryPath + '/AdultEducationMissionClass/UnSubmit', { educationMissionClassIDs: d }, function (data) {
  190. $.messager.alert("系统提示", data);
  191. if (data == "撤销成功。") {
  192. reload();
  193. }
  194. });
  195. }
  196. });
  197. }
  198. //排课班级
  199. function SchedulingClassEdit(rowindex, rowdata) {
  200. var redirectTo = CMS_SystemConfig.VirtualDirectoryPath + "/AdultEducationMissionClass/EducationSchedulingClassList?educationMissionClassID=" + rowdata.EducationMissionClassID + "&MNU=" + mnu;
  201. $.popupTopWindow('排课班信息', redirectTo, 800, 600, null, null);
  202. }
  203. //学生总数
  204. function SchedulingClassStudentEdit(rowindex, rowdata) {
  205. var redirectTo = CMS_SystemConfig.VirtualDirectoryPath + "/EducationMissionClass/EducationSchedulingClassCountStudentList?educationMissionClassID=" + rowdata.EducationMissionClassID + "&MNU=" + mnu + "&ApprovalStatusName=" + rowdata.ApprovalStatusName;
  206. $.popupTopWindow('学生信息', redirectTo, 800, 350, CloseStudentEdit);
  207. }
  208. function CloseStudentEdit() {
  209. reload();
  210. }
  211. function AddStudent_Confirm(studentList) {
  212. alert("这边");
  213. }
  214. //合班
  215. function EducationMissionClass_Conjunction() {
  216. var educationMissionClassList = validChooseObj();
  217. var d = $.map(educationMissionClassList, function (x) { return x.EducationMissionClassID; });
  218. if (d.length < 2) {
  219. $.messager.alert("系统提示", "请至少选择两个以上的任务班进行合并。");
  220. return;
  221. }
  222. for (var i = 0; i < educationMissionClassList.length; i++) {
  223. if (educationMissionClassList[i].ApprovalStatus != notSubmitted) {
  224. $.messager.alert("系统提示", "只有未提交的教学任务才能进行合班。");
  225. return;
  226. }
  227. }
  228. var courseID = educationMissionClassList[0].CoursematerialID;
  229. var schoolyearID = educationMissionClassList[0].SchoolyearID;
  230. var teachModeID = educationMissionClassList[0].TeachingModeID;
  231. var errorList = $.grep(educationMissionClassList, function (x) { return x.CoursematerialID != courseID || x.SchoolyearID != schoolyearID || x.TeachingModeID != teachModeID });
  232. if (errorList.length > 0) {
  233. $.messager.alert("系统提示", "只有同一学年学期上相同课程,授课方式也一致的任务班才可以进行合班。");
  234. return;
  235. }
  236. var redirectTo = CMS_SystemConfig.VirtualDirectoryPath + "/EducationMissionClass/EducationMissionClassConjunctionList?MNU=" + mnu;
  237. $.popupTopWindow('合班信息', redirectTo, 900, 300, reload, d);
  238. }
  239. //导出Excel
  240. function EducationMissionClass_Excel() {
  241. $("#formQuery").submit();
  242. }
  243. function QuerySchoolyearDropdownList(data) {
  244. reload();
  245. }
  246. function QueryComboGridList(data) {
  247. reload();
  248. }
  249. function QueryComboGridCollegeList(data) {
  250. reload();
  251. }
  252. function QueryComboGridCampusList(data) {
  253. reload();
  254. }
  255. function QueryApprovalStatusDropdownList(data) {
  256. reload();
  257. }
  258. function SelectCollegeComboGrid(data) {
  259. CMSFunction.ComboGrid.SetValue($("#GrademajorComboGrid"), "", ""); //清空原有年级专业旧记录
  260. var Year = $("#DictionaryGrade").combobox("getValue");
  261. if (data != null || Year != "-1") {
  262. var jsonString = "({'QueryParamsDatas':'CollegeDropdown|*|" + data.CollegeID + "|@|DictionaryGrade|*|" + Year + "|@|'})";
  263. $("#GrademajorComboGrid").combogridX("reload", eval(jsonString));
  264. }
  265. reload();
  266. }
  267. function SelectDictionaryGrade(data) {
  268. CMSFunction.ComboGrid.SetValue($("#GrademajorComboGrid"), "", "");
  269. var collegeID = $("#ComboGridCollege").combogridX("getValue");
  270. if (data.Value != "-1" || data != null) {
  271. var jsonString = "({'QueryParamsDatas':'CollegeDropdown|*|" + collegeID + "|@|DictionaryGrade|*|" + data.Value + "|@|'})";
  272. $("#GrademajorComboGrid").combogridX("reload", eval(jsonString));
  273. }
  274. reload();
  275. }
  276. //点名
  277. function EducationMissionClass_RollCall() {
  278. var educationMissionClassIDs = validChoose().join(',');
  279. educationMissionClassIDs = (educationMissionClassIDs == "-1" || educationMissionClassIDs == "") ? "=" : "=" + educationMissionClassIDs;
  280. var attribute = $("[name='Attribute']").val();
  281. var attributeObj = eval('(' + attribute + ')');
  282. var conditionString = $("[name='Condition']").val();
  283. var value = SystemQueryControl.GetValue();
  284. var condition = '@DynamicAttribute:' + attributeObj.Value + '|@DynamicCondition:' + conditionString + '|@DynamicValue:' + value;
  285. var schoolYearID = $("[comboname='SchoolyearDropdownList']").combobox("getValue");
  286. schoolYearID = (schoolYearID == "-1" || schoolYearID == "") ? "=" : "=" + schoolYearID;
  287. var collegeID = $("[comboname='ComboGridCollege']").combogridX("getValue");
  288. collegeID = (collegeID == "-1" || collegeID == "") ? "=" : "=" + collegeID;
  289. var year = $("[comboname='DictionaryGrade']").combobox("getValue");
  290. year = (year == "-1" || year == "") ? "=" : "=" + year;
  291. var grademajorID = $("[comboname='GrademajorComboGrid']").combogridX("getValue");
  292. grademajorID = (grademajorID == "-1" || grademajorID == "") ? "=" : "=" + grademajorID;
  293. var coursematerialID = $("[comboname='CoursematerialComboGrid']").combogridX("getValue");
  294. coursematerialID = (coursematerialID == "-1" || coursematerialID == "") ? "=" : "=" + coursematerialID;
  295. var teachingMethod = $('[comboname="DictionaryTeachingMode"]').combobox("getValue");
  296. teachingMethod = (teachingMethod == "-1" || teachingMethod == "") ? "=" : "=" + teachingMethod;
  297. var approvalStatus = $('[comboname="ApprovalStatusDropdownList"]').combobox("getValue");
  298. approvalStatus = (approvalStatus == "-1" || approvalStatus == "") ? "=" : "=" + approvalStatus;
  299. var reportUrl = CMS_SystemConfig.ReportPagePath + "?ReportFolder=%2fEducationManage%2fStudentRollCallReport&condition_RAP=" + condition
  300. + "&schoolyearID_RAP" + schoolYearID
  301. + "&collegeID_RAP" + collegeID
  302. + "&year_RAP" + year
  303. + "&grademajorID_RAP" + grademajorID
  304. + "&coursematerialID_RAP" + coursematerialID
  305. + "&teachingMethod_RAP" + teachingMethod
  306. + "&educationMissionClassIDs_RAP" + educationMissionClassIDs
  307. + "&approvalStatus_RAP" + approvalStatus
  308. $.popupTopWindowOutsite('点名册', reportUrl, 900, 700);
  309. }
  310. SystemBatchModifyControl.OnSubmit = function () {
  311. var state = ApprovalStatusvalidChoose().join(',');
  312. for (var i = 0; i < state.split(',').length; i++) {
  313. if (state.split(',')[i] == scheduled) {
  314. $.messager.alert("系统提示", "您选择的教学任务班包含已排课状态!");
  315. return false;
  316. }
  317. }
  318. }
  319. function EducationMissionClass_BatchUpdate() {
  320. var d = validChoose().join(',');
  321. if (d == "") {
  322. $.messager.alert("系统提示", "请选择您要修改的教学任务。");
  323. return;
  324. }
  325. var redirectTo = CMS_SystemConfig.VirtualDirectoryPath + '/AdultEducationMissionClass/BatchUpdate?educationMissionClassStr=+' + d + '&MNU=' + mnu;
  326. $.popupTopWindow('批量修改课时类别', redirectTo, 450, 200, null, null);
  327. }
  328. //联动查询
  329. function queryStandard(data) {
  330. queryClass();
  331. }
  332. function queryCollege(data) {
  333. queryClass();
  334. }
  335. function queryClass() {
  336. var jsonString = "";
  337. var parameterString = "";
  338. var campusID = $("#CampusDropdown").combogridX("getValue");
  339. var collegeID = $("#CollegeDropdown").combogridX("getValue");
  340. var educationID = $("#DictionaryEducation").combobox("getValue");
  341. var schoolYearID = $("#SchoolyearDictionaryDropDown").combobox("getValue");
  342. var standardID = $("#StandardDictionaryDropDown").combogridX("getValue");
  343. var LearnSystem = $("#DictionaryLearnSystem").combogridX("getValue");
  344. var learningFormID = $("#LearningformDictionaryDropDown").combobox("getValue");
  345. //if (campusID != nonSelect) parameterString += "CampusDropdown|*|" + campusID + "|@|";
  346. //if (collegeID != nonSelect) parameterString += "CollegeDropdown|*|" + collegeID + "|@|";
  347. if (educationID != nonSelect) parameterString += "DictionaryEducation|*|" + educationID + "|@|";
  348. if (schoolYearID != nonSelect) parameterString += "DictionaryGrade|*|" + schoolYearID + "|@|";
  349. if (standardID != nonSelect) parameterString += "DictionaryStandard|*|" + standardID + "|@|";
  350. if (learningFormID != nonSelect) parameterString += "DictionaryLearningform|*|" + learningFormID + "|@|";
  351. if (LearnSystem != nonSelect) parameterString += "DictionaryLearnSystem|*|" + LearnSystem + "|@|";
  352. if (parameterString != "") {
  353. jsonString = "({'QueryParamsDatas':'" + parameterString + "'})";
  354. $("#ClassmajorDropdown").combogridX("reload", eval(jsonString));
  355. $("#StandardDictionaryDropDown").combogridX("reload", eval(jsonString));
  356. } else {
  357. $("#ClassmajorDropdown").combogridX("reload");
  358. $("#StandardDictionaryDropDown").combogridX("reload");
  359. }
  360. reload();
  361. }