Index.js 3.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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_add').on('click', function () {
  25. selectedRow = null;
  26. learun.layerForm({
  27. id: 'form',
  28. title: '部门新增',
  29. url: top.$.rootUrl + '/ACLManager/UserDept/Form',
  30. width: 700,
  31. height: 400,
  32. callBack: function (id) {
  33. return top[id].acceptClick(refreshGirdData);
  34. }
  35. });
  36. });
  37. // 编辑
  38. $('#lr_edit').on('click', function () {
  39. var keyValue = $('#gridtable').jfGridValue('F_NO');
  40. selectedRow = $('#gridtable').jfGridGet('rowdata');
  41. if (learun.checkrow(keyValue)) {
  42. learun.layerForm({
  43. id: 'form',
  44. title: '部门编辑',
  45. url: top.$.rootUrl + '/ACLManager/UserDept/Form?keyValue=' + keyValue,
  46. width: 500,
  47. height: 340,
  48. callBack: function (id) {
  49. return top[id].acceptClick(refreshGirdData);
  50. }
  51. });
  52. }
  53. });
  54. // 删除
  55. $('#lr_delete').on('click', function () {
  56. var keyValue = $('#gridtable').jfGridValue('F_NO');
  57. if (learun.checkrow(keyValue)) {
  58. learun.layerConfirm('是否确认删除该项!', function (res) {
  59. if (res) {
  60. learun.deleteForm(top.$.rootUrl + '/ACLManager/UserDept/DeleteForm', { keyValue: keyValue }, function () {
  61. refreshGirdData();
  62. });
  63. }
  64. });
  65. }
  66. });
  67. },
  68. initGird: function () {
  69. $('#gridtable').jfGrid({
  70. url: top.$.rootUrl + '/ACLManager/UserDept/GetPageList',
  71. headData: [
  72. learun.jfFormatter.col_F_NO("部门编号"),
  73. learun.jfFormatter.col_F_NAME("部门名称"),
  74. learun.jfFormatter.col_F_ISSTOP(),
  75. learun.jfFormatter.col_F_ADDUSERNO(),
  76. learun.jfFormatter.col_F_ADDTIME(),
  77. learun.jfFormatter.col_F_EDITUSERNO(),
  78. learun.jfFormatter.col_F_EDITTIME(),
  79. learun.jfFormatter.col_F_MEMO()
  80. ],
  81. mainId: 'F_NO',
  82. sidx: 'F_NO',
  83. reloadSelected: true,
  84. isPage: true
  85. });
  86. page.search();
  87. },
  88. search: function (param) {
  89. param = param || {};
  90. $('#gridtable').jfGridSet('reload', param);
  91. }
  92. };
  93. refreshGirdData = function () {
  94. page.search();
  95. };
  96. page.init();
  97. }