StudentScore.js 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320
  1. var url = CMS_SystemConfig.VirtualDirectoryPath + "/StudentScore/Edit";
  2. var urlAdd = CMS_SystemConfig.VirtualDirectoryPath + "/StudentScore/Add";
  3. var mnu = "";
  4. //加载
  5. $(function () {
  6. mnu = $.SystemGeneral.getUrlParam("MNU");
  7. SystemBatchModifyControl.OnComplete = function (columnName, modifyValue, batch) {
  8. $.postWithLoading(CMS_SystemConfig.VirtualDirectoryPath + "/StudentScore/RefreshFinallyScoreForBatchUpdate", {
  9. submitedScoreIDString: batch.join(',')
  10. });
  11. };
  12. })
  13. //新增
  14. function StudentScore_Add() {
  15. var d = validChoose();
  16. var SchoolyearID = "";
  17. var CoursematerialID = "";
  18. var UserID = "";
  19. var StarttermID = "";
  20. if (d.length > 0) {
  21. if (d.length > 1) {
  22. $.messager.alert("系统提示", "只能选择单个记录进行复制。");
  23. return;
  24. }
  25. var redirectTo = CMS_SystemConfig.VirtualDirectoryPath + "/PersonalScore/Edit?SubmitedScoreID=" + d + "&SchoolyearID=" + SchoolyearID + "&CoursematerialID=" + CoursematerialID + "&UserID=" + UserID + "&StarttermID=" + StarttermID + "&atype=1&MNU=" + mnu + "&SaveType=Add";
  26. $.popupTopWindow('学生成绩复制新增', redirectTo, 800, 480, null, null);
  27. } else {
  28. var redirectTo = CMS_SystemConfig.VirtualDirectoryPath + "/PersonalScore/Edit?SubmitedScoreID=" + d + "&SchoolyearID=" + SchoolyearID + "&CoursematerialID=" + CoursematerialID + "&UserID=" + UserID + "&StarttermID=" + StarttermID + "&atype=1&MNU=" + mnu;
  29. $.popupTopWindow('学生成绩新增', redirectTo, 800, 480, null, null);
  30. }
  31. }
  32. function reload() {
  33. $("#dgStudentScoreList").cmsXDataTable("load", $.getDataGridParams("dgStudentScoreList"));
  34. }
  35. //获取选中的数据
  36. function validChoose() {
  37. var d = [];
  38. $.each($("#dgStudentScoreList").cmsXDataTable("getSelections"), function (index) {
  39. d.push(this.SubmitedScoreID);
  40. });
  41. return d;
  42. }
  43. //获取列表字段查询对应比较符
  44. function GetDynamicCondition() {
  45. var reg = "/(^/s*)|(/s*$)/g";
  46. var attribute = eval('(' + $("[name='Attribute']").val() + ')').Value;
  47. var conditionString = $("[name='Condition']").val();
  48. var value = $("[name='Condition']").parent().parent().next().find("[name^=" + attribute + "]").val();
  49. value = $.trim(value);
  50. var sql = "";
  51. if (conditionString == "=" || conditionString == ">" || conditionString == "<" || conditionString == "<>") {
  52. sql = attribute + conditionString + value;
  53. } else if (conditionString == "左") {
  54. sql = attribute + " like '" + value + "%'";
  55. } else if (conditionString == "右") {
  56. sql = attribute + " like '%" + value + "'";
  57. } else if (conditionString == "中") {
  58. sql = attribute + " like '%" + value + "%'";
  59. }
  60. return sql;
  61. }
  62. function StudentScore_Report() {
  63. var d = [];
  64. $.each($("#dgStudentScoreList").cmsXDataTable("getSelections"), function (index) {
  65. d.push(this.UserID);
  66. });
  67. var ReportName = $(CMS_SystemConfig.GetConfig()).find("configuration>reportServer>customReportName[name='StudentScoreView']").attr("customName");
  68. if (ReportName == "GzzyStudentScoreReport")
  69. {
  70. var sql = GetDynamicCondition();
  71. var schoolYearID = $("#SchoolyearDropdown").combobox("getValue");
  72. var collegeID = $("#CollegeComboGrid").combogridX("getValue");
  73. var yearID = $("#DictionaryGrade").combobox("getValue");
  74. var standardID = $("#StandardID").combogridX("getValue");
  75. var education = $("#DictionaryEducation").combobox("getValue");
  76. var learningFormID = $("#LearningformDictionaryDropDown").combobox("getValue");
  77. var learnSystem = $("#DictionaryLearnSystem").combogridX("getValue");
  78. var classmajorID = $("#ClassmajorDropdown").combogridX("getValue");
  79. var coursematerialID = $("#CoursematerialComboGrid").combogridX("getValue");
  80. var courseType = $("#DictionaryCourseType").combobox("getValue");
  81. var examsCategory = $("#DictionaryExamsCategory").combobox("getValue");
  82. var starttermBegin = $("#DictionaryStarttermBegin").combobox("getValue");
  83. var starttermEnd = $("#DictionaryStarttermEnd").combobox("getValue");
  84. var conditionString = sql;
  85. var ids = d.join(',');
  86. var redirectTo = CMS_SystemConfig.VirtualDirectoryPath + '/StudentScore/GzzyStudentScoreReport?MNU=' + mnu;
  87. $.popupTopWindow('学生成绩报表', redirectTo, 1100, 550, null, {
  88. CollegeID: collegeID,
  89. YearID: yearID,
  90. ClassmajorID: classmajorID,
  91. SchoolYearID: schoolYearID,
  92. StandardID: standardID,
  93. Education: education,
  94. LearningFormID: learningFormID,
  95. LearnSystem: learnSystem,
  96. CoursematerialID: coursematerialID,
  97. CourseTypeID: courseType,
  98. ExamsCategoryID: examsCategory,
  99. StarttermBegin: starttermBegin,
  100. StarttermEnd: starttermEnd,
  101. ConditionString: conditionString,
  102. Ids: ids
  103. });
  104. }
  105. else if (ReportName == "HBKDStudentFinallyScoreView")
  106. {
  107. var sql = GetDynamicCondition();
  108. var schoolYearID = $("#SchoolyearDropdown").combobox("getValue");
  109. var collegeID = $("#CollegeComboGrid").combogridX("getValue");
  110. var yearID = $("#DictionaryGrade").combobox("getValue");
  111. var standardID = $("#StandardID").combogridX("getValue");
  112. var education = $("#DictionaryEducation").combobox("getValue");
  113. var learningFormID = $("#LearningformDictionaryDropDown").combobox("getValue");
  114. var learnSystem = $("#DictionaryLearnSystem").combogridX("getValue");
  115. var classmajorID = $("#ClassmajorDropdown").combogridX("getValue");
  116. var coursematerialID = $("#CoursematerialComboGrid").combogridX("getValue");
  117. var courseType = $("#DictionaryCourseType").combobox("getValue");
  118. var examsCategory = $("#DictionaryExamsCategory").combobox("getValue");
  119. var starttermBegin = $("#DictionaryStarttermBegin").combobox("getValue");
  120. var starttermEnd = $("#DictionaryStarttermEnd").combobox("getValue");
  121. var conditionString = sql;
  122. var ids = d.join(',');
  123. var redirectTo = CMS_SystemConfig.VirtualDirectoryPath + '/StudentScore/HBKDStudentScoreReport?MNU=' + mnu;
  124. $.popupTopWindow('学生成绩报表', redirectTo, 1100, 550, null, {
  125. CollegeID: collegeID,
  126. YearID: yearID,
  127. ClassmajorID: classmajorID,
  128. SchoolYearID: schoolYearID,
  129. StandardID: standardID,
  130. Education: education,
  131. LearningFormID: learningFormID,
  132. LearnSystem: learnSystem,
  133. CoursematerialID: coursematerialID,
  134. CourseTypeID: courseType,
  135. ExamsCategoryID: examsCategory,
  136. StarttermBegin: starttermBegin,
  137. StarttermEnd: starttermEnd,
  138. ConditionString: conditionString,
  139. Ids: ids
  140. });
  141. }
  142. else {
  143. var Attribute = document.getElementsByName("Attribute")[0].value.split("\"Value\":\"")[1].split("\"")[0]; //获取当前的字段
  144. var redirectTo = CMS_SystemConfig.VirtualDirectoryPath + '/StudentScore/StudentScoreReport?MNU=' + mnu;
  145. if (d.length > 0) {
  146. redirectTo = redirectTo + "&UserIDs=" + d.join(",");
  147. }
  148. else {
  149. redirectTo = redirectTo + "&CollegeID=" + $("#CollegeComboGrid").combogridX("getValue")
  150. + "&Years=" + $("#DictionaryGrade").combobox("getValue")
  151. //+ "&GrademajorID=" + $("#GrademajorComboGrid").combogridX("getValue")
  152. + "&ClassmajorID=" + $("#ClassmajorDropdown").combogridX("getValue")
  153. + "&CoursematerialID=" + $("#CoursematerialComboGrid").combogridX("getValue")
  154. + "&CourseTypeID=" + $("#DictionaryCourseType").combobox("getValue")
  155. + "&SchoolYearID=" + $("#SchoolyearDropdown").combobox("getValue")
  156. + "&ExamsCategoryID=" + $("#DictionaryExamsCategory").combobox("getValue")
  157. + "&StandardID=" + $("#StandardID").combogridX("getValue")
  158. + "&EducationID=" + $("#DictionaryEducation").combobox("getValue")
  159. + "&LearningformID=" + $("#LearningformDictionaryDropDown").combobox("getValue")
  160. + "&LearnSystem=" + $("#DictionaryLearnSystem").combogridX("getValue")
  161. + "&StarttermBegin=" + $("#DictionaryStarttermBegin").combobox("getValue")
  162. + "&StarttermEnd=" + $("#DictionaryStarttermEnd").combobox("getValue")
  163. + "&UserIDs="
  164. + "&Attribute=" + Attribute
  165. + "&Condition=" + document.getElementsByName("Condition")[0].value + "&Value=" + document.getElementsByName(Attribute + "_QueryTextBox")[0].value;
  166. }
  167. $.popupTopWindow('学生成绩表', redirectTo, 1100, 550, null, null);
  168. }
  169. }
  170. //点击列表更新
  171. function edit(rowindex, rowdata) {
  172. var redirectTo = CMS_SystemConfig.VirtualDirectoryPath + "/PersonalScore/Edit" + "?submitedScoreID=" + rowdata.SubmitedScoreID + "&MNU=" + mnu + '&isView=1';
  173. $.popupTopWindow('学生成绩信息详情', redirectTo, 800, 420, null, null);
  174. }
  175. //修改按钮
  176. function StudentScore_Update() {
  177. // var d = validChoose();
  178. // if (d == "") {
  179. // $.messager.alert("系统提示", "请选择您要修改的学生成绩信息。");
  180. // return;
  181. // }
  182. // if (d.length > 1) {
  183. // $.messager.alert("系统提示", "只能选择单个记录进行修改。");
  184. // return;
  185. // }
  186. // var redirectTo = url + "?submitedScoreID=" + d + "&MNU=" + mnu;
  187. // $.popupTopWindow('学生成绩信息修改', redirectTo, 800, 420, null, null);
  188. var d = validChoose();
  189. var SchoolyearID = $("#hid_SchoolyearID").val();
  190. var CoursematerialID = $("#hid_CoursematerialID").val();
  191. var UserID = $("#hid_UserID").val();
  192. var StarttermID = $("#hid_StarttermID").val();
  193. if (d == "") {
  194. $.messager.alert("系统提示", "请选择您要修改的成绩基本信息。");
  195. return;
  196. }
  197. if (d.length > 1) {
  198. $.messager.alert("系统提示", "只能选择单个记录进行修改。");
  199. return;
  200. }
  201. var redirectTo = CMS_SystemConfig.VirtualDirectoryPath + "/PersonalScore/Edit?SubmitedScoreID=" + d + "&SchoolyearID=" + SchoolyearID + "&CoursematerialID=" + CoursematerialID + "&UserID=" + UserID + "&StarttermID=" + StarttermID + "&atype=2&MNU=" + mnu;
  202. $.popupTopWindow('学生成绩修改', redirectTo, 800, 480, null, null);
  203. }
  204. //删除
  205. function StudentScore_Delete() {
  206. var d = validChoose().join(',');
  207. if (d == "") {
  208. $.messager.alert("系统提示", "请选择您要删除的学生成绩信息!");
  209. return;
  210. }
  211. $.messager.confirm("系统提示", "您确定要删除该学生成绩信息?", function (r) {
  212. if (r) {
  213. $.postWithLoading(CMS_SystemConfig.VirtualDirectoryPath + '/StudentScore/Delete', { submitedScoreIDs: d }, function (data) {
  214. if (data == "删除成功") {
  215. $.messager.alert("系统提示", "删除成功!");
  216. $("#dgStudentScoreList").cmsXDataTable('load');
  217. } else {
  218. $.messager.alert("系统提示", data);
  219. }
  220. });
  221. }
  222. });
  223. }
  224. function queryStandard(data) {
  225. queryClass();
  226. reload();
  227. }
  228. function queryCollege(data) {
  229. var campusID = $("#CampusDropdown").combogridX("getValue");
  230. var collegeID = $("#CollegeComboGrid").combogridX("getValue");
  231. var jsonString = "({'QueryParamsDatas':'CampusDropdown|*|" + campusID + "|@|";
  232. jsonString += "CollegeDropdown|*|" + collegeID + "|@|'})";
  233. // if (campusID != nonSelect) {
  234. // var jsonString = "({'QueryParamsDatas':'CampusDropdown|*|" + campusID + "|@|'})";
  235. // $("#CollegeDropdown").combogridX("reload", eval(jsonString));
  236. // }
  237. queryClass();
  238. reload();
  239. }
  240. function queryClass() {
  241. var jsonString = "";
  242. var parameterString = "";
  243. var campusID = $("#CampusDropdown").combogridX("getValue");
  244. var collegeID = $("#CollegeComboGrid").combogridX("getValue");
  245. var schoolYearID = $("#DictionaryGrade").combobox("getValue");
  246. var standardID = $("#StandardID").combogridX("getValue");
  247. var educationID = $("#DictionaryEducation").combobox("getValue");
  248. var LearnSystem = $("#DictionaryLearnSystem").combogridX("getValue");
  249. var learningFormID = $("#LearningformDictionaryDropDown").combobox("getValue");
  250. if (campusID != nonSelect) parameterString += "CampusDropdown|*|" + campusID + "|@|";
  251. if (collegeID != nonSelect) parameterString += "CollegeDropdown|*|" + collegeID + "|@|";
  252. if (schoolYearID != nonSelect) parameterString += "DictionaryGrade|*|" + schoolYearID + "|@|";
  253. if (standardID != nonSelect) parameterString += "DictionaryStandard|*|" + standardID + "|@|";
  254. if (educationID != nonSelect) parameterString += "DictionaryEducation|*|" + educationID + "|@|";
  255. if (learningFormID != nonSelect) parameterString += "DictionaryLearningform|*|" + learningFormID + "|@|";
  256. if (LearnSystem != nonSelect) parameterString += "DictionaryLearnSystem|*|" + LearnSystem + "|@|";
  257. if (parameterString != "") {
  258. jsonString = "({'QueryParamsDatas':'" + parameterString + "'})";
  259. $("#StandardID").combogridX("reload", eval(jsonString));
  260. $("#ClassmajorDropdown").combogridX("reload", eval(jsonString));
  261. } else {
  262. $("#StandardID").combogridX("reload", eval(jsonString));
  263. $("#ClassmajorDropdown").combogridX("reload");
  264. }
  265. reload();
  266. }
  267. //function SelectCollegeComboGrid(data) {
  268. // if (data != null) {
  269. // reloadStandard();
  270. // }
  271. //}
  272. //function SelectDictionaryGrade(data) {
  273. // if (data.Value != "-1") {
  274. // selectClass();
  275. // }
  276. //}
  277. //function reloadStandard() {
  278. // var url = CMS_SystemConfig.VirtualDirectoryPath + "/Facultymajor/BindStandardDropDownList?bindType=0";
  279. // var collegeID = $("#CollegeComboGrid").combogridX("getValue");
  280. // if (collegeID != nonSelect) url += "&collegeID=" + collegeID;
  281. // $("#StandardID").combobox("reload", url);
  282. //}
  283. //function SelectStandard(data) {
  284. // if (data != null) {
  285. // selectClass();
  286. // }
  287. // reload();
  288. //}
  289. function selectClass() {
  290. var collegeID = $("#CollegeComboGrid").combogridX("getValue");
  291. var year = $("#DictionaryGrade").combobox("getValue");
  292. var standard = $("#StandardID").combobox("getValue");
  293. var jsonString = "({'QueryParamsDatas':'CollegeDropdown|*|" + collegeID + "|@|DictionaryGrade|*|" + year
  294. + "|@|DictionaryStandard|*|" + standard + "|@|'})";
  295. $("#ClassmajorDropdown").combogridX("reload", eval(jsonString));
  296. reload();
  297. }
  298. //导出Excel
  299. function StudentScore_Excel() {
  300. var d = validChoose().join(',')
  301. if (d != "") {
  302. document.getElementById("SubmitedScoreID").value = d;
  303. }
  304. else {
  305. document.getElementById("SubmitedScoreID").value = "";
  306. }
  307. $("#formQuery").submit();
  308. }