Index.js 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. /*
  2. * 描 述:权限常量管理
  3. */
  4. var selectedRow;
  5. var refreshGirdData;
  6. var bootstrap = function ($, learun) {
  7. "use strict";
  8. var page = {
  9. init: function () {
  10. page.initGird();
  11. page.bind();
  12. },
  13. bind: function () {
  14. // 查询
  15. $('#btn_Search').on('click', function () {
  16. var keyword = $('#txt_Keyword').val();
  17. page.search({ keyword: keyword });
  18. });
  19. // 刷新
  20. $('#lr_refresh').on('click', function () {
  21. location.reload();
  22. });
  23. // 删除
  24. $('#lr_delete').on('click', function () {
  25. var keyValue = $('#gridtable').jfGridValue('Code');
  26. if (learun.checkrow(keyValue)) {
  27. learun.layerConfirm('是否确认删除该项!', function (res) {
  28. if (res) {
  29. learun.deleteForm(top.$.rootUrl + '/UserCenterManager/ACLConst/DeleteForm', { keyValue: keyValue }, function () {
  30. refreshGirdData();
  31. });
  32. }
  33. });
  34. }
  35. });
  36. // 新增
  37. $('#lr_add').on('click', function () {
  38. var keyValue = {};
  39. selectedRow = $('#gridtable').jfGridGet('rowdata') || {};
  40. learun.layerForm({
  41. id: 'form',
  42. title: '添加',
  43. url: top.$.rootUrl + '/UserCenterManager/ACLConst/Form',
  44. height: 400,
  45. width: 800,
  46. callBack: function (id) {
  47. return top[id].acceptClick(refreshGirdData);
  48. }
  49. });
  50. });
  51. $('#lr_acladd').on('click', function () {
  52. learun.layerConfirm('是否要添加权限!', function (res) {
  53. if (res) {
  54. learun.deleteForm(top.$.rootUrl + '/UserCenterManager/ACLConst/SaveWebACLConst', {}, function () {
  55. refreshGirdData();
  56. });
  57. }
  58. });
  59. });
  60. // 添加按钮权限
  61. $('#lr_acladdbtn').on('click', function () {
  62. var keyValue = $('#gridtable').jfGridValue('Code');
  63. selectedRow = $('#gridtable').jfGridGet('rowdata');
  64. if (learun.checkrow(keyValue)) {
  65. learun.layerForm({
  66. id: 'ModuleBtnForm',
  67. title: '添加权限按钮',
  68. url: top.$.rootUrl + '/UserCenterManager/ACLConst/ModuleBtnForm?keyValue=' + keyValue,
  69. width: 500,
  70. height: 340,
  71. callBack: function (id) {
  72. return top[id].acceptClick(refreshGirdData);
  73. }
  74. });
  75. }
  76. });
  77. },
  78. initGird: function () {
  79. $('#gridtable').jfGrid({
  80. url: top.$.rootUrl + '/UserCenterManager/ACLConst/GetList',
  81. headData: [
  82. learun.jfFormatter.col_NAME("权限常量名称"),
  83. {
  84. label: '应用类型', name: 'AppTypeNum', width: 80, align: "center"
  85. , formatterAsync: function (callback, value, row) {
  86. learun.clientdata.getAsync('dataItem', {
  87. Rowkey: value,
  88. GrpCode: 'EAppType',
  89. getType: 'Num',
  90. callback: function (item) {
  91. callback(item.F_NAME);
  92. }
  93. });
  94. }
  95. },
  96. { label: "排序号", name: "SortNum", width: 100, align: "left" },
  97. { label: "权限常量", name: "ACLItem", width: 300, align: "left" },
  98. learun.jfFormatter.col_ISSTOP(),
  99. learun.jfFormatter.col_AddWho(),
  100. learun.jfFormatter.col_AddTime(),
  101. learun.jfFormatter.col_EditWho(),
  102. learun.jfFormatter.col_EditTime(),
  103. learun.jfFormatter.col_MEMO()
  104. ],
  105. isTree: true,
  106. mainId: 'Code',
  107. parentId: 'PNO'
  108. });
  109. page.search();
  110. },
  111. search: function (param) {
  112. param = param || {};
  113. $('#gridtable').jfGridSet('reload', param);
  114. }
  115. };
  116. refreshGirdData = function () {
  117. page.search();
  118. };
  119. page.init();
  120. }