25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

141 lines
5.6 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. inittree: function () {
  79. $('#companyTree').lrtree({
  80. url: top.$.rootUrl + '/LR_OrganizationModule/Company/GetTree',
  81. param: { parentId: '0' },
  82. nodeClick: page.treeNodeClick
  83. });
  84. $('#companyTree').lrtreeSet('setValue', '53298b7a-404c-4337-aa7f-80b2a4ca6681');
  85. },
  86. treeNodeClick: function (item) {
  87. companyId = item.id;
  88. $('#titleinfo').text(item.text);
  89. page.search();
  90. },
  91. initGrid: function () {
  92. $('#gridtable').lrAuthorizeJfGrid({
  93. url: top.$.rootUrl + '/LR_OrganizationModule/Department/GetList',
  94. headData: [
  95. { label: "部门名称", name: "F_FullName", width: 200, align: "left" },
  96. { label: "部门编号", name: "F_EnCode", width: 100, align: "left" },
  97. { label: "部门简称", name: "F_ShortName", width: 100, align: "left" },
  98. { label: "部门性质", name: "F_Nature", width: 100, align: "left" },
  99. { label: "负责人", name: "F_Manager", width: 100, align: "left" },
  100. { label: "分管校长", name: "F_SchoolMaster", width: 100, align: "left" },
  101. {
  102. label: "公告类别", name: "NoticeCategory", width: 200, align: "left" ,
  103. formatterAsync: function (callback, value, row, op, $cell) {
  104. learun.clientdata.getsAsync('dataItem', {
  105. key: value,
  106. code: 'NoticeCategory',
  107. callback: function (_data) {
  108. callback(_data);
  109. }
  110. });
  111. }
  112. },
  113. { label: "电话号", name: "F_OuterPhone", width: 100, align: "left" },
  114. { label: "分机号", name: "F_InnerPhone", width: 60, align: "center" },
  115. { label: "排序", name: "F_Order", width: 60, align: "center" },
  116. { label: "备注", name: "F_Description", width: 200, align: "left" }
  117. ],
  118. isTree: true,
  119. mainId: 'F_DepartmentId',
  120. parentId: 'F_ParentId',
  121. sidx: 'F_Order',
  122. sord: 'ASC'
  123. });
  124. },
  125. search: function (param) {
  126. param = param || {};
  127. param.companyId = companyId;
  128. $('#gridtable').jfGridSet('reload', param);
  129. }
  130. };
  131. refreshGirdData = function () {
  132. page.search();
  133. };
  134. page.init();
  135. }