SOCDocEdit.js 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. $.parser.onComplete = function (context) {
  2. var roleData = eval("(" + $("[name='hidRoleData']").val() + ")");
  3. var departmentData = eval("(" + $("[name='hidDepartmentData']").val() + ")");
  4. $("#dgRoleList").cmsXDataTable("loadData", { rows: roleData, total: roleData.length });
  5. if (departmentData!=null) {
  6. $("#dgDepartmentList").cmsXDataTable("loadData", { rows: departmentData, total: departmentData.length });
  7. }
  8. changeRoleType();
  9. changeCollegeType();
  10. }
  11. function changeRoleType() {
  12. var isChecked = $("[name='RoleType']:checked").length > 0;
  13. var roleTypeCheckbox = $("[name='RoleType']");
  14. if (isChecked) {
  15. roleTypeCheckbox.parent().parent().next().find("*").attr("disabled", "disabled");
  16. } else {
  17. roleTypeCheckbox.parent().parent().next().find("*").removeAttr("disabled")
  18. }
  19. }
  20. function changeCollegeType() {
  21. var isChecked = $("[name='CollegeType']:checked").length > 0;
  22. var collegeTypeCheckbox = $("[name='CollegeType']");
  23. if (isChecked) {
  24. collegeTypeCheckbox.parent().parent().next().find("*").attr("disabled", "disabled");
  25. } else {
  26. collegeTypeCheckbox.parent().parent().next().find("*").removeAttr("disabled")
  27. }
  28. }
  29. function SOCDoc_Save() {
  30. $(document.forms[0]).submit();
  31. }
  32. function getSelectedRole() {
  33. var d = [];
  34. $.each($("#dgRoleList").cmsXDataTable("getSelections"), function (index) {
  35. d.push(this.RoleID);
  36. });
  37. return d;
  38. }
  39. function SOCDocRole_Add() {
  40. $.popupTopWindow('选择角色', CMS_SystemConfig.VirtualDirectoryPath + '/Common/RoleSelector', 400, 250, SOCDocRole_Add_Confirm);
  41. }
  42. function SOCDocRole_Add_Confirm(data) {
  43. if (data) {
  44. var roleData = $("#dgRoleList").cmsXDataTable("getRows");
  45. $.each(data, function (i, v) {
  46. roleData.push({
  47. RoleID: v.RoleID,
  48. RoleName: v.RoleName
  49. });
  50. });
  51. $("#dgRoleList").cmsXDataTable("loadData", { rows: roleData, total: roleData.length });
  52. }
  53. }
  54. function SOCDocRole_Delete() {
  55. var selectedIDList = getSelectedRole();
  56. var roleData = $("#dgRoleList").cmsXDataTable("getRows");
  57. roleData = $.grep(roleData, function (x) { return !selectedIDList.contains(x.RoleID) });
  58. $("#dgRoleList").cmsXDataTable("loadData", { rows: roleData, total: roleData.length });
  59. }
  60. function getSelectedCollege() {
  61. var d = [];
  62. $.each($("#dgDepartmentList").cmsXDataTable("getSelections"), function (index) {
  63. d.push(this.DepartmentID);
  64. });
  65. return d;
  66. }
  67. function SOCDocCollege_Add() {
  68. $.popupTopWindow('选择部门', CMS_SystemConfig.VirtualDirectoryPath + '/Common/DepartmentSelector', 800, 600, SOCDocCollege_Add_Confirm);
  69. }
  70. function SOCDocCollege_Add_Confirm(data) {
  71. if (data) {
  72. var departmentData = $("#dgDepartmentList").cmsXDataTable("getRows");
  73. $.each(data, function (i, v) {
  74. departmentData.push({
  75. DepartmentID: v.DepartmentID,
  76. Name: v.Name
  77. });
  78. });
  79. $("#dgDepartmentList").cmsXDataTable("loadData", { rows: departmentData, total: departmentData.length });
  80. }
  81. }
  82. function SOCDocCollege_Delete() {
  83. var selectedIDList = getSelectedCollege();
  84. var departmentData = $("#dgDepartmentList").cmsXDataTable("getRows");
  85. departmentData = $.grep(departmentData, function (x) { return !selectedIDList.contains(x.DepartmentID) });
  86. $("#dgDepartmentList").cmsXDataTable("loadData", { rows: departmentData, total: departmentData.length });
  87. }