Staff.js 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. var url = CMS_SystemConfig.VirtualDirectoryPath + "/Staff/Edit";
  2. var mnu = "";
  3. //url个性化配置
  4. var customerUrl = $(CMS_SystemConfig.GetConfig()).find("configuration>customUrls>add[key='StaffEdit']");
  5. if (customerUrl.attr("value")) {
  6. url = CMS_SystemConfig.VirtualDirectoryPath + customerUrl.attr("value");
  7. }
  8. //加载
  9. $(function () {
  10. mnu = $.SystemGeneral.getUrlParam("MNU");
  11. })
  12. //刷新
  13. function reload() {
  14. $("#dgStaffList").cmsXDataTable("load", $.getDataGridParams("dgStaffList"));
  15. }
  16. //获取选中的数据UserID
  17. function validChoose() {
  18. var d = [];
  19. $.each($("#dgStaffList").cmsXDataTable("getSelections"), function (index) {
  20. d.push(this.UserID);
  21. });
  22. return d;
  23. }
  24. //获取选中的数据LoginID
  25. function validChooseLoginID() {
  26. var d = [];
  27. $.each($("#dgStaffList").cmsXDataTable("getSelections"), function (index) {
  28. d.push(this.StaffCode);
  29. });
  30. return d;
  31. }
  32. //新增
  33. function Staff_Add() {
  34. var d = validChoose();
  35. if (d.length > 0) {
  36. $.popupTopWindow('教师信息复制新增', url + '?newUserID=' + d[0] + '&MNU=' + mnu + '&type=copyAdd', 650, 540, null, null);
  37. } else {
  38. var redirectTo = url + "?MNU=" + mnu + "&type=add";
  39. $.popupTopWindow('教师信息新增', redirectTo, 650, 540, null, null);
  40. }
  41. }
  42. //修改按钮
  43. function Staff_Update() {
  44. var d = validChoose();
  45. if (d == "") {
  46. $.messager.alert("系统提示", "请选择您要修改的信息。");
  47. return;
  48. }
  49. if (d.length > 1) {
  50. $.messager.alert("系统提示", "只能选择单个记录进行修改。");
  51. return;
  52. }
  53. var redirectTo = url + "?newUserID=" + d + "&MNU=" + mnu + "&type=edit";
  54. $.popupTopWindow('教师信息修改', redirectTo, 650, 540, null, null);
  55. }
  56. //明细查看
  57. function edit(rowindex, rowdata) {
  58. var redirectTo = url + "?newUserID=" + rowdata.UserID + "&MNU=" + mnu + "&type=detail";
  59. $.popupTopWindow('教师信息明细', redirectTo, 650, 540, null, null);
  60. }
  61. //删除
  62. function Staff_Delete() {
  63. var d = validChoose().join(',');
  64. if (d == "") {
  65. $.messager.alert("系统提示", "请选择您要删除的信息。");
  66. return;
  67. }
  68. $.messager.confirm("系统提示", "您确定要删除选择的信息?", function (r) {
  69. if (r) {
  70. $.postWithLoading(CMS_SystemConfig.VirtualDirectoryPath + '/Staff/Delete', { userIDs: d }, function (data) {
  71. if (data.IsSuccess) {
  72. $.messager.alert("系统提示", data.Message);
  73. $("#dgStaffList").cmsXDataTable('load');
  74. } else {
  75. $.messager.alert("系统提示", data.Message);
  76. }
  77. });
  78. }
  79. });
  80. }
  81. //删除照片
  82. function Staff_PicDelete() {
  83. var d = validChoose().join(',');
  84. if (d == "") {
  85. $.messager.alert("系统提示", "请选择您要删除照片的信息。");
  86. return;
  87. }
  88. $.messager.confirm("系统提示", "您确定要删除选择的信息对应的照片?", function (r) {
  89. if (r) {
  90. $.postWithLoading(CMS_SystemConfig.VirtualDirectoryPath + '/Staff/PicDelete', { userIDs: d }, function (data) {
  91. if (data.IsSuccess) {
  92. $.messager.alert("系统提示", data.Message);
  93. $("#dgStaffList").cmsXDataTable('load');
  94. } else {
  95. $.messager.alert("系统提示", data.Message);
  96. }
  97. });
  98. }
  99. });
  100. }
  101. //教师对应的角色信息明细
  102. function editRoleCount(rowindex, rowdata) {
  103. redirectTo = CMS_SystemConfig.VirtualDirectoryPath + "/Staff/RoleList?userID=" + rowdata.UserID + "&MNU=" + mnu;
  104. $.popupTopWindow('角色信息明细', redirectTo, 1024, 540, null, null);
  105. }
  106. //模拟登录
  107. function Staff_SimulateLogin() {
  108. var d = validChooseLoginID();
  109. if (d.length == 0) {
  110. $.messager.alert("系统提示", "请选择您要模拟登录的教师。");
  111. return;
  112. }
  113. if (d.length > 1) {
  114. $.messager.alert("系统提示", "只能选择一个教师进行模拟登录。");
  115. return;
  116. }
  117. $.messager.confirm("系统提示", "您确定要进行模拟登录?", function (r) {
  118. if (r) {
  119. var loginID = d.toString();
  120. $.postWithLoading(CMS_SystemConfig.VirtualDirectoryPath + '/SimulateLogin/Login', { LoginID: loginID }, function (data) {
  121. parent.location.reload();
  122. });
  123. }
  124. });
  125. }
  126. //设置列颜色为红色
  127. function SetRedColumn(index, row, value) {
  128. return " <span style=\"color: red;\">" + value + "</span>";
  129. }
  130. //Excel导出
  131. function Staff_Export() {
  132. $("#formQuery").submit();
  133. }
  134. //导入照片
  135. function Staff_PicImport() {
  136. var redirectTo = CMS_SystemConfig.VirtualDirectoryPath + '/Staff/PicImport?MNU=' + mnu;
  137. $.popupTopWindow('导入照片', redirectTo, 420, 300, reload);
  138. }
  139. //Excel导入
  140. function Staff_Import() {
  141. var redirectTo = CMS_SystemConfig.VirtualDirectoryPath + '/Staff/Import?MNU=' + mnu;
  142. $.popupTopWindow('教师信息导入', redirectTo, 420, 300, reload);
  143. }
  144. //联动查询
  145. function queryCampus(data) {
  146. var campusID = $("#CampusDropdown").combogridX("getValue");
  147. var jsonString = "({'QueryParamsDatas':'CampusDropdown|*|" + campusID + "|@|'})";
  148. $("#CollegeDropdown").combogridX("reload", eval(jsonString));
  149. $("#DepartmentDropdown").combogridX("reload", eval(jsonString));
  150. reload();
  151. }
  152. function queryCollege(data) {
  153. var campusID = $("#CampusDropdown").combogridX("getValue");
  154. var collegeID = $("#CollegeDropdown").combogridX("getValue");
  155. var jsonString = "({'QueryParamsDatas':'CampusDropdown|*|" + campusID + "|@|";
  156. jsonString += "CollegeDropdown|*|" + collegeID + "|@|'})";
  157. $("#DepartmentDropdown").combogridX("reload", eval(jsonString));
  158. $("#CollegeDropdown").combogridX("reload", eval(jsonString));
  159. reload();
  160. }