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.
 
 
 
 
 
 

118 lines
4.5 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 refreshGird; // 更新表格
  9. var selectedRow;
  10. var bootstrap = function ($, learun) {
  11. "use strict";
  12. var parentId = "0";
  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. selectedRow = null;
  32. learun.layerForm({
  33. id: 'form',
  34. title: '添加区域',
  35. url: top.$.rootUrl + '/LR_SystemModule/Area/Form?parentId=' + parentId,
  36. height: 310,
  37. width: 500,
  38. callBack: function (id) {
  39. return top[id].acceptClick(refreshGird);
  40. }
  41. });
  42. });
  43. // 编辑
  44. $('#lr_edit').on('click', function () {
  45. var keyValue = $('#gridtable').jfGridValue('F_AreaId');
  46. selectedRow = $('#gridtable').jfGridGet('rowdata');
  47. if (learun.checkrow(keyValue)) {
  48. learun.layerForm({
  49. id: 'form',
  50. title: '编辑区域',
  51. url: top.$.rootUrl + '/LR_SystemModule/Area/Form?parentId=' + parentId,
  52. height: 310,
  53. width: 500,
  54. callBack: function (id) {
  55. return top[id].acceptClick(refreshGird);
  56. }
  57. });
  58. }
  59. });
  60. // 删除
  61. $('#lr_delete').on('click', function () {
  62. var keyValue = $('#gridtable').jfGridValue('F_AreaId');
  63. if (learun.checkrow(keyValue)) {
  64. learun.layerConfirm('是否确认删除该项!', function (res) {
  65. if (res) {
  66. learun.deleteForm(top.$.rootUrl + '/LR_SystemModule/Area/DeleteForm', { keyValue: keyValue }, function () {
  67. refreshGird();
  68. });
  69. }
  70. });
  71. }
  72. });
  73. },
  74. initTree: function () {
  75. $('#lr_left_tree').lrtree({
  76. url: top.$.rootUrl + '/LR_SystemModule/Area/GetTree',
  77. nodeClick: function (item) {
  78. parentId = item.id;
  79. page.search();
  80. $('#titleinfo').text(item.text);
  81. }
  82. });
  83. },
  84. initGrid: function () {
  85. $('#gridtable').lrAuthorizeJfGrid({
  86. url: top.$.rootUrl + '/LR_SystemModule/Area/GetList',
  87. headData: [
  88. { label: "编号", name: "F_AreaCode", width: 100, align: "left" },
  89. { label: "名称", name: "F_AreaName", width: 300, align: "left" },
  90. { label: "简拼", name: "F_SimpleSpelling", width: 100, align: "left" },
  91. { label: "级别", name: "F_Layer", width: 50, align: "center" },
  92. {
  93. label: "有效", name: "F_EnabledMark", width: 50, align: "center",
  94. formatter: function (cellvalue, options, rowObject) {
  95. return cellvalue == 1 ? "<i class=\"fa fa-toggle-on\"></i>" : "<i class=\"fa fa-toggle-off\"></i>";
  96. }
  97. },
  98. { label: "备注", name: "F_Description", width: 200, align: "left" }
  99. ],
  100. mainId: 'F_AreaId',
  101. reloadSelected: true
  102. });
  103. page.search();
  104. },
  105. search: function (param) {
  106. param = param || {};
  107. param.parentId = parentId;
  108. $('#gridtable').jfGridSet('reload', param);
  109. }
  110. };
  111. // 保存数据后回调刷新
  112. refreshGird = function () {
  113. page.search();
  114. }
  115. page.init();
  116. }