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.
 
 
 
 
 
 

178 lines
7.3 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_permission').on('click', function () {
  66. var keyValue = $('#gridtable').jfGridValue('F_DepartmentId');
  67. if (learun.checkrow(keyValue)) {
  68. learun.layerForm({
  69. id: 'form',
  70. title: '权限设置',
  71. url: top.$.rootUrl + '/Permission/DepartmentReleasePermissions/Index?departmentId=' + keyValue,
  72. width: 700,
  73. height: 400,
  74. callBack: function (id) {
  75. return top[id].acceptClick(refreshGirdData);
  76. }
  77. });
  78. }
  79. });
  80. // 删除
  81. $('#lr_delete').on('click', function () {
  82. var keyValue = $('#gridtable').jfGridValue('F_DepartmentId');
  83. if (learun.checkrow(keyValue)) {
  84. learun.layerConfirm('是否确认删除该项!', function (res) {
  85. if (res) {
  86. learun.deleteForm(top.$.rootUrl + '/LR_OrganizationModule/Department/DeleteForm', { keyValue: keyValue }, function () {
  87. refreshGirdData();
  88. });
  89. }
  90. });
  91. }
  92. });
  93. },
  94. inittree: function () {
  95. $('#companyTree').lrtree({
  96. url: top.$.rootUrl + '/LR_OrganizationModule/Company/GetTree',
  97. param: { parentId: '0' },
  98. nodeClick: page.treeNodeClick
  99. });
  100. $('#companyTree').lrtreeSet('setValue', '53298b7a-404c-4337-aa7f-80b2a4ca6681');
  101. },
  102. treeNodeClick: function (item) {
  103. companyId = item.id;
  104. $('#titleinfo').text(item.text);
  105. page.search();
  106. },
  107. initGrid: function () {
  108. $('#gridtable').lrAuthorizeJfGrid({
  109. url: top.$.rootUrl + '/LR_OrganizationModule/Department/GetList',
  110. headData: [
  111. { label: "部门名称", name: "F_FullName", width: 200, align: "left" },
  112. { label: "部门编号", name: "F_EnCode", width: 100, align: "left" },
  113. { label: "部门简称", name: "F_ShortName", width: 100, align: "left" },
  114. { label: "部门性质", name: "F_Nature", width: 100, align: "left" },
  115. {
  116. label: "是否虚拟部门", name: "F_IsVirtualization", width: 100, align: "left", formatter: function (cellvalue) {
  117. if (cellvalue) {
  118. return '<span class=\"label label-success\" style=\"cursor: pointer;\">是</span>';
  119. } else{
  120. return '<span class=\"label label-default\" style=\"cursor: pointer;\">否</span>';
  121. }
  122. }
  123. },
  124. { label: "负责人", name: "F_Manager", width: 100, align: "left" },
  125. {
  126. label: "分管校长", name: "F_SchoolMasterId", width: 100, align: "left", formatterAsync: function (callback, value, row, op, $cell) {
  127. learun.clientdata.getAsync('user', {
  128. key: value,
  129. callback: function (_data) {
  130. callback(_data.name);
  131. }
  132. });
  133. }
  134. },
  135. //{
  136. // label: "公告类别", name: "NoticeCategory", width: 200, align: "left" ,
  137. // formatterAsync: function (callback, value, row, op, $cell) {
  138. // learun.clientdata.getsAsync('dataItem', {
  139. // key: value,
  140. // code: 'NoticeCategory',
  141. // callback: function (_data) {
  142. // callback(_data);
  143. // }
  144. // });
  145. // }
  146. //},
  147. { label: "电话号", name: "F_OuterPhone", width: 100, align: "left" },
  148. { label: "分机号", name: "F_InnerPhone", width: 60, align: "center" },
  149. { label: "排序", name: "F_Order", width: 60, align: "center" },
  150. { label: "备注", name: "F_Description", width: 200, align: "left" }
  151. ],
  152. isTree: true,
  153. mainId: 'F_DepartmentId',
  154. parentId: 'F_ParentId',
  155. sidx: 'F_Order',
  156. sord: 'ASC'
  157. });
  158. },
  159. search: function (param) {
  160. param = param || {};
  161. param.companyId = companyId;
  162. $('#gridtable').jfGridSet('reload', param);
  163. }
  164. };
  165. refreshGirdData = function () {
  166. page.search();
  167. };
  168. page.init();
  169. }