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

4 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  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. { label: "电话号", name: "F_OuterPhone", width: 100, align: "left" },
  102. { label: "分机号", name: "F_InnerPhone", width: 60, align: "center" },
  103. { label: "排序", name: "F_Order", width: 60, align: "center" },
  104. { label: "备注", name: "F_Description", width: 200, align: "left" }
  105. ],
  106. isTree: true,
  107. mainId: 'F_DepartmentId',
  108. parentId: 'F_ParentId',
  109. sidx: 'F_Order',
  110. sord: 'ASC'
  111. });
  112. },
  113. search: function (param) {
  114. param = param || {};
  115. param.companyId = companyId;
  116. $('#gridtable').jfGridSet('reload', param);
  117. }
  118. };
  119. refreshGirdData = function () {
  120. page.search();
  121. };
  122. page.init();
  123. }