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 8.0 KiB

4 years ago
4 years ago
4 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  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. callBack: function (id) {
  88. return top[id].acceptClick(refreshGirdData);
  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_Manager", width: 100, align: "left",
  117. formatterAsync: function (callback, value, row, op, $cell) {
  118. learun.clientdata.getAsync('custmerData', {
  119. url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'teacheruserdata',
  120. key: value,
  121. keyId: 'f_userid',
  122. callback: function (_data) {
  123. callback(_data['f_realname']);
  124. }
  125. });
  126. }
  127. },
  128. { label: "分管校长", name: "F_SchoolMaster", width: 100, align: "left" },
  129. {
  130. label: "公告类别", name: "NoticeCategory", width: 200, align: "left",
  131. formatterAsync: function (callback, value, row, op, $cell) {
  132. if (value && value.indexOf(',') != -1) {
  133. var content = '';
  134. var texts = value.split(',');
  135. for (var i = 0; i < texts.length; i++) {
  136. learun.clientdata.getAsync('dataItem',
  137. {
  138. key: texts[i],
  139. code: 'NoticeCategory',
  140. callback: function (_data) {
  141. content += _data.text + ',';
  142. }
  143. });
  144. }
  145. content = content.substring(0, content.length - 1);
  146. callback(content);
  147. } else {
  148. learun.clientdata.getAsync('dataItem',
  149. {
  150. key: value,
  151. code: 'NoticeCategory',
  152. callback: function (_data) {
  153. callback(_data.text);
  154. }
  155. });
  156. }
  157. }
  158. },
  159. { label: "电话号", name: "F_OuterPhone", width: 100, align: "left" },
  160. { label: "分机号", name: "F_InnerPhone", width: 60, align: "center" },
  161. { label: "排序", name: "F_Order", width: 60, align: "center" },
  162. { label: "备注", name: "F_Description", width: 200, align: "left" }
  163. ],
  164. isTree: true,
  165. mainId: 'F_DepartmentId',
  166. parentId: 'F_ParentId',
  167. sidx: 'F_Order',
  168. sord: 'ASC'
  169. });
  170. },
  171. search: function (param) {
  172. param = param || {};
  173. param.companyId = companyId;
  174. $('#gridtable').jfGridSet('reload', param);
  175. }
  176. };
  177. refreshGirdData = function () {
  178. page.search();
  179. };
  180. page.init();
  181. }