Edit.cshtml 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421
  1. @using Bowin.Web.Controls.Mvc;
  2. @using EMIS.Entities;
  3. @using EMIS.Web.Controls;
  4. @using EMIS.ViewModel.EvaluationManage.EvaluationEnter
  5. @using System.Text.RegularExpressions;
  6. @model EMIS.ViewModel.EvaluationManage.EvaluationEnter.EvaluationEnterView
  7. @{
  8. ViewBag.Title = "Edit";
  9. //List<CreateTable> evaluationTableLsit = ViewData["evaluationTableLsit"] as List<CreateTable>;
  10. }
  11. <style>
  12. .target td div
  13. {
  14. font-weight: bold;
  15. }
  16. #table_EvaluationEnter
  17. {
  18. width: 100%;
  19. }
  20. #table_EvaluationEnter tr
  21. {
  22. border: 1px solid #D6D6D6;
  23. height: 30px;
  24. }
  25. #table_EvaluationEnter td
  26. {
  27. border: 1px solid #D6D6D6;
  28. }
  29. .datagrid-body
  30. {
  31. overflow-x: hidden; /*去掉左/右边缘滚动条*/
  32. }
  33. .datagrid-header-row td /*设置grid列标题颜色*/
  34. {
  35. background-color: #D6D6D6; /*using (Html.BeginForm())*/
  36. }
  37. .datagrid-btable .datagrid-cell
  38. {
  39. text-overflow: ellipsis;
  40. }
  41. .div_Content
  42. {
  43. margin: 0 auto;
  44. }
  45. /*居中评价说明注意事项*/
  46. .div_TableName
  47. {
  48. margin: 0 auto;
  49. width: 400px;
  50. height: 20px;
  51. }
  52. /*评价表名*/
  53. </style>
  54. <div class="easyui-panel" data-options="border:false,fit:true" style="position: relative;">
  55. @using (Ajax.BeginForm(new AjaxOptions { Url = Url.Action("Edit"), OnSuccess = "EMISFunction.FormSuccess", OnBegin = "EMISFunction.FormSubmit", OnComplete = "EMISFunction.FormComplete" }))
  56. {
  57. @Html.HiddenFor(x => x.EducationMissionClassID)
  58. @Html.HiddenFor(x => x.EvaluationTableID)
  59. @Html.HiddenFor(x => x.EvaluationEnterID)
  60. @Html.Hidden("ProjectWeightSum")
  61. <div class="div_Content">
  62. <h1 style="text-align: center; color: red;">说明</h1>
  63. <h4>@ViewBag.ContentStr</h4>
  64. </div>
  65. <br />
  66. <br />
  67. <div class="div_TableName">
  68. <h3>@ViewBag.TableName</h3>
  69. </div>
  70. <div class="search_list">
  71. <table cellpadding="0" cellspacing="0" id="table_EvaluationEnter" style="width: 100%">
  72. <tr style="text-align: center;">
  73. <td colspan="2" style="width: 70%; color: red; font-size: 14px">
  74. 准确的评价是你成熟的表现
  75. </td>
  76. <td colspan="2" rowspan="4" style="width: 30%">
  77. <div>
  78. <img src="@Model.PhotoUrl" id="imgPhoto" width="80" height="100" />
  79. </div>
  80. </td>
  81. </tr>
  82. <tr style="text-align: center;">
  83. <td colspan="2" style="width: 60%;">
  84. 被评教师:@ViewBag.UserNames
  85. </td>
  86. </tr>
  87. <tr style="text-align: center;">
  88. <td colspan="2" style="width: 60%;">
  89. 课程名称:@ViewBag.CourseName
  90. </td>
  91. </tr>
  92. <tr style="text-align: center;">
  93. <td colspan="2" style="width: 60%;">
  94. 教研室:@ViewBag.Remark
  95. </td>
  96. </tr>
  97. <tr>
  98. <td colspan="4">
  99. <div id="dgEvaluationEnterList">
  100. </div>
  101. </td>
  102. </tr>
  103. <tr>
  104. <td style="color: red; border: 0px;">
  105. 简要评语或建议:
  106. </td>
  107. <td colspan="3" align="left" style="border: 0px;">@Html.TextAreaFor(x => x.Remark, new Dictionary<string, object> { { "style", "width:300px;" } })
  108. </td>
  109. </tr>
  110. <tr>
  111. @Html.HiddenFor(x => x.EvaluationScore)
  112. @Html.HiddenFor(x => x.ProjectID)
  113. @Html.HiddenFor(x => x.jsonDataStr)
  114. <td style="border: 0px">
  115. 你的评价分数为:<span style="color: red;" id="EvaluationScoreSp">0</span>@Html.HiddenFor(x => x.TotalScore, new Dictionary<string, object> { { "id", "TotalScore" } })
  116. </td>
  117. <td style="border: 0px">
  118. </td>
  119. </tr>
  120. <tr>
  121. <td style="border: 0px">
  122. 限评次数为:@ViewBag.LimitMore 次;您对此已评:@ViewBag.YP 次
  123. </td>
  124. <td style="border: 0px">
  125. </td>
  126. </tr>
  127. <tr>
  128. <td style="border: 0px">
  129. </td>
  130. <td align="center" style="border: 0px">
  131. <input type="button" onclick="EvaluationEnter_Save()" value="保存" id="btnclick" />
  132. <input type="button" class="button" value="关闭" onclick="EvaluationEnter_Close()">
  133. </td>
  134. </tr>
  135. </table>
  136. </div>
  137. }
  138. </div>
  139. @section scripts{
  140. <script type="text/javascript">
  141. var tableIDs = '@ViewBag.EvaluationTableID';
  142. var evaluationEnterID = '@ViewBag.evaluationEnterID';
  143. var educationMissionClassIDs = '@ViewBag.EducationMissionClassID';
  144. var dataColums = Invoke("/EvaluationEnter/GetTitle", null, "jsonp", function (re) { });
  145. var dataList = Invoke("/EvaluationEnter/GetList?tableID=" + tableIDs + "&evaluationEnterID=" + evaluationEnterID, null, "jsonp", function (re) { });
  146. if (dataColums != undefined && dataColums != null && dataList != undefined && dataList != null) {
  147. var jsonData = { rows: eval("[" + dataList.rows + "]"), total: dataList.total };
  148. var colums = eval("[" + dataColums.UpTitle + "]");
  149. $("#dgEvaluationEnterList").datagrid({
  150. columns: [[
  151. { field: 'OrderID', title: '次序', width: 150, align: 'center' },
  152. { field: 'ProjectName', title: '评价项目', width: 300, align: 'center', formatter: formatCellTooltip },
  153. { field: 'NormNameProjectID', title: '评价项目ID', width: 100, align: 'center' },
  154. { field: 'TargetID', title: '评价指标ID', width: 100, align: 'center' },
  155. { field: 'TargetWeight', title: '评价指标分数', width: 100, align: 'center' },
  156. { field: 'Weight', title: '权重', width: 100, align: 'center' },
  157. { field: 'NormNames', title: '评分标准', width: 250, align: 'center' }]],
  158. data: jsonData,
  159. singleSelect: true,
  160. rownumbers: false,
  161. showFooter: true,
  162. striped: 'True',
  163. nowrap: true,
  164. fitColumns: false,
  165. rowStyler: function (index, row) {
  166. if (isNaN(row.OrderID)) {
  167. return 'color:blue;';
  168. }
  169. },
  170. onClickRow: function (rowIndex, field, value) {
  171. //onClickSum(rowIndex, field, value);
  172. }
  173. });
  174. $('#dgEvaluationEnterList').datagrid('hideColumn', 'TargetWeight');
  175. $('#dgEvaluationEnterList').datagrid('hideColumn', 'NormNameProjectID');//隐藏评价项目ID列
  176. $('#dgEvaluationEnterList').datagrid('hideColumn', 'TargetID');//隐藏评价指标ID列
  177. }
  178. //格式化单元格提示信息
  179. function formatCellTooltip(val, rec) {
  180. return "<span title='" + val + "'>" + val + "</span>";
  181. }
  182. //保存
  183. function EvaluationEnter_Save() {
  184. // var radioButtonObject = $("input:radio[name^='radioButtonName_']").not("input:checked") //获取没有选中值~~
  185. var totalScore = $("#EvaluationScoreSp").text();
  186. $("#TotalScore").val(totalScore);
  187. var radioButtonCount = $("input:radio[name^='radioButtonName_']:checked"); //获取所有选中值~~
  188. if (radioButtonCount.length != Xzcount()) {
  189. $.messager.alert("系统提示", "评分没有评选完毕!");
  190. return;
  191. }
  192. $(document.forms[0]).submit();
  193. //EvaluationEnter_Close();//保存直接关闭窗口
  194. }
  195. //关闭窗口
  196. function EvaluationEnter_Close() {
  197. top.$("#@(Request["WindowID"])").dialog("close");//关闭窗口
  198. }
  199. function Xzcount() {
  200. var rows = $("#dgEvaluationEnterList").datagrid("getRows");//获取全部数据
  201. var total = "";
  202. for (var i = 0; i < rows.length; i++) {
  203. if (rows[i]['ProjectName'] != "") {
  204. total += rows[i]['ProjectName'] + "&"; //获取指定列
  205. }
  206. }
  207. if (total.length > 0) {
  208. total = total.substr(0, total.length - 1);
  209. }
  210. return total.split('&').length;
  211. }
  212. function getSum(total, num) {
  213. return total + num;
  214. }
  215. //选中时改变评分值
  216. function getonclick(obj) {
  217. //Loadinfo();
  218. var CodeSum = new Array();
  219. var jsonStr = "";
  220. var tableWeight = '@ViewBag.TableWeight';//评价表格
  221. var rows = $("#dgEvaluationEnterList").datagrid("getRows");//获取全部数据
  222. var orderID = $(obj).closest("tr").find("td[field='OrderID'] div").text();//序号ID
  223. var normNameProjectID = $(obj).closest("tr").find("td[field='NormNameProjectID'] div").text();
  224. var targetWeight = $(obj).closest("tr").find("td[field='TargetWeight'] div").text();//评价指标分数
  225. var weight = $(obj).closest("tr").find("td[field='Weight'] div").text();//项目分数
  226. var targetID = $(obj).closest("tr").find("td[field='TargetID'] div").text();
  227. var allZb = $.grep(rows, function (x) { return (x.NormNameProjectID == ""); });
  228. var brothers = $.grep(rows, function (x) { return (x.TargetID == targetID); })
  229. var xmqzdate = $.grep(rows, function (x) { return (x.TargetID == targetID && x.NormNameProjectID != ""); });//Sum(评价项目权重)
  230. var xmqzSum = 0;
  231. var targetWeightSum = 0;
  232. var totalSum = 0;
  233. var radioButtonObject = $("input:radio[name^='radioButtonName_']:checked") //获取所有选中值~~
  234. for (var j = 0; j < xmqzdate.length; j++) {
  235. var xmqzfs = xmqzdate[j].Weight;
  236. xmqzSum += parseInt(xmqzfs);
  237. }
  238. for (var k = 0; k < allZb.length; k++) {
  239. var pgfs = allZb[k].Weight;
  240. targetWeightSum += parseInt(pgfs);
  241. }
  242. var zb = 0;
  243. var bg = 0;
  244. debugger;
  245. for (var h = 0; h < radioButtonObject.length; h++) {
  246. var qzxmf = radioButtonObject.parent().parent().prev().prev().find("div").eq(h).html();//评价权重
  247. var qz = radioButtonObject.parent().parent().prev().find("div").eq(h).html();//项目权重数据
  248. var pjxmID = radioButtonObject.parent().parent().prev().prev().prev().prev().find("div").eq(h).html();//评价项目ID
  249. var xm = radioButtonObject[h].value / 100 * qz;
  250. zb = xm / xmqzSum * qzxmf/*指标权重*/;
  251. bg = zb / targetWeightSum * parseInt(tableWeight);
  252. CodeSum.push(bg.toFixed(5));
  253. jsonStr += "{ \"ProjectID\":\"" + pjxmID + "\",\"EvaluationScore\":\"" + radioButtonObject[h].value + "\"}" + ","; //拼接json、返回后台操作
  254. }
  255. var jsonData = "[ " + jsonStr + " ]";
  256. for(var z = 0; z < CodeSum.length; z++){
  257. totalSum = totalSum + parseFloat(CodeSum[z]);
  258. }
  259. $("#EvaluationScoreSp").html(((totalSum * 100) / 100).toFixed(2));
  260. $("#jsonDataStr").val(jsonData);
  261. $("#EvaluationEnterID").val('@ViewBag.evaluationEnterID')
  262. $("#EducationMissionClassID").val('@ViewBag.EducationMissionClassID')
  263. }
  264. //页面元素加载完成在执行
  265. $(document).ready(function () {
  266. if ('@ViewBag.IsEvaluation' == "False") {
  267. $("#btnclick").attr("disabled", true);//按钮不可点击
  268. }
  269. Loadinfo();
  270. })
  271. function Loadinfo() {
  272. //1.选中的评分标准权重/100*评价项目权重=评价项目分数;
  273. //2.Sum(评价项目分数)/Sum(评价项目权重)*评价指标权重=评价指标分数;
  274. //3.Sum(评价指标分数)/Sum(评价指标权重)*评价表格权重=评价表格分数;
  275. var radioButtonObject = $("input:radio[name^='radioButtonName_']:checked") //获取所有选中值~~
  276. var rows = $("#dgEvaluationEnterList").datagrid("getRows");//获取全部数据
  277. //求取评价指标分数
  278. var jsonStr = "";
  279. var evaluationScore = 0;//评价项目分数
  280. var zbScore = 0;//评价指标分数
  281. var bgScore = 0;//评价表格分数
  282. var arrList = new Array();
  283. var newarrList = new Array();
  284. var xmqzarrList = new Array();
  285. var pjzbfsArry = new Array();
  286. var pjxmID = null;
  287. var pjzbfs = 0;
  288. for (var k = 0; k < radioButtonObject.length; k++) {
  289. var str = radioButtonObject[k].name;
  290. var strindex = str.lastIndexOf("_") + 1;
  291. var sNewStr = str.substring(strindex);
  292. arrList.push(sNewStr);//将评价指标权重加入数组记录起来
  293. }
  294. var pjzbSum = "";
  295. arrList.sort();
  296. newarrList = $.unique(arrList);//去除重复元素、新指标权重
  297. var targetIDs = newarrList.join(','); //获取指标这个数组的和
  298. if (targetIDs != "") {
  299. $.ajax({
  300. type: "POST",
  301. url: "/EvaluationEnter/GetWeightSum",
  302. data: { targetIDs: targetIDs },
  303. dataType: "json",
  304. async: false,
  305. success: function (result) {
  306. //将返回数据添加到页面表格中
  307. $("#ProjectWeightSum").val(result);
  308. }
  309. });
  310. }
  311. pjzbSum = $("#ProjectWeightSum").val();
  312. var zb = 0;
  313. var bg = 0;
  314. var tableWeight = '@ViewBag.TableWeight';//评价表格
  315. var CodeSum = new Array();
  316. var ProjectSum = 0;
  317. for (var i = 0; i < radioButtonObject.length; i++) {
  318. var qzxmf = radioButtonObject.parent().parent().prev().prev().find("div").eq(i).html();//评价权重
  319. var qz = radioButtonObject.parent().parent().prev().find("div").eq(i).html();//项目权重数据
  320. pjxmID = radioButtonObject.parent().parent().prev().prev().prev().prev().find("div").eq(i).html();//评价项目ID
  321. var targetID = $(radioButtonObject[i]).closest("tr").find("td[field='TargetID'] div").text();
  322. if (targetIDs != "") {
  323. $.ajax({
  324. type: "POST",
  325. url: "/EvaluationEnter/GetProjectWeightSum",
  326. data: { targetID: targetID },
  327. dataType: "json",
  328. async: false,
  329. success: function (result) {
  330. ProjectSum = result;
  331. //将返回数据添加到页面表格中
  332. }
  333. });
  334. }
  335. var pfbz = radioButtonObject[i].value;
  336. var xm = radioButtonObject[i].value / 100 * qz;
  337. zb = xm / parseInt(ProjectSum) * qzxmf/*指标权重*/;
  338. bg = zb / parseInt(pjzbSum) * parseInt(tableWeight);
  339. CodeSum.push(bg.toFixed(5));
  340. evaluationScore += pfbz / 100 * qz
  341. pjzbfs = ((pfbz / 100) * qz) / 100 * (qzxmf)
  342. pjzbfsArry.push(pjzbfs.toFixed(2));
  343. xmqzarrList.push(qz);//记录项目权重
  344. jsonStr += "{ \"ProjectID\":\"" + pjxmID + "\",\"EvaluationScore\":\"" + pfbz + "\"}" + ","; //拼接json、返回后台操作
  345. }
  346. jsonStr = jsonStr.substring(0, jsonStr.length - 1);
  347. var jsonData = "[ " + jsonStr + " ]";
  348. var SumValue = eval(CodeSum.join('+')) //获取项目权重这个数组的和
  349. // var sum = eval(pjzbfsArry.join('+')) //获取项目权重这个数组的和
  350. var TableWeight = '@ViewBag.TableWeight';
  351. var st = 0;
  352. $("#EvaluationScoreSp").html(((SumValue * 100) / 100).toFixed(2));
  353. if ($("#EvaluationScoreSp").html() == "NaN") {
  354. $("#EvaluationScoreSp").html(0);
  355. }
  356. $("#EvaluationScore").val(evaluationScore);
  357. $("#ProjectID").val(pjxmID);
  358. $("#jsonDataStr").val(jsonData);
  359. $("#EvaluationEnterID").val('@ViewBag.evaluationEnterID')
  360. $("#EducationMissionClassID").val('@ViewBag.EducationMissionClassID')
  361. }
  362. Number.prototype.toFixed2 = function () {
  363. return parseFloat(this.toString().replace(/(\.\d{2})\d+$/, "$1"));
  364. }
  365. </script>
  366. }