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.
 
 
 
 
 
 

167 lines
6.8 KiB

  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 companyId = '';
  13. var page = {
  14. init: function () {
  15. page.inittree();
  16. page.initGrid();
  17. page.bind();
  18. },
  19. bind: function () {
  20. // 查询
  21. $('#btn_Search').on('click', function () {
  22. var keyword = $('#txt_Keyword').val();
  23. page.search({ keyword: keyword });
  24. });
  25. // 刷新
  26. $('#lr_refresh').on('click', function () {
  27. location.reload();
  28. });
  29. // 新增
  30. $('#lr_add').on('click', function () {
  31. if (!companyId) {
  32. learun.alert.warning('请选择公司!');
  33. return false;
  34. }
  35. selectedRow = null;
  36. learun.layerForm({
  37. id: 'form',
  38. title: '添加部门',
  39. url: top.$.rootUrl + '/LR_OrganizationModule/Department/Form?companyId=' + companyId,
  40. width: 700,
  41. height: 400,
  42. callBack: function (id) {
  43. return top[id].acceptClick(refreshGirdData);
  44. }
  45. });
  46. });
  47. // 编辑
  48. $('#lr_edit').on('click', function () {
  49. var keyValue = $('#gridtable').jfGridValue('F_DepartmentId');
  50. selectedRow = $('#gridtable').jfGridGet('rowdata');
  51. if (learun.checkrow(keyValue)) {
  52. learun.layerForm({
  53. id: 'form',
  54. title: '编辑部门',
  55. url: top.$.rootUrl + '/LR_OrganizationModule/Department/Form?companyId=' + companyId,
  56. width: 700,
  57. height: 400,
  58. callBack: function (id) {
  59. return top[id].acceptClick(refreshGirdData);
  60. }
  61. });
  62. }
  63. });
  64. // 删除
  65. $('#lr_delete').on('click', function () {
  66. var keyValue = $('#gridtable').jfGridValue('F_DepartmentId');
  67. if (learun.checkrow(keyValue)) {
  68. learun.layerConfirm('是否确认删除该项!', function (res) {
  69. if (res) {
  70. learun.deleteForm(top.$.rootUrl + '/LR_OrganizationModule/Department/DeleteForm', { keyValue: keyValue }, function () {
  71. refreshGirdData();
  72. });
  73. }
  74. });
  75. }
  76. });
  77. // 公告发布权限设置
  78. $('#lr_permission').on('click', function () {
  79. var keyValue = $('#gridtable').jfGridValue('F_DepartmentId');
  80. if (learun.checkrow(keyValue)) {
  81. learun.layerForm({
  82. id: 'form',
  83. title: '权限设置',
  84. url: top.$.rootUrl + '/Permission/DepartmentReleasePermissions/Index?departmentId=' + keyValue,
  85. width: 700,
  86. height: 400,
  87. btn:null
  88. });
  89. }
  90. });
  91. },
  92. inittree: function () {
  93. $('#companyTree').lrtree({
  94. url: top.$.rootUrl + '/LR_OrganizationModule/Company/GetTree',
  95. param: { parentId: '0' },
  96. nodeClick: page.treeNodeClick
  97. });
  98. $('#companyTree').lrtreeSet('setValue', '53298b7a-404c-4337-aa7f-80b2a4ca6681');
  99. },
  100. treeNodeClick: function (item) {
  101. companyId = item.id;
  102. $('#titleinfo').text(item.text);
  103. page.search();
  104. },
  105. initGrid: function () {
  106. $('#gridtable').lrAuthorizeJfGrid({
  107. url: top.$.rootUrl + '/LR_OrganizationModule/Department/GetList',
  108. headData: [
  109. { label: "部门名称", name: "F_FullName", width: 200, align: "left" },
  110. { label: "部门编号", name: "F_EnCode", width: 100, align: "left" },
  111. { label: "部门简称", name: "F_ShortName", width: 100, align: "left" },
  112. { label: "部门性质", name: "F_Nature", width: 100, align: "left" },
  113. {
  114. label: "负责人", name: "F_Manager", width: 100, align: "left",
  115. formatterAsync: function (callback, value, row, op, $cell) {
  116. learun.clientdata.getAsync('custmerData', {
  117. url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'teacheruserdata',
  118. key: value,
  119. keyId: 'f_userid',
  120. callback: function (_data) {
  121. callback(_data['f_realname']);
  122. }
  123. });
  124. }
  125. },
  126. { label: "分管校长", name: "F_SchoolMaster", width: 100, align: "left" },
  127. {
  128. label: "公告类别", name: "NoticeCategory", width: 200, align: "left",
  129. formatterAsync: function (callback, value, row, op, $cell) {
  130. learun.clientdata.getsAsync('dataItem', {
  131. key: value,
  132. code: 'NoticeCategory',
  133. callback: function (_data) {
  134. callback(_data);
  135. }
  136. });
  137. }
  138. },
  139. { label: "电话号", name: "F_OuterPhone", width: 100, align: "left" },
  140. { label: "分机号", name: "F_InnerPhone", width: 60, align: "center" },
  141. { label: "排序", name: "F_Order", width: 60, align: "center" },
  142. { label: "备注", name: "F_Description", width: 200, align: "left" }
  143. ],
  144. isTree: true,
  145. mainId: 'F_DepartmentId',
  146. parentId: 'F_ParentId',
  147. sidx: 'F_Order',
  148. sord: 'ASC'
  149. });
  150. },
  151. search: function (param) {
  152. param = param || {};
  153. param.companyId = companyId;
  154. $('#gridtable').jfGridSet('reload', param);
  155. }
  156. };
  157. refreshGirdData = function () {
  158. page.search();
  159. };
  160. page.init();
  161. }