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.
 
 
 
 
 
 

200 lines
7.7 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 departmentId = '';
  14. var page = {
  15. init: function () {
  16. page.inittree();
  17. page.initGrid();
  18. page.bind();
  19. },
  20. bind: function () {
  21. // 查询
  22. $('#btn_Search').on('click', function () {
  23. var keyword = $('#txt_Keyword').val();
  24. page.search({ keyword: keyword });
  25. });
  26. // 部门选择
  27. $('#department_select').lrselect({
  28. type: 'tree',
  29. placeholder: '请选择部门',
  30. // 展开最大高度
  31. maxHeight: 300,
  32. // 是否允许搜索
  33. allowSearch: true,
  34. select: function (item) {
  35. if (!item || item.value == '-1') {
  36. departmentId = '';
  37. }
  38. else {
  39. departmentId = item.value;
  40. }
  41. page.search();
  42. }
  43. });
  44. // 刷新
  45. $('#lr_refresh').on('click', function () {
  46. location.reload();
  47. });
  48. // 新增
  49. $('#lr_add').on('click', function () {
  50. if (!companyId) {
  51. learun.alert.warning('请选择公司!');
  52. return false;
  53. }
  54. selectedRow = null;
  55. learun.layerForm({
  56. id: 'form',
  57. title: '添加岗位',
  58. url: top.$.rootUrl + '/LR_OrganizationModule/Post/Form?companyId=' + companyId,
  59. width: 500,
  60. height: 379,
  61. callBack: function (id) {
  62. return top[id].acceptClick(refreshGirdData);
  63. }
  64. });
  65. });
  66. // 编辑
  67. $('#lr_edit').on('click', function () {
  68. var keyValue = $('#gridtable').jfGridValue('F_PostId');
  69. selectedRow = $('#gridtable').jfGridGet('rowdata');
  70. if (learun.checkrow(keyValue)) {
  71. learun.layerForm({
  72. id: 'form',
  73. title: '编辑岗位',
  74. url: top.$.rootUrl + '/LR_OrganizationModule/Post/Form?companyId=' + companyId,
  75. width: 500,
  76. height: 379,
  77. callBack: function (id) {
  78. return top[id].acceptClick(refreshGirdData);
  79. }
  80. });
  81. }
  82. });
  83. // 删除
  84. $('#lr_delete').on('click', function () {
  85. var keyValue = $('#gridtable').jfGridValue('F_PostId');
  86. if (learun.checkrow(keyValue)) {
  87. learun.layerConfirm('是否确认删除该项!', function (res) {
  88. if (res) {
  89. learun.deleteForm(top.$.rootUrl + '/LR_OrganizationModule/Post/DeleteForm', { keyValue: keyValue }, function () {
  90. refreshGirdData();
  91. });
  92. }
  93. });
  94. }
  95. });
  96. // 添加岗位成员
  97. $('#lr_memberadd').on('click', function () {
  98. var keyValue = $('#gridtable').jfGridValue('F_PostId');
  99. selectedRow = $('#gridtable').jfGridGet('rowdata');
  100. if (learun.checkrow(keyValue)) {
  101. learun.layerForm({
  102. id: 'form',
  103. title: '添加岗位成员',
  104. url: top.$.rootUrl + '/LR_AuthorizeModule/UserRelation/SelectForm?objectId=' + keyValue + '&companyId=' + companyId + '&departmentId=' + selectedRow.F_DepartmentId + '&category=2',
  105. width: 800,
  106. height: 520,
  107. callBack: function (id) {
  108. return top[id].acceptClick();
  109. }
  110. });
  111. }
  112. });
  113. // 产看成员
  114. $('#lr_memberlook').on('click', function () {
  115. var keyValue = $('#gridtable').jfGridValue('F_PostId');
  116. if (learun.checkrow(keyValue)) {
  117. learun.layerForm({
  118. id: 'form',
  119. title: '查看岗位成员',
  120. url: top.$.rootUrl + '/LR_AuthorizeModule/UserRelation/LookForm?objectId=' + keyValue,
  121. width: 800,
  122. height: 520,
  123. btn: null
  124. });
  125. }
  126. });
  127. },
  128. inittree: function () {
  129. $('#companyTree').lrtree({
  130. url: top.$.rootUrl + '/LR_OrganizationModule/Company/GetTree',
  131. param: { parentId: '0' },
  132. nodeClick: page.treeNodeClick
  133. });
  134. $('#companyTree').lrtreeSet('setValue', '53298b7a-404c-4337-aa7f-80b2a4ca6681');
  135. },
  136. treeNodeClick: function (item) {
  137. companyId = item.id;
  138. $('#titleinfo').text(item.text);
  139. $('#department_select').lrselectRefresh({
  140. // 访问数据接口地址
  141. url: top.$.rootUrl + '/LR_OrganizationModule/Department/GetTree',
  142. // 访问数据接口参数
  143. param: { companyId: companyId, parentId: '0' },
  144. });
  145. departmentId = '';
  146. page.search();
  147. },
  148. initGrid: function () {
  149. $('#gridtable').lrAuthorizeJfGrid({
  150. url: top.$.rootUrl + '/LR_OrganizationModule/Post/GetList',
  151. headData: [
  152. { label: "岗位名称", name: "F_Name", width: 300, align: "left" },
  153. { label: "岗位编号", name: "F_EnCode", width: 100, align: "left" },
  154. {
  155. label: "所属部门", name: "F_DepartmentId", width: 120, align: "left",
  156. formatterAsync: function (callback, value, row) {
  157. learun.clientdata.getAsync('department', {
  158. key: value,
  159. callback: function (item) {
  160. callback(item.name);
  161. }
  162. });
  163. }
  164. },
  165. { label: "备注", name: "F_Description", width: 200, align: "left" },
  166. { label: "创建人", name: "F_CreateUserName", width: 100, align: "left" },
  167. {
  168. label: "创建时间", name: "F_CreateDate", width: 100, align: "left",
  169. formatter: function (cellvalue) {
  170. return learun.formatDate(cellvalue, 'yyyy-MM-dd');
  171. }
  172. }
  173. ],
  174. isTree: true,
  175. mainId: 'F_PostId',
  176. parentId: 'F_ParentId',
  177. });
  178. },
  179. search: function (param) {
  180. param = param || {};
  181. param.companyId = companyId;
  182. param.departmentId = departmentId;
  183. $('#gridtable').jfGridSet('reload', param);
  184. }
  185. };
  186. refreshGirdData = function () {
  187. page.search();
  188. };
  189. page.init();
  190. }