Score.js 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296
  1. var url = CMS_SystemConfig.VirtualDirectoryPath + "/Score/Edit";
  2. var customerUrl = $(CMS_SystemConfig.GetConfig()).find("configuration>customUrls>add[key='Score']");
  3. if (customerUrl.attr("value")) {
  4. url = CMS_SystemConfig.VirtualDirectoryPath + customerUrl.attr("value");
  5. }
  6. var mnu = "";
  7. var isFirstLoadBuilding = true;
  8. //加载
  9. $(function () {
  10. mnu = $.SystemGeneral.getUrlParam("MNU");
  11. })
  12. function reload() {
  13. $("#dgScoreList").cmsXDataTable("load", $.getDataGridParams("dgScoreList"));
  14. }
  15. //获取选中的数据
  16. function validChoose() {
  17. var d = [];
  18. $.each($("#dgScoreList").cmsXDataTable("getSelections"), function (index) {
  19. d.push(this.FinalExaminationID);
  20. });
  21. return d;
  22. }
  23. function validChooseStatus() {
  24. var d = [];
  25. $.each($("#dgScoreList").cmsXDataTable("getSelections"), function (index) {
  26. d.push(this.ApprovalStatusName);
  27. });
  28. return d;
  29. }
  30. function ApprovalStatus() {
  31. var d = 0;
  32. $.each($("#dgScoreList").cmsXDataTable("getSelections"), function (index) {
  33. d = this.ApprovalStatus;
  34. });
  35. return d;
  36. }
  37. function StudentCount() {
  38. var d = 0;
  39. $.each($("#dgScoreList").cmsXDataTable("getSelections"), function (index) {
  40. d = this.StudentCount;
  41. });
  42. return d;
  43. }
  44. //点击列表更新
  45. function edit(rowindex, rowdata) {
  46. var username = $("#hid_UserName").val();
  47. if (username != rowdata.CreatorUserName) {
  48. $.messager.alert("系统提示", "对不起,您没权限进行成绩录入。");
  49. return;
  50. }
  51. if (rowdata.EntryDeadlineTime != null) {
  52. var dt1 = new Date();
  53. var dtime = new Date(dt1.getFullYear(), dt1.getMonth(), dt1.getDate());
  54. var dt2 = getDate(rowdata.EntryDeadlineTime);
  55. if (dtime > dt2) {
  56. $.messager.alert("系统提示", "对不起,该成绩已超过录入截止时间,不能进行录入操作。");
  57. return;
  58. }
  59. }
  60. var redirectTo = url + "?finalExaminationID=" + rowdata.FinalExaminationID + "&MNU=" + mnu;
  61. var windowDiv = $.popupTopWindow('成绩录入信息', redirectTo, window.screen.availWidth-200, window.screen.availHeight - 200, scoreEditClosed);
  62. var isWindowCanClose = false;
  63. windowDiv.panel({
  64. onBeforeClose: function () {
  65. if (!isWindowCanClose) {
  66. if (windowDiv.find('iframe')[0].contentWindow.isWindowCanClose) {
  67. isWindowCanClose = true;
  68. windowDiv.dialog("close");
  69. }
  70. else {
  71. windowDiv.find('iframe')[0].contentWindow.$.messager.confirm("系统提示", "数据并未保存,是否需要退出?", function (r) {
  72. if (r) {
  73. isWindowCanClose = true;
  74. windowDiv.dialog("close");
  75. }
  76. });
  77. }
  78. }
  79. return isWindowCanClose;
  80. }
  81. });
  82. }
  83. function scoreEditClosed() {
  84. top.clearInterval(top.ScoreEditSetInterval);
  85. reload();
  86. }
  87. function SelectCollegeComboGrid() {
  88. var collegeID = $("#CollegeComboGrid").combogridX("getValue");
  89. if (collegeID != nonSelect) {
  90. var jsonString = "({'QueryParamsDatas':'CollegeDropdown|*|" + collegeID + "|@|'})";
  91. $("#DepartmentComboGrid").combogridX("reload", eval(jsonString));
  92. }
  93. reload();
  94. }
  95. //学生成绩录入名单
  96. function StudentList(rowindex, rowdata) {
  97. var redirectTo = CMS_SystemConfig.VirtualDirectoryPath + "/FinalExamination/StudentList?finalExaminationID=" + rowdata.FinalExaminationID + "&MNU=" + mnu;
  98. $.popupTopWindow('学生成绩录入名单', redirectTo, 850, 480, null, null);
  99. }
  100. function Score_Excel() {
  101. $("#formQuery").submit();
  102. }
  103. function editDetails(rowindex, rowdata) {
  104. var redirectTo = url + "?finalExaminationID=" + rowdata.FinalExaminationID + "&Isdisplay=false&MNU=" + mnu;
  105. $.popupTopWindow('成绩录入信息', redirectTo, window.screen.availWidth-200, window.screen.availHeight -200, null, null);
  106. }
  107. function Score_Rebut(rowrindex, rowdata) {
  108. var username = $("#hid_UserName").val();
  109. var CreatorUserName = [];
  110. $.each($("#dgScoreList").cmsXDataTable("getSelections"), function (index) {
  111. CreatorUserName.push(this.CreatorUserName);
  112. });
  113. var ApprovalEndStatus = [];
  114. $.each($("#dgScoreList").cmsXDataTable("getSelections"), function (index) {
  115. ApprovalEndStatus.push(this.ApprovalEndStatus);
  116. });
  117. var ApprovalStatus = [];
  118. $.each($("#dgScoreList").cmsXDataTable("getSelections"), function (index) {
  119. ApprovalStatus.push(this.ApprovalStatus);
  120. });
  121. var d = validChoose();
  122. if (d.length == 0) {
  123. $.messager.alert("系统提示", "请选择您要申请重录的信息。");
  124. return;
  125. }
  126. else if (d.length > 1) {
  127. $.messager.alert("系统提示", "只能对单个信息进行申请重录。");
  128. return;
  129. }
  130. for (var i = 0; i < CreatorUserName.length; i++) {
  131. if (CreatorUserName[i] != "") {
  132. if (CreatorUserName[i] != username) {
  133. $.messager.alert("系统提示", "对不起,您没权限进行申请重录!");
  134. return;
  135. }
  136. }
  137. }
  138. for (var i = 0; i < ApprovalEndStatus.length; i++) {
  139. if (ApprovalEndStatus[i] != "") {
  140. if (ApprovalEndStatus[i] != ApprovalStatus[i]) {
  141. $.messager.alert("系统提示", "只能对已通过状态的信息进行申请重录。");
  142. return;
  143. }
  144. }
  145. }
  146. // if (username != CreatorUserName) {
  147. // $.messager.alert("系统提示", "对不起,您没权限进行申请重录!");
  148. // return;
  149. // }
  150. // if (validChooseStatus() != ApprovalEndStatus) {
  151. // $.messager.alert("系统提示", "只能对审核通过数据进行操作!");
  152. // return;
  153. // }
  154. // if (validChooseStatus() != "已审核") {
  155. // $.messager.alert("系统提示", "只能对已通过状态的信息进行申请重录。");
  156. // return;
  157. // }
  158. var redirectTo = CMS_SystemConfig.VirtualDirectoryPath + "/Score/RebutSubmit" + "?finalExaminationID=" + d + "&MNU=" + mnu;
  159. $.popupTopWindow('成绩录入信息', redirectTo, window.screen.availWidth, window.screen.availHeight - 60, null, null);
  160. }
  161. function Score_Report() {
  162. var d = validChoose();
  163. if (d == "") {
  164. $.messager.alert("系统提示", "请选择您要查看的成绩录入信息。");
  165. return;
  166. }
  167. if (d.length > 1) {
  168. $.messager.alert("系统提示", "只能选择单个成绩录入信息。");
  169. return;
  170. }
  171. var status = validChooseStatus();
  172. if (status != "已通过" && status != "待审核" && status != "重录待审") {
  173. $.messager.alert("系统提示", "只能查看" + "已通过、待审核、重录待审" + "的学生课程成绩报表");
  174. return;
  175. }
  176. var redirectTo = CMS_SystemConfig.VirtualDirectoryPath + "/Score/Report?FinalExaminationID=" + d + "&MNU=" + mnu;
  177. $.popupTopWindow('学生课程成绩报表', redirectTo, 800, 600, null, null);
  178. }
  179. function Score_GroupReport() {
  180. var d = validChoose();
  181. if (d == "") {
  182. $.messager.alert("系统提示", "请选择您要查看的成绩录入信息。");
  183. return;
  184. }
  185. if (d.length > 1) {
  186. $.messager.alert("系统提示", "只能选择单个成绩录入信息。");
  187. return;
  188. }
  189. var status = validChooseStatus();
  190. if (status != "已通过") {
  191. $.messager.alert("系统提示", "只能查看\"已通过\"的学生课程成绩报表");
  192. return;
  193. }
  194. var redirectTo = CMS_SystemConfig.VirtualDirectoryPath + "/Score/ScoreReport?FinalExaminationID=" + d + "&MNU=" + mnu;
  195. $.popupTopWindow('学生课程成绩报表', redirectTo, 800, 600, null, null);
  196. }
  197. function Score_GroupReportHBKD() {
  198. var d = validChoose();
  199. if (d == "") {
  200. $.messager.alert("系统提示", "请选择您要查看的成绩录入信息。");
  201. return;
  202. }
  203. if (d.length > 1) {
  204. $.messager.alert("系统提示", "只能选择单个成绩录入信息。");
  205. return;
  206. }
  207. var status = validChooseStatus();
  208. if (status != "已通过") {
  209. $.messager.alert("系统提示", "只能查看\"已通过\"的学生课程成绩报表");
  210. return;
  211. }
  212. var redirectTo = CMS_SystemConfig.ReportPagePath + "?ReportFolder=%2fEducationResult%2fHBKDStudentScoreView&FinalExaminationID_RAP=" + d;
  213. $.popupTopWindowOutsite('学生课程成绩报表', redirectTo, 800, 600, null, null);
  214. }
  215. function Score_GroupReportHBGD() {
  216. var d = validChoose();
  217. if (d == "") {
  218. $.messager.alert("系统提示", "请选择您要查看的成绩录入信息。");
  219. return;
  220. }
  221. if (d.length > 1) {
  222. $.messager.alert("系统提示", "只能选择单个成绩录入信息。");
  223. return;
  224. }
  225. var status = validChooseStatus();
  226. if (status != "已通过") {
  227. $.messager.alert("系统提示", "只能查看\"已通过\"的学生课程成绩报表");
  228. return;
  229. }
  230. var redirectTo = CMS_SystemConfig.ReportPagePath + "?ReportFolder=%2fEducationResult%2fHBGDStudentScoreView&FinalExaminationID_RAP=" + d;
  231. $.popupTopWindowOutsite('学生课程成绩报表', redirectTo, 800, 600, null, null);
  232. }
  233. function checkBox() {
  234. var jsonString = "({'QueryParamsDatas':'IsCheck|*|" + document.getElementById("isCheck").checked + "|@|'})";
  235. reload();
  236. }
  237. //字符串转时间格式
  238. function getDate(strDate) {
  239. var date = eval('new Date(' + strDate.replace(/\d+(?=-[^-]+$)/,
  240. function (a) { return parseInt(a, 10) - 1; }).match(/\d+/g) + ')');
  241. return date;
  242. }
  243. //添加学生
  244. function FinalExamination_AddStudent() {
  245. var d = validChoose();
  246. var status = ApprovalStatus();
  247. if (d == "") {
  248. $.messager.alert("系统提示", "请选择您要增加学生的信息。");
  249. return;
  250. }
  251. if (d.length > 1) {
  252. $.messager.alert("系统提示", "只能选择单个记录。");
  253. return;
  254. }
  255. if (status == "1" || status == "3" || status == "5") {
  256. var redirectTo = "/FinalExamination/StudentEdit?finalExamination=" + d + "&MNU=" + mnu;
  257. $.popupTopWindow('学生名单', redirectTo, 850, 480, reload);
  258. }
  259. else {
  260. $.messager.alert("系统提示", "该数据已经提交或已审核,不能添加学生!");
  261. return;
  262. }
  263. }
  264. function GZMSScore_Report() {
  265. var d = validChoose().join(',');
  266. if (d == "") {
  267. $.messager.alert("系统提示", "请选择您要打印成绩单的录入信息。");
  268. return;
  269. }
  270. $.postWithLoading(CMS_SystemConfig.VirtualDirectoryPath + '/Score/StudentResult', { finalExaminationIDList: d }, function (data) {
  271. if (data.IsSuccess) {
  272. var redirectTo = "../../Scripts/pdf.js/web/viewer.html?file=" + data.Message;
  273. $.popupTopWindow('成绩单', redirectTo, 850, 480, reload);
  274. } else {
  275. $.messager.alert("系统提示", data);
  276. }
  277. });
  278. }