EvaluationStaffScoreEdit.js 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. //加载
  2. $(function () {
  3. $("#StudentScore").blur(function () {
  4. CalculateTotalScore(true);
  5. });
  6. $("#CollegeScore").blur(function () {
  7. CalculateTotalScore(true);
  8. });
  9. });
  10. //计算对应的总评分
  11. function CalculateTotalScore(obj) {
  12. //非负的分数或保留2位以下小数点分数(/^\d+$/)
  13. var reg = /^\d*(?:\.\d{0,2})?$/;
  14. var studentScore = $("#StudentScore").val();
  15. var collegeScore = $("#CollegeScore").val();
  16. if (!reg.test(studentScore)) {
  17. $.messager.alert("系统提示", "请输非负分数且最多有两位小数。");
  18. $("#StudentScore").val("");
  19. $("#TotalScore").val("");
  20. return;
  21. }
  22. if (!reg.test(collegeScore)) {
  23. $.messager.alert("系统提示", "请输非负分数且最多有两位小数。");
  24. $("#CollegeScore").val("");
  25. $("#TotalScore").val("");
  26. return;
  27. }
  28. if (obj) {
  29. if (studentScore == null || studentScore == "") {
  30. $("#TotalScore").val("");
  31. }
  32. else if (collegeScore == null || collegeScore == "") {
  33. $("#TotalScore").val("");
  34. }
  35. else {
  36. var totalScore = (parseFloat(studentScore) * 0.7) + (parseFloat(collegeScore) * 0.3);
  37. $("#TotalScore").val(parseFloat(totalScore).toFixed(1));
  38. }
  39. }
  40. }
  41. //保存
  42. function EvaluationStaffScore_Save() {
  43. CalculateTotalScore(true);
  44. $("#TotalScore").attr("disabled", false);
  45. $(document.forms[0]).submit();
  46. }
  47. //设置列颜色为红色
  48. function SetRedColumn(index, row, value) {
  49. return " <span style=\"color: red;\">" + value + "</span>";
  50. }
  51. //联动
  52. function queryCollege(data) {
  53. var collegeID = $("#CollegeID").combogridX("getValue");
  54. if (collegeID == "" || collegeID == "-1" || collegeID == null) {
  55. $("#DepartmentID").combogridX("setValue", "-1");
  56. }
  57. var jsonString = "({'QueryParamsDatas':'CollegeDropdown|*|" + collegeID + "|@|'})";
  58. $("#DepartmentID").combogridX("reload", eval(jsonString));
  59. }
  60. function queryDepartment(data) {
  61. var departmentID = $("#DepartmentID").combogridX("getValue");
  62. if (departmentID == "" || departmentID == "-1" || departmentID == null) {
  63. $("#CollegeID").combogridX("setValue", "-1");
  64. }
  65. else {
  66. $("#CollegeID").combogridX("setValue", data.CollegeID);
  67. }
  68. var collegeID = $("#CollegeID").combogridX("getValue");
  69. var jsonString = "({'QueryParamsDatas':'CollegeDropdown|*|" + collegeID + "|@|'})";
  70. $("#DepartmentID").combogridX("reload", eval(jsonString));
  71. }