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.
 
 
 
 
 
 

115 lines
4.4 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 refreshGirdData; // 更新数据
  9. var selectedRow;
  10. var bootstrap = function ($, learun) {
  11. "use strict";
  12. var page = {
  13. init: function () {
  14. page.initGrid();
  15. page.bind();
  16. },
  17. bind: function () {
  18. // 查询
  19. $('#btn_Search').on('click', function () {
  20. var keyword = $('#txt_Keyword').val();
  21. page.search({keyword: keyword });
  22. });
  23. // 刷新
  24. $('#lr_refresh').on('click', function () {
  25. location.reload();
  26. });
  27. // 新增
  28. $('#lr_add').on('click', function () {
  29. var f_ItemId = $('#gridtable').jfGridValue('F_ItemId');
  30. selectedRow = null;
  31. learun.layerForm({
  32. id: 'ClassifyForm',
  33. title: '添加分类',
  34. url: top.$.rootUrl + '/LR_SystemModule/DataItem/ClassifyForm?parentId=' + f_ItemId,
  35. width: 500,
  36. height: 400,
  37. callBack: function (id) {
  38. return top[id].acceptClick(refreshGirdData);
  39. }
  40. });
  41. });
  42. // 编辑
  43. $('#lr_edit').on('click', function () {
  44. selectedRow = $('#gridtable').jfGridGet('rowdata');
  45. var keyValue = $('#gridtable').jfGridValue('F_ItemId');
  46. if (learun.checkrow(keyValue)) {
  47. learun.layerForm({
  48. id: 'ClassifyForm',
  49. title: '编辑分类',
  50. url: top.$.rootUrl + '/LR_SystemModule/DataItem/ClassifyForm',
  51. width: 500,
  52. height: 400,
  53. callBack: function (id) {
  54. return top[id].acceptClick(refreshGirdData);
  55. }
  56. });
  57. }
  58. });
  59. // 删除
  60. $('#lr_delete').on('click', function () {
  61. var keyValue = $('#gridtable').jfGridValue('F_ItemId');
  62. if (learun.checkrow(keyValue)) {
  63. learun.layerConfirm('是否确认删除该项!', function (res) {
  64. if (res) {
  65. learun.deleteForm(top.$.rootUrl + '/LR_SystemModule/DataItem/DeleteClassifyForm', { keyValue: keyValue }, function () {
  66. refreshGirdData();
  67. });
  68. }
  69. });
  70. }
  71. });
  72. },
  73. initGrid: function () {
  74. $('#gridtable').lrAuthorizeJfGrid({
  75. url: top.$.rootUrl + '/LR_SystemModule/DataItem/GetClassifyList',
  76. headData: [
  77. { label: '名称', name: 'F_ItemName', width: 200, align: 'left' },
  78. { label: '编号', name: 'F_ItemCode', width: 200, align: 'left' },
  79. { label: '排序', name: 'F_SortCode', width: 50, align: 'center' },
  80. {
  81. label: "树型", name: "F_IsTree",width: 50, align: "center",
  82. formatter: function (cellvalue) {
  83. return cellvalue == 1 ? "<i class=\"fa fa-toggle-on\"></i>" : "<i class=\"fa fa-toggle-off\"></i>";
  84. }
  85. },
  86. {
  87. label: "有效", name: "F_EnabledMark",width: 50, align: "center",
  88. formatter: function (cellvalue) {
  89. return cellvalue == 1 ? "<i class=\"fa fa-toggle-on\"></i>" : "<i class=\"fa fa-toggle-off\"></i>";
  90. }
  91. },
  92. { label: "备注", name: "F_Description", width: 200, align: "left" }
  93. ],
  94. isTree: true,
  95. mainId: 'F_ItemId',
  96. parentId: 'F_ParentId',
  97. reloadSelected:true
  98. });
  99. page.search();
  100. },
  101. search: function (param) {
  102. $('#gridtable').jfGridSet('reload', param);
  103. }
  104. };
  105. // 保存数据后回调刷新
  106. refreshGirdData = function () {
  107. page.search();
  108. }
  109. page.init();
  110. }