Staff.js 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. var url = CMS_SystemConfig.VirtualDirectoryPath + "/Staff/Edit";
  2. var customerUrl = $(CMS_SystemConfig.GetConfig()).find("configuration>customUrls>add[key='StaffEdit']");
  3. if (customerUrl.attr("value")) {
  4. url = CMS_SystemConfig.VirtualDirectoryPath + customerUrl.attr("value");
  5. }
  6. var mnu = "";
  7. //加载
  8. $(function () {
  9. mnu = $.SystemGeneral.getUrlParam("MNU");
  10. })
  11. //新增
  12. function Staff_Add() {
  13. var redirectTo = url + "?MNU=" + mnu;
  14. $.popupTopWindow('教师信息新增', redirectTo, 700, 540, null, null);
  15. }
  16. function reload() {
  17. $("#dgStaffList").cmsXDataTable("load", $.getDataGridParams("dgStaffList"));
  18. }
  19. function validChooseLoginID() {
  20. var d = [];
  21. $.each($("#dgStaffList").cmsXDataTable("getSelections"), function (index) {
  22. d.push(this.StaffCode);
  23. });
  24. return d;
  25. }
  26. //获取选中的数据
  27. function validChoose() {
  28. var d = [];
  29. $.each($("#dgStaffList").cmsXDataTable("getSelections"), function (index) {
  30. d.push(this.UserID);
  31. });
  32. return d;
  33. }
  34. //查看
  35. function edit(rowindex, rowdata) {
  36. var redirectTo = url + "?userID=" + rowdata.UserID + "&MNU=" + mnu + "&Type=1";
  37. $.popupTopWindow('教师信息', redirectTo, 700, 540, null, null);
  38. }
  39. //修改按钮
  40. function Staff_Update() {
  41. var d = validChoose();
  42. if (d == "") {
  43. $.messager.alert("系统提示", "请选择您要修改的信息。");
  44. return;
  45. }
  46. if (d.length > 1) {
  47. $.messager.alert("系统提示", "只能选择单个记录进行修改。");
  48. return;
  49. }
  50. var redirectTo = url + "?userID=" + d + "&MNU=" + mnu;
  51. $.popupTopWindow('教师信息修改', redirectTo, 700, 540, null, null);
  52. }
  53. //删除
  54. function Staff_Delete() {
  55. var d = validChoose().join(',');
  56. if (d == "") {
  57. $.messager.alert("系统提示", "请选择您要删除的信息。");
  58. return;
  59. }
  60. $.messager.confirm("系统提示", "您确定要删除选择的信息?", function (r) {
  61. if (r) {
  62. $.postWithLoading(CMS_SystemConfig.VirtualDirectoryPath + '/Staff/Delete', { userIDs: d }, function (data) {
  63. if (data == "删除成功。") {
  64. $.messager.alert("系统提示", data);
  65. $("#dgStaffList").cmsXDataTable('load');
  66. } else {
  67. $.messager.alert("系统提示", data);
  68. }
  69. });
  70. }
  71. });
  72. }
  73. //教师信息Excel导入
  74. function Staff_Import() {
  75. var redirectTo = CMS_SystemConfig.VirtualDirectoryPath + '/Staff/Import?MNU=' + mnu;
  76. $.popupTopWindow('教师信息导入', redirectTo, 400, 300, null, null);
  77. }
  78. //Excel导出
  79. function Staff_Export() {
  80. $("#formQuery").submit();
  81. }
  82. function QueryPhotoUrltmentDropdownList(data) {
  83. reload();
  84. }
  85. function QueryCampusComboGridList() {
  86. var campusID = $("#CampusDropdown").combogridX("getValue");
  87. if (campusID != nonSelect) {
  88. var jsonString = "({'QueryParamsDatas':'CampusDropdown|*|" + campusID + "|@|'})";
  89. $("#CollegeDropdown").combogridX("reload", eval(jsonString));
  90. }
  91. reload();
  92. }
  93. function QueryCollegeComboGridList() {
  94. var collegeID = $("#CollegeDropdown").combogridX("getValue");
  95. if (collegeID != nonSelect) {
  96. var jsonString = "({'QueryParamsDatas':'CollegeDropdown|*|" + collegeID + "|@|'})";
  97. $("#DepartmentDropdown").combogridX("reload", eval(jsonString));
  98. }
  99. reload();
  100. }
  101. function QueryDepartmentComboGridList() {
  102. reload();
  103. }
  104. function Staff_SimulateLogin() {
  105. var d = validChooseLoginID();
  106. if (d.length == 0) {
  107. $.messager.alert("系统提示", "请选择您要登录的教师。");
  108. return;
  109. }
  110. if (d.length > 1) {
  111. $.messager.alert("系统提示", "只能选择一个教师进行登录。");
  112. return;
  113. }
  114. $.messager.confirm("系统提示", "您确定要进行模拟登录?", function (r) {
  115. if (r) {
  116. var loginID = d.toString();
  117. $.postWithLoading(CMS_SystemConfig.VirtualDirectoryPath + '/SimulateLogin/Login', { LoginID: loginID }, function (data) {
  118. parent.location.reload();
  119. });
  120. }
  121. });
  122. }