ScoreEdit.js 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627
  1. var mnu;
  2. var time;
  3. var isSave = false;
  4. var isSubmit = false;
  5. var isWindowCanClose = false;
  6. $.parser.onComplete = function () {
  7. var tableContainer = $("#dgScoreDetailList").find(".xDataTable").parent();
  8. var maxHeight = parseInt(tableContainer.css("maxHeight").replace("px", ""));
  9. tableContainer.css("maxHeight", maxHeight - $("#Comment").parent().outerHeight() - 20 + "px");
  10. };
  11. $(function () {
  12. mnu = $.SystemGeneral.getUrlParam("MNU");
  13. var Isdisplay = $.SystemGeneral.getUrlParam("Isdisplay");
  14. if (Isdisplay == "" || Isdisplay == null) {
  15. top.ScoreEditSetInterval = top.setInterval(setTimeout_Save, 1800000);
  16. }
  17. if (ApprovalStatus == 2 || ApprovalStatus == 4 || ApprovalStatus == 6) {
  18. isWindowCanClose = true;
  19. }
  20. $(document).keydown(function (e) {
  21. var keyEv = e || window.event;
  22. if (![37, 38, 39, 40].contains(keyEv.keyCode))
  23. return;
  24. var source = keyEv.srcElement || keyEv.target;
  25. if (!$(source).hasClass('validatebox-text'))
  26. return;
  27. if (!$(source).parent().attr('columnIndex'))
  28. return;
  29. if (!$(source).parent().parent().attr('xRowIndex'))
  30. return;
  31. var allRange = source.createTextRange();
  32. var columnIndex = parseInt($(source).parent().attr('columnIndex'));
  33. var rowIndex = parseInt($(source).parent().parent().attr('xRowIndex'));
  34. switch (keyEv.keyCode) {
  35. //Left Arrow
  36. case 37:
  37. if (document.selection.createRange().compareEndPoints('StartToStart', allRange) > 0) {
  38. return;
  39. }
  40. columnIndex--;
  41. break;
  42. //Up Arrow
  43. case 38:
  44. rowIndex--;
  45. break;
  46. //Right Arrow
  47. case 39:
  48. if (document.selection.createRange().compareEndPoints('EndToEnd', allRange) < 0) {
  49. return;
  50. }
  51. columnIndex++;
  52. break;
  53. //Dw Arrow
  54. case 40:
  55. rowIndex++;
  56. break;
  57. }
  58. var row = $("#dgScoreDetailList").find("[xRowIndex='" + rowIndex + "']");
  59. if (row.length > 0) {
  60. var column = row.find("[columnIndex='" + columnIndex + "']");
  61. if (column.length > 0) {
  62. var textbox = column.find('.validatebox-text');
  63. if (textbox.length > 0) {
  64. textbox.focus();
  65. }
  66. }
  67. }
  68. });
  69. });
  70. //获取选中的数据
  71. function validChoose() {
  72. var d = [];
  73. $.each($("#dgScoreDetailList").cmsXDataTable("getSelections"), function (index) {
  74. d.push(this);
  75. });
  76. return d;
  77. }
  78. function reload() {
  79. $("#dgScoreDetailList").cmsXDataTable("load", $.getDataGridParams("dgScoreDetailList"));
  80. }
  81. function getCustomScoreFormular(scoreTypes) {
  82. var result = new Array();
  83. var customScoreFormula = eval("(" + $("[name='CustomScoreFormula']").val() + ")");
  84. var scoreTypesCount = scoreTypes.length;
  85. //将各种组合先塞到result数组中
  86. $.each(scoreTypes, function (n, scoreType) {
  87. $.each($.grep(customScoreFormula, function (x) { return x.ScoreType == scoreType }), function (i, scoreFormula) {
  88. //找已有数组中有自己同伴的,复制出来把同伴换成自己,增加新数组
  89. var mateResultList = $.grep(result, function (x) { return $.grep(x.Detail, function (w) { return w.ScoreType == scoreFormula.ScoreType; }).length > 0 });
  90. $.each(mateResultList, function (m, mateResult) {
  91. var item = { total: 0, order: 1, Detail: $.grep(mateResult.Detail, function (x) { return x.ScoreType != scoreFormula.ScoreType; }) };
  92. item.Detail.push(scoreFormula);
  93. item.order = scoreTypesCount - item.Detail.length;
  94. $.each(item.Detail, function (v, x) { item.total += x.Percentage; });
  95. result.push(item);
  96. });
  97. //如果已有数组中没有同伴(一个新的ID出现,肯定是没有同伴的),则
  98. //遍历已有数组,把自己加进去
  99. //增加以自己为起点的数组
  100. if (mateResultList.length == 0) {
  101. $.each(result, function (i, x) {
  102. x.total += scoreFormula.Percentage;
  103. x.Detail.push(scoreFormula);
  104. x.order = scoreTypesCount - x.Detail.length;
  105. });
  106. var item = { total: scoreFormula.Percentage, order: scoreTypesCount - 1, Detail: [scoreFormula] };
  107. result.push(item);
  108. }
  109. });
  110. });
  111. //找出总和是100的组合并返回
  112. var correctResult = $.grep(result, function (x) { return x.total == 100 }).sort(function (a, b) { return a.order - b.order; });
  113. if (correctResult.length > 0) {
  114. return correctResult[0].Detail;
  115. } else {
  116. return new Array();
  117. }
  118. }
  119. function getResultType() {
  120. var ResultTypeDetail = new Array();
  121. var ResultType = eval("(" + $("[name='ResultType']").val() + ")");
  122. if (ResultType.length > 0) {
  123. ResultTypeDetail = $.map(ResultType, function (x) {
  124. return { Name: x.Name, MinScore: x.MinScore, MaxScore: x.MaxScore, MinScoreOperator: x.MinScoreOperator, MaxScoreOperator: x.MaxScoreOperator, Score: x.Score };
  125. });
  126. } else {
  127. ResultTypeDetail = null;
  128. }
  129. return ResultTypeDetail;
  130. }
  131. function getScoreFormulaDetail(scoreDetailList) {
  132. var scoreFormulaDetail = new Array();
  133. var scoreFormulaDropdownList = $("#ScoreFormulaID").combobox("getValue");
  134. var scoreFormula = eval("(" + scoreFormulaDropdownList + ")");
  135. //如果有自定义公式(广体那种),就拿自定义公式,否则就按选择的来
  136. var customScoreFormula = eval("(" + $("[name='CustomScoreFormula']").val() + ")");
  137. if (customScoreFormula.length > 0) {
  138. //获取有填写的分数类型
  139. var allScoreTypeList = $.map(customScoreFormula, function (x) { return x.ScoreType; }).unique();
  140. var notEmptyScoreTypes = new Array();
  141. $.each(scoreDetailList, function (i, scoreDetail) {
  142. $.each(allScoreTypeList, function (n, scoreType) {
  143. if (!(scoreDetail.ScoreDetail[scoreType].Score === "" || scoreDetail.ScoreDetail[scoreType].Score == null)) {
  144. if (!notEmptyScoreTypes.contains(scoreType)) {
  145. notEmptyScoreTypes.push(scoreType);
  146. }
  147. }
  148. });
  149. });
  150. //获取对应的总分公式
  151. scoreFormulaDetail = $.map(getCustomScoreFormular(notEmptyScoreTypes), function (x) {
  152. return { ScoreType: x.ScoreType, Percentage: x.Percentage, IsRequirePass: x.IsRequirePass, PassScore: x.PassScore };
  153. });
  154. } else {
  155. scoreFormulaDetail = $.map(scoreFormula.ScoreFormulaDetail, function (x) {
  156. return { ScoreType: x.ScoreType, Percentage: x.Percentage, IsRequirePass: x.IsRequirePass, PassScore: x.PassScore };
  157. });
  158. }
  159. return scoreFormulaDetail;
  160. }
  161. function getSpecialStateScore(examsStateID, originalScore) {
  162. var examStateSettingList = eval("(" + $("#ExamsStateSetting").val() + ")");
  163. var examStateSetting = $.grep(examStateSettingList, function (x) { return x.ExamsStateID == examsStateID }).shift();
  164. if (examStateSetting) {
  165. if (examStateSetting.Score) {
  166. return examStateSetting.Score;
  167. } else {
  168. return originalScore;
  169. }
  170. }
  171. return originalScore;
  172. }
  173. function Score_Calculate() {
  174. var creditFormulaDropdownList = $("#CreditFormulaID").combobox("getValue");
  175. var gradePointFormulaDropdownList = $("#GradePointFormulaID").combobox("getValue");
  176. var scoreDetailList = $("#dgScoreDetailList").cmsXDataTable("getRows");
  177. var creditFormula = eval("(" + creditFormulaDropdownList + ")");
  178. var gradePointFormula = eval("(" + gradePointFormulaDropdownList + ")");
  179. //根据目前填写情况获取总分公式
  180. var scoreFormulaDetail = getScoreFormulaDetail(scoreDetailList);
  181. var ResultType = new Array();
  182. var defeat = 0;
  183. ResultType = getResultType();
  184. // if (scoreFormulaDetail.length <= 0) {
  185. // return false;
  186. // }
  187. $.each(scoreDetailList, function (index, value) {
  188. //如果当前行不可编辑(重录时的非重录学生),跳过
  189. if (!value.RecordStatus) {
  190. return true;
  191. }
  192. //如果当前行不可编辑(成绩认定的学生),跳过
  193. if (!value.IsCanEdit) {
  194. return true;
  195. }
  196. if (value.RecordStatus <= unusableStatusID) {
  197. return true;
  198. }
  199. var examsStateID = null;
  200. if (value.ExamsStateID != null) {
  201. examsStateID = parseInt(value.ExamsStateID);
  202. }
  203. //如果考试状态不为正常考试,总分清零,跳过
  204. if (examsStateID == suspensionStateID || misconductStateIDList.contains(examsStateID)) {
  205. value.TotalScore = getSpecialStateScore(examsStateID, 0);
  206. value.Credit = 0;
  207. value.GradePoint = 0;
  208. return true;
  209. }
  210. //如果当前行是空行,则跳过
  211. if (examsStateID != exemptionStateID) {
  212. var isEmpty = true;
  213. for (var scoreType in value.ScoreDetail) {
  214. //判断空行时,单独管理的成绩不算填了值,因为不是用户填的
  215. if (scoreType == fixedScoreTypeID) {
  216. continue;
  217. }
  218. if (!(value.ScoreDetail[scoreType].Score === "" || value.ScoreDetail[scoreType].Score == null)) {
  219. isEmpty = false;
  220. }
  221. }
  222. if (isEmpty) {
  223. value.TotalScore = null;
  224. value.Credit = null;
  225. value.GradePoint = null;
  226. return true;
  227. }
  228. }
  229. //算总分
  230. var totalScore = 0;
  231. var needPassFailed = false;
  232. if (examsStateID == exemptionStateID) {
  233. value.TotalScore = getSpecialStateScore(examsStateID, 0);
  234. } else {
  235. if (scoreFormulaDetail.length > 0) {
  236. $.each(scoreFormulaDetail, function (i, x) {
  237. if (value.ScoreDetail[x.ScoreType]) {
  238. if (!(value.ScoreDetail[x.ScoreType].Score === "" || value.ScoreDetail[x.ScoreType].Score == null)) {
  239. totalScore += value.ScoreDetail[x.ScoreType].Score * x.Percentage / 100;
  240. if (x.IsRequirePass && x.PassScore != null) {
  241. if (value.ScoreDetail[x.ScoreType].Score < x.PassScore) {
  242. needPassFailed = true;
  243. }
  244. }
  245. } else if (x.IsRequirePass) {
  246. needPassFailed = true;
  247. }
  248. if (isSubmit && (value.ScoreDetail[x.ScoreType].Score === "" || value.ScoreDetail[x.ScoreType].Score == null)) {
  249. defeat++;
  250. return;
  251. }
  252. } else if (x.IsRequirePass) {
  253. needPassFailed = true;
  254. }
  255. });
  256. } else if (isSubmit) {
  257. defeat++;
  258. return;
  259. }
  260. if (needPassFailed) {
  261. totalScore = 0;
  262. value.TotalScore = 0;
  263. } else {
  264. //toFixed方法有问题,对小于1的数字计算不正确,所以运算前先加1确保没问题
  265. value.TotalScore = totalScore.toFixed(scoreDigitCount);
  266. }
  267. }
  268. //分制转化
  269. if (ResultType != null) {
  270. $.each(ResultType, function (i, x) {
  271. if (x.MinScore <= totalScore && totalScore <= x.MaxScore && x.MinScoreOperator == "<=" && x.MaxScoreOperator == "<=") {
  272. value.TotalScore = x.Score;
  273. }
  274. if (x.MinScore < totalScore && totalScore <= x.MaxScore && x.MinScoreOperator == "<" && x.MaxScoreOperator == "<=") {
  275. value.TotalScore = x.Score;
  276. }
  277. if (x.MinScore < totalScore && totalScore < x.MaxScore && x.MinScoreOperator == "<" && x.MaxScoreOperator == "<") {
  278. value.TotalScore = x.Score;
  279. }
  280. if (x.MinScore <= totalScore && totalScore < x.MaxScore && x.MinScoreOperator == "<=" && x.MaxScoreOperator == "<") {
  281. value.TotalScore = x.Score;
  282. }
  283. });
  284. }
  285. //算学分
  286. //免修是不需要计算,直接获得学分的
  287. if (examsStateID == exemptionStateID) {
  288. value.Credit = credit;
  289. } else {
  290. if (value.TotalScore >= creditFormula.Scores) {
  291. value.Credit = credit;
  292. }
  293. else {
  294. value.Credit = 0;
  295. }
  296. }
  297. //算绩点
  298. if (value.TotalScore >= gradePointFormula.GradePointlimit) {
  299. var gradePoint = 1;
  300. gradePoint += (value.TotalScore - gradePointFormula.GradePointlimit) * gradePointFormula.GradePointFloor;
  301. value.GradePoint = gradePoint.toFixed(1);
  302. }
  303. else {
  304. value.GradePoint = 0;
  305. }
  306. });
  307. if (defeat > 0 && isSubmit) {
  308. return false;
  309. }
  310. // if (defeat > 0 && !isSave && !isSubmit) {
  311. // $.messager.alert("系统提示", "录入信息不完整");
  312. // return;
  313. // }
  314. $("#dgScoreDetailList").cmsXDataTable("loadData", { rows: scoreDetailList, total: scoreDetailList.length });
  315. }
  316. //提交
  317. function Score_Submit() {
  318. var msg = "";
  319. var scoreDetailList = $("#dgScoreDetailList").cmsXDataTable("getRows");
  320. var scoreFormulaDetail = getScoreFormulaDetail(scoreDetailList);
  321. var requireScoreTypes = $.map(scoreFormulaDetail, function (x) { return x.ScoreType; });
  322. isSubmit = true;
  323. isSave = false;
  324. //Score_Calculate();
  325. var isOk = Score_Calculate();
  326. if (!isOk && isOk != null) {
  327. $.messager.alert("系统提示", "录入信息不完整。");
  328. return;
  329. } else {
  330. $.each(scoreDetailList, function (index, value) {
  331. if (value.ExamsStateID == null) {
  332. msg = "请选择考试状态!"
  333. return false;
  334. }
  335. });
  336. if (scoreDetailList.length == 0) {
  337. $.messager.alert("系统提示", "录入学生数不能为0");
  338. return
  339. }
  340. if (msg != "") {
  341. $.messager.alert("系统提示", msg);
  342. return;
  343. }
  344. $(document.forms[0]).attr("action", CMS_SystemConfig.VirtualDirectoryPath + '/Score/Submit');
  345. $(document.forms[0]).submit();
  346. isWindowCanClose = true;
  347. }
  348. }
  349. //保存
  350. function Score_Save() {
  351. isSubmit = false;
  352. isSave = true;
  353. commonSave();
  354. }
  355. function commonSave() {
  356. Score_Calculate(); //计算
  357. $(document.forms[0]).attr("action", CMS_SystemConfig.VirtualDirectoryPath + '/Score/ScoreSave');
  358. $(document.forms[0]).submit();
  359. isWindowCanClose = true;
  360. }
  361. //定时保存
  362. function setTimeout_Save() {
  363. isSubmit = false;
  364. isSave = false;
  365. commonSave();
  366. }
  367. //重置
  368. function Score_Resetting() {
  369. var scoreDetailList = $("#dgScoreDetailList").cmsXDataTable("getRows");
  370. $.each(scoreDetailList, function (index, value) {
  371. //如果当前行不可编辑(重录时的非重录学生),跳过
  372. if (!value.RecordStatus) {
  373. return true;
  374. }
  375. //如果当前行不可编辑(成绩认定的学生),跳过
  376. if (!value.IsCanEdit) {
  377. return true;
  378. }
  379. if (value.RecordStatus <= unusableStatusID) {
  380. return true;
  381. }
  382. $.each(value.ScoreDetail, function (i, score) {
  383. score.Score = null;
  384. });
  385. value.TotalScore = null;
  386. value.Credit = null;
  387. value.GradePoint = null;
  388. });
  389. $("#dgScoreDetailList").cmsXDataTable("loadData", { rows: scoreDetailList, total: scoreDetailList.length });
  390. }
  391. //成绩导入
  392. function Score_Import() {
  393. var finalExaminationID = $("#FinalExaminationID").val();
  394. var redirectTo = CMS_SystemConfig.VirtualDirectoryPath + '/Score/Import?finalExaminationID=' + finalExaminationID + '&MNU=' + mnu;
  395. $.popupTopWindow('学生成绩导入', redirectTo, 400, 300, ScoreImportComplete);
  396. }
  397. function ScoreImportComplete(data) {
  398. if (data != null) {
  399. var scoreViewList = $("#dgScoreDetailList").cmsXDataTable("getRows");
  400. $.each(scoreViewList, function (i, x) {
  401. if (x.IsCanEdit == true) {
  402. var importedScore = $.grep(data, function (w) { return w.UserID == x.UserID }).pop();
  403. if (importedScore) {
  404. $.each(x.ScoreDetail, function (n, v) {
  405. if (v.IsCanEdit == true) {
  406. var score = importedScore.ScoreDetail[v.ScoreTypeID];
  407. v.Score = score;
  408. }
  409. });
  410. }
  411. }
  412. });
  413. $("#dgScoreDetailList").cmsXDataTable("loadData", { rows: scoreViewList, total: scoreViewList.length });
  414. Score_Calculate();
  415. }
  416. }
  417. function FormSuecess(data) {
  418. if (isSubmit) {
  419. EMISFunction.FormSuccess(data);
  420. } else if (isSave) {
  421. $.messager.alert("系统提示", data.Message);
  422. }
  423. }
  424. function FormSubmit(formID) {
  425. if (isSubmit || isSave) {
  426. EMISFunction.FormSubmit(formID);
  427. } else {
  428. $('a').attr('disabled', 'disabled');
  429. $.each($('a'), function () {
  430. if ($.data(this, "linkbutton")) {
  431. $(this).linkbutton('disable');
  432. }
  433. });
  434. $('#autoSave').show();
  435. }
  436. }
  437. function FormComplete() {
  438. if (isSubmit || isSave) {
  439. EMISFunction.FormComplete();
  440. } else {
  441. $.each($('a'), function () {
  442. if ($.data(this, "linkbutton")) {
  443. $(this).linkbutton('enable');
  444. }
  445. });
  446. $('a').removeAttr('disabled', 'disabled');
  447. $('#autoSave').hide();
  448. }
  449. }
  450. function formSuccessReloadNoClose(data) {
  451. if (data.IsSuccess == true) {
  452. if (data.Message == "提交成功。" || data.Message == "保存成功。") {
  453. $.messager.alert("系统提示", data.Message, null, function () {
  454. location.reload();
  455. });
  456. }
  457. }
  458. else {
  459. $.messager.alert("系统提示", data.Message);
  460. }
  461. }
  462. // if (data.IsSuccess == true) {
  463. // $.messager.alert("系统提示", data.Message);
  464. // location.reload();
  465. // //isWindowCanClose = true;
  466. // }
  467. // else {
  468. // $.messager.alert("系统提示", data.Message);
  469. // }
  470. function LoginIDColor(index, row, value) {
  471. if (row.IsDifferentDynamic == true) {
  472. return " <span style=\"color:red;\">" + value + "</span>";
  473. }
  474. else {
  475. return value
  476. }
  477. }
  478. function UserNameColor(index, row, value) {
  479. if (row.IsDifferentDynamic == true) {
  480. return " <span style=\"color:red;\">" + value + "</span>";
  481. }
  482. else {
  483. return value
  484. }
  485. }
  486. function ExamsCategoryNameColor(index, row, value) {
  487. if (row.IsDifferentDynamic == true) {
  488. return " <span style=\"color:red;\">" + value + "</span>";
  489. }
  490. else {
  491. return value
  492. }
  493. }
  494. function TotalScoreColor(index, row, value) {
  495. var ResultType = new Array();
  496. ResultType = getResultType();
  497. if (row.IsDifferentDynamic == true) {
  498. if (ResultType != null) {
  499. var valueName = "";
  500. $.each(ResultType, function (i, x) {
  501. if (value !== "" && value != null) {
  502. if (x.MinScore <= value && value <= x.MaxScore && x.MinScoreOperator == "<=" && x.MaxScoreOperator == "<=") {
  503. valueName = " <span style=\"color:red;\">" + x.Name + "</span>";
  504. }
  505. if (x.MinScore < value && value <= x.MaxScore && x.MinScoreOperator == "<" && x.MaxScoreOperator == "<=") {
  506. valueName = " <span style=\"color:red;\">" + x.Name + "</span>";
  507. }
  508. if (x.MinScore < value && value < x.MaxScore && x.MinScoreOperator == "<" && x.MaxScoreOperator == "<") {
  509. valueName = " <span style=\"color:red;\">" + x.Name + "</span>";
  510. }
  511. if (x.MinScore <= value && value < x.MaxScore && x.MinScoreOperator == "<=" && x.MaxScoreOperator == "<") {
  512. valueName = " <span style=\"color:red;\">" + x.Name + "</span>";
  513. }
  514. }
  515. });
  516. return valueName;
  517. }
  518. else {
  519. return " <span style=\"color:red;\">" + value + "</span>";
  520. }
  521. }
  522. else {
  523. if (ResultType != null) {
  524. var valueName = "";
  525. $.each(ResultType, function (i, x) {
  526. if (value !== "" && value != null) {
  527. if (x.MinScore <= value && value <= x.MaxScore && x.MinScoreOperator == "<=" && x.MaxScoreOperator == "<=") {
  528. valueName = x.Name;
  529. }
  530. if (x.MinScore < value && value <= x.MaxScore && x.MinScoreOperator == "<" && x.MaxScoreOperator == "<=") {
  531. valueName = x.Name;
  532. }
  533. if (x.MinScore < value && value < x.MaxScore && x.MinScoreOperator == "<" && x.MaxScoreOperator == "<") {
  534. valueName = x.Name;
  535. }
  536. if (x.MinScore <= value && value < x.MaxScore && x.MinScoreOperator == "<=" && x.MaxScoreOperator == "<") {
  537. valueName = x.Name;
  538. }
  539. }
  540. });
  541. return valueName;
  542. }
  543. else {
  544. return value;
  545. }
  546. }
  547. }
  548. function Score_Report() {
  549. var FinalExaminationID = $("#FinalExaminationID").val();
  550. var redirectTo = CMS_SystemConfig.VirtualDirectoryPath + "/Score/Report?FinalExaminationID=" + FinalExaminationID + "&MNU=" + mnu;
  551. $.popupTopWindow('学生课程成绩报表', redirectTo, 800, 600, null, null);
  552. }
  553. function CreditColor(index, row, value) {
  554. if (row.IsDifferentDynamic == true) {
  555. return " <span style=\"color:red;\">" + value + "</span>";
  556. }
  557. else {
  558. return value
  559. }
  560. }
  561. function GradePointColor(index, row, value) {
  562. if (row.IsDifferentDynamic == true) {
  563. return " <span style=\"color:red;\">" + value + "</span>";
  564. }
  565. else {
  566. return value
  567. }
  568. }
  569. function Score_SetScoreBySOCScore() {
  570. var FinalExaminationID = $("#FinalExaminationID").val();
  571. var scoreDetailList = $("#dgScoreDetailList").cmsXDataTable("getRows");
  572. $.messager.confirm("系统提示", "同步SOC成绩后将覆盖当前已录的考试成绩,是否需要同步?", function (r) {
  573. if (r) {
  574. $.postWithLoading(CMS_SystemConfig.VirtualDirectoryPath + '/Score/SetScoreBySOCScore', { finalExaminationID: FinalExaminationID }, function (res) {
  575. $.messager.alert("系统提示", res.Message);
  576. if (res.IsSuccess) {
  577. if (res.Data.length > 0) {
  578. for (var i = 0; i < res.Data.length; i++) {
  579. $.each(scoreDetailList, function (index, value) {
  580. if (res.Data[i].UserID == value.UserID) {
  581. $.each(value.ScoreDetail, function (ind, score) {
  582. if (ind == 3) {
  583. score.Score = res.Data[i].TotalScore;
  584. }
  585. });
  586. //value.Score = res.Data[i].TotalScore;
  587. }
  588. });
  589. }
  590. $("#dgScoreDetailList").cmsXDataTable("loadData", { rows: scoreDetailList, total: scoreDetailList.length });
  591. }
  592. }
  593. });
  594. }
  595. });
  596. }