//加载 $(function () { $("#StudentScore").blur(function () { CalculateTotalScore(true); }); $("#CollegeScore").blur(function () { CalculateTotalScore(true); }); }); //计算对应的总评分 function CalculateTotalScore(obj) { //非负的分数或保留2位以下小数点分数(/^\d+$/) var reg = /^\d*(?:\.\d{0,2})?$/; var studentScore = $("#StudentScore").val(); var collegeScore = $("#CollegeScore").val(); if (!reg.test(studentScore)) { $.messager.alert("系统提示", "请输非负分数且最多有两位小数。"); $("#StudentScore").val(""); $("#TotalScore").val(""); return; } if (!reg.test(collegeScore)) { $.messager.alert("系统提示", "请输非负分数且最多有两位小数。"); $("#CollegeScore").val(""); $("#TotalScore").val(""); return; } if (obj) { if (studentScore == null || studentScore == "") { $("#TotalScore").val(""); } else if (collegeScore == null || collegeScore == "") { $("#TotalScore").val(""); } else { var totalScore = (parseFloat(studentScore) * 0.7) + (parseFloat(collegeScore) * 0.3); $("#TotalScore").val(parseFloat(totalScore).toFixed(1)); } } } //保存 function EvaluationStaffScore_Save() { CalculateTotalScore(true); $("#TotalScore").attr("disabled", false); $(document.forms[0]).submit(); } //设置列颜色为红色 function SetRedColumn(index, row, value) { return " " + value + ""; } //联动 function queryCollege(data) { var collegeID = $("#CollegeID").combogridX("getValue"); if (collegeID == "" || collegeID == "-1" || collegeID == null) { $("#DepartmentID").combogridX("setValue", "-1"); } var jsonString = "({'QueryParamsDatas':'CollegeDropdown|*|" + collegeID + "|@|'})"; $("#DepartmentID").combogridX("reload", eval(jsonString)); } function queryDepartment(data) { var departmentID = $("#DepartmentID").combogridX("getValue"); if (departmentID == "" || departmentID == "-1" || departmentID == null) { $("#CollegeID").combogridX("setValue", "-1"); } else { $("#CollegeID").combogridX("setValue", data.CollegeID); } var collegeID = $("#CollegeID").combogridX("getValue"); var jsonString = "({'QueryParamsDatas':'CollegeDropdown|*|" + collegeID + "|@|'})"; $("#DepartmentID").combogridX("reload", eval(jsonString)); }