You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Index.js 9.6 KiB

4 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  1. /*
  2. * 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园(http://www.learun.cn)
  3. * Copyright (c) 2013-2018 北京泉江科技有限公司
  4. * 创建人:陈彬彬
  5. * 日 期:2017.03.22
  6. * 描 述:部门管理
  7. */
  8. var selectedRow;
  9. var refreshGirdData;
  10. var bootstrap = function ($, learun) {
  11. "use strict";
  12. var page = {
  13. init: function () {
  14. page.initGrid();
  15. page.bind();
  16. },
  17. bind: function () {
  18. // 查询
  19. $('#btn_Search').on('click', function () {
  20. var keyword = $('#txt_Keyword').val();
  21. page.search({ keyword: keyword });
  22. });
  23. // 刷新
  24. $('#lr_refresh').on('click', function () {
  25. location.reload();
  26. });
  27. // 新增
  28. $('#lr_add').on('click', function () {
  29. selectedRow = null;
  30. learun.layerForm({
  31. id: 'form',
  32. title: '添加角色',
  33. url: top.$.rootUrl + '/LR_OrganizationModule/Role/Form',
  34. width: 500,
  35. height: 340,
  36. callBack: function (id) {
  37. return top[id].acceptClick(refreshGirdData);
  38. }
  39. });
  40. });
  41. // 编辑
  42. $('#lr_edit').on('click', function () {
  43. var keyValue = $('#gridtable').jfGridValue('F_RoleId');
  44. selectedRow = $('#gridtable').jfGridGet('rowdata');
  45. if (learun.checkrow(keyValue)) {
  46. learun.layerForm({
  47. id: 'form',
  48. title: '编辑角色',
  49. url: top.$.rootUrl + '/LR_OrganizationModule/Role/Form',
  50. width: 500,
  51. height: 340,
  52. callBack: function (id) {
  53. return top[id].acceptClick(refreshGirdData);
  54. }
  55. });
  56. }
  57. });
  58. // 删除
  59. $('#lr_delete').on('click', function () {
  60. var keyValue = $('#gridtable').jfGridValue('F_RoleId');
  61. if (learun.checkrow(keyValue)) {
  62. learun.layerConfirm('是否确认删除该项!', function (res) {
  63. if (res) {
  64. learun.deleteForm(top.$.rootUrl + '/LR_OrganizationModule/Role/DeleteForm', { keyValue: keyValue }, function () {
  65. refreshGirdData();
  66. });
  67. }
  68. });
  69. }
  70. });
  71. // 添加角色成员
  72. $('#lr_memberadd').on('click', function () {
  73. var keyValue = $('#gridtable').jfGridValue('F_RoleId');
  74. var loginInfo = learun.clientdata.get(['userinfo']);
  75. if (learun.checkrow(keyValue)) {
  76. learun.layerForm({
  77. id: 'form',
  78. title: '添加角色成员',
  79. url: top.$.rootUrl + '/LR_AuthorizeModule/UserRelation/SelectForm?objectId=' + keyValue + '&companyId=' + loginInfo.F_CompanyId + '&departmentId=' + loginInfo.F_DepartmentId + '&category=1',
  80. width: 800,
  81. height: 520,
  82. callBack: function (id) {
  83. return top[id].acceptClick();
  84. }
  85. });
  86. }
  87. });
  88. // 查看成员
  89. $('#lr_memberlook').on('click', function () {
  90. var keyValue = $('#gridtable').jfGridValue('F_RoleId');
  91. if (learun.checkrow(keyValue)) {
  92. learun.layerForm({
  93. id: 'form',
  94. title: '查看角色成员',
  95. url: top.$.rootUrl + '/LR_AuthorizeModule/UserRelation/LookForm?objectId=' + keyValue,
  96. width: 800,
  97. height: 520,
  98. btn: null
  99. });
  100. }
  101. });
  102. // 功能授权
  103. $('#lr_authorize').on('click', function () {
  104. var keyValue = $('#gridtable').jfGridValue('F_RoleId');
  105. selectedRow = $('#gridtable').jfGridGet('rowdata');
  106. if (learun.checkrow(keyValue)) {
  107. learun.layerForm({
  108. id: 'authorizeForm',
  109. title: '功能授权 - ' + selectedRow.F_FullName,
  110. url: top.$.rootUrl + '/LR_AuthorizeModule/Authorize/Form?objectId=' + keyValue + '&objectType=1',
  111. width: 550,
  112. height: 690,
  113. btn: null
  114. });
  115. }
  116. });
  117. // 数据授权
  118. $('#lr_dataauthorize').on('click', function () {
  119. var keyValue = $('#gridtable').jfGridValue('F_RoleId');
  120. selectedRow = $('#gridtable').jfGridGet('rowdata');
  121. if (learun.checkrow(keyValue)) {
  122. learun.layerForm({
  123. id: 'dataAuthorizeForm',
  124. title: '数据授权 - ' + selectedRow.F_FullName,
  125. url: top.$.rootUrl + '/LR_AuthorizeModule/DataAuthorize/Index?objectId=' + keyValue + '&objectType=1',
  126. width: 1100,
  127. height: 700,
  128. maxmin: true,
  129. btn: null
  130. });
  131. }
  132. });
  133. // 移动功能授权
  134. $('#lr_appauthorize').on('click', function () {
  135. var keyValue = $('#gridtable').jfGridValue('F_RoleId');
  136. selectedRow = $('#gridtable').jfGridGet('rowdata');
  137. if (learun.checkrow(keyValue)) {
  138. learun.layerForm({
  139. id: 'appAuthorizeForm',
  140. title: '移动功能授权 - ' + selectedRow.F_FullName,
  141. url: top.$.rootUrl + '/LR_AuthorizeModule/Authorize/AppForm?objectId=' + keyValue + '&objectType=1',
  142. width: 550,
  143. height: 690,
  144. callBack: function (id) {
  145. return top[id].acceptClick();
  146. }
  147. });
  148. }
  149. });
  150. // 设置Ip过滤
  151. $('#lr_ipfilter').on('click', function () {
  152. var keyValue = $('#gridtable').jfGridValue('F_RoleId');
  153. selectedRow = $('#gridtable').jfGridGet('rowdata');
  154. if (learun.checkrow(keyValue)) {
  155. learun.layerForm({
  156. id: 'filterIPIndex',
  157. title: 'TCP/IP 地址访问限制 - ' + selectedRow.F_FullName,
  158. url: top.$.rootUrl + '/LR_AuthorizeModule/FilterIP/Index?objectId=' + keyValue + '&objectType=Role',
  159. width: 600,
  160. height: 400,
  161. btn: null,
  162. callBack: function (id) { }
  163. });
  164. }
  165. });
  166. // 设置时间段过滤
  167. $('#lr_timefilter').on('click', function () {
  168. var keyValue = $('#gridtable').jfGridValue('F_RoleId');
  169. selectedRow = $('#gridtable').jfGridGet('rowdata');
  170. if (learun.checkrow(keyValue)) {
  171. learun.layerForm({
  172. id: 'filterTimeForm',
  173. title: '时段访问过滤 - ' + selectedRow.F_FullName,
  174. url: top.$.rootUrl + '/LR_AuthorizeModule/FilterTime/Form?objectId=' + keyValue + '&objectType=Role',
  175. width: 610,
  176. height: 470,
  177. callBack: function (id) {
  178. return top[id].acceptClick();
  179. }
  180. });
  181. }
  182. });
  183. },
  184. initGrid: function () {
  185. $('#gridtable').lrAuthorizeJfGrid({
  186. url: top.$.rootUrl + '/LR_OrganizationModule/Role/GetPageList',
  187. headData: [
  188. { label: '角色编号', name: 'F_EnCode', width: 100, align: 'left' },
  189. { label: '角色名称', name: 'F_FullName', width: 200, align: 'left' },
  190. { label: '人数', name: 'UserNum', width: 200, align: 'left' },
  191. {
  192. label: '创建时间', name: 'F_CreateDate', width: 130, align: 'center'
  193. },
  194. {
  195. label: '创建人', name: 'F_CreateUserName', width: 130, align: 'center'
  196. },
  197. {
  198. label: "有效", name: "F_EnabledMark", width: 50, align: "center",
  199. formatter: function (cellvalue) {
  200. return cellvalue == 1 ? "<i class=\"fa fa-toggle-on\"></i>" : "<i class=\"fa fa-toggle-off\"></i>";
  201. }
  202. },
  203. { label: "角色描述", name: "F_Description", index: "F_Description", width: 300, align: "left" }
  204. ],
  205. isPage: true,
  206. reloadSelected: true,
  207. mainId: 'F_RoleId',
  208. sidx: 'F_EnCode',
  209. sord: 'ASC'
  210. });
  211. page.search();
  212. },
  213. search: function (param) {
  214. param = param || {};
  215. $('#gridtable').jfGridSet('reload', param);
  216. }
  217. };
  218. refreshGirdData = function () {
  219. page.search();
  220. };
  221. page.init();
  222. }