AnnouncementEdit.js 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. function Announcement_RoleAdd() {
  2. $.popupTopWindow('选择发布角色', CMS_SystemConfig.VirtualDirectoryPath + '/Common/RoleSelector', 620, 360, Announcement_RoleAdd_Confirm);
  3. }
  4. function Announcement_RoleAdd_Confirm(roleList) {
  5. if (!roleList) return;
  6. var roleViewList = $("#dgRoleList").cmsXDataTable("getRows");
  7. $.each(roleList, function (index, value) {
  8. if ($.grep(roleViewList, function (row, index) { return value.RoleID == row.RoleID; }).length == 0) {
  9. roleViewList.push({
  10. RoleID: value.RoleID,
  11. OrderNo: value.OrderNo,
  12. RoleName: value.RoleName,
  13. DefaultDataRangeDesc: value.DefaultDataRangeDesc,
  14. RecordStatusDesc: value.RecordStatusDesc,
  15. Description: value.Description
  16. });
  17. }
  18. $("#dgRoleList").cmsXDataTable("loadData", { rows: roleViewList, total: roleViewList.length });
  19. });
  20. }
  21. function validChoose() {
  22. var d = [];
  23. $.each($("#dgRoleList").cmsXDataTable("getSelections"), function (index) {
  24. d.push(this);
  25. });
  26. return d;
  27. }
  28. function Announcement_RoleDelete() {
  29. var d = validChoose();
  30. var roleViewList = $("#dgRoleList").cmsXDataTable("getRows");
  31. var i, j;
  32. var len = roleViewList.length;
  33. for (i = len - 1; i >= 0; i--) {
  34. for (j = 0; j < d.length; j++) {
  35. if (roleViewList[i].RoleID == d[j].RoleID) {
  36. roleViewList.splice(i, 1);
  37. break;
  38. }
  39. }
  40. }
  41. $("#dgRoleList").cmsXDataTable("loadData", { rows: roleViewList, total: roleViewList.length });
  42. }