ProjectRecordEdit.js 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. var mnu = "";
  2. //加载
  3. $(function () {
  4. mnu = $.SystemGeneral.getUrlParam("MNU");
  5. var SupervisionTypeID = $("#SupervisionTypeID").combobox("getValue");
  6. if (SupervisionTypeID == evaluation) {
  7. $("#OtherTarget").hide();
  8. $("#UserID").show();
  9. $("#coursetd").show();
  10. $("#coursetd2").show();
  11. $("#coursenull").hide();
  12. $("#totalScorered").show();
  13. $("#coursered").show();
  14. } else {
  15. $("#OtherTarget").show();
  16. $("#UserID").hide();
  17. $("#coursetd").hide();
  18. $("#coursetd2").hide();
  19. $("#coursenull").show();
  20. $("#totalScorered").hide();
  21. $("#coursered").hide();
  22. }
  23. })
  24. function SupervisionTypeSelect() {
  25. var SupervisionTypeID = $("#SupervisionTypeID").combobox("getValue");
  26. if (SupervisionTypeID == evaluation) {
  27. $("#OtherTarget").hide();
  28. $("#UserID").show();
  29. $("#coursetd").show();
  30. $("#coursetd2").show();
  31. $("#coursenull").hide();
  32. $("#totalScorered").show();
  33. $("#coursered").show();
  34. } else {
  35. $("#OtherTarget").show();
  36. $("#UserID").hide();
  37. $("#coursetd").hide();
  38. $("#coursetd2").hide();
  39. $("#coursenull").show();
  40. $("#totalScorered").hide();
  41. $("#coursered").hide();
  42. }
  43. }
  44. function ProjectRecord_Upload() {
  45. var projectRecordID = $("#ProjectRecordID").val();
  46. var redirectTo = CMS_SystemConfig.VirtualDirectoryPath + "/ProjectRecord/Upload?projectRecordID=" + projectRecordID + "&MNU=" + mnu;
  47. $.popupTopWindow('附件上传', redirectTo, 700, 400, setAttachment);
  48. }
  49. function setAttachment() {
  50. $.ajaxSetup({
  51. async: false
  52. });
  53. var fileList;
  54. var projectRecordID = $("#ProjectRecordID").val();
  55. $.post(CMS_SystemConfig.VirtualDirectoryPath + '/ProjectRecord/GetFileListByProjectRecordID', { projectRecordID: projectRecordID }, function (data) {
  56. fileList = data;
  57. });
  58. var count = fileList.length;
  59. var nameStr = "";
  60. var detailID;
  61. for (var i = 0; i < count; i++) {
  62. detailID = fileList[i].FormID;
  63. var name = fileList[i].FileName;
  64. nameStr = nameStr + "、" + name;
  65. }
  66. if (detailID != null) {
  67. $("#IsChangeAttachment").val(1);
  68. }
  69. nameStr = nameStr.substr(1, (nameStr.length - 1));
  70. $("#AttachmentName").val(nameStr);
  71. }
  72. function ProjectRecord_Save() {
  73. var Content = $("#Content").val();
  74. var Advise = $("#Advise").val();
  75. var SupervisionTypeID = $("#SupervisionTypeID").combobox("getValue");
  76. var user = $("#UserID").combogridX("getValue");
  77. var course = $("#CoursematerialID").combogridX("getValue");
  78. var totalScore = $("#TotalScore").val();
  79. var otherTarget = $("#OtherTarget").val();
  80. //只留提示实际不限制
  81. // if (Content.length < 100) {
  82. // $.messager.alert("系统提示", "督导情况字数不能小于100。");
  83. // return;
  84. // }
  85. // if (Advise.length < 60) {
  86. // $.messager.alert("系统提示", "建议或结果字数不能小于60。");
  87. // return;
  88. // }
  89. if (SupervisionTypeID == evaluation) {
  90. if (user == nonSelect) {
  91. $.messager.alert("系统提示", "督导对象不能为空。");
  92. return;
  93. }
  94. if (course == nonSelect) {
  95. $.messager.alert("系统提示", "课程不能为空。");
  96. return;
  97. }
  98. if (totalScore == "" || totalScore == null) {
  99. $.messager.alert("系统提示", "综合评分不能为空。");
  100. return;
  101. }
  102. }
  103. else {
  104. if (otherTarget == "" || otherTarget == null) {
  105. $.messager.alert("系统提示", "督导对象不能为空。");
  106. return;
  107. }
  108. }
  109. var nowDate = new Date().format('yyyy-MM-dd');
  110. var ProjectDate = $("#ProjectDate").val();
  111. if (ProjectDate > nowDate) {
  112. $.messager.alert("系统信息", "只能选择当前时间和之前时间的督导时间。");
  113. return;
  114. }
  115. $(document.forms[0]).submit();
  116. }
  117. function ProjectDateChange(dp) {
  118. var week = new Date(dp.cal.newdate.y, dp.cal.newdate.M - 1, dp.cal.newdate.d).getDay();
  119. $("[comboname='Weekday']").combobox('setValue', week);
  120. }
  121. //选中的督导组成员
  122. function validChoose() {
  123. var d = [];
  124. $.each($("#dgTeacherList").cmsXDataTable("getSelections"), function (index) {
  125. d.push(this);
  126. });
  127. return d;
  128. }
  129. function ProjectRecord_AddStaff() {
  130. $.popupTopWindow('教师信息', CMS_SystemConfig.VirtualDirectoryPath + '/ProjectRecord/TeacherSelect?FromMNU=' + mnu, 900, 500, AddTeachers_Confirm);
  131. }
  132. function ProjectRecord_DeleteStaff() {
  133. var d = validChoose();
  134. var teacherViewList = $("#dgTeacherList").cmsXDataTable("getRows");
  135. var i, j;
  136. var len = teacherViewList.length;
  137. for (i = len - 1; i >= 0; i--) {
  138. for (j = 0; j < d.length; j++) {
  139. if (teacherViewList[i].UserID == d[j].UserID) {
  140. teacherViewList.splice(i, 1);
  141. break;
  142. }
  143. }
  144. }
  145. $("#dgTeacherList").cmsXDataTable("loadData", { rows: teacherViewList, total: teacherViewList.length });
  146. }
  147. function AddTeachers_Confirm(teacherList) {
  148. if (!teacherList) return;
  149. var teacherViewList = $("#dgTeacherList").cmsXDataTable("getRows");
  150. $.each(teacherList, function (index, value) {
  151. if ($.grep(teacherViewList, function (row, index) { return value.UserID == row.UserID; }).length == 0) {
  152. teacherViewList.push({
  153. UserID: value.UserID,
  154. LoginID: value.LoginID,
  155. Name: value.Name,
  156. CollegeID: value.CollegeID,
  157. CollegeName: value.CollegeName,
  158. BirthDate: value.BirthDate,
  159. TeacherType: value.TeacherType,
  160. TeacherTypeName: value.TeacherTypeName,
  161. IncumbencyState: value.IncumbencyState,
  162. IncumbencyStateName: value.IncumbencyStateName,
  163. Title: value.Title,
  164. TitleName: value.TitleName,
  165. TeachingMethod: 0, //默認选取的数据为主讲课
  166. TeachingMethodDesc: null,
  167. SexName: value.SexName,
  168. DepartmentName: value.DepartmentName,
  169. DepartmentID: value.DepartmentID
  170. });
  171. }
  172. });
  173. $("#dgTeacherList").cmsXDataTable("loadData", { rows: teacherViewList, total: teacherViewList.length });
  174. }
  175. function ProjectRecord_SeletcAdvise() {
  176. $.popupTopWindow('评价建议', CMS_SystemConfig.VirtualDirectoryPath + '/ProjectRecord/SelectAdvise?FromMNU=' + mnu, 900, 500, AddAdvise);
  177. }
  178. function AddAdvise(data) {
  179. var advise = $("#Advise").val();
  180. data = advise + ";" + data;
  181. if (advise == "" || advise == null) {
  182. data = data.substr(1, (data.length - 1));
  183. }
  184. $("#Advise").val(data);
  185. }