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.2 KiB

4 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  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 refreshGirdData; // 更新数据
  9. var bootstrap = function ($, learun) {
  10. "use strict";
  11. var moduleId = '0';
  12. var page = {
  13. init: function () {
  14. page.inittree();
  15. page.initGrid();
  16. page.bindEvent();
  17. },
  18. bindEvent: function () {
  19. // 查询
  20. $('#btn_Search').on('click', function () {
  21. var keyword = $('#txt_Keyword').val();
  22. page.search({ parentId: moduleId, keyword: keyword });
  23. });
  24. // 刷新
  25. $('#lr_refresh').on('click', function () {
  26. location.reload();
  27. });
  28. // 新增
  29. $('#lr_add').on('click', function () {
  30. learun.layerForm({
  31. id: 'form',
  32. title: '添加功能',
  33. url: top.$.rootUrl + '/LR_SystemModule/Module/Form?moduleId=' + moduleId,
  34. height: 430,
  35. width: 700,
  36. btn: null
  37. });
  38. });
  39. // 编辑
  40. $('#lr_edit').on('click', function () {
  41. var keyValue = $('#gridtable').jfGridValue('F_ModuleId');
  42. if (learun.checkrow(keyValue)) {
  43. learun.layerForm({
  44. id: 'form',
  45. title: '编辑功能',
  46. url: top.$.rootUrl + '/LR_SystemModule/Module/Form?keyValue=' + keyValue,
  47. height: 430,
  48. width: 700,
  49. btn: null
  50. });
  51. }
  52. });
  53. // 删除
  54. $('#lr_delete').on('click', function () {
  55. var keyValue = $('#gridtable').jfGridValue('F_ModuleId');
  56. if (learun.checkrow(keyValue)) {
  57. learun.layerConfirm('是否确认删除该项!', function (res) {
  58. if (res) {
  59. learun.deleteForm(top.$.rootUrl + '/LR_SystemModule/Module/DeleteForm', { keyValue: keyValue }, function () {
  60. refreshGirdData();
  61. });
  62. }
  63. });
  64. }
  65. });
  66. },
  67. inittree: function () {
  68. $('#module_tree').lrtree({
  69. url: top.$.rootUrl + '/LR_SystemModule/Module/GetModuleTree',
  70. nodeClick: page.treeNodeClick
  71. });
  72. },
  73. treeNodeClick: function (item) {
  74. moduleId = item.id;
  75. $('#titleinfo').text(item.text);
  76. page.search({ parentId: moduleId });
  77. },
  78. initGrid: function () {
  79. $('#gridtable').lrAuthorizeJfGrid({
  80. url: top.$.rootUrl + '/LR_SystemModule/Module/GetModuleListByParentId',
  81. headData: [
  82. { label: "编号", name: "F_EnCode", width: 150, align: "left" },
  83. { label: "名称", name: "F_FullName", width: 150, align: "left" },
  84. { label: "地址", name: "F_UrlAddress", width: 350, align: "left" },
  85. { label: "目标", name: "F_Target", width: 60, align: "center" },
  86. {
  87. label: "菜单", name: "F_IsMenu", width: 50, align: "center",
  88. formatter: function (cellvalue, rowObject) {
  89. return cellvalue == 1 ? "<i class=\"fa fa-toggle-on\"></i>" : "<i class=\"fa fa-toggle-off\"></i>";
  90. }
  91. },
  92. {
  93. label: "展开", name: "F_AllowExpand", width: 50, align: "center",
  94. formatter: function (cellvalue, rowObject) {
  95. return cellvalue == 1 ? "<i class=\"fa fa-toggle-on\"></i>" : "<i class=\"fa fa-toggle-off\"></i>";
  96. }
  97. },
  98. //{
  99. // label: "公共", name: "F_IsPublic", width: 50, align: "center",
  100. // formatter: function (cellvalue, rowObject) {
  101. // return cellvalue == 1 ? "<i class=\"fa fa-toggle-on\"></i>" : "<i class=\"fa fa-toggle-off\"></i>";
  102. // }
  103. //},
  104. {
  105. label: "有效", name: "F_EnabledMark", width: 50, align: "center",
  106. formatter: function (cellvalue, rowObject) {
  107. return cellvalue == 1 ? "<i class=\"fa fa-toggle-on\"></i>" : "<i class=\"fa fa-toggle-off\"></i>";
  108. }
  109. },
  110. { label: "描述", name: "F_Description", width: 200, align: "left" }
  111. ]
  112. });
  113. page.search({ parentId: moduleId });
  114. },
  115. search: function (param) {
  116. $('#gridtable').jfGridSet('reload', param);
  117. }
  118. };
  119. // 保存数据后回调刷新
  120. refreshGirdData = function () {
  121. page.search({ parentId: moduleId });
  122. //$('#module_tree').lrtreeSet('refresh');
  123. }
  124. page.init();
  125. }